diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index 1431bd2db..3bf04d2fd 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -95,6 +95,7 @@ struct FetchTexture bool32 customName; ResourceFormat format; uint32_t dimension; + ShaderResourceType resType; uint32_t width, height, depth; ResourceId ID; bool32 cubemap; diff --git a/renderdoc/api/replay/gl_pipestate.h b/renderdoc/api/replay/gl_pipestate.h index 481d7793f..f080aaf93 100644 --- a/renderdoc/api/replay/gl_pipestate.h +++ b/renderdoc/api/replay/gl_pipestate.h @@ -72,6 +72,7 @@ struct GLPipelineState { ResourceId Resource; uint32_t FirstSlice; + ShaderResourceType ResType; }; rdctype::array Textures; diff --git a/renderdoc/driver/d3d11/d3d11_replay.cpp b/renderdoc/driver/d3d11/d3d11_replay.cpp index 18da09394..5bd8d06b8 100644 --- a/renderdoc/driver/d3d11/d3d11_replay.cpp +++ b/renderdoc/driver/d3d11/d3d11_replay.cpp @@ -87,6 +87,8 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.mips = tex.numSubresources; tex.arraysize = desc.ArraySize; + tex.resType = tex.arraysize > 1 ? eResType_Texture1DArray : eResType_Texture1D; + tex.msQual = 0; tex.msSamp = 1; tex.numSubresources *= desc.ArraySize; @@ -165,6 +167,12 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.msQual = desc.SampleDesc.Quality; tex.msSamp = desc.SampleDesc.Count; + tex.resType = tex.arraysize > 1 ? eResType_Texture2DArray : eResType_Texture2D; + if(tex.cubemap) + tex.resType = tex.arraysize > 1 ? eResType_TextureCubeArray : eResType_TextureCube; + if(tex.msSamp > 1) + tex.resType = tex.arraysize > 1 ? eResType_Texture2DMSArray : eResType_Texture2DMS; + tex.numSubresources *= desc.ArraySize; tex.customName = true; @@ -229,6 +237,8 @@ FetchTexture D3D11Replay::GetTexture(ResourceId id) tex.numSubresources = desc.MipLevels; + tex.resType = eResType_Texture3D; + tex.creationFlags = 0; if(desc.BindFlags & D3D11_BIND_SHADER_RESOURCE) tex.creationFlags |= eTextureCreate_SRV; diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index 9cd1a9fdb..294eacaca 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -360,6 +360,7 @@ void GLReplay::CacheTexture(ResourceId id) tex.customName = false; tex.format = ResourceFormat(); tex.dimension = 1; + tex.resType = eResType_None; tex.width = tex.height = tex.depth = 1; tex.cubemap = false; tex.mips = 1; @@ -377,6 +378,7 @@ void GLReplay::CacheTexture(ResourceId id) if(res.resource.Namespace == eResRenderbuffer || res.curType == eGL_RENDERBUFFER) { tex.dimension = 2; + tex.resType = eResType_Texture2D; tex.width = res.width; tex.height = res.height; tex.depth = 1; @@ -458,7 +460,48 @@ void GLReplay::CacheTexture(ResourceId id) tex.msSamp = 1; tex.width = tex.height = tex.depth = tex.arraysize = 1; tex.cubemap = false; + + switch(target) + { + case eGL_TEXTURE_BUFFER: + tex.resType = eResType_Buffer; + break; + case eGL_TEXTURE_1D: + tex.resType = eResType_Texture1D; + break; + case eGL_TEXTURE_2D: + tex.resType = eResType_Texture2D; + break; + case eGL_TEXTURE_3D: + tex.resType = eResType_Texture3D; + break; + case eGL_TEXTURE_1D_ARRAY: + tex.resType = eResType_Texture1DArray; + break; + case eGL_TEXTURE_2D_ARRAY: + tex.resType = eResType_Texture2DArray; + break; + case eGL_TEXTURE_RECTANGLE: + tex.resType = eResType_TextureRect; + break; + case eGL_TEXTURE_2D_MULTISAMPLE: + tex.resType = eResType_Texture2DMS; + break; + case eGL_TEXTURE_2D_MULTISAMPLE_ARRAY: + tex.resType = eResType_Texture2DMSArray; + break; + case eGL_TEXTURE_CUBE_MAP: + tex.resType = eResType_TextureCube; + break; + case eGL_TEXTURE_CUBE_MAP_ARRAY: + tex.resType = eResType_TextureCubeArray; + break; + default: + tex.resType = eResType_None; + RDCERR("Unexpected texture enum %s", ToStr::Get(target).c_str()); + } + switch(target) { case eGL_TEXTURE_1D: @@ -1120,6 +1163,7 @@ void GLReplay::SavePipelineState() { GLenum binding = eGL_NONE; GLenum target = eGL_NONE; + ShaderResourceType resType = eResType_None; bool shadow = false; @@ -1180,6 +1224,8 @@ void GLReplay::SavePipelineState() if(target != eGL_NONE) t = TextureBinding(target); + resType = refls[s]->Resources[r].resType; + if(binding == eGL_NONE) { binding = t; @@ -1212,6 +1258,7 @@ void GLReplay::SavePipelineState() pipe.Textures[unit].Resource = rm->GetOriginalID(rm->GetID(TextureRes(ctx, tex))); pipe.Textures[unit].FirstSlice = (uint32_t)firstSlice; + pipe.Textures[unit].ResType = resType; GLuint samp; gl.glGetIntegerv(eGL_SAMPLER_BINDING, (GLint *)&samp); diff --git a/renderdocui/Interop/FetchInfo.cs b/renderdocui/Interop/FetchInfo.cs index 730d83824..64b8102bf 100644 --- a/renderdocui/Interop/FetchInfo.cs +++ b/renderdocui/Interop/FetchInfo.cs @@ -248,6 +248,7 @@ namespace renderdoc [CustomMarshalAs(CustomUnmanagedType.CustomClass)] public ResourceFormat format; public UInt32 dimension; + public ShaderResourceType resType; public UInt32 width, height, depth; public ResourceId ID; public bool cubemap; diff --git a/renderdocui/Interop/GLPipelineState.cs b/renderdocui/Interop/GLPipelineState.cs index 5d436b1d3..c6b69bc62 100644 --- a/renderdocui/Interop/GLPipelineState.cs +++ b/renderdocui/Interop/GLPipelineState.cs @@ -94,8 +94,8 @@ namespace renderdoc public class Texture { public ResourceId Resource; - public UInt32 FirstSlice; + public ShaderResourceType ResType; }; [CustomMarshalAs(CustomUnmanagedType.TemplatedArray)] public Texture[] Textures; diff --git a/renderdocui/Windows/PipelineState/D3D11PipelineStateViewer.cs b/renderdocui/Windows/PipelineState/D3D11PipelineStateViewer.cs index e8857f74e..285bc426f 100644 --- a/renderdocui/Windows/PipelineState/D3D11PipelineStateViewer.cs +++ b/renderdocui/Windows/PipelineState/D3D11PipelineStateViewer.cs @@ -261,9 +261,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if(texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; } @@ -889,9 +887,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; } @@ -1129,9 +1125,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; } @@ -1208,9 +1202,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; } @@ -1296,9 +1288,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; } @@ -2401,9 +2391,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tex = texs[t]; } diff --git a/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs b/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs index 8c748aa7d..05c9b6ee0 100644 --- a/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs +++ b/renderdocui/Windows/PipelineState/GLPipelineStateViewer.cs @@ -263,9 +263,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; } @@ -957,9 +955,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; @@ -1019,9 +1015,7 @@ namespace renderdocui.Windows.PipelineState a = texs[t].arraysize; format = texs[t].format.ToString(); name = texs[t].name; - typename = string.Format("Texture{0}D", texs[t].dimension); - if (texs[t].cubemap) - typename = "TexCube"; + typename = texs[t].resType.ToString(); tag = texs[t]; }