gsdx-ogl: remove old colclip algo

This commit is contained in:
Gregory Hainaut 2015-07-30 22:11:32 +02:00
parent 93c47feb7c
commit cfd0fd6cc8
6 changed files with 13 additions and 97 deletions

View File

@ -696,7 +696,7 @@ void GSDeviceOGL::SelfShaderTest()
int perf = 0;
int all = 0;
// Test: SW blending
for (int colclip = 0; colclip < 4; colclip += 3) {
for (int colclip = 0; colclip < 2; colclip++) {
for (int fmt = 0; fmt < 3; fmt++) {
for (int i = 0; i < 3; i++) {
PSSelector sel;
@ -787,18 +787,6 @@ void GSDeviceOGL::SelfShaderTest()
}
PRINT_TEST("Fst/Tc/IIp");
// Test: Colclip
for (int colclip = 0; colclip < 3; colclip += 1) {
PSSelector sel;
sel.tfx = 4;
sel.atst = 1;
sel.colclip = colclip;
std::string file = format("Shader_Colclip_%d.glsl.asm", colclip);
RUN_TEST;
}
PRINT_TEST("Colclip");
// Test: tfx/tcc
for (int tfx = 0; tfx < 5; tfx++) {
for (int tcc = 0; tcc < 2; tcc++) {

View File

@ -66,14 +66,6 @@ public:
if (IsConstant(src) || IsConstant(dst)) m_constant_factor = true;
}
void RevertOp()
{
if(m_equation_RGB == GL_FUNC_ADD)
m_equation_RGB = GL_FUNC_REVERSE_SUBTRACT;
else if(m_equation_RGB == GL_FUNC_REVERSE_SUBTRACT)
m_equation_RGB = GL_FUNC_ADD;
}
void EnableBlend() { m_enable = true;}
bool IsConstant(GLenum factor) { return ((factor == GL_CONSTANT_COLOR) || (factor == GL_ONE_MINUS_CONSTANT_COLOR)); }
@ -332,7 +324,7 @@ class GSDeviceOGL : public GSDevice
uint32 tcoffsethack:1;
//uint32 point_sampler:1; Not tested, so keep the bit for blend
uint32 iip:1;
uint32 colclip:2;
uint32 colclip:1;
uint32 atst:3;
uint32 tfx:3;
uint32 tcc:1;
@ -344,7 +336,7 @@ class GSDeviceOGL : public GSDevice
uint32 read_ba:1;
uint32 fbmask:1;
//uint32 _free1:0;
uint32 _free1:1;
// Word 2
uint32 blend_a:2;
@ -451,19 +443,16 @@ class GSDeviceOGL : public GSDevice
uint32 b:2;
uint32 c:2;
uint32 d:2;
uint32 negative:1;
uint32 _free:22;
uint32 _free:23;
};
struct
{
uint32 _abe:1;
uint32 abcd:8;
uint32 _negative:1;
uint32 _accu:1;
uint32 _free2:21;
uint32 _free2:23;
};
uint32 key;

View File

@ -367,7 +367,7 @@ bool GSRendererOGL::EmulateBlending(GSDeviceOGL::PSSelector& ps_sel, GSDeviceOGL
ps_sel.hdr = 1;
GL_INS("COLCLIP Fast HDR mode ENABLED");
} else if (m_sw_blending >= ACC_BLEND_CCLIP || sw_blending_base) {
ps_sel.colclip = 3;
ps_sel.colclip = 1;
sw_blending_base = true;
GL_INS("COLCLIP SW ENABLED (blending is %d/%d/%d/%d)", ALPHA.A, ALPHA.B, ALPHA.C, ALPHA.D);
} else {
@ -943,24 +943,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
if (m_context->TEST.DoFirstPass())
{
SendDraw(require_barrier);
if (ps_sel.colclip == 1)
{
ASSERT(!om_bsel.ps);
GL_PUSH("COLCLIP");
GSDeviceOGL::OMBlendSelector om_bselneg(om_bsel);
GSDeviceOGL::PSSelector ps_selneg(ps_sel);
om_bselneg.negative = 1;
ps_selneg.colclip = 2;
dev->SetupOM(om_dssel, om_bselneg, afix);
dev->SetupPS(ps_selneg);
SendDraw(false);
dev->SetupOM(om_dssel, om_bsel, afix);
GL_POP();
}
}
if (m_context->TEST.DoSecondPass())
@ -1003,23 +985,6 @@ void GSRendererOGL::DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Sour
dev->SetupOM(om_dssel, om_bsel, afix);
SendDraw(require_barrier);
if (ps_sel.colclip == 1)
{
ASSERT(!om_bsel.ps);
GL_PUSH("COLCLIP");
GSDeviceOGL::OMBlendSelector om_bselneg(om_bsel);
GSDeviceOGL::PSSelector ps_selneg(ps_sel);
om_bselneg.negative = 1;
ps_selneg.colclip = 2;
dev->SetupOM(om_dssel, om_bselneg, afix);
dev->SetupPS(ps_selneg);
SendDraw(false);
GL_POP();
}
}
}

View File

@ -123,9 +123,6 @@ GSBlendStateOGL* GSDeviceOGL::CreateBlend(OMBlendSelector bsel, float afix)
} else {
bs->EnableBlend();
}
// Not very good but I don't wanna write another 81 row table
if(bsel.negative) bs->RevertOp();
}
return bs;

