From 88863500fd2228486031506719f99b0b9ef4fc47 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 6 Sep 2010 16:16:52 +0200 Subject: [PATCH] Add support for more semantics --- hlslang/GLSLCodeGen/hlslLinker.cpp | 118 ++++++++++++++++++++++++++++- include/hlsl2glsl.h | 22 ++++++ 2 files changed, 138 insertions(+), 2 deletions(-) mode change 100644 => 100755 hlslang/GLSLCodeGen/hlslLinker.cpp mode change 100644 => 100755 include/hlsl2glsl.h diff --git a/hlslang/GLSLCodeGen/hlslLinker.cpp b/hlslang/GLSLCodeGen/hlslLinker.cpp old mode 100644 new mode 100755 index 0a8f6bf..9ae9d30 --- a/hlslang/GLSLCodeGen/hlslLinker.cpp +++ b/hlslang/GLSLCodeGen/hlslLinker.cpp @@ -27,7 +27,13 @@ static const char* attribString[EAttrSemCount] = { "gl_Vertex", "", "", + "", + "", + "", "gl_Normal", + "", + "", + "", "gl_Color", "gl_SecondaryColor", "", @@ -43,11 +49,27 @@ static const char* attribString[EAttrSemCount] = { "", "", "xlat_attrib_tangent", + "", + "", + "", "xlat_attrib_binorm", + "", + "", + "", "xlat_attrib_blendweights", + "", + "", + "", "xlat_attrib_blendindices", "", "", + "", + "", + "", + "", + "", + "", + "", "gl_VertexID", "gl_InstanceIDARB", "" @@ -60,6 +82,12 @@ static const char* varOutString[EAttrSemCount] = { "", "", "", + "", + "", + "", + "", + "", + "", "gl_FrontColor", "gl_FrontSecondaryColor", "", @@ -82,16 +110,38 @@ static const char* varOutString[EAttrSemCount] = { "", "", "", - "" + "", + "", + "", + "", + "", + "", + "", + "", + "gl_PointSize", + "", + "", + "", + "", + "", + "", + "", + "", }; // String table that maps attribute semantics to built-in GLSL input varyings static const char* varInString[EAttrSemCount] = { + "", + "", + "", "", "", "gl_FragCoord", "gl_FrontFacing", "", + "", + "", + "", "gl_Color", "gl_SecondaryColor", "", @@ -114,11 +164,33 @@ static const char* varInString[EAttrSemCount] = { "", "", "", - "gl_PrimitiveID" + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "gl_PrimitiveID", }; // String table that maps attribute semantics to built-in GLSL fragment shader outputs static const char* resultString[EAttrSemCount] = { + "", + "", + "", + "", + "", + "", "", "", "", @@ -142,8 +214,27 @@ static const char* resultString[EAttrSemCount] = { "", "", "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", "gl_FragDepth", "", + "", + "", + "", }; static const char* kUserVaryingPrefix = "xlv_"; @@ -388,18 +479,41 @@ struct AttrSemanticMapping { static AttrSemanticMapping kAttributeSemantic[] = { { "position", EAttrSemPosition }, { "position0", EAttrSemPosition }, + { "position1", EAttrSemPosition1 }, + { "position2", EAttrSemPosition2 }, + { "position3", EAttrSemPosition3 }, { "vpos", EAttrSemVPos }, { "vface", EAttrSemVFace }, { "normal", EAttrSemNormal }, { "normal0", EAttrSemNormal }, + { "normal1", EAttrSemNormal1 }, + { "normal2", EAttrSemNormal2 }, + { "normal3", EAttrSemNormal3 }, { "tangent", EAttrSemTangent }, { "tangent0", EAttrSemTangent }, + { "tangent1", EAttrSemTangent1 }, + { "tangent2", EAttrSemTangent2 }, + { "tangent3", EAttrSemTangent3 }, { "binormal", EAttrSemBinormal }, { "binormal0", EAttrSemBinormal }, + { "binormal1", EAttrSemBinormal1 }, + { "binormal2", EAttrSemBinormal2 }, + { "binormal3", EAttrSemBinormal3 }, { "blendweight", EAttrSemBlendWeight }, { "blendweight0", EAttrSemBlendWeight }, + { "blendweight1", EAttrSemBlendWeight1 }, + { "blendweight2", EAttrSemBlendWeight2 }, + { "blendweight3", EAttrSemBlendWeight3 }, { "blendindices", EAttrSemBlendIndices }, { "blendindices0", EAttrSemBlendIndices }, + { "blendindices1", EAttrSemBlendIndices1 }, + { "blendindices2", EAttrSemBlendIndices2 }, + { "blendindices3", EAttrSemBlendIndices3 }, + { "psize", EAttrSemPSize }, + { "psize0", EAttrSemPSize }, + { "psize1", EAttrSemPSize1 }, + { "psize2", EAttrSemPSize2 }, + { "psize3", EAttrSemPSize3 }, { "color", EAttrSemColor0 }, { "color0", EAttrSemColor0 }, { "color1", EAttrSemColor1 }, diff --git a/include/hlsl2glsl.h b/include/hlsl2glsl.h old mode 100644 new mode 100755 index 7d94e31..1611628 --- a/include/hlsl2glsl.h +++ b/include/hlsl2glsl.h @@ -86,9 +86,15 @@ enum EAttribSemantic { EAttrSemNone, EAttrSemPosition, + EAttrSemPosition1, + EAttrSemPosition2, + EAttrSemPosition3, EAttrSemVPos, EAttrSemVFace, EAttrSemNormal, + EAttrSemNormal1, + EAttrSemNormal2, + EAttrSemNormal3, EAttrSemColor0, EAttrSemColor1, EAttrSemColor2, @@ -104,9 +110,25 @@ enum EAttribSemantic EAttrSemTex8, EAttrSemTex9, EAttrSemTangent, + EAttrSemTangent1, + EAttrSemTangent2, + EAttrSemTangent3, EAttrSemBinormal, + EAttrSemBinormal1, + EAttrSemBinormal2, + EAttrSemBinormal3, EAttrSemBlendWeight, + EAttrSemBlendWeight1, + EAttrSemBlendWeight2, + EAttrSemBlendWeight3, EAttrSemBlendIndices, + EAttrSemBlendIndices1, + EAttrSemBlendIndices2, + EAttrSemBlendIndices3, + EAttrSemPSize, + EAttrSemPSize1, + EAttrSemPSize2, + EAttrSemPSize3, EAttrSemDepth, EAttrSemUnknown, EAttrSemVertexID,