Commit d42cf4ed by Geoff Lang Committed by Shannon Woods

D3D9 will now use D3DFMT_R5G6B5 textures when GL_RGB565 is requested if the device supports it.

TRAC #23279 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods Author: Geoff Lang
parent 42b8b908
......@@ -163,6 +163,7 @@ class Renderer
virtual bool getFloat16TextureSupport() const= 0;
virtual bool getFloat16TextureFilteringSupport() const= 0;
virtual bool getFloat16TextureRenderingSupport() const = 0;
virtual bool getRGB565TextureSupport() const = 0;
virtual bool getLuminanceTextureSupport() const = 0;
virtual bool getLuminanceAlphaTextureSupport() const = 0;
bool getVertexTextureSupport() const { return getMaxVertexTextureImageUnits() > 0; }
......
......@@ -2110,6 +2110,11 @@ bool Renderer11::getFloat16TextureRenderingSupport() const
return mFloat16RenderSupport;
}
bool Renderer11::getRGB565TextureSupport() const
{
return false;
}
bool Renderer11::getLuminanceTextureSupport() const
{
return false;
......
......@@ -105,6 +105,7 @@ class Renderer11 : public Renderer
virtual bool getFloat16TextureSupport() const;
virtual bool getFloat16TextureFilteringSupport() const;
virtual bool getFloat16TextureRenderingSupport() const;
virtual bool getRGB565TextureSupport() const;
virtual bool getLuminanceTextureSupport() const;
virtual bool getLuminanceAlphaTextureSupport() const;
virtual unsigned int getMaxVertexTextureImageUnits() const;
......
......@@ -380,6 +380,10 @@ EGLint Renderer9::initialize()
SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
D3DUSAGE_QUERY_VERTEXTEXTURE, D3DRTYPE_TEXTURE, D3DFMT_R16F));
// Check RGB565 texture support
mRGB565TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format,
D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, D3DFMT_R5G6B5));
// Check depth texture support
// we use INTZ for depth textures in Direct3D9
// we also want NULL texture support to ensure the we can make depth-only FBOs
......@@ -2243,6 +2247,11 @@ bool Renderer9::getFloat16TextureRenderingSupport() const
return mFloat16RenderSupport;
}
bool Renderer9::getRGB565TextureSupport() const
{
return mRGB565TextureSupport;
}
bool Renderer9::getLuminanceTextureSupport() const
{
return mLuminanceTextureSupport;
......
......@@ -120,6 +120,7 @@ class Renderer9 : public Renderer
virtual bool getFloat16TextureSupport() const;
virtual bool getFloat16TextureFilteringSupport() const;
virtual bool getFloat16TextureRenderingSupport() const;
virtual bool getRGB565TextureSupport() const;
virtual bool getLuminanceTextureSupport() const;
virtual bool getLuminanceAlphaTextureSupport() const;
virtual unsigned int getMaxVertexTextureImageUnits() const;
......@@ -272,6 +273,8 @@ class Renderer9 : public Renderer
bool mDepthTextureSupport;
bool mRGB565TextureSupport;
bool mFloat32TextureSupport;
bool mFloat32FilterSupport;
bool mFloat32RenderSupport;
......
......@@ -112,7 +112,7 @@ static D3D9FormatMap BuildD3D9FormatMap()
map.insert(D3D9FormatPair(GL_ALPHA8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, FallbackLoadFunction<gl::supportsSSE2, loadAlphaDataToBGRASSE2, loadAlphaDataToBGRA>)));
map.insert(D3D9FormatPair(GL_RGB8_OES, D3D9FormatInfo(D3D9Format<D3DFMT_X8R8G8B8>, D3D9Format<D3DFMT_X8R8G8B8>, SimpleLoad<loadRGBUByteDataToBGRX> )));
map.insert(D3D9FormatPair(GL_RGB565, D3D9FormatInfo(D3D9Format<D3DFMT_X8R8G8B8>, D3D9Format<D3DFMT_R5G6B5>, SimpleLoad<loadRGB565DataToBGRA> )));
map.insert(D3D9FormatPair(GL_RGB565, D3D9FormatInfo(CheckFormatSupport<&Renderer9::getRGB565TextureSupport, D3DFMT_R5G6B5, D3DFMT_X8R8G8B8>, CheckFormatSupport<&Renderer9::getRGB565TextureSupport, D3DFMT_R5G6B5, D3DFMT_X8R8G8B8>, RendererCheckLoad<&Renderer9::getRGB565TextureSupport, loadToNative<GLushort, 1>, loadRGB565DataToBGRA>)));
map.insert(D3D9FormatPair(GL_RGBA8_OES, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, FallbackLoadFunction<gl::supportsSSE2, loadRGBAUByteDataToBGRASSE2, loadRGBAUByteDataToBGRA>)));
map.insert(D3D9FormatPair(GL_RGBA4, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA4444DataToBGRA> )));
map.insert(D3D9FormatPair(GL_RGB5_A1, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA5551DataToBGRA> )));
......
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