View File

@ -352,17 +352,6 @@ void atst(vec4 C)
#endif
}
void colclip(inout vec4 C)
{
#if (PS_COLCLIP == 2)
C.rgb = 256.0f - C.rgb;
#endif
#if (PS_COLCLIP == 1 || PS_COLCLIP == 2)
bvec3 factor = lessThan(C.rgb, vec3(128.0f));
C.rgb *= vec3(factor);
#endif
}
void fog(inout vec4 C, float f)
{
#if PS_FOG != 0
@ -384,8 +373,6 @@ vec4 ps_color()
fog(C, PSin_t.z);
colclip(C);
#if (PS_CLR1 != 0) // needed for Cd * (As/Ad/F + 1) blending modes
C.rgb = vec3(255.0f);
#endif
@ -460,7 +447,7 @@ void ps_blend(inout vec4 Color, float As)
// FIXME dithering
// Correct the Color value based on the output format
#if PS_COLCLIP != 3
#if PS_COLCLIP == 0
// Standard Clamp
Color.rgb = clamp(Color.rgb, vec3(0.0f), vec3(255.0f));
#endif
@ -475,7 +462,7 @@ void ps_blend(inout vec4 Color, float As)
// In 16 bits format, only 5 bits of colors are used. It impacts shadows computation of Castlevania
Color.rgb = vec3(ivec3(Color.rgb) & ivec3(0xF8));
#elif PS_COLCLIP == 3
#elif PS_COLCLIP == 1
Color.rgb = vec3(ivec3(Color.rgb) & ivec3(0xFF));
#endif

View File

@ -535,6 +535,9 @@ static const char* shadeboost_glsl =
"** Contrast, saturation, brightness\n"
"** Code of this function is from TGM's shader pack\n"
"** http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=21057\n"
"** TGM's author comment about the license (included in the previous link)\n"
"** \"do with it, what you want! its total free!\n"
"** (but would be nice, if you say that you used my shaders :wink: ) but not necessary\"\n"
"*/\n"
"\n"
"struct vertex_basic\n"
@ -1211,17 +1214,6 @@ static const char* tfx_fs_all_glsl =
"#endif\n"
"}\n"
"\n"
"void colclip(inout vec4 C)\n"
"{\n"
"#if (PS_COLCLIP == 2)\n"
" C.rgb = 256.0f - C.rgb;\n"
"#endif\n"
"#if (PS_COLCLIP == 1 || PS_COLCLIP == 2)\n"
" bvec3 factor = lessThan(C.rgb, vec3(128.0f));\n"
" C.rgb *= vec3(factor);\n"
"#endif\n"
"}\n"
"\n"
"void fog(inout vec4 C, float f)\n"
"{\n"
"#if PS_FOG != 0\n"
@ -1243,8 +1235,6 @@ static const char* tfx_fs_all_glsl =
"\n"
" fog(C, PSin_t.z);\n"
"\n"
" colclip(C);\n"
"\n"
"#if (PS_CLR1 != 0) // needed for Cd * (As/Ad/F + 1) blending modes\n"
" C.rgb = vec3(255.0f);\n"
"#endif\n"
@ -1319,7 +1309,7 @@ static const char* tfx_fs_all_glsl =
" // FIXME dithering\n"
"\n"
" // Correct the Color value based on the output format\n"
"#if PS_COLCLIP != 3\n"
"#if PS_COLCLIP == 0\n"
" // Standard Clamp\n"
" Color.rgb = clamp(Color.rgb, vec3(0.0f), vec3(255.0f));\n"
"#endif\n"
@ -1334,7 +1324,7 @@ static const char* tfx_fs_all_glsl =
" // In 16 bits format, only 5 bits of colors are used. It impacts shadows computation of Castlevania\n"
"\n"
" Color.rgb = vec3(ivec3(Color.rgb) & ivec3(0xF8));\n"
"#elif PS_COLCLIP == 3\n"
"#elif PS_COLCLIP == 1\n"
" Color.rgb = vec3(ivec3(Color.rgb) & ivec3(0xFF));\n"
"#endif\n"
"\n"