From eb7a0c485ab43abe07b33d48cbd6c7fd1ee0c0fb Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 11 Jan 2012 04:10:43 -0600 Subject: [PATCH] More "stuff" for SS, also a small fix in the program shader cache cache setup." --- .../Core/VideoCommon/Src/PixelShaderGen.cpp | 18 +++++++++++------- .../Core/VideoCommon/Src/VertexShaderGen.cpp | 19 ++++++++++++------- .../Plugin_VideoOGL/Src/ProgramShaderCache.h | 2 ++ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 640712e673..2f34909652 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -573,12 +573,16 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType WRITE(p, "#extension GL_ARB_uniform_buffer_object : enable\n"); WRITE(p, "#define ATTRIN in\n"); WRITE(p, "#define ATTROUT out\n"); + WRITE(p, "#define VARYIN in\n"); + WRITE(p, "#define VARYOUT out\n"); } else { WRITE(p, "#version 120\n"); WRITE(p, "#define ATTRIN attribute\n"); - WRITE(p, "#define ATTROUT attribute\n"); + WRITE(p, "#define ATTROUT attribute\n"); // Can't really be used, but provide it anyway + WRITE(p, "#define VARYIN varying\n"); + WRITE(p, "#define VARYOUT varying\n"); } if (g_ActiveConfig.backend_info.bSupportsGLSLATTRBind) @@ -729,7 +733,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType } if (DepthTextureEnable) WRITE(p, " float depth;\n"); // TODO: Passed to Vertex Shader right? - WRITE(p, " float4 rawpos = gl_FragCoord;\n"); + WRITE(p, "VARYIN float4 rawpos;\n"); WRITE(p, " float4 colors_0 = gl_Color;\n"); WRITE(p, " float4 colors_1 = gl_SecondaryColor;\n"); @@ -740,14 +744,14 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType { for (int i = 0; i < 8; ++i) { - WRITE(p, "ATTRIN float3 uv%d_2;\n", i); + WRITE(p, "VARYIN float3 uv%d_2;\n", i); WRITE(p, " float3 uv%d = uv%d_2;\n", i, i); } - WRITE(p, "ATTRIN float4 clipPos_2;\n"); + WRITE(p, "VARYIN float4 clipPos_2;\n"); WRITE(p, " float4 clipPos = clipPos_2;\n"); if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) { - WRITE(p, "ATTRIN float4 Normal_2;\n"); + WRITE(p, "VARYIN float4 Normal_2;\n"); WRITE(p, " float4 Normal = Normal_2;\n"); } } @@ -758,7 +762,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType { for (int i = 0; i < 8; ++i) { - WRITE(p, "ATTRIN float4 uv%d_2;\n", i); + WRITE(p, "VARYIN float4 uv%d_2;\n", i); WRITE(p, " float4 uv%d = uv%d_2;\n", i, i); } } @@ -766,7 +770,7 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType { for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) { - WRITE(p, "ATTRIN float%d uv%d_2;\n", i < 4 ? 4 : 3 , i); + WRITE(p, "VARYIN float%d uv%d_2;\n", i < 4 ? 4 : 3 , i); WRITE(p, " float%d uv%d = uv%d_2;\n", i < 4 ? 4 : 3 , i, i); } } diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 69837f973d..97b5dc32f3 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -197,12 +197,16 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType) WRITE(p, "#extension GL_ARB_uniform_buffer_object : enable\n"); WRITE(p, "#define ATTRIN in\n"); WRITE(p, "#define ATTROUT out\n"); + WRITE(p, "#define VARYIN in\n"); + WRITE(p, "#define VARYOUT out\n"); } else { WRITE(p, "#version 120\n"); WRITE(p, "#define ATTRIN attribute\n"); - WRITE(p, "#define ATTROUT attribute\n"); + WRITE(p, "#define ATTROUT attribute\n"); // Can't really be used, but provide it anyway + WRITE(p, "#define VARYIN varying\n"); + WRITE(p, "#define VARYOUT varying\n"); } if (g_ActiveConfig.backend_info.bSupportsGLSLATTRBind) WRITE(p, "#extension GL_ARB_explicit_attrib_location : enable\n"); @@ -275,10 +279,10 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType) if (xfregs.numTexGen.numTexGens < 7) { for (int i = 0; i < 8; ++i) - WRITE(p, "ATTROUT float3 uv%d_2;\n", i); - WRITE(p, "ATTROUT float4 clipPos_2;\n"); + WRITE(p, "VARYOUT float3 uv%d_2;\n", i); + WRITE(p, "VARYOUT float4 clipPos_2;\n"); if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) - WRITE(p, "ATTROUT float4 Normal_2;\n"); + WRITE(p, "VARYOUT float4 Normal_2;\n"); } else { @@ -286,17 +290,18 @@ const char *GenerateVertexShaderCode(u32 components, API_TYPE ApiType) if (g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) { for (int i = 0; i < 8; ++i) - WRITE(p, "ATTROUT float4 uv%d_2;\n", i); + WRITE(p, "VARYOUT float4 uv%d_2;\n", i); } else { for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) - WRITE(p, "ATTROUT float%d uv%d_2;\n", i < 4 ? 4 : 3 , i); + WRITE(p, "VARYOUT float%d uv%d_2;\n", i < 4 ? 4 : 3 , i); } } - WRITE(p, " float4 rawpos = gl_Vertex;\n") ; + WRITE(p, "VARYOUT float4 rawpos;\n") ; WRITE(p, "void main()\n{\n"); + WRITE(p, "rawpos = gl_Vertex;\n"); } else { diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h index 07e77e3eae..d4a12aac43 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.h @@ -78,6 +78,8 @@ public: // No idea how necessary this is static GLenum SetProgramFormat() { + if(!g_ActiveConfig.backend_info.bSupportsGLSLCache) + return 0; GLint Supported; glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &Supported);