Get the element type from the Constant not Global Variable for GEP

This commit is contained in:
Jake Turner
2025-02-24 16:37:45 +00:00
parent f2de54c148
commit 4ab9cba381
+7 -2
View File
@@ -891,12 +891,17 @@ static bool ConvertDXILConstantToShaderVariable(const Constant *constant, Shader
RDCERR("Constant GetElementPtr first member is not a GlobalVar");
return false;
}
const DXIL::Type *elementType = gv->type;
if(elementType->type != Type::TypeKind::Pointer)
if(gv->type->type != Type::TypeKind::Pointer)
{
RDCERR("Constant GetElementPtr global variable is not a Pointer");
return false;
}
const DXIL::Type *elementType = constant->type;
if(elementType->type != Type::TypeKind::Pointer)
{
RDCERR("Constant variable is not a Pointer");
return false;
}
elementType = elementType->inner;
VarType baseType = ConvertDXILTypeToVarType(elementType);
uint32_t elementSize = GetElementByteSize(baseType);