diff --git a/docs/python_api/renderdoc/shaders.rst b/docs/python_api/renderdoc/shaders.rst index 83128523f..fda100343 100644 --- a/docs/python_api/renderdoc/shaders.rst +++ b/docs/python_api/renderdoc/shaders.rst @@ -75,10 +75,10 @@ Shader Constants .. autoclass:: renderdoc.ShaderConstant :members: -.. autoclass:: renderdoc.ShaderVariableType +.. autoclass:: renderdoc.ShaderConstantType :members: -.. autoclass:: renderdoc.ShaderVariableDescriptor +.. autoclass:: renderdoc.ShaderConstantDescriptor :members: .. autoclass:: renderdoc.VarType diff --git a/qrenderdoc/Code/BufferFormatter.cpp b/qrenderdoc/Code/BufferFormatter.cpp index b55e3f52e..5a5356210 100644 --- a/qrenderdoc/Code/BufferFormatter.cpp +++ b/qrenderdoc/Code/BufferFormatter.cpp @@ -832,7 +832,7 @@ QString BufferFormatter::DeclareStruct(QList &declaredStructs, const QS if(members[i].type.descriptor.pointerTypeID != ~0U) { - const ShaderVariableType &pointeeType = + const ShaderConstantType &pointeeType = PointerTypeRegistry::GetTypeDescriptor(members[i].type.descriptor.pointerTypeID); varTypeName = pointeeType.descriptor.name; @@ -1240,7 +1240,7 @@ inline T readObj(const byte *&data, const byte *end, bool &ok) return ret; } -QVariantList GetVariants(ResourceFormat format, const ShaderVariableDescriptor &varDesc, +QVariantList GetVariants(ResourceFormat format, const ShaderConstantDescriptor &varDesc, const byte *&data, const byte *end) { QVariantList ret; diff --git a/qrenderdoc/Code/QRDUtils.cpp b/qrenderdoc/Code/QRDUtils.cpp index 9d0ea2c68..f4c27d490 100644 --- a/qrenderdoc/Code/QRDUtils.cpp +++ b/qrenderdoc/Code/QRDUtils.cpp @@ -75,7 +75,7 @@ rdcstr DoStringise(const ResourceId &el) } QMap, uint32_t> PointerTypeRegistry::typeMapping; -rdcarray PointerTypeRegistry::typeDescriptions; +rdcarray PointerTypeRegistry::typeDescriptions; static const uint32_t TypeIDBit = 0x80000000; @@ -93,7 +93,7 @@ uint32_t PointerTypeRegistry::GetTypeID(ResourceId shader, uint32_t pointerTypeI return typeMapping[qMakePair(shader, pointerTypeId)]; } -uint32_t PointerTypeRegistry::GetTypeID(const ShaderVariableType &structDef) +uint32_t PointerTypeRegistry::GetTypeID(const ShaderConstantType &structDef) { // see if the type is already registered, return its existing ID for(uint32_t i = 1; i < typeDescriptions.size(); i++) @@ -111,13 +111,13 @@ uint32_t PointerTypeRegistry::GetTypeID(const ShaderVariableType &structDef) return id; } -const ShaderVariableType &PointerTypeRegistry::GetTypeDescriptor(uint32_t typeId) +const ShaderConstantType &PointerTypeRegistry::GetTypeDescriptor(uint32_t typeId) { return typeDescriptions[typeId & ~TypeIDBit]; } void PointerTypeRegistry::CacheSubTypes(const ShaderReflection *reflection, - ShaderVariableType &structDef) + ShaderConstantType &structDef) { if((structDef.descriptor.pointerTypeID & TypeIDBit) == 0) structDef.descriptor.pointerTypeID = @@ -139,7 +139,7 @@ void PointerTypeRegistry::CacheShader(const ShaderReflection *reflection) for(uint32_t i = 0; i < reflection->pointerTypes.size(); i++) { - ShaderVariableType typeDesc = reflection->pointerTypes[i]; + ShaderConstantType typeDesc = reflection->pointerTypes[i]; // first recursively cache all subtypes needed by the root struct types CacheSubTypes(reflection, typeDesc); @@ -789,7 +789,7 @@ bool RichResourceTextMouseEvent(const QWidget *owner, const QVariant &var, QRect { ICaptureContext &ctx = *(ICaptureContext *)ctxptr; - const ShaderVariableType &ptrType = PointerTypeRegistry::GetTypeDescriptor(ptr->val); + const ShaderConstantType &ptrType = PointerTypeRegistry::GetTypeDescriptor(ptr->val); QString formatter; diff --git a/qrenderdoc/Code/QRDUtils.h b/qrenderdoc/Code/QRDUtils.h index 162b9389e..36aa7b8fa 100644 --- a/qrenderdoc/Code/QRDUtils.h +++ b/qrenderdoc/Code/QRDUtils.h @@ -104,7 +104,7 @@ public: static QString DeclarePaddingBytes(uint32_t bytes); }; -QVariantList GetVariants(ResourceFormat format, const ShaderVariableDescriptor &varDesc, +QVariantList GetVariants(ResourceFormat format, const ShaderConstantDescriptor &varDesc, const byte *&data, const byte *end); ResourceFormat GetInterpretedResourceFormat(const ShaderConstant &elem); void SetInterpretedResourceFormat(ShaderConstant &elem, ResourceFormatType interpretType, @@ -137,23 +137,23 @@ public: static uint32_t GetTypeID(ResourceId shader, uint32_t pointerTypeId); static uint32_t GetTypeID(PointerVal val) { return GetTypeID(val.shader, val.pointerTypeID); } - static uint32_t GetTypeID(const ShaderVariableType &structDef); + static uint32_t GetTypeID(const ShaderConstantType &structDef); - static const ShaderVariableType &GetTypeDescriptor(uint32_t typeId); - static const ShaderVariableType &GetTypeDescriptor(ResourceId shader, uint32_t pointerTypeId) + static const ShaderConstantType &GetTypeDescriptor(uint32_t typeId); + static const ShaderConstantType &GetTypeDescriptor(ResourceId shader, uint32_t pointerTypeId) { return GetTypeDescriptor(GetTypeID(shader, pointerTypeId)); } - static const ShaderVariableType &GetTypeDescriptor(PointerVal val) + static const ShaderConstantType &GetTypeDescriptor(PointerVal val) { return GetTypeDescriptor(GetTypeID(val)); } private: - static void CacheSubTypes(const ShaderReflection *reflection, ShaderVariableType &structDef); + static void CacheSubTypes(const ShaderReflection *reflection, ShaderConstantType &structDef); static QMap, uint32_t> typeMapping; - static rdcarray typeDescriptions; + static rdcarray typeDescriptions; }; struct GPUAddress diff --git a/qrenderdoc/Code/pyrenderdoc/renderdoc.i b/qrenderdoc/Code/pyrenderdoc/renderdoc.i index 1a853597b..3375a1633 100644 --- a/qrenderdoc/Code/pyrenderdoc/renderdoc.i +++ b/qrenderdoc/Code/pyrenderdoc/renderdoc.i @@ -368,7 +368,7 @@ TEMPLATE_ARRAY_INSTANTIATE(rdcarray, BoundResourceArray) TEMPLATE_ARRAY_INSTANTIATE(rdcarray, FloatVector) TEMPLATE_ARRAY_INSTANTIATE(rdcarray, GraphicsAPI) TEMPLATE_ARRAY_INSTANTIATE(rdcarray, GPUDevice) -TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderVariableType) +TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderConstantType) TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ShaderChangeStats) TEMPLATE_ARRAY_INSTANTIATE(rdcarray, ResourceBindStats) TEMPLATE_ARRAY_INSTANTIATE(rdcarray, SamplerBindStats) diff --git a/renderdoc/api/replay/shader_types.h b/renderdoc/api/replay/shader_types.h index a7febb1d4..e8e8fe343 100644 --- a/renderdoc/api/replay/shader_types.h +++ b/renderdoc/api/replay/shader_types.h @@ -939,21 +939,21 @@ DECLARE_REFLECTION_STRUCT(SigParameter); struct ShaderConstant; DOCUMENT("Describes the storage characteristics for a basic :class:`ShaderConstant` in memory."); -struct ShaderVariableDescriptor +struct ShaderConstantDescriptor { DOCUMENT(""); - ShaderVariableDescriptor() = default; - ShaderVariableDescriptor(const ShaderVariableDescriptor &) = default; - ShaderVariableDescriptor &operator=(const ShaderVariableDescriptor &) = default; + ShaderConstantDescriptor() = default; + ShaderConstantDescriptor(const ShaderConstantDescriptor &) = default; + ShaderConstantDescriptor &operator=(const ShaderConstantDescriptor &) = default; - bool operator==(const ShaderVariableDescriptor &o) const + bool operator==(const ShaderConstantDescriptor &o) const { return type == o.type && rows == o.rows && columns == o.columns && rowMajorStorage == o.rowMajorStorage && elements == o.elements && arrayByteStride == o.arrayByteStride && matrixByteStride == o.matrixByteStride && pointerTypeID == o.pointerTypeID && name == o.name; } - bool operator<(const ShaderVariableDescriptor &o) const + bool operator<(const ShaderConstantDescriptor &o) const { if(!(type == o.type)) return type < o.type; @@ -999,21 +999,21 @@ struct ShaderVariableDescriptor bool displayAsRGB = false; }; -DECLARE_REFLECTION_STRUCT(ShaderVariableDescriptor); +DECLARE_REFLECTION_STRUCT(ShaderConstantDescriptor); DOCUMENT("Describes the type and members of a :class:`ShaderConstant`."); -struct ShaderVariableType +struct ShaderConstantType { DOCUMENT(""); - ShaderVariableType() = default; - ShaderVariableType(const ShaderVariableType &) = default; - ShaderVariableType &operator=(const ShaderVariableType &) = default; + ShaderConstantType() = default; + ShaderConstantType(const ShaderConstantType &) = default; + ShaderConstantType &operator=(const ShaderConstantType &) = default; - bool operator==(const ShaderVariableType &o) const + bool operator==(const ShaderConstantType &o) const { return descriptor == o.descriptor && members == o.members; } - bool operator<(const ShaderVariableType &o) const + bool operator<(const ShaderConstantType &o) const { if(!(descriptor == o.descriptor)) return descriptor < o.descriptor; @@ -1023,9 +1023,9 @@ struct ShaderVariableType } DOCUMENT(R"(The description of this constant. -:type: ShaderVariableDescriptor +:type: ShaderConstantDescriptor )"); - ShaderVariableDescriptor descriptor; + ShaderConstantDescriptor descriptor; DOCUMENT(R"(Any members that this constant may contain. @@ -1034,7 +1034,7 @@ struct ShaderVariableType rdcarray members; }; -DECLARE_REFLECTION_STRUCT(ShaderVariableType); +DECLARE_REFLECTION_STRUCT(ShaderConstantType); DOCUMENT("Contains the detail of a constant within a :class:`ConstantBlock` in memory."); struct ShaderConstant @@ -1069,9 +1069,9 @@ struct ShaderConstant uint64_t defaultValue = 0; DOCUMENT(R"(The type information for this constant. -:type: ShaderVariableType +:type: ShaderConstantType )"); - ShaderVariableType type; + ShaderConstantType type; }; DECLARE_REFLECTION_STRUCT(ShaderConstant); @@ -1206,9 +1206,9 @@ struct ShaderResource DOCUMENT(R"(The type of each element of this resource. -:type: ShaderVariableType +:type: ShaderConstantType )"); - ShaderVariableType variableType; + ShaderConstantType variableType; DOCUMENT(R"(The bindpoint for this block. This is an index in either the :data:`ShaderBindpointMapping.readOnlyResources` list or @@ -1451,9 +1451,9 @@ struct ShaderReflection DOCUMENT(R"(The list of pointer types referred to in this shader. -:type: List[ShaderVariableType] +:type: List[ShaderConstantType] )"); - rdcarray pointerTypes; + rdcarray pointerTypes; }; DECLARE_REFLECTION_STRUCT(ShaderReflection); diff --git a/renderdoc/data/glsl_shaders.cpp b/renderdoc/data/glsl_shaders.cpp index 346cc61ac..0d4ab75c5 100644 --- a/renderdoc/data/glsl_shaders.cpp +++ b/renderdoc/data/glsl_shaders.cpp @@ -2087,7 +2087,7 @@ void main() { // due to a bug in glslang the reflection is broken for these SSBOs. So we can still run // this test on GLSL we do a little hack here, which can get removed when we update // glslang with the fix - const ShaderVariableType *varType = &res.variableType; + const ShaderConstantType *varType = &res.variableType; if(testType == ShaderType::GLSL && res.variableType.members.size() != 2) { diff --git a/renderdoc/driver/gl/gl_program_iterate.cpp b/renderdoc/driver/gl/gl_program_iterate.cpp index 6c94cc550..f07d95578 100644 --- a/renderdoc/driver/gl/gl_program_iterate.cpp +++ b/renderdoc/driver/gl/gl_program_iterate.cpp @@ -86,7 +86,7 @@ struct UnrolledSPIRVConstant int32_t location = -1; }; -static GLenum MakeGLType(const ShaderVariableType &type) +static GLenum MakeGLType(const ShaderConstantType &type) { if(type.descriptor.type == VarType::Double) { diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index edf1456e9..d746cb230 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -2056,7 +2056,7 @@ void GLReplay::OpenGLFillCBufferVariables(ResourceId shader, GLuint prog, bool b for(int32_t i = 0; i < variables.count(); i++) { - const ShaderVariableDescriptor &desc = variables[i].type.descriptor; + const ShaderConstantDescriptor &desc = variables[i].type.descriptor; // remove implicit '.' for recursing through "structs" if it's actually a multi-dimensional // array. diff --git a/renderdoc/driver/gl/gl_shader_refl.cpp b/renderdoc/driver/gl/gl_shader_refl.cpp index d4bfe507a..662b75b15 100644 --- a/renderdoc/driver/gl/gl_shader_refl.cpp +++ b/renderdoc/driver/gl/gl_shader_refl.cpp @@ -1017,8 +1017,8 @@ void ReconstructVarTree(GLenum query, GLuint sepProg, GLuint varIdx, GLint numPa { if((*parentmembers)[i].name == var.name) { - ShaderVariableDescriptor &oldtype = (*parentmembers)[i].type.descriptor; - ShaderVariableDescriptor &newtype = var.type.descriptor; + ShaderConstantDescriptor &oldtype = (*parentmembers)[i].type.descriptor; + ShaderConstantDescriptor &newtype = var.type.descriptor; if(oldtype.rows != newtype.rows || oldtype.columns != newtype.columns || oldtype.type != newtype.type || oldtype.elements != newtype.elements) diff --git a/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp b/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp index 7a5192bf1..868d1dfd6 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_reflect.cpp @@ -30,9 +30,9 @@ static ShaderConstant MakeConstantBufferVariable(const DXBC::CBufferVariable &var); -static ShaderVariableType MakeShaderVariableType(DXBC::CBufferVariableType type) +static ShaderConstantType MakeShaderConstantType(DXBC::CBufferVariableType type) { - ShaderVariableType ret; + ShaderConstantType ret; ret.descriptor.type = type.descriptor.varType; ret.descriptor.rows = (uint8_t)type.descriptor.rows; @@ -84,7 +84,7 @@ static ShaderConstant MakeConstantBufferVariable(const DXBC::CBufferVariable &va ret.name = var.name; ret.byteOffset = var.offset; ret.defaultValue = 0; - ret.type = MakeShaderVariableType(var.type); + ret.type = MakeShaderConstantType(var.type); return ret; } @@ -188,7 +188,7 @@ static void MakeResourceList(bool srv, DXBC::DXBCContainer *dxbc, auto it = dxbc->GetReflection()->ResourceBinds.find(r.name); if(it != dxbc->GetReflection()->ResourceBinds.end()) { - res.variableType = MakeShaderVariableType(it->second); + res.variableType = MakeShaderConstantType(it->second); } else { diff --git a/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp b/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp index 4bbbe9eb7..fe32688f6 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp +++ b/renderdoc/driver/shaders/dxbc/dxbc_spdb.cpp @@ -1776,7 +1776,7 @@ void SPDBChunk::GetLocals(const DXBC::DXBCContainer *dxbc, size_t, uintptr_t off // check if we already have a mapping for this variable for(SourceVariableMapping &a : locals) { - const ShaderVariableDescriptor &b = it->var; + const ShaderConstantDescriptor &b = it->var; if(a.name == b.name) { diff --git a/renderdoc/driver/shaders/dxbc/dxbc_spdb.h b/renderdoc/driver/shaders/dxbc/dxbc_spdb.h index 3ac9cfa49..981e43c68 100644 --- a/renderdoc/driver/shaders/dxbc/dxbc_spdb.h +++ b/renderdoc/driver/shaders/dxbc/dxbc_spdb.h @@ -253,7 +253,7 @@ struct LocalMapping uint32_t numComps; rdcarray gaps; - ShaderVariableDescriptor var; + ShaderConstantDescriptor var; // stored here so that we don't need to have the register mapping at the time we parse the SPDB // chunk diff --git a/renderdoc/replay/renderdoc_serialise.inl b/renderdoc/replay/renderdoc_serialise.inl index ae6bfe07b..04677b9f3 100644 --- a/renderdoc/replay/renderdoc_serialise.inl +++ b/renderdoc/replay/renderdoc_serialise.inl @@ -170,7 +170,7 @@ void DoSerialise(SerialiserType &ser, SigParameter &el) } template -void DoSerialise(SerialiserType &ser, ShaderVariableDescriptor &el) +void DoSerialise(SerialiserType &ser, ShaderConstantDescriptor &el) { SERIALISE_MEMBER(type); SERIALISE_MEMBER(rows); @@ -188,7 +188,7 @@ void DoSerialise(SerialiserType &ser, ShaderVariableDescriptor &el) } template -void DoSerialise(SerialiserType &ser, ShaderVariableType &el) +void DoSerialise(SerialiserType &ser, ShaderConstantType &el) { SERIALISE_MEMBER(descriptor); SERIALISE_MEMBER(members); @@ -2285,7 +2285,7 @@ INSTANTIATE_SERIALISE_TYPE(ResourceFormat) INSTANTIATE_SERIALISE_TYPE(Bindpoint) INSTANTIATE_SERIALISE_TYPE(ShaderBindpointMapping) INSTANTIATE_SERIALISE_TYPE(SigParameter) -INSTANTIATE_SERIALISE_TYPE(ShaderVariableType) +INSTANTIATE_SERIALISE_TYPE(ShaderConstantType) INSTANTIATE_SERIALISE_TYPE(ShaderConstant) INSTANTIATE_SERIALISE_TYPE(ConstantBlock) INSTANTIATE_SERIALISE_TYPE(ShaderSampler) diff --git a/renderdoc/replay/replay_driver.cpp b/renderdoc/replay/replay_driver.cpp index a70472673..d175d3673 100644 --- a/renderdoc/replay/replay_driver.cpp +++ b/renderdoc/replay/replay_driver.cpp @@ -337,7 +337,7 @@ void PatchTriangleFanRestartIndexBufer(rdcarray &patchedIndices, uint3 newIndices.swap(patchedIndices); } -void StandardFillCBufferVariable(ResourceId shader, const ShaderVariableDescriptor &desc, +void StandardFillCBufferVariable(ResourceId shader, const ShaderConstantDescriptor &desc, uint32_t dataOffset, const bytebuf &data, ShaderVariable &outvar, uint32_t matStride) { diff --git a/renderdoc/replay/replay_driver.h b/renderdoc/replay/replay_driver.h index 0ad303abe..240bf10a2 100644 --- a/renderdoc/replay/replay_driver.h +++ b/renderdoc/replay/replay_driver.h @@ -309,7 +309,7 @@ void PatchTriangleFanRestartIndexBufer(rdcarray &patchedIndices, uint3 uint64_t CalcMeshOutputSize(uint64_t curSize, uint64_t requiredOutput); -void StandardFillCBufferVariable(ResourceId shader, const ShaderVariableDescriptor &desc, +void StandardFillCBufferVariable(ResourceId shader, const ShaderConstantDescriptor &desc, uint32_t dataOffset, const bytebuf &data, ShaderVariable &outvar, uint32_t matStride); void StandardFillCBufferVariables(ResourceId shader, const rdcarray &invars, diff --git a/util/test/tests/D3D12/D3D12_Reflection_Zoo.py b/util/test/tests/D3D12/D3D12_Reflection_Zoo.py index 0f9994a2d..28bd6af57 100644 --- a/util/test/tests/D3D12/D3D12_Reflection_Zoo.py +++ b/util/test/tests/D3D12/D3D12_Reflection_Zoo.py @@ -74,7 +74,7 @@ class D3D12_Reflection_Zoo(rdtest.TestCase): 'structVarCheck': structVarCheck, } - def buf_struct_check(type: rd.ShaderVariableType): + def buf_struct_check(type: rd.ShaderConstantType): self.check(type.descriptor.name == 'buf_struct') self.check(len(type.members) == 3)