| Index: ddraw/ShaderGen2D.cpp |
| — | — | @@ -1111,8 +1111,10 @@ |
| 1112 | 1112 | String_Append(fsrc, op_pixeluyvy);
|
| 1113 | 1113 | break;
|
| 1114 | 1114 | case 0x81:
|
| | 1115 | + String_Append(fsrc, op_pixelyuyv);
|
| 1115 | 1116 | break;
|
| 1116 | 1117 | case 0x82:
|
| | 1118 | + String_Append(fsrc, op_pixelyvyu);
|
| 1117 | 1119 | break;
|
| 1118 | 1120 | }
|
| 1119 | 1121 | }
|
| — | — | @@ -1164,6 +1166,16 @@ |
| 1165 | 1167 | String_Append(fsrc, op_destout);
|
| 1166 | 1168 | else String_Append(fsrc, op_destoutyuvrgb);
|
| 1167 | 1169 | break;
|
| | 1170 | + case 0x81:
|
| | 1171 | + if ((desttype >= 0x80) && (desttype <= 0x83))
|
| | 1172 | + String_Append(fsrc, op_destout);
|
| | 1173 | + else String_Append(fsrc, op_destoutyuvrgb);
|
| | 1174 | + break;
|
| | 1175 | + case 0x82:
|
| | 1176 | + if ((desttype >= 0x80) && (desttype <= 0x83))
|
| | 1177 | + String_Append(fsrc, op_destout);
|
| | 1178 | + else String_Append(fsrc, op_destoutyuvrgb);
|
| | 1179 | + break;
|
| 1168 | 1180 | case 0x83:
|
| 1169 | 1181 | if ((desttype >= 0x80) && (desttype <= 0x83))
|
| 1170 | 1182 | String_Append(fsrc, op_destout);
|
| Index: ddraw/fourcc.c |
| — | — | @@ -25,6 +25,10 @@ |
| 26 | 26 | MAKEFOURCC('U','Y','V','Y'),
|
| 27 | 27 | MAKEFOURCC('U','Y','N','V'),
|
| 28 | 28 | MAKEFOURCC('Y','4','2','2'),
|
| | 29 | + MAKEFOURCC('Y','U','Y','2'),
|
| | 30 | + MAKEFOURCC('Y','U','Y','V'),
|
| | 31 | + MAKEFOURCC('Y','U','N','V'),
|
| | 32 | + MAKEFOURCC('Y','V','Y','U'),
|
| 29 | 33 | MAKEFOURCC('A','Y','U','V'),
|
| 30 | 34 | MAKEFOURCC('Y','8',' ',' '),
|
| 31 | 35 | MAKEFOURCC('Y','8','0','0'),
|
| Index: ddraw/glTexture.cpp |
| — | — | @@ -1463,10 +1463,22 @@ |
| 1464 | 1464 | case DXGLPIXELFORMAT_FOURCC_YUY2:
|
| 1465 | 1465 | case DXGLPIXELFORMAT_FOURCC_YUYV:
|
| 1466 | 1466 | case DXGLPIXELFORMAT_FOURCC_YUNV:
|
| | 1467 | + if (This->renderer->ext->glver_major >= 3)
|
| | 1468 | + {
|
| | 1469 | + This->internalformats[0] = GL_RG8;
|
| | 1470 | + This->format = GL_RG;
|
| | 1471 | + }
|
| | 1472 | + else
|
| | 1473 | + {
|
| | 1474 | + This->useconv = TRUE;
|
| | 1475 | + This->convfunctionupload = 9;
|
| | 1476 | + This->convfunctiondownload = 10;
|
| | 1477 | + This->internalsize = 4;
|
| | 1478 | + This->internalformats[0] = GL_RGBA8;
|
| | 1479 | + This->format = GL_RGBA;
|
| | 1480 | + }
|
| 1467 | 1481 | This->blttype = 0x81;
|
| 1468 | | - This->internalformats[0] = GL_RGBA8;
|
| 1469 | | - This->format = GL_BGRA;
|
| 1470 | | - This->type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
| | 1482 | + This->type = GL_UNSIGNED_BYTE;
|
| 1471 | 1483 | if (!This->target) This->target = GL_TEXTURE_RECTANGLE;
|
| 1472 | 1484 | This->colororder = 1;
|
| 1473 | 1485 | This->colorsizes[0] = 255;
|
| — | — | @@ -1477,13 +1489,25 @@ |
| 1478 | 1490 | This->colorbits[1] = 8;
|
| 1479 | 1491 | This->colorbits[2] = 8;
|
| 1480 | 1492 | This->colorbits[3] = 8;
|
| 1481 | | - This->packsize = 2;
|
| | 1493 | + This->packsize = 1;
|
| 1482 | 1494 | break;
|
| 1483 | 1495 | case DXGLPIXELFORMAT_FOURCC_YVYU:
|
| | 1496 | + if (This->renderer->ext->glver_major >= 3)
|
| | 1497 | + {
|
| | 1498 | + This->internalformats[0] = GL_RG8;
|
| | 1499 | + This->format = GL_RG;
|
| | 1500 | + }
|
| | 1501 | + else
|
| | 1502 | + {
|
| | 1503 | + This->useconv = TRUE;
|
| | 1504 | + This->convfunctionupload = 9;
|
| | 1505 | + This->convfunctiondownload = 10;
|
| | 1506 | + This->internalsize = 4;
|
| | 1507 | + This->internalformats[0] = GL_RGBA8;
|
| | 1508 | + This->format = GL_RGBA;
|
| | 1509 | + }
|
| 1484 | 1510 | This->blttype = 0x82;
|
| 1485 | | - This->internalformats[0] = GL_RGBA8;
|
| 1486 | | - This->format = GL_BGRA;
|
| 1487 | | - This->type = GL_UNSIGNED_INT_8_8_8_8_REV;
|
| | 1511 | + This->type = GL_UNSIGNED_BYTE;
|
| 1488 | 1512 | if (!This->target) This->target = GL_TEXTURE_RECTANGLE;
|
| 1489 | 1513 | This->colororder = 1;
|
| 1490 | 1514 | This->colorsizes[0] = 255;
|
| — | — | @@ -1494,7 +1518,7 @@ |
| 1495 | 1519 | This->colorbits[1] = 8;
|
| 1496 | 1520 | This->colorbits[2] = 8;
|
| 1497 | 1521 | This->colorbits[3] = 8;
|
| 1498 | | - This->packsize = 2;
|
| | 1522 | + This->packsize = 1;
|
| 1499 | 1523 | break;
|
| 1500 | 1524 | case DXGLPIXELFORMAT_FOURCC_RGBG:
|
| 1501 | 1525 | This->blttype = 0x9E;
|
| Index: dxglcfg/surfacegen.cpp |
| — | — | @@ -216,6 +216,30 @@ |
| 217 | 217 | else return (u | (y << 8));
|
| 218 | 218 | }
|
| 219 | 219 |
|
| | 220 | +unsigned short EncodeYUYV(unsigned long value, DWORD x)
|
| | 221 | +{
|
| | 222 | + short r = (value >> 16) & 0xff;
|
| | 223 | + short g = (value >> 8) & 0xff;
|
| | 224 | + short b = value & 0xff;
|
| | 225 | + unsigned char y = ((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
|
| | 226 | + unsigned char u = ((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
|
| | 227 | + unsigned char v = ((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
|
| | 228 | + if (x % 2) return (y | (v << 8));
|
| | 229 | + else return (y | (u << 8));
|
| | 230 | +}
|
| | 231 | +
|
| | 232 | +unsigned short EncodeYVYU(unsigned long value, DWORD x)
|
| | 233 | +{
|
| | 234 | + short r = (value >> 16) & 0xff;
|
| | 235 | + short g = (value >> 8) & 0xff;
|
| | 236 | + short b = value & 0xff;
|
| | 237 | + unsigned char y = ((66 * r + 129 * g + 25 * b + 128) >> 8) + 16;
|
| | 238 | + unsigned char u = ((-38 * r - 74 * g + 112 * b + 128) >> 8) + 128;
|
| | 239 | + unsigned char v = ((112 * r - 94 * g - 18 * b + 128) >> 8) + 128;
|
| | 240 | + if (x % 2) return (y | (u << 8));
|
| | 241 | + else return (y | (v << 8));
|
| | 242 | +}
|
| | 243 | +
|
| 220 | 244 | unsigned long EncodeAYUV(unsigned long value)
|
| 221 | 245 | {
|
| 222 | 246 | short r = (value >> 16) & 0xff;
|
| — | — | @@ -327,6 +351,26 @@ |
| 328 | 352 | }
|
| 329 | 353 | }
|
| 330 | 354 | break;
|
| | 355 | + case MAKEFOURCC('Y', 'U', 'Y', '2'):
|
| | 356 | + case MAKEFOURCC('Y', 'U', 'Y', 'V'):
|
| | 357 | + case MAKEFOURCC('Y', 'U', 'N', 'V'):
|
| | 358 | + for (y = 0; y < ddsd.dwHeight; y++)
|
| | 359 | + {
|
| | 360 | + for (x = 0; x < ddsd.dwWidth; x++)
|
| | 361 | + {
|
| | 362 | + buffer16[x + ((ddsd.lPitch / 2) * y)] = EncodeYUYV((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))), x);
|
| | 363 | + }
|
| | 364 | + }
|
| | 365 | + break;
|
| | 366 | + case MAKEFOURCC('Y', 'V', 'Y', 'U'):
|
| | 367 | + for (y = 0; y < ddsd.dwHeight; y++)
|
| | 368 | + {
|
| | 369 | + for (x = 0; x < ddsd.dwWidth; x++)
|
| | 370 | + {
|
| | 371 | + buffer16[x + ((ddsd.lPitch / 2) * y)] = EncodeYVYU((unsigned long)((x / (ddsd.dwWidth / 4096.)) + 4096 * floor((y / (ddsd.dwHeight / 4096.)))), x);
|
| | 372 | + }
|
| | 373 | + }
|
| | 374 | + break;
|
| 331 | 375 | default:
|
| 332 | 376 | for (y = 0; y < ddsd.dwHeight; y++)
|
| 333 | 377 | {
|