Add support for more semantics

This commit is contained in:
Maxime Coste 2010-09-06 16:16:52 +02:00
Родитель 26acd8f05a
Коммит 88863500fd
2 изменённых файлов: 138 добавлений и 2 удалений

118
hlslang/GLSLCodeGen/hlslLinker.cpp Normal file → Executable file
Просмотреть файл

@ -27,7 +27,13 @@ static const char* attribString[EAttrSemCount] = {
"gl_Vertex", "gl_Vertex",
"", "",
"", "",
"",
"",
"",
"gl_Normal", "gl_Normal",
"",
"",
"",
"gl_Color", "gl_Color",
"gl_SecondaryColor", "gl_SecondaryColor",
"", "",
@ -43,11 +49,27 @@ static const char* attribString[EAttrSemCount] = {
"", "",
"", "",
"xlat_attrib_tangent", "xlat_attrib_tangent",
"",
"",
"",
"xlat_attrib_binorm", "xlat_attrib_binorm",
"",
"",
"",
"xlat_attrib_blendweights", "xlat_attrib_blendweights",
"",
"",
"",
"xlat_attrib_blendindices", "xlat_attrib_blendindices",
"", "",
"", "",
"",
"",
"",
"",
"",
"",
"",
"gl_VertexID", "gl_VertexID",
"gl_InstanceIDARB", "gl_InstanceIDARB",
"" ""
@ -60,6 +82,12 @@ static const char* varOutString[EAttrSemCount] = {
"", "",
"", "",
"", "",
"",
"",
"",
"",
"",
"",
"gl_FrontColor", "gl_FrontColor",
"gl_FrontSecondaryColor", "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 // String table that maps attribute semantics to built-in GLSL input varyings
static const char* varInString[EAttrSemCount] = { static const char* varInString[EAttrSemCount] = {
"",
"",
"",
"", "",
"", "",
"gl_FragCoord", "gl_FragCoord",
"gl_FrontFacing", "gl_FrontFacing",
"", "",
"",
"",
"",
"gl_Color", "gl_Color",
"gl_SecondaryColor", "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 // String table that maps attribute semantics to built-in GLSL fragment shader outputs
static const char* resultString[EAttrSemCount] = { static const char* resultString[EAttrSemCount] = {
"",
"",
"",
"",
"",
"",
"", "",
"", "",
"", "",
@ -142,8 +214,27 @@ static const char* resultString[EAttrSemCount] = {
"", "",
"", "",
"", "",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"gl_FragDepth", "gl_FragDepth",
"", "",
"",
"",
"",
}; };
static const char* kUserVaryingPrefix = "xlv_"; static const char* kUserVaryingPrefix = "xlv_";
@ -388,18 +479,41 @@ struct AttrSemanticMapping {
static AttrSemanticMapping kAttributeSemantic[] = { static AttrSemanticMapping kAttributeSemantic[] = {
{ "position", EAttrSemPosition }, { "position", EAttrSemPosition },
{ "position0", EAttrSemPosition }, { "position0", EAttrSemPosition },
{ "position1", EAttrSemPosition1 },
{ "position2", EAttrSemPosition2 },
{ "position3", EAttrSemPosition3 },
{ "vpos", EAttrSemVPos }, { "vpos", EAttrSemVPos },
{ "vface", EAttrSemVFace }, { "vface", EAttrSemVFace },
{ "normal", EAttrSemNormal }, { "normal", EAttrSemNormal },
{ "normal0", EAttrSemNormal }, { "normal0", EAttrSemNormal },
{ "normal1", EAttrSemNormal1 },
{ "normal2", EAttrSemNormal2 },
{ "normal3", EAttrSemNormal3 },
{ "tangent", EAttrSemTangent }, { "tangent", EAttrSemTangent },
{ "tangent0", EAttrSemTangent }, { "tangent0", EAttrSemTangent },
{ "tangent1", EAttrSemTangent1 },
{ "tangent2", EAttrSemTangent2 },
{ "tangent3", EAttrSemTangent3 },
{ "binormal", EAttrSemBinormal }, { "binormal", EAttrSemBinormal },
{ "binormal0", EAttrSemBinormal }, { "binormal0", EAttrSemBinormal },
{ "binormal1", EAttrSemBinormal1 },
{ "binormal2", EAttrSemBinormal2 },
{ "binormal3", EAttrSemBinormal3 },
{ "blendweight", EAttrSemBlendWeight }, { "blendweight", EAttrSemBlendWeight },
{ "blendweight0", EAttrSemBlendWeight }, { "blendweight0", EAttrSemBlendWeight },
{ "blendweight1", EAttrSemBlendWeight1 },
{ "blendweight2", EAttrSemBlendWeight2 },
{ "blendweight3", EAttrSemBlendWeight3 },
{ "blendindices", EAttrSemBlendIndices }, { "blendindices", EAttrSemBlendIndices },
{ "blendindices0", EAttrSemBlendIndices }, { "blendindices0", EAttrSemBlendIndices },
{ "blendindices1", EAttrSemBlendIndices1 },
{ "blendindices2", EAttrSemBlendIndices2 },
{ "blendindices3", EAttrSemBlendIndices3 },
{ "psize", EAttrSemPSize },
{ "psize0", EAttrSemPSize },
{ "psize1", EAttrSemPSize1 },
{ "psize2", EAttrSemPSize2 },
{ "psize3", EAttrSemPSize3 },
{ "color", EAttrSemColor0 }, { "color", EAttrSemColor0 },
{ "color0", EAttrSemColor0 }, { "color0", EAttrSemColor0 },
{ "color1", EAttrSemColor1 }, { "color1", EAttrSemColor1 },

22
include/hlsl2glsl.h Normal file → Executable file
Просмотреть файл

@ -86,9 +86,15 @@ enum EAttribSemantic
{ {
EAttrSemNone, EAttrSemNone,
EAttrSemPosition, EAttrSemPosition,
EAttrSemPosition1,
EAttrSemPosition2,
EAttrSemPosition3,
EAttrSemVPos, EAttrSemVPos,
EAttrSemVFace, EAttrSemVFace,
EAttrSemNormal, EAttrSemNormal,
EAttrSemNormal1,
EAttrSemNormal2,
EAttrSemNormal3,
EAttrSemColor0, EAttrSemColor0,
EAttrSemColor1, EAttrSemColor1,
EAttrSemColor2, EAttrSemColor2,
@ -104,9 +110,25 @@ enum EAttribSemantic
EAttrSemTex8, EAttrSemTex8,
EAttrSemTex9, EAttrSemTex9,
EAttrSemTangent, EAttrSemTangent,
EAttrSemTangent1,
EAttrSemTangent2,
EAttrSemTangent3,
EAttrSemBinormal, EAttrSemBinormal,
EAttrSemBinormal1,
EAttrSemBinormal2,
EAttrSemBinormal3,
EAttrSemBlendWeight, EAttrSemBlendWeight,
EAttrSemBlendWeight1,
EAttrSemBlendWeight2,
EAttrSemBlendWeight3,
EAttrSemBlendIndices, EAttrSemBlendIndices,
EAttrSemBlendIndices1,
EAttrSemBlendIndices2,
EAttrSemBlendIndices3,
EAttrSemPSize,
EAttrSemPSize1,
EAttrSemPSize2,
EAttrSemPSize3,
EAttrSemDepth, EAttrSemDepth,
EAttrSemUnknown, EAttrSemUnknown,
EAttrSemVertexID, EAttrSemVertexID,