diff options
| author | Shawn Hoffman <godisgovernment@gmail.com> | 2011-12-26 00:15:54 -0500 |
|---|---|---|
| committer | Shawn Hoffman <godisgovernment@gmail.com> | 2011-12-26 00:15:54 -0500 |
| commit | 4bc14c347338f951b3b87de23a3fa19d7118a629 (patch) | |
| tree | a3ae931fa2d0c5954ff115f392a6f9e517752c32 /Source/Core/VideoCommon/Src/TextureConversionShader.cpp | |
| parent | f59063c8e7ec48992cdb0e7b2952ffc801daeefd (diff) | |
fix formatting uglies introduced in glsl-master branch
Diffstat (limited to 'Source/Core/VideoCommon/Src/TextureConversionShader.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/TextureConversionShader.cpp | 315 |
1 files changed, 158 insertions, 157 deletions
diff --git a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp index 2d3b642593..3fc83ddb7c 100644 --- a/Source/Core/VideoCommon/Src/TextureConversionShader.cpp +++ b/Source/Core/VideoCommon/Src/TextureConversionShader.cpp @@ -66,17 +66,19 @@ u16 GetEncodedSampleCount(u32 format) default: return 1; } } + const char* WriteRegister(API_TYPE ApiType, const char *prefix, const u32 num) { - if(ApiType == API_GLSL) + if (ApiType == API_GLSL) return ""; // Once we switch to GLSL 1.3 we can do something here static char result[64]; sprintf(result, " : register(%s%d)", prefix, num); return result; } + const char *WriteLocation(API_TYPE ApiType) { - if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO) + if (ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO) return ""; static char result[64]; sprintf(result, "uniform "); @@ -90,12 +92,12 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) // [0] left, top, right, bottom of source rectangle within source texture // [1] width and height of destination texture in pixels // Two were merged for GLSL - 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, "%sfloat4 "I_COLORS"[2] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_COLORS)); - if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO) + if (ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO) WRITE(p, "};\n"); float blkW = (float)TexDecoder_GetBlockWidthInTexels(format); @@ -122,7 +124,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) } - if(ApiType == API_GLSL) + if (ApiType == API_GLSL) { WRITE(p, " float4 ocol0;\n"); WRITE(p, " float2 uv0 = gl_TexCoord[0].xy;\n"); @@ -131,7 +133,7 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) else { WRITE(p,"void main(\n"); - if(ApiType != API_D3D11) + if (ApiType != API_D3D11) { WRITE(p," out float4 ocol0 : COLOR0,\n"); } @@ -163,12 +165,12 @@ void WriteSwizzler(char*& p, u32 format, API_TYPE ApiType) WRITE(p, " sampleUv = sampleUv * "I_COLORS"[0].xy;\n"); - if(ApiType == API_OPENGL || ApiType == API_GLSL) + if (ApiType == API_OPENGL || ApiType == API_GLSL) WRITE(p," sampleUv.y = "I_COLORS"[1].y - sampleUv.y;\n"); WRITE(p, " sampleUv = sampleUv + "I_COLORS"[1].zw;\n"); - if(ApiType != API_OPENGL && ApiType != API_GLSL) + if (ApiType != API_OPENGL && ApiType != API_GLSL) { WRITE(p, " sampleUv = sampleUv + float2(0.0f,1.0f);\n");// still to determine the reason for this WRITE(p, " sampleUv = sampleUv / "I_COLORS"[0].zw;\n"); @@ -182,17 +184,17 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType) // [0] left, top, right, bottom of source rectangle within source texture // [1] width and height of destination texture in pixels // Two were merged for GLSL - 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, "%sfloat4 "I_COLORS"[2] %s;\n", WriteLocation(ApiType), WriteRegister(ApiType, "c", C_COLORS)); - if(ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO) + if (ApiType == API_GLSL && g_ActiveConfig.backend_info.bSupportsGLSLUBO) WRITE(p, "};\n"); float blkW = (float)TexDecoder_GetBlockWidthInTexels(format); float blkH = (float)TexDecoder_GetBlockHeightInTexels(format); // 32 bit textures (RGBA8 and Z24) are store in 2 cache line increments - if(ApiType == API_OPENGL) + if (ApiType == API_OPENGL) { WRITE(p,"uniform samplerRECT samp0 : register(s0);\n"); } @@ -212,7 +214,7 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType) WRITE(p, "Texture2D Tex0 : register(t0);\n"); } - if(ApiType == API_GLSL) + if (ApiType == API_GLSL) { WRITE(p, " float4 ocol0;\n"); WRITE(p, " float2 uv0 = gl_TexCoord[0].xy;\n"); @@ -249,18 +251,17 @@ void Write32BitSwizzler(char*& p, u32 format, API_TYPE ApiType) WRITE(p, " float xl = floor(x2 / %f);\n", blkW); WRITE(p, " float xib = x2 - (xl * %f);\n", blkW); WRITE(p, " float halfxb = floor(xb / 2);\n"); - WRITE(p, " sampleUv.x = xib + (halfxb * %f);\n", blkW); WRITE(p, " sampleUv.y = yb + xoff;\n"); WRITE(p, " sampleUv = sampleUv * "I_COLORS"[0].xy;\n"); - if(ApiType == API_OPENGL || ApiType == API_GLSL) + if (ApiType == API_OPENGL || ApiType == API_GLSL) WRITE(p," sampleUv.y = "I_COLORS"[1].y - sampleUv.y;\n"); WRITE(p, " sampleUv = sampleUv + "I_COLORS"[1].zw;\n"); - if(ApiType != API_OPENGL && ApiType != API_GLSL) + if (ApiType != API_OPENGL && ApiType != API_GLSL) { WRITE(p, " sampleUv = sampleUv + float2(0.0f,1.0f);\n");// still to determine the reason for this WRITE(p, " sampleUv = sampleUv / "I_COLORS"[0].zw;\n"); @@ -281,7 +282,7 @@ void WriteSampleColor(char*& p, const char* colorComp, const char* dest, API_TYP // the increment of sampleUv.x is delayed, so we perform it here. see WriteIncrementSampleX. const char* texSampleIncrementUnit; - if(ApiType != API_OPENGL || ApiType != API_GLSL) + if (ApiType != API_OPENGL || ApiType != API_GLSL) texSampleIncrementUnit = I_COLORS"[0].x / "I_COLORS"[0].z"; else texSampleIncrementUnit = I_COLORS"[0].x"; @@ -292,7 +293,7 @@ void WriteSampleColor(char*& p, const char* colorComp, const char* dest, API_TYP void WriteColorToIntensity(char*& p, const char* src, const char* dest) { - if(!IntensityConstantAdded) + if (!IntensityConstantAdded) { WRITE(p, " float4 IntensityConst = float4(0.257f,0.504f,0.098f,0.0625f);\n"); IntensityConstantAdded = true; @@ -328,7 +329,7 @@ void WriteToBitDepth(char*& p, u8 depth, const char* src, const char* dest) void WriteEncoderEnd(char* p, API_TYPE ApiType) { - if(ApiType == API_GLSL) + if (ApiType == API_GLSL) WRITE(p, "gl_FragData[0] = ocol0;\n"); WRITE(p, "}\n"); IntensityConstantAdded = false; @@ -337,22 +338,22 @@ void WriteEncoderEnd(char* p, API_TYPE ApiType) void WriteI8Encoder(char* p, API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_I8,ApiType); + WriteSwizzler(p, GX_TF_I8, ApiType); WRITE(p, " float3 texSample;\n"); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "ocol0.b"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "ocol0.g"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "ocol0.r"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "ocol0.a"); WRITE(p, " ocol0.rgba += IntensityConst.aaaa;\n"); // see WriteColorToIntensity @@ -362,40 +363,40 @@ void WriteI8Encoder(char* p, API_TYPE ApiType) void WriteI4Encoder(char* p, API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_I4,ApiType); + WriteSwizzler(p, GX_TF_I4, ApiType); WRITE(p, " float3 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color0.b"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color1.b"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color0.g"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color1.g"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color0.r"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color1.r"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color0.a"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgb", "texSample",ApiType); + WriteSampleColor(p, "rgb", "texSample", ApiType); WriteColorToIntensity(p, "texSample", "color1.a"); WRITE(p, " color0.rgba += IntensityConst.aaaa;\n"); @@ -410,15 +411,15 @@ void WriteI4Encoder(char* p, API_TYPE ApiType) void WriteIA8Encoder(char* p,API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_IA8,ApiType); + WriteSwizzler(p, GX_TF_IA8, ApiType); WRITE(p, " float4 texSample;\n"); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " ocol0.b = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "ocol0.g"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " ocol0.r = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "ocol0.a"); @@ -429,27 +430,27 @@ void WriteIA8Encoder(char* p,API_TYPE ApiType) void WriteIA4Encoder(char* p,API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_IA4,ApiType); + WriteSwizzler(p, GX_TF_IA4, ApiType); WRITE(p, " float4 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " color0.b = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.b"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " color0.g = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.g"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " color0.r = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.r"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " color0.a = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.a"); @@ -464,11 +465,11 @@ void WriteIA4Encoder(char* p,API_TYPE ApiType) void WriteRGB565Encoder(char* p,API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_RGB565,ApiType); + WriteSwizzler(p, GX_TF_RGB565, ApiType); - WriteSampleColor(p, "rgb", "float3 texSample0",ApiType); - WriteIncrementSampleX(p,ApiType); - WriteSampleColor(p, "rgb", "float3 texSample1",ApiType); + WriteSampleColor(p, "rgb", "float3 texSample0", ApiType); + WriteIncrementSampleX(p, ApiType); + WriteSampleColor(p, "rgb", "float3 texSample1", ApiType); WRITE(p, " float2 texRs = float2(texSample0.r, texSample1.r);\n"); WRITE(p, " float2 texGs = float2(texSample0.g, texSample1.g);\n"); WRITE(p, " float2 texBs = float2(texSample0.b, texSample1.b);\n"); @@ -488,14 +489,14 @@ void WriteRGB565Encoder(char* p,API_TYPE ApiType) void WriteRGB5A3Encoder(char* p,API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_RGB5A3,ApiType); + WriteSwizzler(p, GX_TF_RGB5A3, ApiType); WRITE(p, " float4 texSample;\n"); WRITE(p, " float color0;\n"); WRITE(p, " float gUpper;\n"); WRITE(p, " float gLower;\n"); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); // 0.8784 = 224 / 255 which is the maximum alpha value that can be represented in 3 bits WRITE(p, "if(texSample.a > 0.878f) {\n"); @@ -522,9 +523,9 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType) WRITE(p, "}\n"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, "if(texSample.a > 0.878f) {\n"); @@ -555,21 +556,21 @@ void WriteRGB5A3Encoder(char* p,API_TYPE ApiType) void WriteRGBA4443Encoder(char* p,API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_RGB5A3,ApiType); + WriteSwizzler(p, GX_TF_RGB5A3, ApiType); WRITE(p, " float4 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WriteToBitDepth(p, 3, "texSample.a", "color0.b"); WriteToBitDepth(p, 4, "texSample.r", "color1.b"); WriteToBitDepth(p, 4, "texSample.g", "color0.g"); WriteToBitDepth(p, 4, "texSample.b", "color1.g"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WriteToBitDepth(p, 3, "texSample.a", "color0.r"); WriteToBitDepth(p, 4, "texSample.r", "color1.r"); WriteToBitDepth(p, 4, "texSample.g", "color0.a"); @@ -581,7 +582,7 @@ void WriteRGBA4443Encoder(char* p,API_TYPE ApiType) void WriteRGBA8Encoder(char* p,API_TYPE ApiType) { - Write32BitSwizzler(p, GX_TF_RGBA8,ApiType); + Write32BitSwizzler(p, GX_TF_RGBA8, ApiType); WRITE(p, " float cl1 = xb - (halfxb * 2);\n"); WRITE(p, " float cl0 = 1.0f - cl1;\n"); @@ -590,15 +591,15 @@ void WriteRGBA8Encoder(char* p,API_TYPE ApiType) WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " color0.b = texSample.a;\n"); WRITE(p, " color0.g = texSample.r;\n"); WRITE(p, " color1.b = texSample.g;\n"); WRITE(p, " color1.g = texSample.b;\n"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "rgba", "texSample",ApiType); + WriteSampleColor(p, "rgba", "texSample", ApiType); WRITE(p, " color0.r = texSample.a;\n"); WRITE(p, " color0.a = texSample.r;\n"); WRITE(p, " color1.r = texSample.g;\n"); @@ -611,32 +612,32 @@ void WriteRGBA8Encoder(char* p,API_TYPE ApiType) void WriteC4Encoder(char* p, const char* comp,API_TYPE ApiType) { - WriteSwizzler(p, GX_CTF_R4,ApiType); + WriteSwizzler(p, GX_CTF_R4, ApiType); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); - WriteSampleColor(p, comp, "color0.b",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "color0.b", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "color1.b",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "color1.b", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "color0.g",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "color0.g", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "color1.g",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "color1.g", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "color0.r",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "color0.r", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "color1.r",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "color1.r", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "color0.a",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "color0.a", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "color1.a",ApiType); + WriteSampleColor(p, comp, "color1.a", ApiType); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); @@ -647,45 +648,45 @@ void WriteC4Encoder(char* p, const char* comp,API_TYPE ApiType) void WriteC8Encoder(char* p, const char* comp,API_TYPE ApiType) { - WriteSwizzler(p, GX_CTF_R8,ApiType); + WriteSwizzler(p, GX_CTF_R8, ApiType); - WriteSampleColor(p, comp, "ocol0.b",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "ocol0.b", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "ocol0.g",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "ocol0.g", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "ocol0.r",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "ocol0.r", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "ocol0.a",ApiType); + WriteSampleColor(p, comp, "ocol0.a", ApiType); WriteEncoderEnd(p, ApiType); } void WriteCC4Encoder(char* p, const char* comp,API_TYPE ApiType) { - WriteSwizzler(p, GX_CTF_RA4,ApiType); + WriteSwizzler(p, GX_CTF_RA4, ApiType); WRITE(p, " float2 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); - WriteSampleColor(p, comp, "texSample",ApiType); + WriteSampleColor(p, comp, "texSample", ApiType); WRITE(p, " color0.b = texSample.x;\n"); WRITE(p, " color1.b = texSample.y;\n"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "texSample",ApiType); + WriteSampleColor(p, comp, "texSample", ApiType); WRITE(p, " color0.g = texSample.x;\n"); WRITE(p, " color1.g = texSample.y;\n"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "texSample",ApiType); + WriteSampleColor(p, comp, "texSample", ApiType); WRITE(p, " color0.r = texSample.x;\n"); WRITE(p, " color1.r = texSample.y;\n"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "texSample",ApiType); + WriteSampleColor(p, comp, "texSample", ApiType); WRITE(p, " color0.a = texSample.x;\n"); WRITE(p, " color1.a = texSample.y;\n"); @@ -698,35 +699,35 @@ void WriteCC4Encoder(char* p, const char* comp,API_TYPE ApiType) void WriteCC8Encoder(char* p, const char* comp, API_TYPE ApiType) { - WriteSwizzler(p, GX_CTF_RA8,ApiType); + WriteSwizzler(p, GX_CTF_RA8, ApiType); - WriteSampleColor(p, comp, "ocol0.bg",ApiType); - WriteIncrementSampleX(p,ApiType); + WriteSampleColor(p, comp, "ocol0.bg", ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, comp, "ocol0.ra",ApiType); + WriteSampleColor(p, comp, "ocol0.ra", ApiType); WriteEncoderEnd(p, ApiType); } void WriteZ8Encoder(char* p, const char* multiplier,API_TYPE ApiType) { - WriteSwizzler(p, GX_CTF_Z8M,ApiType); + WriteSwizzler(p, GX_CTF_Z8M, ApiType); WRITE(p, " float depth;\n"); - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, "ocol0.b = frac(depth * %s);\n", multiplier); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, "ocol0.g = frac(depth * %s);\n", multiplier); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, "ocol0.r = frac(depth * %s);\n", multiplier); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, "ocol0.a = frac(depth * %s);\n", multiplier); WriteEncoderEnd(p, ApiType); @@ -734,14 +735,14 @@ void WriteZ8Encoder(char* p, const char* multiplier,API_TYPE ApiType) void WriteZ16Encoder(char* p,API_TYPE ApiType) { - WriteSwizzler(p, GX_TF_Z16,ApiType); + WriteSwizzler(p, GX_TF_Z16, ApiType); WRITE(p, " float depth;\n"); WRITE(p, " float3 expanded;\n"); // byte order is reversed - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, " depth *= 16777215.0f;\n"); WRITE(p, " expanded.r = floor(depth / (256 * 256));\n"); @@ -751,9 +752,9 @@ void WriteZ16Encoder(char* p,API_TYPE ApiType) WRITE(p, " ocol0.b = expanded.g / 255;\n"); WRITE(p, " ocol0.g = expanded.r / 255;\n"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, " depth *= 16777215.0f;\n"); WRITE(p, " expanded.r = floor(depth / (256 * 256));\n"); @@ -768,14 +769,14 @@ void WriteZ16Encoder(char* p,API_TYPE ApiType) void WriteZ16LEncoder(char* p,API_TYPE ApiType) { - WriteSwizzler(p, GX_CTF_Z16L,ApiType); + WriteSwizzler(p, GX_CTF_Z16L, ApiType); WRITE(p, " float depth;\n"); WRITE(p, " float3 expanded;\n"); // byte order is reversed - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, " depth *= 16777215.0f;\n"); WRITE(p, " expanded.r = floor(depth / (256 * 256));\n"); @@ -787,9 +788,9 @@ void WriteZ16LEncoder(char* p,API_TYPE ApiType) WRITE(p, " ocol0.b = expanded.b / 255;\n"); WRITE(p, " ocol0.g = expanded.g / 255;\n"); - WriteIncrementSampleX(p,ApiType); + WriteIncrementSampleX(p, ApiType); - WriteSampleColor(p, "b", "depth",ApiType); + WriteSampleColor(p, "b", "depth", ApiType); WRITE(p, " depth *= 16777215.0f;\n"); WRITE(p, " expanded.r = floor(depth / (256 * 256));\n"); @@ -806,7 +807,7 @@ void WriteZ16LEncoder(char* p,API_TYPE ApiType) void WriteZ24Encoder(char* p, API_TYPE ApiType) { - Write32BitSwizzler(p, GX_TF_Z24X8,ApiType); + Write32BitSwizzler(p, GX_TF_Z24X8, ApiType); WRITE(p, " float cl = xb - (halfxb * 2);\n"); @@ -815,19 +816,19 @@ void WriteZ24Encoder(char* p, API_TYPE ApiType) WRITE(p, " float3 expanded0;\n"); WRITE(p, " float3 expanded1;\n"); - WriteSampleColor(p, "b", "depth0",ApiType); - WriteIncrementSampleX(p,ApiType); - WriteSampleColor(p, "b", "depth1",ApiType); + WriteSampleColor(p, "b", "depth0", ApiType); + WriteIncrementSampleX(p, ApiType); + WriteSampleColor(p, "b", "depth1", ApiType); for (int i = 0; i < 2; i++) { - WRITE(p, " depth%i *= 16777215.0f;\n", i); + WRITE(p, " depth%i *= 16777215.0f;\n", i); - WRITE(p, " expanded%i.r = floor(depth%i / (256 * 256));\n", i, i); - WRITE(p, " depth%i -= expanded%i.r * 256 * 256;\n", i, i); - WRITE(p, " expanded%i.g = floor(depth%i / 256);\n", i, i); - WRITE(p, " depth%i -= expanded%i.g * 256;\n", i, i); - WRITE(p, " expanded%i.b = depth%i;\n", i, i); + WRITE(p, " expanded%i.r = floor(depth%i / (256 * 256));\n", i, i); + WRITE(p, " depth%i -= expanded%i.r * 256 * 256;\n", i, i); + WRITE(p, " expanded%i.g = floor(depth%i / 256);\n", i, i); + WRITE(p, " depth%i -= expanded%i.g * 256;\n", i, i); + WRITE(p, " expanded%i.b = depth%i;\n", i, i); } WRITE(p, " if(cl > 0.5f) {\n"); @@ -854,7 +855,7 @@ const char *GenerateEncodingShader(u32 format,API_TYPE ApiType) char *p = text; - if(ApiType == API_GLSL) + if (ApiType == API_GLSL) { // A few required defines and ones that will make our lives a lot easier if (g_ActiveConfig.backend_info.bSupportsGLSLBinding || g_ActiveConfig.backend_info.bSupportsGLSLUBO) @@ -881,76 +882,76 @@ const char *GenerateEncodingShader(u32 format,API_TYPE ApiType) WRITE(p, "#ifdef GL_ARB_texture_rectangle\n #extension GL_ARB_texture_rectangle : require\n#endif\n"); } - switch(format) + switch (format) { case GX_TF_I4: - WriteI4Encoder(p,ApiType); + WriteI4Encoder(p, ApiType); break; case GX_TF_I8: - WriteI8Encoder(p,ApiType); + WriteI8Encoder(p, ApiType); break; case GX_TF_IA4: - WriteIA4Encoder(p,ApiType); + WriteIA4Encoder(p, ApiType); break; case GX_TF_IA8: - WriteIA8Encoder(p,ApiType); + WriteIA8Encoder(p, ApiType); break; case GX_TF_RGB565: - WriteRGB565Encoder(p,ApiType); + WriteRGB565Encoder(p, ApiType); break; case GX_TF_RGB5A3: - WriteRGB5A3Encoder(p,ApiType); + WriteRGB5A3Encoder(p, ApiType); break; case GX_TF_RGBA8: - WriteRGBA8Encoder(p,ApiType); + WriteRGBA8Encoder(p, ApiType); break; case GX_CTF_R4: - WriteC4Encoder(p, "r",ApiType); + WriteC4Encoder(p, "r", ApiType); break; case GX_CTF_RA4: - WriteCC4Encoder(p, "ar",ApiType); + WriteCC4Encoder(p, "ar", ApiType); break; case GX_CTF_RA8: - WriteCC8Encoder(p, "ar",ApiType); + WriteCC8Encoder(p, "ar", ApiType); break; case GX_CTF_A8: - WriteC8Encoder(p, "a",ApiType); + WriteC8Encoder(p, "a", ApiType); break; case GX_CTF_R8: - WriteC8Encoder(p, "r",ApiType); + WriteC8Encoder(p, "r", ApiType); break; case GX_CTF_G8: - WriteC8Encoder(p, "g",ApiType); + WriteC8Encoder(p, "g", ApiType); break; case GX_CTF_B8: - WriteC8Encoder(p, "b",ApiType); + WriteC8Encoder(p, "b", ApiType); break; case GX_CTF_RG8: - WriteCC8Encoder(p, "rg",ApiType); + WriteCC8Encoder(p, "rg", ApiType); break; case GX_CTF_GB8: - WriteCC8Encoder(p, "gb",ApiType); + WriteCC8Encoder(p, "gb", ApiType); break; case GX_TF_Z8: - WriteC8Encoder(p, "b",ApiType); + WriteC8Encoder(p, "b", ApiType); break; case GX_TF_Z16: - WriteZ16Encoder(p,ApiType); + WriteZ16Encoder(p, ApiType); break; case GX_TF_Z24X8: - WriteZ24Encoder(p,ApiType); + WriteZ24Encoder(p, ApiType); break; case GX_CTF_Z4: - WriteC4Encoder(p, "b",ApiType); + WriteC4Encoder(p, "b", ApiType); break; case GX_CTF_Z8M: - WriteZ8Encoder(p, "256.0f",ApiType); + WriteZ8Encoder(p, "256.0f", ApiType); break; case GX_CTF_Z8L: - WriteZ8Encoder(p, "65536.0f" ,ApiType); + WriteZ8Encoder(p, "65536.0f" , ApiType); break; case GX_CTF_Z16L: - WriteZ16LEncoder(p,ApiType); + WriteZ16LEncoder(p, ApiType); break; default: PanicAlert("Unknown texture copy format: 0x%x\n", format); |
