From c9d361d424976474a44f121b93f412ee9e2bb7ee Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 26 Sep 2012 00:02:27 +0200 Subject: [PATCH] Changed: Added a warning when a texture can't be created in D3D driver --- .../3d/driver/direct3d/driver_direct3d_texture.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp index 2cd16bf1c..cfafaf5f9 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d_texture.cpp @@ -442,7 +442,7 @@ bool CDriverD3D::generateD3DTexture (ITexture& tex, bool textureDegradation, D3D if (d3dtext->Texture == NULL) { // profiling: count TextureMemory usage. - uint32 textureMeory = computeTextureMemoryUsage (width, height, levels, destFormat, cube); + uint32 textureMemory = computeTextureMemoryUsage (width, height, levels, destFormat, cube); // Create the texture bool createSuccess; @@ -465,7 +465,14 @@ bool CDriverD3D::generateD3DTexture (ITexture& tex, bool textureDegradation, D3D _DeviceInterface->SetSamplerState(0, D3DSAMP_ADDRESSW, D3DTADDRESS_CLAMP); } - createSuccess = _DeviceInterface->CreateTexture (width, height, levels, renderTarget?D3DUSAGE_RENDERTARGET:0, destFormat, renderTarget?D3DPOOL_DEFAULT:D3DPOOL_MANAGED, &(d3dtext->Texture2d), NULL) == D3D_OK; + HRESULT hr = _DeviceInterface->CreateTexture (width, height, levels, renderTarget?D3DUSAGE_RENDERTARGET:0, destFormat, renderTarget?D3DPOOL_DEFAULT:D3DPOOL_MANAGED, &(d3dtext->Texture2d), NULL); + + if (hr != D3D_OK) + { + nlwarning("CreateTexture failed with code 0x%x for texture %s in %ux%u", hr, tex.getShareName().c_str(), width, height); + } + + createSuccess = hr == D3D_OK; d3dtext->Texture = d3dtext->Texture2d; } @@ -473,7 +480,7 @@ bool CDriverD3D::generateD3DTexture (ITexture& tex, bool textureDegradation, D3D return false; // Stats - d3dtext->TextureMemory = textureMeory; + d3dtext->TextureMemory = textureMemory; _AllocatedTextureMemory += d3dtext->TextureMemory; // Copy parameters