Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Revert "Revert "Fix performance issues on certain legacy graphics har…
…dware that isn't capable of copying an integer.""

This reverts commit 8b7141d.

GLSL120 can't handle integer attributes :-(
  • Loading branch information
degasus committed Apr 24, 2013
1 parent 1b76655 commit 4a48485
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Source/Core/VideoCommon/Src/VertexShaderGen.cpp
Expand Up @@ -199,7 +199,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
{
WRITE(p, "ATTRIN float4 rawpos; // ATTR%d,\n", SHADER_POSITION_ATTRIB);
if (components & VB_HAS_POSMTXIDX)
WRITE(p, "ATTRIN int posmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
WRITE(p, "ATTRIN float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
if (components & VB_HAS_NRM0)
WRITE(p, "ATTRIN float3 rawnorm0; // ATTR%d,\n", SHADER_NORM0_ATTRIB);
if (components & VB_HAS_NRM1)
Expand Down Expand Up @@ -296,6 +296,10 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
{
WRITE(p, "int posmtx = blend_indices.x * 255.0f;\n");
}
else
{
WRITE(p, "int posmtx = int(fposmtx);\n");
}

WRITE(p, "float4 pos = float4(dot(" I_TRANSFORMMATRICES"[posmtx], rawpos), dot(" I_TRANSFORMMATRICES"[posmtx+1], rawpos), dot(" I_TRANSFORMMATRICES"[posmtx+2], rawpos), 1);\n");

Expand Down
2 changes: 1 addition & 1 deletion Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp
Expand Up @@ -87,7 +87,7 @@ void GLVertexFormat::Initialize(const PortableVertexDeclaration &_vtx_decl)

if (vtx_decl.posmtx_offset != -1) {
glEnableVertexAttribArray(SHADER_POSMTX_ATTRIB);
glVertexAttribIPointer(SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, vtx_decl.stride, (u8*)NULL + vtx_decl.posmtx_offset);
glVertexAttribPointer(SHADER_POSMTX_ATTRIB, 4, GL_UNSIGNED_BYTE, GL_FALSE, vtx_decl.stride, (u8*)NULL + vtx_decl.posmtx_offset);
}

vm->m_last_vao = VAO;
Expand Down

0 comments on commit 4a48485

Please sign in to comment.