Commit a649829f authored by hybrid's avatar hybrid

Some minor changes from the RTT patch.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1606 dfc29bdd-3216-0410-991c-e03cc46cb475
parent bae1cd68
...@@ -156,6 +156,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<s32>& screenSize, ...@@ -156,6 +156,7 @@ bool CD3D9Driver::initDriver(const core::dimension2d<s32>& screenSize,
{ {
HRESULT hr; HRESULT hr;
Fullscreen = fullScreen; Fullscreen = fullScreen;
CurrentDepthBufferSize = screenSize;
if (!pID3D) if (!pID3D)
{ {
...@@ -711,10 +712,10 @@ bool CD3D9Driver::setRenderTarget(video::ITexture* texture, ...@@ -711,10 +712,10 @@ bool CD3D9Driver::setRenderTarget(video::ITexture* texture,
return false; return false;
} }
if (texture && (tex->getSize().Width > ScreenSize.Width || if (texture && (tex->getSize().Width > CurrentDepthBufferSize.Width ||
tex->getSize().Height > ScreenSize.Height )) tex->getSize().Height > CurrentDepthBufferSize.Height))
{ {
os::Printer::log("Error: Tried to set a render target texture which is bigger than the screen.", ELL_ERROR); os::Printer::log("Error: Tried to set a render target texture which is bigger than the depth buffer.", ELL_ERROR);
return false; return false;
} }
...@@ -782,7 +783,7 @@ bool CD3D9Driver::setRenderTarget(video::ITexture* texture, ...@@ -782,7 +783,7 @@ bool CD3D9Driver::setRenderTarget(video::ITexture* texture,
void CD3D9Driver::setViewPort(const core::rect<s32>& area) void CD3D9Driver::setViewPort(const core::rect<s32>& area)
{ {
core::rect<s32> vp = area; core::rect<s32> vp = area;
core::rect<s32> rendert(0,0, ScreenSize.Width, ScreenSize.Height); core::rect<s32> rendert(0,0, getCurrentRenderTargetSize().Width, getCurrentRenderTargetSize().Height);
vp.clipAgainst(rendert); vp.clipAgainst(rendert);
D3DVIEWPORT9 viewPort; D3DVIEWPORT9 viewPort;
......
...@@ -314,6 +314,7 @@ namespace video ...@@ -314,6 +314,7 @@ namespace video
IDirect3DSurface9* PrevRenderTarget; IDirect3DSurface9* PrevRenderTarget;
core::dimension2d<s32> CurrentRendertargetSize; core::dimension2d<s32> CurrentRendertargetSize;
core::dimension2d<s32> CurrentDepthBufferSize;
void* WindowId; void* WindowId;
core::rect<s32>* SceneSourceRect; core::rect<s32>* SceneSourceRect;
......
...@@ -108,8 +108,18 @@ CD3D9Texture::~CD3D9Texture() ...@@ -108,8 +108,18 @@ CD3D9Texture::~CD3D9Texture()
void CD3D9Texture::createRenderTarget() void CD3D9Texture::createRenderTarget()
{ {
TextureSize.Width = getTextureSizeFromSurfaceSize(TextureSize.Width); // are texture size restrictions there ?
TextureSize.Height = getTextureSizeFromSurfaceSize(TextureSize.Height); if(!Driver->queryFeature(EVDF_TEXTURE_NPOT))
{
TextureSize.Width = getTextureSizeFromSurfaceSize(TextureSize.Width);
if (TextureSize.Width>1) // remove when larger RTTs are supported
TextureSize.Width >>= 1;
TextureSize.Height = getTextureSizeFromSurfaceSize(TextureSize.Height);
if (TextureSize.Height>1) // remove when larger RTTs are supported
TextureSize.Height >>= 1;
os::Printer::log("RenderTarget size has to be a power of 2",ELL_WARNING);
}
// get backbuffer format to create the render target in the // get backbuffer format to create the render target in the
// same format // same format
...@@ -152,7 +162,18 @@ void CD3D9Texture::createRenderTarget() ...@@ -152,7 +162,18 @@ void CD3D9Texture::createRenderTarget()
ColorFormat = getColorFormatFromD3DFormat(d3DFormat); ColorFormat = getColorFormatFromD3DFormat(d3DFormat);
if (FAILED(hr)) if (FAILED(hr))
os::Printer::log("Could not create render target texture"); {
if (D3DERR_INVALIDCALL == hr)
os::Printer::log("Could not create render target texture", "Invalid Call");
else
if (D3DERR_OUTOFVIDEOMEMORY == hr)
os::Printer::log("Could not create render target texture", "Out of Video Memory");
else
if (E_OUTOFMEMORY == hr)
os::Printer::log("Could not create render target texture", "Out of Memory");
else
os::Printer::log("Could not create render target texture");
}
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment