diff --git a/renderdoc/data/glsl/gl_texsample.h b/renderdoc/data/glsl/gl_texsample.h index 13c4788f7..f778058d3 100644 --- a/renderdoc/data/glsl/gl_texsample.h +++ b/renderdoc/data/glsl/gl_texsample.h @@ -88,7 +88,7 @@ uvec4 SampleTextureUInt4(int type, vec2 pos, float slice, int mipLevel, int samp } else // if (type == RESTYPE_TEX3D) { - col = texelFetch(texUInt3D, ivec3(pos * texRes.xy, slice), mipLevel); + col = texelFetch(texUInt3D, ivec3(pos * texRes.xy, slice + 0.001f), mipLevel); } return col; @@ -166,7 +166,7 @@ ivec4 SampleTextureSInt4(int type, vec2 pos, float slice, int mipLevel, int samp } else // if (type == RESTYPE_TEX3D) { - col = texelFetch(texSInt3D, ivec3(pos * texRes.xy, slice), mipLevel); + col = texelFetch(texSInt3D, ivec3(pos * texRes.xy, slice + 0.001f), mipLevel); } return col; @@ -281,7 +281,7 @@ vec4 SampleTextureFloat4(int type, vec2 pos, float slice, int mipLevel, int samp } else if(type == RESTYPE_TEX3D) { - col = textureLod(tex3D, vec3(pos, slice / texRes.z), float(mipLevel)); + col = textureLod(tex3D, vec3(pos, (slice + 0.001f) / texRes.z), float(mipLevel)); } else if(type == RESTYPE_TEXCUBE) { diff --git a/renderdoc/data/glsl/gles_texsample.h b/renderdoc/data/glsl/gles_texsample.h index 40871c90e..6bf3bd83a 100644 --- a/renderdoc/data/glsl/gles_texsample.h +++ b/renderdoc/data/glsl/gles_texsample.h @@ -84,7 +84,7 @@ uvec4 SampleTextureUInt4(int type, vec2 pos, float slice, int mipLevel, int samp } else // if (type == RESTYPE_TEX3D) { - col = texelFetch(texUInt3D, ivec3(pos * texRes.xy, slice), mipLevel); + col = texelFetch(texUInt3D, ivec3(pos * texRes.xy, slice + 0.001f), mipLevel); } return col; @@ -150,7 +150,7 @@ ivec4 SampleTextureSInt4(int type, vec2 pos, float slice, int mipLevel, int samp } else // if (type == RESTYPE_TEX3D) { - col = texelFetch(texSInt3D, ivec3(pos * texRes.xy, slice), mipLevel); + col = texelFetch(texSInt3D, ivec3(pos * texRes.xy, slice + 0.001f), mipLevel); } return col; @@ -258,7 +258,7 @@ vec4 SampleTextureFloat4(int type, vec2 pos, float slice, int mipLevel, int samp } else if(type == RESTYPE_TEX3D) { - col = textureLod(tex3D, vec3(pos, slice / texRes.z), float(mipLevel)); + col = textureLod(tex3D, vec3(pos, (slice + 0.001f) / texRes.z), float(mipLevel)); } else if(type == RESTYPE_TEXCUBE) { diff --git a/renderdoc/data/glsl/vk_texsample.h b/renderdoc/data/glsl/vk_texsample.h index 9b9532ee7..86fd5e764 100644 --- a/renderdoc/data/glsl/vk_texsample.h +++ b/renderdoc/data/glsl/vk_texsample.h @@ -44,7 +44,7 @@ vec4 SampleTextureFloat4(int type, vec2 pos, float slice, int mipLevel, int samp } else if(type == RESTYPE_TEX3D) { - col = textureLod(tex3D, vec3(pos, slice / texRes.z), float(mipLevel)); + col = textureLod(tex3D, vec3(pos, (slice + 0.001f) / texRes.z), float(mipLevel)); } else if(type == RESTYPE_TEX2DMS) { @@ -96,7 +96,7 @@ uvec4 SampleTextureUInt4(int type, vec2 pos, float slice, int mipLevel, int samp } else if(type == RESTYPE_TEX3D) { - col = texelFetch(texUInt3D, ivec3(pos * texRes.xy, slice), mipLevel); + col = texelFetch(texUInt3D, ivec3(pos * texRes.xy, slice + 0.001f), mipLevel); } else if(type == RESTYPE_TEX2DMS) { @@ -133,7 +133,7 @@ ivec4 SampleTextureSInt4(int type, vec2 pos, float slice, int mipLevel, int samp } else if(type == RESTYPE_TEX3D) { - col = texelFetch(texSInt3D, ivec3(pos * texRes.xy, slice), mipLevel); + col = texelFetch(texSInt3D, ivec3(pos * texRes.xy, slice + 0.001f), mipLevel); } else if(type == RESTYPE_TEX2DMS) { diff --git a/renderdoc/data/hlsl/debugcommon.hlsl b/renderdoc/data/hlsl/debugcommon.hlsl index 7fe446372..5877f67db 100644 --- a/renderdoc/data/hlsl/debugcommon.hlsl +++ b/renderdoc/data/hlsl/debugcommon.hlsl @@ -61,7 +61,7 @@ uint4 SampleTextureUInt4(uint type, float2 uv, float slice, float mip, int sampl if(type == RESTYPE_TEX1D) col = texDisplayUIntTex1DArray.Load(int3(uv.x*texRes.x, slice, mip)); else if(type == RESTYPE_TEX3D) - col = texDisplayUIntTex3D.Load(int4(uv.xy*texRes.xy, slice*texRes.z, mip)); + col = texDisplayUIntTex3D.Load(int4(uv.xy*texRes.xy, slice + 0.001f, mip)); else if(type == RESTYPE_TEX2D) col = texDisplayUIntTex2DArray.Load(int4(uv.xy*texRes.xy, slice, mip)); else if(type == RESTYPE_TEX2D_MS) @@ -81,7 +81,7 @@ int4 SampleTextureInt4(uint type, float2 uv, float slice, float mip, int sample, if(type == RESTYPE_TEX1D) col = texDisplayIntTex1DArray.Load(int3(uv.x*texRes.x, slice, mip)); else if(type == RESTYPE_TEX3D) - col = texDisplayIntTex3D.Load(int4(uv.xy*texRes.xy, slice*texRes.z, mip)); + col = texDisplayIntTex3D.Load(int4(uv.xy*texRes.xy, slice + 0.001f, mip)); else if(type == RESTYPE_TEX2D) col = texDisplayIntTex2DArray.Load(int4(uv.xy*texRes.xy, slice, mip)); else if(type == RESTYPE_TEX2D_MS) @@ -108,9 +108,9 @@ float4 SampleTextureFloat4(uint type, bool linearSample, float2 uv, float slice, else if(type == RESTYPE_TEX3D) { if(linearSample) - col = texDisplayTex3D.SampleLevel(linearSampler, float3(uv.xy, slice), mip); + col = texDisplayTex3D.SampleLevel(linearSampler, float3(uv.xy, (slice + 0.001f) / texRes.z), mip); else - col = texDisplayTex3D.Load(int4(uv.xy*texRes.xy, slice*texRes.z, mip)); + col = texDisplayTex3D.Load(int4(uv.xy*texRes.xy, slice + 0.001f, mip)); } else if(type == RESTYPE_DEPTH) { diff --git a/renderdoc/driver/d3d11/d3d11_debug.cpp b/renderdoc/driver/d3d11/d3d11_debug.cpp index b990d4e5f..a660adf6d 100644 --- a/renderdoc/driver/d3d11/d3d11_debug.cpp +++ b/renderdoc/driver/d3d11/d3d11_debug.cpp @@ -1817,7 +1817,7 @@ bool D3D11DebugManager::GetHistogram(ResourceId texid, uint32_t sliceFace, uint3 } if(details.texType == eTexType_3D) - cdata.HistogramSlice = float(sliceFace) / float(details.texDepth) + 0.001f; + cdata.HistogramSlice = float(sliceFace); ID3D11Buffer *cbuf = MakeCBuffer(&cdata, sizeof(cdata)); @@ -1918,7 +1918,7 @@ bool D3D11DebugManager::GetMinMax(ResourceId texid, uint32_t sliceFace, uint32_t } if(details.texType == eTexType_3D) - cdata.HistogramSlice = float(sliceFace) / float(details.texDepth) + 0.001f; + cdata.HistogramSlice = float(sliceFace); ID3D11Buffer *cbuf = MakeCBuffer(&cdata, sizeof(cdata)); @@ -3414,7 +3414,7 @@ bool D3D11DebugManager::RenderTexture(TextureDisplay cfg, bool blendAlpha) if(details.texType == eTexType_3D) { pixelData.OutputDisplayFormat = RESTYPE_TEX3D; - pixelData.Slice = (float(cfg.sliceFace) / float(details.texDepth)) + 0.001f; + pixelData.Slice = float(cfg.sliceFace); } else if(details.texType == eTexType_1D) { diff --git a/renderdoc/driver/d3d12/d3d12_debug.cpp b/renderdoc/driver/d3d12/d3d12_debug.cpp index 007b6fb10..fd9b1c909 100644 --- a/renderdoc/driver/d3d12/d3d12_debug.cpp +++ b/renderdoc/driver/d3d12/d3d12_debug.cpp @@ -7981,7 +7981,7 @@ bool D3D12DebugManager::RenderTextureInternal(D3D12_CPU_DESCRIPTOR_HANDLE rtv, T pixelData.Slice = float(RDCCLAMP(cfg.sliceFace, 0U, uint32_t(resourceDesc.DepthOrArraySize - 1))); if(resourceDesc.Dimension == D3D12_RESOURCE_DIMENSION_TEXTURE3D) - pixelData.Slice = (float(cfg.sliceFace) / float(resourceDesc.DepthOrArraySize)) + 0.001f; + pixelData.Slice = float(cfg.sliceFace); vector barriers; int resType = 0;