diff --git a/renderdoc/api/replay/replay_enums.h b/renderdoc/api/replay/replay_enums.h index 27a72c1cb..fcc1e491a 100644 --- a/renderdoc/api/replay/replay_enums.h +++ b/renderdoc/api/replay/replay_enums.h @@ -53,6 +53,7 @@ enum ShaderResourceType eResType_Texture1D, eResType_Texture1DArray, eResType_Texture2D, + eResType_TextureRect, eResType_Texture2DArray, eResType_Texture2DMS, eResType_Texture2DMSArray, diff --git a/renderdoc/data/glsl/debuguniforms.h b/renderdoc/data/glsl/debuguniforms.h index 863631e9f..2a1a9ce18 100644 --- a/renderdoc/data/glsl/debuguniforms.h +++ b/renderdoc/data/glsl/debuguniforms.h @@ -97,21 +97,23 @@ BINDING(0) uniform HistogramCBufferData #define CUBEMAP_FACE_POS_Z 4 #define CUBEMAP_FACE_NEG_Z 5 -#define RESTYPE_TEX1D 0x1 -#define RESTYPE_TEX2D 0x2 -#define RESTYPE_TEX3D 0x3 -#define RESTYPE_TEXCUBE 0x4 -#define RESTYPE_TEX1DARRAY 0x5 -#define RESTYPE_TEX2DARRAY 0x6 -#define RESTYPE_TEXCUBEARRAY 0x7 +#define RESTYPE_TEX1D 0x1 +#define RESTYPE_TEX2D 0x2 +#define RESTYPE_TEX3D 0x3 +#define RESTYPE_TEXCUBE 0x4 +#define RESTYPE_TEX1DARRAY 0x5 +#define RESTYPE_TEX2DARRAY 0x6 +#define RESTYPE_TEXCUBEARRAY 0x7 +#define RESTYPE_TEXRECT 0x8 +#define RESTYPE_TEXTYPEMAX 0x8 -#define TEXDISPLAY_TYPEMASK 0x7 -#define TEXDISPLAY_UINT_TEX 0x8 -#define TEXDISPLAY_SINT_TEX 0x10 -#define TEXDISPLAY_DEPTH_TEX 0x20 -#define TEXDISPLAY_NANS 0x40 -#define TEXDISPLAY_CLIPPING 0x80 -#define TEXDISPLAY_GAMMA_CURVE 0x100 +#define TEXDISPLAY_TYPEMASK 0xF +#define TEXDISPLAY_UINT_TEX 0x10 +#define TEXDISPLAY_SINT_TEX 0x20 +#define TEXDISPLAY_DEPTH_TEX 0x40 +#define TEXDISPLAY_NANS 0x80 +#define TEXDISPLAY_CLIPPING 0x100 +#define TEXDISPLAY_GAMMA_CURVE 0x200 #ifndef FLT_EPSILON #define FLT_EPSILON 1.192092896e-07f diff --git a/renderdoc/data/glsl/texsample.h b/renderdoc/data/glsl/texsample.h index efa4e18f4..d7bf95d42 100644 --- a/renderdoc/data/glsl/texsample.h +++ b/renderdoc/data/glsl/texsample.h @@ -29,18 +29,21 @@ layout (binding = 4) uniform samplerCube texCube; layout (binding = 5) uniform sampler1DArray tex1DArray; layout (binding = 6) uniform sampler2DArray tex2DArray; layout (binding = 7) uniform samplerCubeArray texCubeArray; +layout (binding = 8) uniform sampler2DRect tex2DRect; -layout (binding = 9) uniform usampler1D texUInt1D; -layout (binding = 10) uniform usampler2D texUInt2D; -layout (binding = 11) uniform usampler3D texUInt3D; -layout (binding = 13) uniform usampler1DArray texUInt1DArray; -layout (binding = 14) uniform usampler2DArray texUInt2DArray; +layout (binding = 17) uniform usampler1D texUInt1D; +layout (binding = 18) uniform usampler2D texUInt2D; +layout (binding = 19) uniform usampler3D texUInt3D; +layout (binding = 20) uniform usampler1DArray texUInt1DArray; +layout (binding = 21) uniform usampler2DArray texUInt2DArray; +layout (binding = 22) uniform usampler2DRect texUInt2DRect; -layout (binding = 16) uniform isampler1D texSInt1D; -layout (binding = 17) uniform isampler2D texSInt2D; -layout (binding = 18) uniform isampler3D texSInt3D; -layout (binding = 20) uniform isampler1DArray texSInt1DArray; -layout (binding = 21) uniform isampler2DArray texSInt2DArray; +layout (binding = 33) uniform isampler1D texSInt1D; +layout (binding = 34) uniform isampler2D texSInt2D; +layout (binding = 35) uniform isampler3D texSInt3D; +layout (binding = 36) uniform isampler1DArray texSInt1DArray; +layout (binding = 37) uniform isampler2DArray texSInt2DArray; +layout (binding = 38) uniform isampler2DRect texSInt2DRect; vec3 CalcCubeCoord(vec2 uv, int face) { @@ -86,6 +89,15 @@ uvec4 SampleTextureUInt4(vec2 pos, int type, bool flipY, int mipLevel, float sli col = texelFetch(texUInt2D, ivec2(pos), mipLevel); } + else if (type == RESTYPE_TEXRECT) + { + ivec2 size = textureSize(texUInt2DRect, mipLevel); + + if (flipY) + pos.y = size.y - pos.y; + + col = texelFetch(texUInt2DRect, ivec2(pos)); + } else if (type == RESTYPE_TEX2DARRAY) { ivec3 size = textureSize(texUInt2DArray, mipLevel); @@ -132,6 +144,15 @@ ivec4 SampleTextureSInt4(vec2 pos, int type, bool flipY, int mipLevel, float sli col = texelFetch(texSInt2D, ivec2(pos), mipLevel); } + else if (type == RESTYPE_TEXRECT) + { + ivec2 size = textureSize(texSInt2DRect, mipLevel); + + if (flipY) + pos.y = size.y - pos.y; + + col = texelFetch(texSInt2DRect, ivec2(pos)); + } else if (type == RESTYPE_TEX2DARRAY) { ivec3 size = textureSize(texSInt2DArray, mipLevel); @@ -188,6 +209,15 @@ vec4 SampleTextureFloat4(vec2 pos, int type, bool flipY, bool linearSample, int else col = texelFetch(tex2D, ivec2(pos), mipLevel); } + else if (type == RESTYPE_TEXRECT) + { + ivec2 size = textureSize(tex2DRect); + + if (flipY) + pos.y = size.y - pos.y; + + col = texelFetch(tex2DRect, ivec2(pos)); + } else if (type == RESTYPE_TEX2DARRAY) { ivec3 size = textureSize(tex2DArray, mipLevel); diff --git a/renderdoc/driver/gl/gl_debug.cpp b/renderdoc/driver/gl/gl_debug.cpp index 1e66c4362..421dc5d6b 100644 --- a/renderdoc/driver/gl/gl_debug.cpp +++ b/renderdoc/driver/gl/gl_debug.cpp @@ -234,7 +234,9 @@ void GLReplay::InitDebugData() RDCEraseEl(DebugData.histogramProgram); RDCEraseEl(DebugData.minmaxResultProgram); - for(int t=1; t <= TEXDISPLAY_TYPEMASK; t++) + RDCCOMPILE_ASSERT(ARRAY_COUNT(DebugData.minmaxTileProgram) >= (TEXDISPLAY_SINT_TEX|TEXDISPLAY_TYPEMASK)+1, "not enough programs"); + + for(int t=1; t <= RESTYPE_TEXTYPEMAX; t++) { // float, uint, sint for(int i=0; i < 3; i++) @@ -581,6 +583,9 @@ bool GLReplay::RenderTexture(TextureDisplay cfg) case eGL_TEXTURE_2D: resType = RESTYPE_TEX2D; break; + case eGL_TEXTURE_RECTANGLE: + resType = RESTYPE_TEXRECT; + break; case eGL_TEXTURE_3D: resType = RESTYPE_TEX3D; break; diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index a872ab479..423c1c2bc 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -1148,6 +1148,9 @@ void GLReplay::SavePipelineState() case eResType_Texture2D: target = eGL_TEXTURE_2D; break; + case eResType_TextureRect: + target = eGL_TEXTURE_RECTANGLE; + break; case eResType_Texture2DArray: target = eGL_TEXTURE_2D_ARRAY; break; diff --git a/renderdoc/driver/gl/gl_replay.h b/renderdoc/driver/gl/gl_replay.h index b35c3dc79..97c5a3b98 100644 --- a/renderdoc/driver/gl/gl_replay.h +++ b/renderdoc/driver/gl/gl_replay.h @@ -180,8 +180,8 @@ class GLReplay : public IReplayDriver GLuint minmaxResult; // Vec4f[2] final result buffer GLuint histogramBuf; // uint32_t * num buckets buffer GLuint minmaxResultProgram[3]; // float/uint/sint tile result -> final result program - GLuint minmaxTileProgram[32]; // RESTYPE indexed (see debuguniforms.h, 1d/2d/3d etc | uint/sint) src tex -> tile result buf program - GLuint histogramProgram[32]; // RESTYPE indexed (see debuguniforms.h, 1d/2d/3d etc | uint/sint) src tex -> histogram result buf program + GLuint minmaxTileProgram[64]; // RESTYPE indexed (see debuguniforms.h, 1d/2d/3d etc | uint/sint) src tex -> tile result buf program + GLuint histogramProgram[64]; // RESTYPE indexed (see debuguniforms.h, 1d/2d/3d etc | uint/sint) src tex -> histogram result buf program GLuint replayQuadProg; diff --git a/renderdoc/driver/gl/gl_shader_refl.cpp b/renderdoc/driver/gl/gl_shader_refl.cpp index c6e0a4d90..5443624db 100644 --- a/renderdoc/driver/gl/gl_shader_refl.cpp +++ b/renderdoc/driver/gl/gl_shader_refl.cpp @@ -264,13 +264,13 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, } else if(values[0] == GL_SAMPLER_2D_RECT) { - res.resType = eResType_Texture2D; + res.resType = eResType_TextureRect; res.variableType.descriptor.name = "sampler2DRect"; res.variableType.descriptor.type = eVar_Float; } else if(values[0] == GL_SAMPLER_2D_RECT_SHADOW) { - res.resType = eResType_Texture2D; + res.resType = eResType_TextureRect; res.variableType.descriptor.name = "sampler2DRectShadow"; res.variableType.descriptor.type = eVar_Float; } @@ -343,7 +343,7 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, } else if(values[0] == GL_INT_SAMPLER_2D_RECT) { - res.resType = eResType_Texture2D; + res.resType = eResType_TextureRect; res.variableType.descriptor.name = "sampler2DRect"; res.variableType.descriptor.type = eVar_Int; } @@ -410,7 +410,7 @@ void MakeShaderReflection(const GLHookSet &gl, GLenum shadType, GLuint sepProg, } else if(values[0] == GL_UNSIGNED_INT_SAMPLER_2D_RECT) { - res.resType = eResType_Texture2D; + res.resType = eResType_TextureRect; res.variableType.descriptor.name = "sampler2DRect"; res.variableType.descriptor.type = eVar_UInt; } diff --git a/renderdocui/Interop/Enums.cs b/renderdocui/Interop/Enums.cs index ec1088488..9a1a1fdb3 100644 --- a/renderdocui/Interop/Enums.cs +++ b/renderdocui/Interop/Enums.cs @@ -55,6 +55,7 @@ namespace renderdoc Texture1D, Texture1DArray, Texture2D, + TextureRect, Texture2DArray, Texture2DMS, Texture2DMSArray,