Commit ed321197 authored by nadro's avatar nadro

- Solved issue related to crash at screenshot unit test.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4991 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 1ec89f0d
...@@ -50,6 +50,26 @@ namespace video ...@@ -50,6 +50,26 @@ namespace video
/** The following formats may only be used for render target textures. */ /** The following formats may only be used for render target textures. */
/** Floating point formats. */
//! 16 bit format using 16 bits for the red channel.
ECF_R16F,
//! 32 bit format using 16 bits for the red and green channels.
ECF_G16R16F,
//! 64 bit format using 16 bits for the red, green, blue and alpha channels.
ECF_A16B16G16R16F,
//! 32 bit format using 32 bits for the red channel.
ECF_R32F,
//! 64 bit format using 32 bits for the red and green channels.
ECF_G32R32F,
//! 128 bit format using 32 bits for the red, green, blue and alpha channels.
ECF_A32B32G32R32F,
/** Depth and stencil formats. */ /** Depth and stencil formats. */
//! 16 bit format using 16 bits for depth. //! 16 bit format using 16 bits for depth.
...@@ -75,26 +95,6 @@ namespace video ...@@ -75,26 +95,6 @@ namespace video
//! 32 bit format using 16 bits for the red and green channels. //! 32 bit format using 16 bits for the red and green channels.
ECF_R16G16, ECF_R16G16,
/** Floating point formats. */
//! 16 bit format using 16 bits for the red channel.
ECF_R16F,
//! 32 bit format using 16 bits for the red and green channels.
ECF_G16R16F,
//! 64 bit format using 16 bits for the red, green, blue and alpha channels.
ECF_A16B16G16R16F,
//! 32 bit format using 32 bits for the red channel.
ECF_R32F,
//! 64 bit format using 32 bits for the red and green channels.
ECF_G32R32F,
//! 128 bit format using 32 bits for the red, green, blue and alpha channels.
ECF_A32B32G32R32F,
//! Unknown color format: //! Unknown color format:
ECF_UNKNOWN ECF_UNKNOWN
}; };
......
...@@ -3314,13 +3314,16 @@ IImage* CD3D9Driver::createScreenShot(video::ECOLOR_FORMAT format, video::E_REND ...@@ -3314,13 +3314,16 @@ IImage* CD3D9Driver::createScreenShot(video::ECOLOR_FORMAT format, video::E_REND
if (target != video::ERT_FRAME_BUFFER) if (target != video::ERT_FRAME_BUFFER)
return 0; return 0;
if (format==video::ECF_UNKNOWN)
format=getColorFormat();
if (IImage::isRenderTargetOnlyFormat(format) || IImage::isCompressedFormat(format) || IImage::isDepthFormat(format))
return 0;
// query the screen dimensions of the current adapter // query the screen dimensions of the current adapter
D3DDISPLAYMODE displayMode; D3DDISPLAYMODE displayMode;
pID3DDevice->GetDisplayMode(0, &displayMode); pID3DDevice->GetDisplayMode(0, &displayMode);
if (format==video::ECF_UNKNOWN)
format=video::ECF_A8R8G8B8;
// create the image surface to store the front buffer image [always A8R8G8B8] // create the image surface to store the front buffer image [always A8R8G8B8]
HRESULT hr; HRESULT hr;
LPDIRECT3DSURFACE9 lpSurface; LPDIRECT3DSURFACE9 lpSurface;
......
...@@ -4653,13 +4653,13 @@ void COpenGLDriver::clearZBuffer() ...@@ -4653,13 +4653,13 @@ void COpenGLDriver::clearZBuffer()
//! Returns an image created from the last rendered frame. //! Returns an image created from the last rendered frame.
IImage* COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RENDER_TARGET target) IImage* COpenGLDriver::createScreenShot(video::ECOLOR_FORMAT format, video::E_RENDER_TARGET target)
{ {
if (target==video::ERT_MULTI_RENDER_TEXTURES || target==video::ERT_RENDER_TEXTURE || target==video::ERT_STEREO_BOTH_BUFFERS) if (target != video::ERT_FRAME_BUFFER)
return 0; return 0;
if (format==video::ECF_UNKNOWN) if (format==video::ECF_UNKNOWN)
format=getColorFormat(); format=getColorFormat();
if (IImage::isRenderTargetOnlyFormat(format)) if (IImage::isRenderTargetOnlyFormat(format) || IImage::isCompressedFormat(format) || IImage::isDepthFormat(format))
return 0; return 0;
// allows to read pixels in top-to-bottom order // allows to read pixels in top-to-bottom order
......
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