Oops. A return value of 0 means that the view/depth format was ok, not that it was invalid.

This commit is contained in:
UnknownShadow200 2017-08-19 22:24:16 +10:00
parent e84cd9ebe3
commit 21435f24c7
2 changed files with 9 additions and 2 deletions

View File

@ -124,9 +124,12 @@ void Gfx_Free(void) {
void D3D9_FindCompatibleFormat(void) {
Int32 count = sizeof(d3d9_viewFormats) / sizeof(d3d9_viewFormats[0]);
Int32 i;
ReturnCode res;
for (i = 0; i < count; i++) {
d3d9_viewFormat = d3d9_viewFormats[i];
if (IDirect3D9_CheckDeviceType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3d9_viewFormat, d3d9_viewFormat, true)) break;
res = IDirect3D9_CheckDeviceType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3d9_viewFormat, d3d9_viewFormat, true);
if (ErrorHandler_Check(res)) break;
if (i == count - 1) {
ErrorHandler_Fail("Unable to create a back buffer with sufficient precision.");
@ -136,7 +139,8 @@ void D3D9_FindCompatibleFormat(void) {
count = sizeof(d3d9_depthFormats) / sizeof(d3d9_depthFormats[0]);
for (i = 0; i < count; i++) {
d3d9_depthFormat = d3d9_depthFormats[i];
if (IDirect3D9_CheckDepthStencilMatch(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3d9_viewFormat, d3d9_viewFormat, d3d9_depthFormat)) break;
res = IDirect3D9_CheckDepthStencilMatch(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, d3d9_viewFormat, d3d9_viewFormat, d3d9_depthFormat);
if (ErrorHandler_Check(res)) break;
if (i == count - 1) {
ErrorHandler_Fail("Unable to create a depth buffer with sufficient precision.");

View File

@ -12,10 +12,13 @@ int main(int argc, char* argv[]) {
Window_Create(320, 320, 640, 480, &str, NULL);
Window_SetVisible(true);
Gfx_Init();
Gfx_ClearColour(PackedCol_Red);
while (true) {
Window_ProcessEvents();
Platform_ThreadSleep(100);
Gfx_BeginFrame();
Gfx_Clear();
Gfx_EndFrame();
}
Gfx_Free();