Give OSX users more of a chance of supporting Single pass DSB in the future.
This commit is contained in:
parent
a10656b1b2
commit
8e0172374c
|
@ -563,6 +563,9 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
WRITE(p, "#version 120\n");
|
WRITE(p, "#version 120\n");
|
||||||
|
|
||||||
|
if(g_ActiveConfig.backend_info.bSupportsGLSLATTRBind)
|
||||||
|
WRITE(p, "#extension GL_ARB_explicit_attrib_location : enable\n");
|
||||||
// Silly differences
|
// Silly differences
|
||||||
WRITE(p, "#define float2 vec2\n");
|
WRITE(p, "#define float2 vec2\n");
|
||||||
WRITE(p, "#define float3 vec3\n");
|
WRITE(p, "#define float3 vec3\n");
|
||||||
|
@ -621,7 +624,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
|
||||||
|
|
||||||
WRITE(p, "\n");
|
WRITE(p, "\n");
|
||||||
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||||
WRITE(p, "layout(std140%s) uniform PSBlock {\n", g_ActiveConfig.backend_info.bSupportsGLSLBinding ? ", binding = 1" : "");
|
WRITE(p, "layout(std140) uniform PSBlock {\n");
|
||||||
|
|
||||||
WRITE(p, "%sfloat4 "I_COLORS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_COLORS));
|
WRITE(p, "%sfloat4 "I_COLORS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_COLORS));
|
||||||
WRITE(p, "%sfloat4 "I_KCOLORS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_KCOLORS));
|
WRITE(p, "%sfloat4 "I_KCOLORS"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_KCOLORS));
|
||||||
|
|
|
@ -204,6 +204,8 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
||||||
WRITE(p, "#define ATTRIN attribute\n");
|
WRITE(p, "#define ATTRIN attribute\n");
|
||||||
WRITE(p, "#define ATTROUT attribute\n");
|
WRITE(p, "#define ATTROUT attribute\n");
|
||||||
}
|
}
|
||||||
|
if(g_ActiveConfig.backend_info.bSupportsGLSLATTRBind)
|
||||||
|
WRITE(p, "#extension GL_ARB_explicit_attrib_location : enable\n");
|
||||||
// Silly differences
|
// Silly differences
|
||||||
WRITE(p, "#define float2 vec2\n");
|
WRITE(p, "#define float2 vec2\n");
|
||||||
WRITE(p, "#define float3 vec3\n");
|
WRITE(p, "#define float3 vec3\n");
|
||||||
|
@ -217,7 +219,7 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
||||||
|
|
||||||
// uniforms
|
// uniforms
|
||||||
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO)
|
||||||
WRITE(p, "layout(std140%s) uniform VSBlock {\n", g_ActiveConfig.backend_info.bSupportsGLSLBinding ? ", binding = 2" : "");
|
WRITE(p, "layout(std140) uniform VSBlock {\n");
|
||||||
|
|
||||||
WRITE(p, "%sfloat4 "I_POSNORMALMATRIX"[6] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_POSNORMALMATRIX));
|
WRITE(p, "%sfloat4 "I_POSNORMALMATRIX"[6] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_POSNORMALMATRIX));
|
||||||
WRITE(p, "%sfloat4 "I_PROJECTION"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_PROJECTION));
|
WRITE(p, "%sfloat4 "I_PROJECTION"[4] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_PROJECTION));
|
||||||
|
@ -241,12 +243,24 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType)
|
||||||
if (components & VB_HAS_NRM0)
|
if (components & VB_HAS_NRM0)
|
||||||
WRITE(p, " float3 rawnorm0 = gl_Normal; // NORMAL0,\n");
|
WRITE(p, " float3 rawnorm0 = gl_Normal; // NORMAL0,\n");
|
||||||
|
|
||||||
|
if(g_ActiveConfig.backend_info.bSupportsGLSLATTRBind)
|
||||||
|
{
|
||||||
|
if (components & VB_HAS_POSMTXIDX)
|
||||||
|
WRITE(p, "layout(location = %d) ATTRIN float fposmtx;\n", SHADER_POSMTX_ATTRIB);
|
||||||
|
if (components & VB_HAS_NRM1)
|
||||||
|
WRITE(p, "layout(location = %d) ATTRIN float3 rawnorm1;\n", SHADER_NORM1_ATTRIB);
|
||||||
|
if (components & VB_HAS_NRM2)
|
||||||
|
WRITE(p, "layout(location = %d) ATTRIN float3 rawnorm2;\n", SHADER_NORM2_ATTRIB);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (components & VB_HAS_POSMTXIDX)
|
if (components & VB_HAS_POSMTXIDX)
|
||||||
WRITE(p, "ATTRIN float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
|
WRITE(p, "ATTRIN float fposmtx; // ATTR%d,\n", SHADER_POSMTX_ATTRIB);
|
||||||
if (components & VB_HAS_NRM1)
|
if (components & VB_HAS_NRM1)
|
||||||
WRITE(p, "ATTRIN float3 rawnorm1; // ATTR%d,\n", SHADER_NORM1_ATTRIB);
|
WRITE(p, "ATTRIN float3 rawnorm1; // ATTR%d,\n", SHADER_NORM1_ATTRIB);
|
||||||
if (components & VB_HAS_NRM2)
|
if (components & VB_HAS_NRM2)
|
||||||
WRITE(p, "ATTRIN float3 rawnorm2; // ATTR%d,\n", SHADER_NORM2_ATTRIB);
|
WRITE(p, "ATTRIN float3 rawnorm2; // ATTR%d,\n", SHADER_NORM2_ATTRIB);
|
||||||
|
}
|
||||||
|
|
||||||
if (components & VB_HAS_COL0)
|
if (components & VB_HAS_COL0)
|
||||||
WRITE(p, " float4 color0 = gl_Color; // COLOR0,\n");
|
WRITE(p, " float4 color0 = gl_Color; // COLOR0,\n");
|
||||||
|
|
|
@ -171,6 +171,7 @@ struct VideoConfig
|
||||||
bool bSupportsGLSL;
|
bool bSupportsGLSL;
|
||||||
bool bSupportsGLSLBinding;
|
bool bSupportsGLSLBinding;
|
||||||
bool bSupportsGLSLUBO;
|
bool bSupportsGLSLUBO;
|
||||||
|
bool bSupportsGLSLATTRBind;
|
||||||
bool bSupportsGLSLCache;
|
bool bSupportsGLSLCache;
|
||||||
} backend_info;
|
} backend_info;
|
||||||
};
|
};
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace OGL
|
||||||
}
|
}
|
||||||
|
|
||||||
// Need to get some attribute locations
|
// Need to get some attribute locations
|
||||||
if(uid.uid.vsid != 0) // We have no vertex Shader
|
if(uid.uid.vsid != 0 && !g_ActiveConfig.backend_info.bSupportsGLSLATTRBind) // We have no vertex Shader
|
||||||
{
|
{
|
||||||
glBindAttribLocation(entry.program.glprogid, SHADER_NORM1_ATTRIB, "rawnorm1");
|
glBindAttribLocation(entry.program.glprogid, SHADER_NORM1_ATTRIB, "rawnorm1");
|
||||||
glBindAttribLocation(entry.program.glprogid, SHADER_NORM2_ATTRIB, "rawnorm2");
|
glBindAttribLocation(entry.program.glprogid, SHADER_NORM2_ATTRIB, "rawnorm2");
|
||||||
|
|
|
@ -315,6 +315,8 @@ Renderer::Renderer()
|
||||||
// TODO: Switch over to using glew once 1.6/1.7 becomes more mainstream, seems most people are stuck in 1.5
|
// TODO: Switch over to using glew once 1.6/1.7 becomes more mainstream, seems most people are stuck in 1.5
|
||||||
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_shading_language_420pack") != NULL)
|
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_shading_language_420pack") != NULL)
|
||||||
g_Config.backend_info.bSupportsGLSLBinding = true;
|
g_Config.backend_info.bSupportsGLSLBinding = true;
|
||||||
|
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_explicit_attrib_location") != NULL)
|
||||||
|
g_Config.backend_info.bSupportsGLSLATTRBind = true;
|
||||||
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_uniform_buffer_object") != NULL)
|
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_uniform_buffer_object") != NULL)
|
||||||
g_Config.backend_info.bSupportsGLSLUBO = true;
|
g_Config.backend_info.bSupportsGLSLUBO = true;
|
||||||
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_get_program_binary") != NULL)
|
if (strstr((const char*)glGetString(GL_EXTENSIONS), "GL_ARB_get_program_binary") != NULL)
|
||||||
|
|
|
@ -178,7 +178,7 @@ void VertexManager::vFlush()
|
||||||
&& bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
|
&& bpmem.zcontrol.pixel_format == PIXELFMT_RGBA6_Z24;
|
||||||
|
|
||||||
// Makes sure we can actually do Dual source blending
|
// Makes sure we can actually do Dual source blending
|
||||||
bool dualSourcePossible = g_ActiveConfig.bUseGLSL && g_ActiveConfig.backend_info.bSupportsGLSLBinding;
|
bool dualSourcePossible = g_ActiveConfig.bUseGLSL && g_ActiveConfig.backend_info.bSupportsGLSLATTRBind;
|
||||||
|
|
||||||
// finally bind
|
// finally bind
|
||||||
FRAGMENTSHADER* ps;
|
FRAGMENTSHADER* ps;
|
||||||
|
|
Loading…
Reference in New Issue