Skip to content

Commit

Permalink
Merge pull request #310 from Sonicadvance1/Integer-posmtx
Browse files Browse the repository at this point in the history
Change over to use integer posmtx in our vertex shaders
  • Loading branch information
neobrain committed May 1, 2014
2 parents c5d5061 + 2d8cfb8 commit 2cf8f55
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
Expand Up @@ -1604,6 +1604,7 @@ namespace GLExtensions
"GL_ARB_sync",
"GL_ARB_ES2_compatibility",
"VERSION_GLES3",
"VERSION_3_0",
};
for (auto it : gles3exts)
m_extension_list[it] = true;
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoBackends/OGL/ProgramShaderCache.cpp
Expand Up @@ -102,7 +102,7 @@ void SHADER::SetProgramBindings()
// Need to set some attribute locations
glBindAttribLocation(glprogid, SHADER_POSITION_ATTRIB, "rawpos");

glBindAttribLocation(glprogid, SHADER_POSMTX_ATTRIB, "fposmtx");
glBindAttribLocation(glprogid, SHADER_POSMTX_ATTRIB, "posmtx");

glBindAttribLocation(glprogid, SHADER_COLOR0_ATTRIB, "color0");
glBindAttribLocation(glprogid, SHADER_COLOR1_ATTRIB, "color1");
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VideoCommon/VertexLoader.cpp
Expand Up @@ -753,7 +753,7 @@ void VertexLoader::CompileVertexTranslator()
vtx_decl.posmtx.enable = true;
vtx_decl.posmtx.offset = nat_offset;
vtx_decl.posmtx.type = VAR_UNSIGNED_BYTE;
vtx_decl.posmtx.integer = false;
vtx_decl.posmtx.integer = true;
nat_offset += 4;
}

Expand Down
6 changes: 2 additions & 4 deletions Source/Core/VideoCommon/VertexShaderGen.cpp
Expand Up @@ -109,7 +109,7 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
{
out.Write("in float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB);
if (components & VB_HAS_POSMTXIDX)
out.Write("in float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
out.Write("in int posmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
if (components & VB_HAS_NRM0)
out.Write("in float3 rawnorm0; // ATTR%d,\n", SHADER_NORM0_ATTRIB);
if (components & VB_HAS_NRM1)
Expand Down Expand Up @@ -168,16 +168,14 @@ static inline void GenerateVertexShader(T& out, u32 components, API_TYPE api_typ
out.Write(" float%d tex%d : TEXCOORD%d,\n", hastexmtx ? 3 : 2, i, i);
}
if (components & VB_HAS_POSMTXIDX)
out.Write(" float fposmtx : BLENDINDICES,\n");
out.Write(" int posmtx : BLENDINDICES,\n");
out.Write(" float4 rawpos : POSITION) {\n");
}
out.Write("VS_OUTPUT o;\n");

// transforms
if (components & VB_HAS_POSMTXIDX)
{
out.Write("int posmtx = int(fposmtx * 255.0);\n"); // TODO: Ugly, should use an integer instead

if (is_writing_shadercode && (DriverDetails::HasBug(DriverDetails::BUG_NODYNUBOACCESS) && !DriverDetails::HasBug(DriverDetails::BUG_ANNIHILATEDUBOS)) )
{
// This'll cause issues, but it can't be helped
Expand Down

0 comments on commit 2cf8f55

Please sign in to comment.