Index: ddraw/ShaderGen3D.cpp |
— | — | @@ -331,15 +331,12 @@ |
332 | 332 | static const char var_fogfactorpixel[] = "float fogfactor;\n";
|
333 | 333 | // Constants
|
334 | 334 | static const char const_nxyz[] = "const vec3 nxyz = vec3(0,0,0);\n";
|
335 | | -static const char const_threshold[] = "float threshold[64] = float[64](\n\
|
336 | | -0, 32, 8, 40, 2, 34, 10, 42,\n\
|
337 | | -48, 16, 56, 24, 50, 18, 58, 26,\n\
|
338 | | -12, 44, 4, 36, 14, 46, 6, 38,\n\
|
339 | | -60, 28, 52, 20, 62, 30, 54, 22,\n\
|
340 | | -3, 35, 11, 43, 1, 33, 9, 41,\n\
|
341 | | -51, 19, 59, 27, 49, 17, 57, 25,\n\
|
342 | | -15, 47, 7, 39, 13, 45, 5, 37,\n\
|
343 | | -63, 31, 55, 23, 61, 29, 53, 21);\n";
|
| 335 | +static const char const_threshold[] = "mat4 threshold = mat4(\n\
|
| 336 | +1.0, 9.0, 3.0, 11.0,\n\
|
| 337 | +13.0, 5.0, 15.0, 7.0,\n\
|
| 338 | +4.0, 12.0, 2.0, 10.0,\n\
|
| 339 | +16.0, 8.0, 14.0, 6.0);\n";
|
| 340 | +
|
344 | 341 | // Operations
|
345 | 342 | static const char op_transform[] = "xyzw = vec4(xyz,1.0);\n\
|
346 | 343 | vec4 pos = gl_ModelViewProjectionMatrix*xyzw;\n\
|
— | — | @@ -449,12 +446,12 @@ |
450 | 447 | static const char func_dither[] = "vec4 dither(vec4 color2)\n\
|
451 | 448 | {\n\
|
452 | 449 | vec4 color = color2;\n\
|
453 | | - int x = int(mod(gl_FragCoord.x, 8.0));\n\
|
454 | | - int y = int(mod(gl_FragCoord.y, 8.0));\n\
|
| 450 | + int x = int(mod(gl_FragCoord.x, 4.0));\n\
|
| 451 | + int y = int(mod(gl_FragCoord.y, 4.0));\n\
|
455 | 452 | vec4 limit;\n\
|
456 | | - limit.r = (threshold[x + (y * 8)]) / ((pow(2.0, float(ditherbits.r)) - 1.0)*64.0);\n\
|
457 | | - limit.g = (threshold[x + (y * 8)]) / ((pow(2.0, float(ditherbits.g)) - 1.0)*64.0);\n\
|
458 | | - limit.b = (threshold[x + (y * 8)]) / ((pow(2.0, float(ditherbits.b)) - 1.0)*64.0);\n\
|
| 453 | + limit.r = (threshold[x][y]) / ((pow(2.0, float(ditherbits.r)) - 1.0)*16.0);\n\
|
| 454 | + limit.g = (threshold[x][y]) / ((pow(2.0, float(ditherbits.g)) - 1.0)*16.0);\n\
|
| 455 | + limit.b = (threshold[x][y]) / ((pow(2.0, float(ditherbits.b)) - 1.0)*16.0);\n\
|
459 | 456 | color.r += limit.r;\n\
|
460 | 457 | color.g += limit.g;\n\
|
461 | 458 | color.b += limit.b;\n\
|
— | — | @@ -771,15 +768,10 @@ |
772 | 769 | }
|
773 | 770 | #endif
|
774 | 771 | // Create fragment shader
|
775 | | - if ((id>>62)&1)
|
776 | | - {
|
777 | | - if ((This->ext->glver_major > 2) || ((This->ext->glver_major == 2) && (This->ext->glver_minor >= 1)))
|
778 | | - dither = true;
|
779 | | - }
|
| 772 | + if ((id>>62)&1) dither = true;
|
780 | 773 | STRING *fsrc = &This->genshaders[index].shader.fsrc;
|
781 | 774 | String_Append(fsrc, header);
|
782 | | - if (dither) String_Append(fsrc, ver120);
|
783 | | - else String_Append(fsrc, ver110);
|
| 775 | + String_Append(fsrc, ver110);
|
784 | 776 | String_Append(fsrc, fragshader);
|
785 | 777 | _snprintf(idstring,21,"%0.16I64X\n",id);
|
786 | 778 | idstring[21] = 0;
|