Index: ddraw/glDirect3DDevice.cpp |
— | — | @@ -1008,6 +1008,25 @@ |
1009 | 1009 | ERR(DDERR_GENERIC);
|
1010 | 1010 | }
|
1011 | 1011 |
|
| 1012 | +// Use EXACTLY one line per entry. Don't change layout of the list.
|
| 1013 | +// This list is a subset of the list found in glTexture to be used when limited
|
| 1014 | +// texture support is enabled.
|
| 1015 | +static const int START_LIMITEDTEXFORMATS = __LINE__;
|
| 1016 | +const DDPIXELFORMAT limitedtexformats[] =
|
| 1017 | +{ // Size Flags FOURCC bits R/Ymask G/U/Zmask B/V/STmask A/Zmask
|
| 1018 | + {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x7C00, 0x3E0, 0x1F, 0}, // 15 bit 555
|
| 1019 | + {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_ALPHAPIXELS, 0, 16, 0x7c00, 0x3E0, 0x1F, 0x8000}, // 16-bit 1555
|
| 1020 | + {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0xF800, 0x7E0, 0x1F, 0}, // 16 bit 565
|
| 1021 | + {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_ALPHAPIXELS, 0, 16, 0xF00, 0xF0, 0xF, 0xF000}, // 16-bit 4444
|
| 1022 | + {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 32, 0xFF0000, 0xFF00, 0xFF, 0}, // 32 bit 888
|
| 1023 | + {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_ALPHAPIXELS, 0, 32, 0xFF0000, 0xFF00, 0xFF, 0xFF000000}, // 32-bit 8888
|
| 1024 | + {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 8, 0xE0, 0x1C, 0x3, 0}, // 8 bit 332
|
| 1025 | + {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED8, 0, 8, 0, 0, 0, 0}, // 8-bit paletted
|
| 1026 | +};
|
| 1027 | +static const int END_LIMITEDTEXFORMATS = __LINE__ - 4;
|
| 1028 | +int numlimitedtexformats;
|
| 1029 | +
|
| 1030 | +
|
1012 | 1031 | HRESULT WINAPI glDirect3DDevice7::EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg)
|
1013 | 1032 | {
|
1014 | 1033 | TRACE_ENTER(3,14,this,14,lpd3dEnumPixelProc,14,lpArg);
|
— | — | @@ -1014,19 +1033,37 @@ |
1015 | 1034 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1016 | 1035 | HRESULT result;
|
1017 | 1036 | DDPIXELFORMAT fmt;
|
1018 | | - for(int i = 0; i < numtexformats; i++)
|
| 1037 | + if (dxglcfg.LimitTextureFormats >= 2)
|
1019 | 1038 | {
|
1020 | | - if (i == 11) continue;
|
1021 | | - if(::texformats[i].dwFlags & DDPF_ZBUFFER) continue;
|
1022 | | - //FIXME: Remove these line after implementing palette textures
|
1023 | | - if(::texformats[i].dwFlags & DDPF_PALETTEINDEXED1) continue;
|
1024 | | - if(::texformats[i].dwFlags & DDPF_PALETTEINDEXED2) continue;
|
1025 | | - if(::texformats[i].dwFlags & DDPF_PALETTEINDEXED4) continue;
|
1026 | | - if(::texformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
|
1027 | | - memcpy(&fmt,&::texformats[i],sizeof(DDPIXELFORMAT));
|
1028 | | - result = lpd3dEnumPixelProc(&fmt,lpArg);
|
1029 | | - if(result != D3DENUMRET_OK) TRACE_RET(HRESULT,23,D3D_OK);
|
| 1039 | + numlimitedtexformats = END_LIMITEDTEXFORMATS - START_LIMITEDTEXFORMATS;
|
| 1040 | + for (int i = 0; i < numlimitedtexformats; i++)
|
| 1041 | + {
|
| 1042 | + if (limitedtexformats[i].dwFlags & DDPF_ZBUFFER) continue;
|
| 1043 | + //FIXME: Remove this line after implementing palette textures
|
| 1044 | + if (limitedtexformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
|
| 1045 | + memcpy(&fmt, &limitedtexformats[i], sizeof(DDPIXELFORMAT));
|
| 1046 | + result = lpd3dEnumPixelProc(&fmt, lpArg);
|
| 1047 | + if (result != D3DENUMRET_OK) TRACE_RET(HRESULT, 23, D3D_OK);
|
| 1048 | + }
|
1030 | 1049 | }
|
| 1050 | + else
|
| 1051 | + {
|
| 1052 | + for (int i = 0; i < numtexformats; i++)
|
| 1053 | + {
|
| 1054 | + //FIXME: Remove this line after implementing RGB3328 textures
|
| 1055 | + if (i == 11) continue;
|
| 1056 | + // Exclude Z buffer formats
|
| 1057 | + if (::texformats[i].dwFlags & DDPF_ZBUFFER) continue;
|
| 1058 | + //FIXME: Remove these lines after implementing palette textures
|
| 1059 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED1) continue;
|
| 1060 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED2) continue;
|
| 1061 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED4) continue;
|
| 1062 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
|
| 1063 | + memcpy(&fmt, &::texformats[i], sizeof(DDPIXELFORMAT));
|
| 1064 | + result = lpd3dEnumPixelProc(&fmt, lpArg);
|
| 1065 | + if (result != D3DENUMRET_OK) TRACE_RET(HRESULT, 23, D3D_OK);
|
| 1066 | + }
|
| 1067 | + }
|
1031 | 1068 | TRACE_EXIT(23,D3D_OK);
|
1032 | 1069 | return D3D_OK;
|
1033 | 1070 | }
|
— | — | @@ -1041,20 +1078,40 @@ |
1042 | 1079 | ddsd.dwSize = sizeof(DDSURFACEDESC);
|
1043 | 1080 | ddsd.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT;
|
1044 | 1081 | ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
1045 | | - for (int i = 0; i < numtexformats; i++)
|
| 1082 | + if (dxglcfg.LimitTextureFormats >= 1)
|
1046 | 1083 | {
|
1047 | | - if (i == 11) continue;
|
1048 | | - if (::texformats[i].dwFlags & DDPF_ZBUFFER) continue;
|
1049 | | - if (::texformats[i].dwFlags & DDPF_FOURCC) continue;
|
1050 | | - //FIXME: Remove these line after implementing palette textures
|
1051 | | - if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED1) continue;
|
1052 | | - if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED2) continue;
|
1053 | | - if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED4) continue;
|
1054 | | - if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
|
1055 | | - memcpy(&ddsd.ddpfPixelFormat, &::texformats[i], sizeof(DDPIXELFORMAT));
|
1056 | | - result = lpd3dEnumTextureProc(&ddsd, lpArg);
|
1057 | | - if (result != D3DENUMRET_OK) TRACE_RET(HRESULT, 23, D3D_OK);
|
| 1084 | + numlimitedtexformats = END_LIMITEDTEXFORMATS - START_LIMITEDTEXFORMATS;
|
| 1085 | + for (int i = 0; i < numlimitedtexformats; i++)
|
| 1086 | + {
|
| 1087 | + // Exclude FOURCC formats
|
| 1088 | + if (limitedtexformats[i].dwFlags & DDPF_FOURCC) continue;
|
| 1089 | + //FIXME: Remove this line after implementing palette textures
|
| 1090 | + if (limitedtexformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
|
| 1091 | + memcpy(&ddsd.ddpfPixelFormat, &limitedtexformats[i], sizeof(DDPIXELFORMAT));
|
| 1092 | + result = lpd3dEnumTextureProc(&ddsd, lpArg);
|
| 1093 | + if (result != D3DENUMRET_OK) TRACE_RET(HRESULT, 23, D3D_OK);
|
| 1094 | + }
|
1058 | 1095 | }
|
| 1096 | + else
|
| 1097 | + {
|
| 1098 | + for (int i = 0; i < numtexformats; i++)
|
| 1099 | + {
|
| 1100 | + //FIXME: Remove this line after implementing RGB3328 textures
|
| 1101 | + if (i == 11) continue;
|
| 1102 | + // Exclude Z buffer formats
|
| 1103 | + if (::texformats[i].dwFlags & DDPF_ZBUFFER) continue;
|
| 1104 | + // Exclude FOURCC formats
|
| 1105 | + if (::texformats[i].dwFlags & DDPF_FOURCC) continue;
|
| 1106 | + //FIXME: Remove these lines after implementing palette textures
|
| 1107 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED1) continue;
|
| 1108 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED2) continue;
|
| 1109 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED4) continue;
|
| 1110 | + if (::texformats[i].dwFlags & DDPF_PALETTEINDEXED8) continue;
|
| 1111 | + memcpy(&ddsd.ddpfPixelFormat, &::texformats[i], sizeof(DDPIXELFORMAT));
|
| 1112 | + result = lpd3dEnumTextureProc(&ddsd, lpArg);
|
| 1113 | + if (result != D3DENUMRET_OK) TRACE_RET(HRESULT, 23, D3D_OK);
|
| 1114 | + }
|
| 1115 | + }
|
1059 | 1116 | TRACE_EXIT(23, D3D_OK);
|
1060 | 1117 | return D3D_OK;
|
1061 | 1118 | }
|
Index: ddraw/glTexture.cpp |
— | — | @@ -69,9 +69,9 @@ |
70 | 70 | static const int START_TEXFORMATS = __LINE__;
|
71 | 71 | const DDPIXELFORMAT texformats[] =
|
72 | 72 | { // Size Flags FOURCC bits R/Ymask G/U/Zmask B/V/STmask A/Zmask
|
73 | | - {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED1, 0, 1, 0, 0, 0, 0}, // 8-bit paletted
|
74 | | - {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED2, 0, 2, 0, 0, 0, 0}, // 8-bit paletted
|
75 | | - {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED4, 0, 4, 0, 0, 0, 0}, // 8-bit paletted
|
| 73 | + {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED1, 0, 1, 0, 0, 0, 0}, // 1-bit paletted
|
| 74 | + {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED2, 0, 2, 0, 0, 0, 0}, // 2-bit paletted
|
| 75 | + {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED4, 0, 4, 0, 0, 0, 0}, // 4-bit paletted
|
76 | 76 | {sizeof(DDPIXELFORMAT), DDPF_RGB|DDPF_PALETTEINDEXED8, 0, 8, 0, 0, 0, 0}, // 8-bit paletted
|
77 | 77 | {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 8, 0xE0, 0x1C, 0x3, 0}, // 8 bit 332
|
78 | 78 | {sizeof(DDPIXELFORMAT), DDPF_RGB, 0, 16, 0x7C00, 0x3E0, 0x1F, 0}, // 15 bit 555
|
Index: dxgl-example.ini |
— | — | @@ -413,7 +413,9 @@ |
414 | 414 |
|
415 | 415 | ; LimitTextureFormats - Integer
|
416 | 416 | ; Limits the available texture formats returned by EnumTextureFormats to
|
417 | | -; avoid crashes in some games.
|
| 417 | +; avoid crashes in some games. When limited, texture formats will be returned
|
| 418 | +; in the same order as given in Wine 4.14, subject to the limitation of
|
| 419 | +; currently implemented formats.
|
418 | 420 | ; The following values are valid:
|
419 | 421 | ; 0 - Don't limit formats regardless of API version
|
420 | 422 | ; 1 - Limit formats on API versions 2 and 1 (DirectX 5 and DirectX 3/2)
|