MCPcopy Create free account
hub / github.com/davideberly/GeometricTools / GetVariables

Method GetVariables

GTE/Graphics/DX11/HLSLShaderFactory.cpp:455–488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455bool HLSLShaderFactory::GetVariables(
456 ID3DShaderReflectionConstantBuffer* cbuffer,
457 uint32_t numVariables,
458 std::vector<HLSLBaseBuffer::Member>& members)
459{
460 for (UINT i = 0; i < numVariables; ++i)
461 {
462 ID3DShaderReflectionVariable* var = cbuffer->GetVariableByIndex(i);
463 ID3DShaderReflectionType* varType = var->GetType();
464
465 D3D_SHADER_VARIABLE_DESC varDesc;
466 DX11Log(var->GetDesc(&varDesc));
467
468 D3D_SHADER_TYPE_DESC varTypeDesc;
469 DX11Log(varType->GetDesc(&varTypeDesc));
470
471 // Get the top-level information about the shader variable.
472 HLSLShaderVariable svar;
473 svar.SetDescription(varDesc);
474
475 // Get the type of the variable. If this is a struct type, the
476 // call recurses to build the type tree implied by the struct.
477 HLSLShaderType stype;
478 stype.SetName(svar.GetName());
479 stype.SetDescription(varTypeDesc);
480 if (!GetTypes(varType, varTypeDesc.Members, stype))
481 {
482 return false;
483 }
484
485 members.push_back(std::make_pair(svar, stype));
486 }
487 return true;
488}
489
490bool HLSLShaderFactory::GetTypes(ID3DShaderReflectionType* rtype,
491 uint32_t numMembers, HLSLShaderType& stype)

Callers

nothing calls this directly

Calls 4

GetNameMethod · 0.80
GetTypeMethod · 0.45
SetDescriptionMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected