diff --git a/renderdoc/data/glsl/histogram.comp b/renderdoc/data/glsl/histogram.comp index 371f7786b..4c63dd1a4 100644 --- a/renderdoc/data/glsl/histogram.comp +++ b/renderdoc/data/glsl/histogram.comp @@ -128,7 +128,7 @@ void main() { for(uint x=topleft.x; x < min(texDim.x, topleft.x + HGRAM_PIXELS_PER_TILE); x++) { - vec4 data = SampleTextureFloat4(vec2(x, y), RESTYPE_TEX2D, false, true, + vec4 data = SampleTextureFloat4(vec2(x, y), RESTYPE_TEX2D, false, HistogramMip, HistogramSlice, HistogramSample, HistogramNumSamples); if(i == 0) @@ -351,7 +351,7 @@ void main() } #else { - vec4 data = SampleTextureFloat4(vec2(x, y), texType, false, false, + vec4 data = SampleTextureFloat4(vec2(x, y), texType, false, HistogramMip, HistogramSlice, HistogramSample, HistogramNumSamples); float divisor = 0.0f; diff --git a/renderdoc/data/glsl/texdisplay.frag b/renderdoc/data/glsl/texdisplay.frag index d42a36ad0..3030ba45a 100644 --- a/renderdoc/data/glsl/texdisplay.frag +++ b/renderdoc/data/glsl/texdisplay.frag @@ -65,7 +65,7 @@ void main(void) } else { - col = SampleTextureFloat4(scr, texType, FlipY == 0, (Scale < 1.0 && MipLevel == 0.0 && !depthTex), int(MipLevel), Slice, SampleIdx, NumSamples); + col = SampleTextureFloat4(scr, texType, FlipY == 0, int(MipLevel), Slice, SampleIdx, NumSamples); } if(RawOutput != 0) diff --git a/renderdoc/data/glsl/texsample.h b/renderdoc/data/glsl/texsample.h index eab32405e..51873158a 100644 --- a/renderdoc/data/glsl/texsample.h +++ b/renderdoc/data/glsl/texsample.h @@ -216,26 +216,20 @@ ivec4 SampleTextureSInt4(vec2 pos, int type, bool flipY, int mipLevel, float sli } -vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, bool linearSample, int mipLevel, float slice, int sampleIdx, int sampleCount) +vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, int mipLevel, float slice, int sampleIdx, int sampleCount) { vec4 col; if (type == RESTYPE_TEX1D) { int size = textureSize(tex1D, mipLevel); - if (linearSample) - col = texture(tex1D, pos.x / size); - else - col = texelFetch(tex1D, int(pos.x), mipLevel); + col = textureLod(tex1D, pos.x / size, float(mipLevel)); } else if (type == RESTYPE_TEX1DARRAY) { ivec2 size = textureSize(tex1DArray, mipLevel); - if (linearSample) - col = texture(tex1DArray, vec2(pos.x / size.x, slice)); - else - col = texelFetch(tex1DArray, ivec2(pos.x, slice), mipLevel); + col = textureLod(tex1DArray, vec2(pos.x / size.x, slice), float(mipLevel)); } else if (type == RESTYPE_TEX2D) { @@ -244,10 +238,7 @@ vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, bool linearSample, int if (flipY) pos.y = size.y - pos.y; - if (linearSample) - col = texture(tex2D, pos / size); - else - col = texelFetch(tex2D, ivec2(pos), mipLevel); + col = textureLod(tex2D, pos / size, float(mipLevel)); } else if (type == RESTYPE_TEXRECT) { @@ -329,10 +320,7 @@ vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, bool linearSample, int if (flipY) pos.y = size.y - pos.y; - if (linearSample) - col = texture(tex2DArray, vec3(pos / size.xy, slice)); - else - col = texelFetch(tex2DArray, ivec3(pos, slice), mipLevel); + col = textureLod(tex2DArray, vec3(pos / size.xy, slice), float(mipLevel)); } else if (type == RESTYPE_TEX3D) { @@ -341,10 +329,7 @@ vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, bool linearSample, int if (flipY) pos.y = size.y - pos.y; - if (linearSample) - col = texture(tex3D, vec3(pos / size.xy, slice)); - else - col = texelFetch(tex3D, ivec3(pos, slice), mipLevel); + col = textureLod(tex3D, vec3(pos / size.xy, slice), float(mipLevel)); } else if (type == RESTYPE_TEXCUBE) { @@ -355,10 +340,7 @@ vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, bool linearSample, int vec3 cubeCoord = CalcCubeCoord(pos / size, int(slice)); - if (linearSample) - col = texture(texCube, cubeCoord); - else - col = textureLod(texCube, cubeCoord, mipLevel); + col = textureLod(texCube, cubeCoord, float(mipLevel)); } else // type == RESTYPE_TEXCUBEARRAY { @@ -370,10 +352,7 @@ vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, bool linearSample, int vec3 cubeCoord = CalcCubeCoord(pos / size.xy, int(slice) % 6); vec4 arrayCoord = vec4(cubeCoord, int(slice) / 6); - if (linearSample) - col = texture(texCubeArray, arrayCoord); - else - col = textureLod(texCubeArray, arrayCoord, mipLevel); + col = textureLod(texCubeArray, arrayCoord, float(mipLevel)); } return col;