MCPcopy Create free account
hub / github.com/baldurk/renderdoc / GetInterpretedResourceFormat

Function GetInterpretedResourceFormat

qrenderdoc/Code/BufferFormatter.cpp:3101–3136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3099}
3100
3101ResourceFormat GetInterpretedResourceFormat(const ShaderConstant &elem)
3102{
3103 ResourceFormat format;
3104 format.type = ResourceFormatType::Regular;
3105
3106 if(elem.type.flags & ShaderVariableFlags::R10G10B10A2)
3107 format.type = ResourceFormatType::R10G10B10A2;
3108 else if(elem.type.flags & ShaderVariableFlags::R11G11B10)
3109 format.type = ResourceFormatType::R11G11B10;
3110
3111 format.compType = VarTypeCompType(elem.type.baseType);
3112
3113 if(elem.type.flags & ShaderVariableFlags::UNorm)
3114 format.compType = CompType::UNorm;
3115 else if(elem.type.flags & ShaderVariableFlags::SNorm)
3116 format.compType = CompType::SNorm;
3117
3118 format.compByteWidth = VarTypeByteSize(elem.type.baseType);
3119
3120 if(elem.type.baseType == VarType::Enum)
3121 format.compByteWidth = elem.type.matrixByteStride;
3122
3123 if(elem.type.RowMajor() || elem.type.rows == 1)
3124 format.compCount = elem.type.columns;
3125 else
3126 format.compCount = elem.type.rows;
3127
3128 if(elem.type.baseType == VarType::GPUPointer)
3129 {
3130 format.compCount = 1;
3131 format.compType = CompType::UInt;
3132 format.compByteWidth = 8;
3133 }
3134
3135 return format;
3136}
3137
3138static void FillShaderVarData(ShaderVariable &var, const ShaderConstant &elem, const byte *data,
3139 const byte *end)

Callers 2

FillShaderVarDataFunction · 0.85
UnrollConstantFunction · 0.85

Calls 2

VarTypeCompTypeFunction · 0.85
VarTypeByteSizeFunction · 0.85

Tested by

no test coverage detected