static void WriteCC4Encoder(char*& p, const char* comp,API_TYPE 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", 0, ApiType); WRITE(p, " color0.b = texSample.x;\n"); WRITE(p, " color1.b = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 1, ApiType); WRITE(p, " color0.g = texSample.x;\n"); WRITE(p, " color1.g = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 2, ApiType); WRITE(p, " color0.r = texSample.x;\n"); WRITE(p, " color1.r = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 3, ApiType); WRITE(p, " color0.a = texSample.x;\n"); WRITE(p, " color1.a = texSample.y;\n"); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); WriteEncoderEnd(p, ApiType); }
static void WriteIA4Encoder(char*& p,API_TYPE 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", 0, ApiType); WRITE(p, " color0.b = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.b"); WriteSampleColor(p, "rgba", "texSample", 1, ApiType); WRITE(p, " color0.g = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.g"); WriteSampleColor(p, "rgba", "texSample", 2, ApiType); WRITE(p, " color0.r = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.r"); WriteSampleColor(p, "rgba", "texSample", 3, ApiType); WRITE(p, " color0.a = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.a"); WRITE(p, " color1.rgba += IntensityConst.aaaa;\n"); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); WriteEncoderEnd(p, ApiType); }
void WriteIA4Encoder(char* p) { WriteSwizzler(p, GX_TF_IA4); WRITE(p, " float4 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); WriteSampleColor(p, "rgba", "texSample", 0); WRITE(p, " color0.b = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.b"); WriteSampleColor(p, "rgba", "texSample", 1); WRITE(p, " color0.g = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.g"); WriteSampleColor(p, "rgba", "texSample", 2); WRITE(p, " color0.r = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.r"); WriteSampleColor(p, "rgba", "texSample", 3); WRITE(p, " color0.a = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.a"); WRITE(p, " color1.rgba += IntensityConst.aaaa;\n"); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n"); WriteEncoderEnd(p); }
void WriteC4Encoder(char* p, const char* comp,API_TYPE 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, "color1.b",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, "color0.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, "color1.a",ApiType); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n"); WriteEncoderEnd(p); }
void WriteCC4Encoder(char* p, const char* comp) { WriteSwizzler(p, GX_CTF_RA4); WRITE(p, " float2 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); WriteSampleColor(p, comp, "texSample", 0); WRITE(p, " color0.b = texSample.x;\n"); WRITE(p, " color1.b = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 1); WRITE(p, " color0.g = texSample.x;\n"); WRITE(p, " color1.g = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 2); WRITE(p, " color0.r = texSample.x;\n"); WRITE(p, " color1.r = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 3); WRITE(p, " color0.a = texSample.x;\n"); WRITE(p, " color1.a = texSample.y;\n"); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n"); WriteEncoderEnd(p); }
static void WriteCC4Encoder(char*& p, const char* comp, APIType ApiType, const EFBCopyParams& params) { WriteSwizzler(p, EFBCopyFormat::RA4, ApiType); WRITE(p, " float2 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); WriteSampleColor(p, comp, "texSample", 0, ApiType, params); WRITE(p, " color0.b = texSample.x;\n"); WRITE(p, " color1.b = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 1, ApiType, params); WRITE(p, " color0.g = texSample.x;\n"); WRITE(p, " color1.g = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 2, ApiType, params); WRITE(p, " color0.r = texSample.x;\n"); WRITE(p, " color1.r = texSample.y;\n"); WriteSampleColor(p, comp, "texSample", 3, ApiType, params); WRITE(p, " color0.a = texSample.x;\n"); WRITE(p, " color1.a = texSample.y;\n"); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); WriteEncoderEnd(p); }
static void WriteIA4Encoder(char*& p, APIType ApiType, const EFBCopyParams& params) { WriteSwizzler(p, EFBCopyFormat::RA4, ApiType); WRITE(p, " float4 texSample;\n"); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); WriteSampleColor(p, "rgba", "texSample", 0, ApiType, params); WRITE(p, " color0.b = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.b"); WriteSampleColor(p, "rgba", "texSample", 1, ApiType, params); WRITE(p, " color0.g = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.g"); WriteSampleColor(p, "rgba", "texSample", 2, ApiType, params); WRITE(p, " color0.r = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.r"); WriteSampleColor(p, "rgba", "texSample", 3, ApiType, params); WRITE(p, " color0.a = texSample.a;\n"); WriteColorToIntensity(p, "texSample", "color1.a"); WRITE(p, " color1.rgba += IntensityConst.aaaa;\n"); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); WriteEncoderEnd(p); }
void WriteRGBA4443Encoder(char* p,API_TYPE 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); 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); 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"); WriteToBitDepth(p, 4, "texSample.b", "color1.a"); WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n"); WriteEncoderEnd(p); }
void WriteI4Encoder(char* p, API_TYPE 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); WriteColorToIntensity(p, "texSample", "color0.b"); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "texSample",ApiType); WriteColorToIntensity(p, "texSample", "color1.b"); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "texSample",ApiType); WriteColorToIntensity(p, "texSample", "color0.g"); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "texSample",ApiType); WriteColorToIntensity(p, "texSample", "color1.g"); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "texSample",ApiType); WriteColorToIntensity(p, "texSample", "color0.r"); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "texSample",ApiType); WriteColorToIntensity(p, "texSample", "color1.r"); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "texSample",ApiType); WriteColorToIntensity(p, "texSample", "color0.a"); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "texSample",ApiType); WriteColorToIntensity(p, "texSample", "color1.a"); WRITE(p, " color0.rgba += IntensityConst.aaaa;\n"); WRITE(p, " color1.rgba += IntensityConst.aaaa;\n"); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n"); WriteEncoderEnd(p); }
static void WriteC4Encoder(char*& p, const char* comp,API_TYPE ApiType) { WriteSwizzler(p, GX_CTF_R4, ApiType); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); WriteSampleColor(p, comp, "color0.b", 0, ApiType); WriteSampleColor(p, comp, "color1.b", 1, ApiType); WriteSampleColor(p, comp, "color0.g", 2, ApiType); WriteSampleColor(p, comp, "color1.g", 3, ApiType); WriteSampleColor(p, comp, "color0.r", 4, ApiType); WriteSampleColor(p, comp, "color1.r", 5, ApiType); WriteSampleColor(p, comp, "color0.a", 6, ApiType); WriteSampleColor(p, comp, "color1.a", 7, ApiType); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); WriteEncoderEnd(p, ApiType); }
void WriteC4Encoder(char* p, const char* comp) { WriteSwizzler(p, GX_CTF_R4); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); WriteSampleColor(p, comp, "color0.b", 0); WriteSampleColor(p, comp, "color1.b", 1); WriteSampleColor(p, comp, "color0.g", 2); WriteSampleColor(p, comp, "color1.g", 3); WriteSampleColor(p, comp, "color0.r", 4); WriteSampleColor(p, comp, "color1.r", 5); WriteSampleColor(p, comp, "color0.a", 6); WriteSampleColor(p, comp, "color1.a", 7); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0f + color1) / 255.0f;\n"); WriteEncoderEnd(p); }
static void WriteC4Encoder(char*& p, const char* comp, APIType ApiType, const EFBCopyParams& params) { WriteSwizzler(p, params, EFBCopyFormat::R4, ApiType); WRITE(p, " float4 color0;\n"); WRITE(p, " float4 color1;\n"); WriteSampleColor(p, comp, "color0.b", 0, ApiType, params); WriteSampleColor(p, comp, "color1.b", 1, ApiType, params); WriteSampleColor(p, comp, "color0.g", 2, ApiType, params); WriteSampleColor(p, comp, "color1.g", 3, ApiType, params); WriteSampleColor(p, comp, "color0.r", 4, ApiType, params); WriteSampleColor(p, comp, "color1.r", 5, ApiType, params); WriteSampleColor(p, comp, "color0.a", 6, ApiType, params); WriteSampleColor(p, comp, "color1.a", 7, ApiType, params); WriteToBitDepth(p, 4, "color0", "color0"); WriteToBitDepth(p, 4, "color1", "color1"); WRITE(p, " ocol0 = (color0 * 16.0 + color1) / 255.0;\n"); WriteEncoderEnd(p); }
static void WriteRGB565Encoder(char*& p,API_TYPE ApiType) { WriteSwizzler(p, GX_TF_RGB565, ApiType); WriteSampleColor(p, "rgb", "float3 texSample0", 0, ApiType); WriteSampleColor(p, "rgb", "float3 texSample1", 1, 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"); WriteToBitDepth(p, 6, "texGs", "float2 gInt"); WRITE(p, " float2 gUpper = floor(gInt / 8.0);\n"); WRITE(p, " float2 gLower = gInt - gUpper * 8.0;\n"); WriteToBitDepth(p, 5, "texRs", "ocol0.br"); WRITE(p, " ocol0.br = ocol0.br * 8.0 + gUpper;\n"); WriteToBitDepth(p, 5, "texBs", "ocol0.ga"); WRITE(p, " ocol0.ga = ocol0.ga + gLower * 32.0;\n"); WRITE(p, " ocol0 = ocol0 / 255.0;\n"); WriteEncoderEnd(p, ApiType); }
void WriteRGB565Encoder(char* p,API_TYPE ApiType) { WriteSwizzler(p, GX_TF_RGB565,ApiType); WriteSampleColor(p, "rgb", "float3 texSample0",ApiType); WriteIncrementSampleX(p,ApiType); WriteSampleColor(p, "rgb", "float3 texSample1",ApiType); WRITE(p, " float2 texRs = {texSample0.r, texSample1.r};\n"); WRITE(p, " float2 texGs = {texSample0.g, texSample1.g};\n"); WRITE(p, " float2 texBs = {texSample0.b, texSample1.b};\n"); WriteToBitDepth(p, 6, "texGs", "float2 gInt"); WRITE(p, " float2 gUpper = floor(gInt / 8.0f);\n"); WRITE(p, " float2 gLower = gInt - gUpper * 8.0f;\n"); WriteToBitDepth(p, 5, "texRs", "ocol0.br"); WRITE(p, " ocol0.br = ocol0.br * 8.0f + gUpper;\n"); WriteToBitDepth(p, 5, "texBs", "ocol0.ga"); WRITE(p, " ocol0.ga = ocol0.ga + gLower * 32.0f;\n"); WRITE(p, " ocol0 = ocol0 / 255.0f;\n"); WriteEncoderEnd(p); }
static void WriteRGB565Encoder(char*& p, APIType ApiType, const EFBCopyParams& params) { WriteSwizzler(p, params, EFBCopyFormat::RGB565, ApiType); WRITE(p, " float3 texSample0;\n"); WRITE(p, " float3 texSample1;\n"); WriteSampleColor(p, "rgb", "texSample0", 0, ApiType, params); WriteSampleColor(p, "rgb", "texSample1", 1, ApiType, params); 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"); WriteToBitDepth(p, 6, "texGs", "float2 gInt"); WRITE(p, " float2 gUpper = floor(gInt / 8.0);\n"); WRITE(p, " float2 gLower = gInt - gUpper * 8.0;\n"); WriteToBitDepth(p, 5, "texRs", "ocol0.br"); WRITE(p, " ocol0.br = ocol0.br * 8.0 + gUpper;\n"); WriteToBitDepth(p, 5, "texBs", "ocol0.ga"); WRITE(p, " ocol0.ga = ocol0.ga + gLower * 32.0;\n"); WRITE(p, " ocol0 = ocol0 / 255.0;\n"); WriteEncoderEnd(p); }
static void WriteRGB5A3Encoder(char*& p,API_TYPE 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", 0, 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"); WriteToBitDepth(p, 5, "texSample.g", "color0"); WRITE(p, " gUpper = floor(color0 / 8.0);\n"); WRITE(p, " gLower = color0 - gUpper * 8.0;\n"); WriteToBitDepth(p, 5, "texSample.r", "ocol0.b"); WRITE(p, " ocol0.b = ocol0.b * 4.0 + gUpper + 128.0;\n"); WriteToBitDepth(p, 5, "texSample.b", "ocol0.g"); WRITE(p, " ocol0.g = ocol0.g + gLower * 32.0;\n"); WRITE(p, "} else {\n"); WriteToBitDepth(p, 4, "texSample.r", "ocol0.b"); WriteToBitDepth(p, 4, "texSample.b", "ocol0.g"); WriteToBitDepth(p, 3, "texSample.a", "color0"); WRITE(p, "ocol0.b = ocol0.b + color0 * 16.0;\n"); WriteToBitDepth(p, 4, "texSample.g", "color0"); WRITE(p, "ocol0.g = ocol0.g + color0 * 16.0;\n"); WRITE(p, "}\n"); WriteSampleColor(p, "rgba", "texSample", 1, ApiType); WRITE(p, "if(texSample.a > 0.878f) {\n"); WriteToBitDepth(p, 5, "texSample.g", "color0"); WRITE(p, " gUpper = floor(color0 / 8.0);\n"); WRITE(p, " gLower = color0 - gUpper * 8.0;\n"); WriteToBitDepth(p, 5, "texSample.r", "ocol0.r"); WRITE(p, " ocol0.r = ocol0.r * 4.0 + gUpper + 128.0;\n"); WriteToBitDepth(p, 5, "texSample.b", "ocol0.a"); WRITE(p, " ocol0.a = ocol0.a + gLower * 32.0;\n"); WRITE(p, "} else {\n"); WriteToBitDepth(p, 4, "texSample.r", "ocol0.r"); WriteToBitDepth(p, 4, "texSample.b", "ocol0.a"); WriteToBitDepth(p, 3, "texSample.a", "color0"); WRITE(p, "ocol0.r = ocol0.r + color0 * 16.0;\n"); WriteToBitDepth(p, 4, "texSample.g", "color0"); WRITE(p, "ocol0.a = ocol0.a + color0 * 16.0;\n"); WRITE(p, "}\n"); WRITE(p, " ocol0 = ocol0 / 255.0;\n"); WriteEncoderEnd(p, ApiType); }