Index: ddraw/ShaderGen2D.cpp |
— | — | @@ -61,7 +61,7 @@ |
62 | 62 |
|
63 | 63 | Texture types:
|
64 | 64 | 0x00: Classic DXGL processing
|
65 | | -0x01: 32-bit YUV444, 8-bit component (convert from other formats via software)
|
| 65 | +0x01: Luminance-only (write to red)
|
66 | 66 | 0x10: 8-bit palette
|
67 | 67 | 0x11: 4-bit palette
|
68 | 68 | 0x12: 2-bit palette
|
— | — | @@ -140,6 +140,7 @@ |
141 | 141 | vec2 index = vec2(((myindex.x*(255.0/256.0))+(0.5/256.0)),0.5);\n\
|
142 | 142 | pixel = ivec4(texture2D(srcpal, index)*vec4(colorsizedest)+.5);\n";
|
143 | 143 | static const char op_pixelmul256[] = "pixel = ivec4(vec4(256.0)*texture2D(srctex,gl_TexCoord[0].st)*vec4(colorsizedest)+.5);\n";
|
| 144 | +static const char op_lumpixel[] = "pixel = ivec4(vec4(texture2D(srctex,gl_TexCoord[0].st).rrr,1.0)*vec4(colorsizedest)+.5);\n";
|
144 | 145 | static const char op_color[] = "pixel = fillcolor;\n";
|
145 | 146 | static const char op_dest[] = "dest = ivec4(texture2D(desttex,gl_TexCoord[1].st)*vec4(colorsizedest)+.5);\n";
|
146 | 147 | static const char op_pattern[] = "patternst = vec2(mod(gl_FragCoord.x,float(patternsize.x))/float(patternsize.x),\n\
|
— | — | @@ -953,10 +954,13 @@ |
954 | 955 | {
|
955 | 956 | switch (srctype2)
|
956 | 957 | {
|
957 | | - case 0:
|
| 958 | + case 0x00:
|
958 | 959 | default:
|
959 | 960 | String_Append(fsrc, op_pixel);
|
960 | 961 | break;
|
| 962 | + case 0x01:
|
| 963 | + String_Append(fsrc, op_lumpixel);
|
| 964 | + break;
|
961 | 965 | case 0x10:
|
962 | 966 | case 0x11:
|
963 | 967 | case 0x12:
|
Index: ddraw/glTexture.cpp |
— | — | @@ -1196,14 +1196,23 @@ |
1197 | 1197 | This->colorbits[3] = 8;
|
1198 | 1198 | This->packsize = 1;
|
1199 | 1199 | break;
|
1200 | | - case DXGLPIXELFORMAT_LUM8: // 8-bit Luminance
|
1201 | | - case DXGLPIXELFORMAT_FOURCC_Y8:
|
| 1200 | + case DXGLPIXELFORMAT_FOURCC_Y8: // 8-bit Y-only
|
1202 | 1201 | case DXGLPIXELFORMAT_FOURCC_Y800:
|
1203 | 1202 | case DXGLPIXELFORMAT_FOURCC_GREY:
|
1204 | | - This->internalformats[0] = GL_LUMINANCE8;
|
| 1203 | + case DXGLPIXELFORMAT_LUM8: // 8-bit Luminance
|
| 1204 | + This->blttype = 0x01;
|
| 1205 | + if (This->renderer->ext->glver_major >= 3 && !(This->levels[0].ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
| 1206 | + {
|
| 1207 | + This->internalformats[0] = GL_R8;
|
| 1208 | + This->format = GL_RED;
|
| 1209 | + }
|
| 1210 | + else
|
| 1211 | + {
|
| 1212 | + This->internalformats[0] = GL_LUMINANCE8;
|
| 1213 | + This->format = GL_LUMINANCE;
|
| 1214 | + }
|
1205 | 1215 | This->internalformats[1] = GL_RGB8;
|
1206 | 1216 | This->internalformats[2] = GL_RGBA8;
|
1207 | | - This->format = GL_LUMINANCE;
|
1208 | 1217 | This->type = GL_UNSIGNED_BYTE;
|
1209 | 1218 | if (!This->target) This->target = GL_TEXTURE_2D;
|
1210 | 1219 | This->colororder = 5;
|
— | — | @@ -1370,8 +1379,17 @@ |
1371 | 1380 | This->packsize = 1;
|
1372 | 1381 | break;
|
1373 | 1382 | case DXGLPIXELFORMAT_FOURCC_Y16:
|
1374 | | - This->internalformats[0] = GL_LUMINANCE16;
|
1375 | | - This->format = GL_LUMINANCE;
|
| 1383 | + This->blttype = 0x01;
|
| 1384 | + if (This->renderer->ext->glver_major >= 3 && !(This->levels[0].ddsd.ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
| 1385 | + {
|
| 1386 | + This->internalformats[0] = GL_R16;
|
| 1387 | + This->format = GL_RED;
|
| 1388 | + }
|
| 1389 | + else
|
| 1390 | + {
|
| 1391 | + This->internalformats[0] = GL_LUMINANCE16;
|
| 1392 | + This->format = GL_LUMINANCE;
|
| 1393 | + }
|
1376 | 1394 | This->type = GL_UNSIGNED_SHORT;
|
1377 | 1395 | if (!This->target) This->target = GL_TEXTURE_2D;
|
1378 | 1396 | This->colororder = 4;
|