diff options
| author | Ryan Houdek <Sonicadvance1@gmail.com> | 2011-12-02 20:17:26 -0600 |
|---|---|---|
| committer | Ryan Houdek <Sonicadvance1@gmail.com> | 2011-12-02 20:17:26 -0600 |
| commit | 804938e9fc4afefac1e04b2eeae4c158b7b34d00 (patch) | |
| tree | c20cad1f39a85a05620266252504870daaeb81b4 /Source/Core/VideoCommon | |
| parent | ae6ac5b4399a5032cf185b7f695896859799af99 (diff) | |
More stuff
Diffstat (limited to 'Source/Core/VideoCommon')
| -rw-r--r-- | Source/Core/VideoCommon/Src/PixelShaderGen.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexShaderGen.cpp | 20 | ||||
| -rw-r--r-- | Source/Core/VideoCommon/Src/VideoConfig.cpp | 4 |
3 files changed, 15 insertions, 11 deletions
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp index 4cdf562182..5d7fa9790e 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp @@ -1183,7 +1183,7 @@ void SampleTexture(char *&p, const char *destination, const char *texcoords, con if (ApiType == API_D3D11) WRITE(p, "%s=Tex%d.Sample(samp%d,%s.xy * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap,texmap, texcoords, texmap, texswap); else - WRITE(p, "%s=tex2D(samp%d,%s.xy * "I_TEXDIMS"[%d].xy).%s;\n", destination, texmap, texcoords, texmap, texswap); + WRITE(p, "%s=%s(samp%d,%s.xy * "I_TEXDIMS"[%d].xy).%s;\n", destination, ApiType == API_GLSL ? "texture2D" : "tex2D", texmap, texcoords, texmap, texswap); } static const char *tevAlphaFuncsTable[] = diff --git a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp index 43ffdeedd8..ac35a4aa35 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderGen.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderGen.cpp @@ -132,30 +132,32 @@ static char text[16384]; char* GenerateVSOutputStruct(char* p, u32 components, API_TYPE ApiType) { + // This turned a bit ugly with GLSL + // Will be less ugly with GLSL 1.3...hopefully WRITE(p, "struct VS_OUTPUT {\n"); - WRITE(p, " float4 pos : POSITION;\n"); - WRITE(p, " float4 colors_0 : COLOR0;\n"); - WRITE(p, " float4 colors_1 : COLOR1;\n"); + WRITE(p, " float4 pos %s POSITION;\n", ApiType == API_GLSL ? ";//" : ":"); + WRITE(p, " float4 colors_0 %s COLOR0;\n", ApiType == API_GLSL ? ";//" : ":"); + WRITE(p, " float4 colors_1 %s COLOR1;\n", ApiType == API_GLSL ? ";//" : ":"); if (xfregs.numTexGen.numTexGens < 7) { for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) - WRITE(p, " float3 tex%d : TEXCOORD%d;\n", i, i); - WRITE(p, " float4 clipPos : TEXCOORD%d;\n", xfregs.numTexGen.numTexGens); + WRITE(p, " float3 tex%d %s TEXCOORD%d;\n", i, ApiType == API_GLSL ? ";//" : ":", i); + WRITE(p, " float4 clipPos %s TEXCOORD%d;\n", ApiType == API_GLSL ? ";//" : ":", xfregs.numTexGen.numTexGens); if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) - WRITE(p, " float4 Normal : TEXCOORD%d;\n", xfregs.numTexGen.numTexGens + 1); + WRITE(p, " float4 Normal %s TEXCOORD%d;\n", ApiType == API_GLSL ? ";//" : ":", xfregs.numTexGen.numTexGens + 1); } else { // clip position is in w of first 4 texcoords if(g_ActiveConfig.bEnablePixelLighting && g_ActiveConfig.backend_info.bSupportsPixelLighting) { for (int i = 0; i < 8; ++i) - WRITE(p, " float4 tex%d : TEXCOORD%d;\n", i, i); + WRITE(p, " float4 tex%d %s TEXCOORD%d;\n", i, ApiType == API_GLSL ? ";//" : ":", i); } else { for (unsigned int i = 0; i < xfregs.numTexGen.numTexGens; ++i) - WRITE(p, " float%d tex%d : TEXCOORD%d;\n", i < 4 ? 4 : 3 , i, i); + WRITE(p, " float%d tex%d %s TEXCOORD%d;\n", i < 4 ? 4 : 3 , i, ApiType == API_GLSL ? ";//" : ":", i); } - } + } WRITE(p, "};\n"); return p; diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 57685dec09..69c1c4ce1c 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -43,6 +43,7 @@ VideoConfig::VideoConfig() backend_info.APIType = API_NONE; backend_info.bUseRGBATextures = false; backend_info.bSupports3DVision = false; + backend_info.bSupportsGLSL = false; } void VideoConfig::Load(const char *ini_file) @@ -92,6 +93,7 @@ void VideoConfig::Load(const char *ini_file) iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0); iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0); iniFile.Get("Settings", "DisableFog", &bDisableFog, 0); + iniFile.Get("Settings", "UseGLSL", &bUseGLSL, 0); iniFile.Get("Settings", "EnableOpenCL", &bEnableOpenCL, false); iniFile.Get("Settings", "OMPDecoder", &bOMPDecoder, false); @@ -232,7 +234,7 @@ void VideoConfig::Save(const char *ini_file) iniFile.Set("Settings", "DisableTexturing", bDisableTexturing); iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass); iniFile.Set("Settings", "DisableFog", bDisableFog); - iniFile.Set("Settings", "bUseGLSL", bUseGLSL); + iniFile.Set("Settings", "UseGLSL", bUseGLSL); iniFile.Set("Settings", "EnableOpenCL", bEnableOpenCL); iniFile.Set("Settings", "OMPDecoder", bOMPDecoder); |
