Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Laszlo Agocs
qtrhi
Commits
3c7ad5c6
Commit
3c7ad5c6
authored
Mar 21, 2019
by
Laszlo Agocs
Browse files
vk: Fix mipmap generation for npot textures
parent
dfff3935
Changes
2
Show whitespace changes
Inline
Side-by-side
src/rhi/qrhi.cpp
View file @
3c7ad5c6
...
@@ -4088,7 +4088,7 @@ int QRhi::ubufAligned(int v) const
...
@@ -4088,7 +4088,7 @@ int QRhi::ubufAligned(int v) const
*/
*/
int
QRhi
::
mipLevelsForSize
(
const
QSize
&
size
)
const
int
QRhi
::
mipLevelsForSize
(
const
QSize
&
size
)
const
{
{
return
q
Ceil
(
std
::
log2
(
qMax
(
size
.
width
(),
size
.
height
())))
+
1
;
return
q
Floor
(
std
::
log2
(
qMax
(
size
.
width
(),
size
.
height
())))
+
1
;
}
}
/*!
/*!
...
@@ -4097,8 +4097,8 @@ int QRhi::mipLevelsForSize(const QSize &size) const
...
@@ -4097,8 +4097,8 @@ int QRhi::mipLevelsForSize(const QSize &size) const
*/
*/
QSize
QRhi
::
sizeForMipLevel
(
int
mipLevel
,
const
QSize
&
baseLevelSize
)
const
QSize
QRhi
::
sizeForMipLevel
(
int
mipLevel
,
const
QSize
&
baseLevelSize
)
const
{
{
const
int
w
=
qFloor
(
float
(
qMax
(
1
,
baseLevelSize
.
width
()
>>
mipLevel
)
))
;
const
int
w
=
qMax
(
1
,
baseLevelSize
.
width
()
>>
mipLevel
);
const
int
h
=
qFloor
(
float
(
qMax
(
1
,
baseLevelSize
.
height
()
>>
mipLevel
)
))
;
const
int
h
=
qMax
(
1
,
baseLevelSize
.
height
()
>>
mipLevel
);
return
QSize
(
w
,
h
);
return
QSize
(
w
,
h
);
}
}
...
...
src/rhi/qrhivulkan.cpp
View file @
3c7ad5c6
...
@@ -2636,8 +2636,8 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
...
@@ -2636,8 +2636,8 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
region
.
srcSubresource
.
baseArrayLayer
=
0
;
region
.
srcSubresource
.
baseArrayLayer
=
0
;
region
.
srcSubresource
.
layerCount
=
layerCount
;
region
.
srcSubresource
.
layerCount
=
layerCount
;
region
.
srcOffsets
[
1
].
x
=
w
;
region
.
srcOffsets
[
1
].
x
=
qMax
(
1
,
w
)
;
region
.
srcOffsets
[
1
].
y
=
h
;
region
.
srcOffsets
[
1
].
y
=
qMax
(
1
,
h
)
;
region
.
srcOffsets
[
1
].
z
=
1
;
region
.
srcOffsets
[
1
].
z
=
1
;
region
.
dstSubresource
.
aspectMask
=
VK_IMAGE_ASPECT_COLOR_BIT
;
region
.
dstSubresource
.
aspectMask
=
VK_IMAGE_ASPECT_COLOR_BIT
;
...
@@ -2645,8 +2645,8 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
...
@@ -2645,8 +2645,8 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
region
.
dstSubresource
.
baseArrayLayer
=
0
;
region
.
dstSubresource
.
baseArrayLayer
=
0
;
region
.
dstSubresource
.
layerCount
=
layerCount
;
region
.
dstSubresource
.
layerCount
=
layerCount
;
region
.
dstOffsets
[
1
].
x
=
w
>>
1
;
region
.
dstOffsets
[
1
].
x
=
qMax
(
1
,
w
>>
1
)
;
region
.
dstOffsets
[
1
].
y
=
h
>>
1
;
region
.
dstOffsets
[
1
].
y
=
qMax
(
1
,
h
>>
1
)
;
region
.
dstOffsets
[
1
].
z
=
1
;
region
.
dstOffsets
[
1
].
z
=
1
;
df
->
vkCmdBlitImage
(
cbD
->
cb
,
df
->
vkCmdBlitImage
(
cbD
->
cb
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment