Commit 529077d9 by Jamie Madill Committed by Shannon Woods

Add support for column/row major layout qualifiers in generated HLSL.

TRAC #23271 Signed-off-by: Nicolas Capens Signed-off-by: Shannon Woods Authored-by: Jamie Madill
parent 9cf6c070
...@@ -214,17 +214,19 @@ TString OutputHLSL::interfaceBlockInstanceString(const TType& interfaceBlockType ...@@ -214,17 +214,19 @@ TString OutputHLSL::interfaceBlockInstanceString(const TType& interfaceBlockType
TString OutputHLSL::interfaceBlockMemberTypeString(const TType &memberType) TString OutputHLSL::interfaceBlockMemberTypeString(const TType &memberType)
{ {
// TODO: layout support const TLayoutMatrixPacking matrixPacking = memberType.getLayoutQualifier().matrixPacking;
ASSERT(matrixPacking != EmpUnspecified);
if (memberType.isMatrix()) if (memberType.isMatrix())
{ {
// Use HLSL row-major packing for GLSL column-major matrices // Use HLSL row-major packing for GLSL column-major matrices
return "row_major " + typeString(memberType); const TString &matrixPackString = (matrixPacking == EmpRowMajor ? "column_major" : "row_major");
return matrixPackString + " " + typeString(memberType);
} }
else if (memberType.getBasicType() == EbtStruct) else if (memberType.getBasicType() == EbtStruct)
{ {
// Use HLSL row-major packing for GLSL column-major matrices // Use HLSL row-major packing for GLSL column-major matrices
return structureTypeName(memberType, true); return structureTypeName(memberType, matrixPacking == EmpColumnMajor);
} }
else else
{ {
...@@ -287,16 +289,6 @@ void OutputHLSL::header() ...@@ -287,16 +289,6 @@ void OutputHLSL::header()
ShShaderType shaderType = mContext.shaderType; ShShaderType shaderType = mContext.shaderType;
TInfoSinkBase &out = mHeader; TInfoSinkBase &out = mHeader;
for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
{
out << *structDeclaration;
}
for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
{
out << *constructor;
}
TString uniforms; TString uniforms;
TString interfaceBlocks; TString interfaceBlocks;
TString interfaceBlockInit; TString interfaceBlockInit;
...@@ -402,6 +394,16 @@ void OutputHLSL::header() ...@@ -402,6 +394,16 @@ void OutputHLSL::header()
mActiveAttributes.push_back(shaderVar); mActiveAttributes.push_back(shaderVar);
} }
for (StructDeclarations::iterator structDeclaration = mStructDeclarations.begin(); structDeclaration != mStructDeclarations.end(); structDeclaration++)
{
out << *structDeclaration;
}
for (Constructors::iterator constructor = mConstructors.begin(); constructor != mConstructors.end(); constructor++)
{
out << *constructor;
}
if (shaderType == SH_FRAGMENT_SHADER) if (shaderType == SH_FRAGMENT_SHADER)
{ {
TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers"); TExtensionBehavior::const_iterator iter = mContext.extensionBehavior().find("GL_EXT_draw_buffers");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment