mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Calculate mip shift accurately for NPOT textures
This commit is contained in:
@@ -107,9 +107,8 @@ BINDING(0) uniform TexDisplayUBOData
|
||||
float Slice;
|
||||
|
||||
int SampleIdx;
|
||||
float MipShift;
|
||||
int DecodeYUV;
|
||||
float Padding;
|
||||
vec2 MipShift;
|
||||
|
||||
uvec4 YUVDownsampleRate;
|
||||
uvec4 YUVAChannels;
|
||||
|
||||
@@ -94,7 +94,7 @@ void main(void)
|
||||
|
||||
scr /= texdisplay.Scale;
|
||||
|
||||
scr /= vec2(texdisplay.MipShift, texdisplay.MipShift);
|
||||
scr /= texdisplay.MipShift;
|
||||
vec2 scr2 = scr;
|
||||
|
||||
#ifdef VULKAN
|
||||
|
||||
@@ -623,9 +623,14 @@ bool GLReplay::RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flags)
|
||||
ubo->TextureResolutionPS.z = float(RDCMAX(1, tex_z >> cfg.subresource.mip));
|
||||
|
||||
if(mipShift)
|
||||
ubo->MipShift = float(1 << cfg.subresource.mip);
|
||||
{
|
||||
ubo->MipShift.x = float(tex_x) / float(RDCMAX(1, tex_x >> cfg.subresource.mip));
|
||||
ubo->MipShift.y = float(tex_y) / float(RDCMAX(1, tex_y >> cfg.subresource.mip));
|
||||
}
|
||||
else
|
||||
ubo->MipShift = 1.0f;
|
||||
{
|
||||
ubo->MipShift.x = ubo->MipShift.y = 1.0f;
|
||||
}
|
||||
|
||||
ubo->OutputRes.x = DebugData.outWidth;
|
||||
ubo->OutputRes.y = DebugData.outHeight;
|
||||
|
||||
@@ -246,8 +246,6 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, const ImageState &i
|
||||
if(!data)
|
||||
return false;
|
||||
|
||||
data->Padding = 0;
|
||||
|
||||
float x = cfg.xOffset;
|
||||
float y = cfg.yOffset;
|
||||
|
||||
@@ -332,9 +330,14 @@ bool VulkanReplay::RenderTextureInternal(TextureDisplay cfg, const ImageState &i
|
||||
data->TextureResolutionPS.z = float(RDCMAX(1, tex_z >> cfg.subresource.mip));
|
||||
|
||||
if(mipShift)
|
||||
data->MipShift = float(1 << cfg.subresource.mip);
|
||||
{
|
||||
data->MipShift.x = float(tex_x) / float(RDCMAX(1, tex_x >> cfg.subresource.mip));
|
||||
data->MipShift.y = float(tex_y) / float(RDCMAX(1, tex_y >> cfg.subresource.mip));
|
||||
}
|
||||
else
|
||||
data->MipShift = 1.0f;
|
||||
{
|
||||
data->MipShift.x = data->MipShift.y = 1.0f;
|
||||
}
|
||||
|
||||
data->Scale = cfg.scale;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user