Commit 632192dd by Geoff Lang

Added support for EXT_texture_rg in D3D9 and D3D11.

TRAC #22423 Signed-off-by: Jamie Madill Signed-off-by: Shannon Woods
parent 4133f5c2
Name
EXT_texture_rg
Name Strings
GL_EXT_texture_rg
Contributors
Contributors to ARB_texture_rg, on which this extension is based
Kyle Haughey
Richard Schreyer
Contact
Benj Lipchak, Apple (lipchak 'at' apple.com)
Status
Complete
Version
Date: July 22, 2011
Revision: 3
Number
OpenGL ES Extension #103
Dependencies
Requires OpenGL ES 2.0.
Written based on the wording of the OpenGL ES 2.0.25 Full Specification
(November 2, 2010).
OES_texture_float affects the definition of this extension.
OES_texture_half_float affects the definition of this extension.
APPLE_framebuffer_multisample affects the definition of this extension.
Overview
Historically one- and two-component textures have been specified in OpenGL
ES using the luminance or luminance-alpha (L/LA) formats. With the advent
of programmable shaders and render-to-texture capabilities these legacy
formats carry some historical artifacts which are no longer useful.
For example, when sampling from such textures, the luminance values are
replicated across the color components. This is no longer necessary with
programmable shaders.
It is also desirable to be able to render to one- and two-component format
textures using capabilities such as framebuffer objects (FBO), but
rendering to L/LA formats is under-specified (specifically how to map
R/G/B/A values to L/A texture channels).
This extension adds new base internal formats for one-component RED and
two-component RG (red green) textures as well as sized RED and RG internal
formats for renderbuffers. The RED and RG texture formats can be used for
both texturing and rendering into with framebuffer objects.
New Procedures and Functions
None
New Tokens
Accepted by the <internalformat> parameter of TexImage2D and CopyTexImage2D,
and the <format> parameter of TexImage2D, TexSubImage2D, and ReadPixels:
RED_EXT 0x1903
RG_EXT 0x8227
Accepted by the <internalformat> parameter of RenderbufferStorage and
RenderbufferStorageMultisampleAPPLE:
R8_EXT 0x8229
RG8_EXT 0x822B
Additions to Chapter 2 of the OpenGL ES 2.0 Specification (OpenGL ES Operation)
None
Additions to Chapter 3 of the OpenGL ES 2.0 Specification (Rasterization)
(Add the following to Table 3.3: "TexImage2D and ReadPixels formats")
Format Name Element Meaning and Order Target Buffer
----------- ------------------------- -------------
RED_EXT R Color
RG_EXT R, G Color
(Add the following to Table 3.4: "Valid pixel format and type combinations")
(as modified by OES_texture_float and OES_texture_half_float)
Format Type Bytes per Pixel
----------- ------------------------- ---------------
RED_EXT FLOAT 4
RED_EXT HALF_FLOAT_OES 2
RED_EXT UNSIGNED_BYTE 1
RG_EXT FLOAT 8
RG_EXT HALF_FLOAT_OES 4
RG_EXT UNSIGNED_BYTE 2
(Add the following to Table 3.8: "Conversion from RGBA and depth pixel
components to internal texture")
Base Internal Format RGBA Internal Components
-------------------- ------ -------------------
RED_EXT R R
RG_EXT R,G R,G
(Modify Table 3.9: "CopyTexImage internal format/color buffer combinations")
Texture Format
Color Buffer A L LA R RG RGB RGBA
------------ - - -- - -- --- ----
A X
R X X
RG X X X
RGB X X X X
RGBA X X X X X X X
(Add the following to Table 3.12: "Correspondence of filtered texture
components to texture source color components")
Texture Base Texture source color
Internal Format C_s A_s
--------------- ------------- ------
RED_EXT (R_t, 0, 0) 1
RG_EXT (R_t, G_t, 0) 1
Additions to Chapter 4 of the OpenGL ES 2.0 Specification (Per-Fragment
Operations and the Framebuffer)
In section 4.3.1 "Reading Pixels", subsection "Obtaining Pixels from the
Framebuffer", modify the last sentence to read:
"If the framebuffer does not support G, B, or A values then the G, B, and A
values that are obtained are 0.0, 0.0, and 1.0 respectively."
In section 4.4.5 "Framebuffer Completeness", modify the last sentence of
the second paragraph to read:
"Color-renderable formats contain red, and possibly green, blue, and alpha
components; depth-renderable formats contain depth components; and
stencil-renderable formats contain stencil components."
(Add the following to Table 4.5: "Renderbuffer image formats, showing their
renderable type (color-, depth-, or stencil-renderable) and the number of
bits each format contains for color (R, G, B, A), depth (D), and stencil
(S) components")
Sized Internal Renderable Type R bits G bits B bits A bits D bits S bits
Format
-------------- ---------------- ------ ------ ------ ------ ------ ------
R8_EXT color-renderable 8
RG8_EXT color-renderable 8 8
Additions to Chapter 5 of the OpenGL ES 2.0 Specification (Special Functions)
None
Additions to Chapter 6 of the OpenGL ES 2.0 Specification (State and State
Requests)
None
Dependencies on OES_texture_float
If OES_texture_float is not supported, then omit the rows of
Table 3.4 that have Type FLOAT.
Dependencies on OES_texture_half_float
If OES_texture_half_float is not supported, then omit the rows of
Table 3.4 that have Type HALF_FLOAT_OES.
Dependencies on APPLE_framebuffer_multisample
If APPLE_framebuffer_multisample is not supported, then all references to
RenderbufferStorageMultisampleAPPLE should be ignored.
Revision History
#1 February 22, 2011, khaughey
- initial version adapted from ARB_texture_rg.
#2 June 16, 2011, benj
- add interaction with APPLE_framebuffer_multisample
#3 July 22, 2011, benj
- rename from APPLE to EXT
...@@ -343,6 +343,7 @@ void Context::makeCurrent(egl::Surface *surface) ...@@ -343,6 +343,7 @@ void Context::makeCurrent(egl::Surface *surface)
mSupportsFloat16RenderableTextures = mRenderer->getFloat16TextureRenderingSupport(); mSupportsFloat16RenderableTextures = mRenderer->getFloat16TextureRenderingSupport();
mSupportsLuminanceTextures = mRenderer->getLuminanceTextureSupport(); mSupportsLuminanceTextures = mRenderer->getLuminanceTextureSupport();
mSupportsLuminanceAlphaTextures = mRenderer->getLuminanceAlphaTextureSupport(); mSupportsLuminanceAlphaTextures = mRenderer->getLuminanceAlphaTextureSupport();
mSupportsRGTextures = mRenderer->getRGTextureSupport();
mSupportsDepthTextures = mRenderer->getDepthTextureSupport(); mSupportsDepthTextures = mRenderer->getDepthTextureSupport();
mSupportsTextureFilterAnisotropy = mRenderer->getTextureFilterAnisotropySupport(); mSupportsTextureFilterAnisotropy = mRenderer->getTextureFilterAnisotropySupport();
mSupports32bitIndices = mRenderer->get32BitIndexSupport(); mSupports32bitIndices = mRenderer->get32BitIndexSupport();
...@@ -3107,6 +3108,11 @@ bool Context::supportsLuminanceAlphaTextures() const ...@@ -3107,6 +3108,11 @@ bool Context::supportsLuminanceAlphaTextures() const
return mSupportsLuminanceAlphaTextures; return mSupportsLuminanceAlphaTextures;
} }
bool Context::supportsRGTextures() const
{
return mSupportsRGTextures;
}
bool Context::supportsDepthTextures() const bool Context::supportsDepthTextures() const
{ {
return mSupportsDepthTextures; return mSupportsDepthTextures;
...@@ -3526,6 +3532,11 @@ void Context::initExtensionString() ...@@ -3526,6 +3532,11 @@ void Context::initExtensionString()
mExtensionStringList.push_back("GL_OES_texture_float_linear"); mExtensionStringList.push_back("GL_OES_texture_float_linear");
} }
if (supportsRGTextures())
{
mExtensionStringList.push_back("GL_EXT_texture_rg");
}
if (supportsNonPower2Texture()) if (supportsNonPower2Texture())
{ {
mExtensionStringList.push_back("GL_OES_texture_npot"); mExtensionStringList.push_back("GL_OES_texture_npot");
......
...@@ -422,6 +422,7 @@ class Context ...@@ -422,6 +422,7 @@ class Context
bool supportsFloat16RenderableTextures() const; bool supportsFloat16RenderableTextures() const;
bool supportsLuminanceTextures() const; bool supportsLuminanceTextures() const;
bool supportsLuminanceAlphaTextures() const; bool supportsLuminanceAlphaTextures() const;
bool supportsRGTextures() const;
bool supportsDepthTextures() const; bool supportsDepthTextures() const;
bool supports32bitIndices() const; bool supports32bitIndices() const;
bool supportsNonPower2Texture() const; bool supportsNonPower2Texture() const;
...@@ -544,6 +545,7 @@ class Context ...@@ -544,6 +545,7 @@ class Context
bool mSupportsFloat16RenderableTextures; bool mSupportsFloat16RenderableTextures;
bool mSupportsLuminanceTextures; bool mSupportsLuminanceTextures;
bool mSupportsLuminanceAlphaTextures; bool mSupportsLuminanceAlphaTextures;
bool mSupportsRGTextures;
bool mSupportsDepthTextures; bool mSupportsDepthTextures;
bool mSupports32bitIndices; bool mSupports32bitIndices;
bool mSupportsTextureFilterAnisotropy; bool mSupportsTextureFilterAnisotropy;
......
...@@ -60,6 +60,14 @@ FormatMap BuildES2FormatMap() ...@@ -60,6 +60,14 @@ FormatMap BuildES2FormatMap()
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, WriteColor<L32A32F, GLfloat> ); InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, WriteColor<L32A32F, GLfloat> );
InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_LUMINANCE_ALPHA16F_EXT, WriteColor<L16A16F, GLfloat> ); InsertFormatMapping(&map, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_LUMINANCE_ALPHA16F_EXT, WriteColor<L16A16F, GLfloat> );
InsertFormatMapping(&map, GL_RED, GL_UNSIGNED_BYTE, GL_R8_EXT, WriteColor<R8, GLfloat> );
InsertFormatMapping(&map, GL_RED, GL_FLOAT, GL_R32F_EXT, WriteColor<R32F, GLfloat> );
InsertFormatMapping(&map, GL_RED, GL_HALF_FLOAT_OES, GL_R16F_EXT, WriteColor<R16F, GLfloat> );
InsertFormatMapping(&map, GL_RG, GL_UNSIGNED_BYTE, GL_RG8_EXT, WriteColor<R8G8, GLfloat> );
InsertFormatMapping(&map, GL_RG, GL_FLOAT, GL_RG32F_EXT, WriteColor<R32G32F, GLfloat> );
InsertFormatMapping(&map, GL_RG, GL_HALF_FLOAT_OES, GL_RG16F_EXT, WriteColor<R16G16F, GLfloat> );
InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB8_OES, WriteColor<R8G8B8, GLfloat> ); InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_BYTE, GL_RGB8_OES, WriteColor<R8G8B8, GLfloat> );
InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB565, WriteColor<R5G6B5, GLfloat> ); InsertFormatMapping(&map, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_RGB565, WriteColor<R5G6B5, GLfloat> );
InsertFormatMapping(&map, GL_RGB, GL_FLOAT, GL_RGB32F_EXT, WriteColor<R32G32B32F, GLfloat> ); InsertFormatMapping(&map, GL_RGB, GL_FLOAT, GL_RGB32F_EXT, WriteColor<R32G32B32F, GLfloat> );
...@@ -792,6 +800,8 @@ static InternalFormatInfoMap BuildES2InternalFormatInfoMap() ...@@ -792,6 +800,8 @@ static InternalFormatInfoMap BuildES2InternalFormatInfoMap()
map.insert(InternalFormatInfoPair(GL_RGB565, InternalFormatInfo::RGBAFormat( 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_RGB565, InternalFormatInfo::RGBAFormat( 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
// Extension formats // Extension formats
map.insert(InternalFormatInfoPair(GL_R8_EXT, InternalFormatInfo::RGBAFormat( 8, 0, 0, 0, 0, GL_RED_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures>)));
map.insert(InternalFormatInfoPair(GL_RG8_EXT, InternalFormatInfo::RGBAFormat( 8, 8, 0, 0, 0, GL_RG_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures>)));
map.insert(InternalFormatInfoPair(GL_RGB8_OES, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_RGB8_OES, InternalFormatInfo::RGBAFormat( 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_RGBA8_OES, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_RGBA8_OES, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_BGRA8_EXT, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_BGRA8_EXT, InternalFormatInfo::RGBAFormat( 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, AlwaysSupported, AlwaysSupported, AlwaysSupported)));
...@@ -801,6 +811,10 @@ static InternalFormatInfoMap BuildES2InternalFormatInfoMap() ...@@ -801,6 +811,10 @@ static InternalFormatInfoMap BuildES2InternalFormatInfoMap()
// Floating point formats have to query the renderer for support // Floating point formats have to query the renderer for support
// | Internal format | | R | G | B | A |S | Format | Type | Comp | SRGB | Color renderable | Texture filterable | Supported | // | Internal format | | R | G | B | A |S | Format | Type | Comp | SRGB | Color renderable | Texture filterable | Supported |
// | | | | | | | | | | type | | | | | // | | | | | | | | | | type | | | | |
map.insert(InternalFormatInfoPair(GL_R16F_EXT, InternalFormatInfo::RGBAFormat(16, 0, 0, 0, 0, GL_RED, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
map.insert(InternalFormatInfoPair(GL_R32F_EXT, InternalFormatInfo::RGBAFormat(32, 0, 0, 0, 0, GL_RED, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
map.insert(InternalFormatInfoPair(GL_RG16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 0, 0, 0, GL_RG, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
map.insert(InternalFormatInfoPair(GL_RG32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 0, 0, 0, GL_RG, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures, &rx::Renderer::getRGTextureSupport>, CheckSupport<&Context::supportsRGTextures> )));
map.insert(InternalFormatInfoPair(GL_RGB16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>))); map.insert(InternalFormatInfoPair(GL_RGB16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 0, 0, GL_RGB, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>)));
map.insert(InternalFormatInfoPair(GL_RGB32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, CheckSupport<&Context::supportsFloat32Textures>))); map.insert(InternalFormatInfoPair(GL_RGB32F_EXT, InternalFormatInfo::RGBAFormat(32, 32, 32, 0, 0, GL_RGB, GL_FLOAT, GL_FLOAT, false, CheckSupport<&Context::supportsFloat32RenderableTextures, &rx::Renderer::getFloat32TextureRenderingSupport>, CheckSupport<&Context::supportsFloat32LinearFilter, &rx::Renderer::getFloat32TextureFilteringSupport>, CheckSupport<&Context::supportsFloat32Textures>)));
map.insert(InternalFormatInfoPair(GL_RGBA16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>))); map.insert(InternalFormatInfoPair(GL_RGBA16F_EXT, InternalFormatInfo::RGBAFormat(16, 16, 16, 16, 0, GL_RGBA, GL_HALF_FLOAT_OES, GL_FLOAT, false, CheckSupport<&Context::supportsFloat16RenderableTextures, &rx::Renderer::getFloat16TextureRenderingSupport>, CheckSupport<&Context::supportsFloat16LinearFilter, &rx::Renderer::getFloat16TextureFilteringSupport>, CheckSupport<&Context::supportsFloat16Textures>)));
...@@ -819,6 +833,8 @@ static InternalFormatInfoMap BuildES2InternalFormatInfoMap() ...@@ -819,6 +833,8 @@ static InternalFormatInfoMap BuildES2InternalFormatInfoMap()
map.insert(InternalFormatInfoPair(GL_ALPHA, InternalFormatInfo::UnsizedFormat(GL_ALPHA, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_ALPHA, InternalFormatInfo::UnsizedFormat(GL_ALPHA, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_LUMINANCE, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_LUMINANCE, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE_ALPHA, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_LUMINANCE_ALPHA, InternalFormatInfo::UnsizedFormat(GL_LUMINANCE_ALPHA, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_RED_EXT, InternalFormatInfo::UnsizedFormat(GL_RED_EXT, CheckSupport<&Context::supportsRGTextures>)));
map.insert(InternalFormatInfoPair(GL_RG_EXT, InternalFormatInfo::UnsizedFormat(GL_RG_EXT, CheckSupport<&Context::supportsRGTextures>)));
map.insert(InternalFormatInfoPair(GL_RGB, InternalFormatInfo::UnsizedFormat(GL_RGB, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_RGB, InternalFormatInfo::UnsizedFormat(GL_RGB, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_RGBA, InternalFormatInfo::UnsizedFormat(GL_RGBA, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_RGBA, InternalFormatInfo::UnsizedFormat(GL_RGBA, AlwaysSupported)));
map.insert(InternalFormatInfoPair(GL_BGRA_EXT, InternalFormatInfo::UnsizedFormat(GL_BGRA_EXT, AlwaysSupported))); map.insert(InternalFormatInfoPair(GL_BGRA_EXT, InternalFormatInfo::UnsizedFormat(GL_BGRA_EXT, AlwaysSupported)));
......
...@@ -167,6 +167,7 @@ class Renderer ...@@ -167,6 +167,7 @@ class Renderer
virtual bool getRGB565TextureSupport() const = 0; virtual bool getRGB565TextureSupport() const = 0;
virtual bool getLuminanceTextureSupport() const = 0; virtual bool getLuminanceTextureSupport() const = 0;
virtual bool getLuminanceAlphaTextureSupport() const = 0; virtual bool getLuminanceAlphaTextureSupport() const = 0;
virtual bool getRGTextureSupport() const = 0;
bool getVertexTextureSupport() const { return getMaxVertexTextureImageUnits() > 0; } bool getVertexTextureSupport() const { return getMaxVertexTextureImageUnits() > 0; }
virtual unsigned int getMaxVertexTextureImageUnits() const = 0; virtual unsigned int getMaxVertexTextureImageUnits() const = 0;
virtual unsigned int getMaxCombinedTextureImageUnits() const = 0; virtual unsigned int getMaxCombinedTextureImageUnits() const = 0;
......
...@@ -316,6 +316,31 @@ EGLint Renderer11::initialize() ...@@ -316,6 +316,31 @@ EGLint Renderer11::initialize()
} }
} }
DXGI_FORMAT rgTextureFormats[] =
{
DXGI_FORMAT_R8_UNORM,
DXGI_FORMAT_R8G8_UNORM,
DXGI_FORMAT_R16_FLOAT,
DXGI_FORMAT_R16G16_FLOAT,
DXGI_FORMAT_R32_FLOAT,
DXGI_FORMAT_R32G32_FLOAT,
};
mRGTextureSupport = true;
for (unsigned int i = 0; i < ArraySize(rgTextureFormats); i++)
{
if (SUCCEEDED(mDevice->CheckFormatSupport(rgTextureFormats[i], &formatSupport)))
{
mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredTextureFlags) == requiredTextureFlags;
mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredFilterFlags) == requiredFilterFlags;
mRGTextureSupport = mRGTextureSupport && (formatSupport & requiredRenderableFlags) == requiredRenderableFlags;
}
else
{
mRGTextureSupport = false;
}
}
// Check compressed texture support // Check compressed texture support
const unsigned int requiredCompressedTextureFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D; const unsigned int requiredCompressedTextureFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D;
...@@ -1871,6 +1896,11 @@ bool Renderer11::getLuminanceAlphaTextureSupport() const ...@@ -1871,6 +1896,11 @@ bool Renderer11::getLuminanceAlphaTextureSupport() const
return false; return false;
} }
bool Renderer11::getRGTextureSupport() const
{
return mRGTextureSupport;
}
bool Renderer11::getTextureFilterAnisotropySupport() const bool Renderer11::getTextureFilterAnisotropySupport() const
{ {
return true; return true;
......
...@@ -112,6 +112,7 @@ class Renderer11 : public Renderer ...@@ -112,6 +112,7 @@ class Renderer11 : public Renderer
virtual bool getRGB565TextureSupport() const; virtual bool getRGB565TextureSupport() const;
virtual bool getLuminanceTextureSupport() const; virtual bool getLuminanceTextureSupport() const;
virtual bool getLuminanceAlphaTextureSupport() const; virtual bool getLuminanceAlphaTextureSupport() const;
virtual bool getRGTextureSupport() const;
virtual unsigned int getMaxVertexTextureImageUnits() const; virtual unsigned int getMaxVertexTextureImageUnits() const;
virtual unsigned int getMaxCombinedTextureImageUnits() const; virtual unsigned int getMaxCombinedTextureImageUnits() const;
virtual unsigned int getReservedVertexUniformVectors() const; virtual unsigned int getReservedVertexUniformVectors() const;
...@@ -262,6 +263,8 @@ class Renderer11 : public Renderer ...@@ -262,6 +263,8 @@ class Renderer11 : public Renderer
bool mDXT3TextureSupport; bool mDXT3TextureSupport;
bool mDXT5TextureSupport; bool mDXT5TextureSupport;
bool mRGTextureSupport;
bool mDepthTextureSupport; bool mDepthTextureSupport;
// Multisample format support // Multisample format support
......
...@@ -402,6 +402,14 @@ static D3D11ES2FormatMap BuildD3D11ES2FormatMap() ...@@ -402,6 +402,14 @@ static D3D11ES2FormatMap BuildD3D11ES2FormatMap()
map.insert(D3D11ES2FormatPair(GL_BGRA4_ANGLEX, D3D11ES2FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA4444DataToRGBA ))); map.insert(D3D11ES2FormatPair(GL_BGRA4_ANGLEX, D3D11ES2FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA4444DataToRGBA )));
map.insert(D3D11ES2FormatPair(GL_BGR5_A1_ANGLEX, D3D11ES2FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA5551DataToRGBA ))); map.insert(D3D11ES2FormatPair(GL_BGR5_A1_ANGLEX, D3D11ES2FormatInfo(DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_B8G8R8A8_UNORM, DXGI_FORMAT_UNKNOWN, loadRGBA5551DataToRGBA )));
// From GL_EXT_texture_rg
map.insert(D3D11ES2FormatPair(GL_R8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_R8_UNORM, DXGI_FORMAT_UNKNOWN, loadToNative<GLubyte, 1> )));
map.insert(D3D11ES2FormatPair(GL_R32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_R32_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLfloat, 1> )));
map.insert(D3D11ES2FormatPair(GL_R16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_R16_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLhalf, 1> )));
map.insert(D3D11ES2FormatPair(GL_RG8_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_R8G8_UNORM, DXGI_FORMAT_UNKNOWN, loadToNative<GLubyte, 2> )));
map.insert(D3D11ES2FormatPair(GL_RG32F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_R32G32_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLfloat, 2> )));
map.insert(D3D11ES2FormatPair(GL_RG16F_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_R16G16_FLOAT, DXGI_FORMAT_UNKNOWN, loadToNative<GLhalf, 2> )));
map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 8>))); map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGB_S3TC_DXT1_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 8>)));
map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 8>))); map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, D3D11ES2FormatInfo(DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_BC1_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 8>)));
map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, D3D11ES2FormatInfo(DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 16>))); map.insert(D3D11ES2FormatPair(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, D3D11ES2FormatInfo(DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_BC2_UNORM, DXGI_FORMAT_UNKNOWN, DXGI_FORMAT_UNKNOWN, loadCompressedBlockDataToNative<4, 4, 16>)));
......
...@@ -354,6 +354,8 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat) ...@@ -354,6 +354,8 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat)
case GL_RGBA: case GL_RGBA:
case GL_BGRA_EXT: case GL_BGRA_EXT:
case GL_RGB: case GL_RGB:
case GL_RG_EXT:
case GL_RED_EXT:
case GL_ALPHA: case GL_ALPHA:
okay = okay && setPixelShader(SHADER_PS_COMPONENTMASK); okay = okay && setPixelShader(SHADER_PS_COMPONENTMASK);
break; break;
...@@ -373,36 +375,94 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat) ...@@ -373,36 +375,94 @@ bool Blit9::setFormatConvertShaders(GLenum destFormat)
// The meaning of this constant depends on the shader that was selected. // The meaning of this constant depends on the shader that was selected.
// See the shader assembly code above for details. // See the shader assembly code above for details.
float psConst0[4] = { 0, 0, 0, 0 }; // Allocate one array for both registers and split it into two float4's.
float psConst[8] = { 0 };
float *multConst = &psConst[0];
float *addConst = &psConst[4];
switch (destFormat) switch (destFormat)
{ {
default: UNREACHABLE(); default: UNREACHABLE();
case GL_RGBA: case GL_RGBA:
case GL_BGRA_EXT: case GL_BGRA_EXT:
psConst0[X] = 1; multConst[X] = 1;
psConst0[Z] = 1; multConst[Y] = 1;
multConst[Z] = 1;
multConst[W] = 1;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 0;
break; break;
case GL_RGB: case GL_RGB:
psConst0[X] = 1; multConst[X] = 1;
psConst0[W] = 1; multConst[Y] = 1;
multConst[Z] = 1;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break;
case GL_RG_EXT:
multConst[X] = 1;
multConst[Y] = 1;
multConst[Z] = 0;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break;
case GL_RED_EXT:
multConst[X] = 1;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break; break;
case GL_ALPHA: case GL_ALPHA:
psConst0[Z] = 1; multConst[X] = 0;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 1;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 0;
break; break;
case GL_LUMINANCE: case GL_LUMINANCE:
psConst0[Y] = 1; multConst[X] = 1;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 0;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 1;
break; break;
case GL_LUMINANCE_ALPHA: case GL_LUMINANCE_ALPHA:
psConst0[X] = 1; multConst[X] = 1;
multConst[Y] = 0;
multConst[Z] = 0;
multConst[W] = 1;
addConst[X] = 0;
addConst[Y] = 0;
addConst[Z] = 0;
addConst[W] = 0;
break; break;
} }
mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst0, 1); mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst, 2);
return true; return true;
} }
...@@ -528,12 +588,12 @@ void Blit9::saveState() ...@@ -528,12 +588,12 @@ void Blit9::saveState()
setCommonBlitState(); setCommonBlitState();
static const float dummyConst[4] = { 0, 0, 0, 0 }; static const float dummyConst[8] = { 0 };
device->SetVertexShader(NULL); device->SetVertexShader(NULL);
device->SetVertexShaderConstantF(0, dummyConst, 1); device->SetVertexShaderConstantF(0, dummyConst, 2);
device->SetPixelShader(NULL); device->SetPixelShader(NULL);
device->SetPixelShaderConstantF(0, dummyConst, 1); device->SetPixelShaderConstantF(0, dummyConst, 2);
D3DVIEWPORT9 dummyVp; D3DVIEWPORT9 dummyVp;
dummyVp.X = 0; dummyVp.X = 0;
......
...@@ -454,6 +454,25 @@ EGLint Renderer9::initialize() ...@@ -454,6 +454,25 @@ EGLint Renderer9::initialize()
mFloat16TextureSupport = true; mFloat16TextureSupport = true;
} }
D3DFORMAT rgTextureFormats[] =
{
D3DFMT_R16F,
D3DFMT_G16R16F,
D3DFMT_R32F,
D3DFMT_G32R32F,
};
mRGTextureSupport = true;
for (unsigned int i = 0; i < ArraySize(rgTextureFormats); i++)
{
D3DFORMAT fmt = rgTextureFormats[i];
mRGTextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, D3DRTYPE_TEXTURE, fmt)) &&
SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, fmt)) &&
SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_QUERY_FILTER, D3DRTYPE_CUBETEXTURE, fmt)) &&
SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, D3DUSAGE_RENDERTARGET, D3DRTYPE_CUBETEXTURE, fmt));
}
// Check DXT texture support // Check DXT texture support
mDXT1TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1)); mDXT1TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT1));
mDXT3TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3)); mDXT3TextureSupport = SUCCEEDED(mD3d9->CheckDeviceFormat(mAdapter, mDeviceType, currentDisplayMode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_DXT3));
...@@ -2316,6 +2335,11 @@ bool Renderer9::getLuminanceAlphaTextureSupport() const ...@@ -2316,6 +2335,11 @@ bool Renderer9::getLuminanceAlphaTextureSupport() const
return mLuminanceAlphaTextureSupport; return mLuminanceAlphaTextureSupport;
} }
bool Renderer9::getRGTextureSupport() const
{
return mRGTextureSupport;
}
bool Renderer9::getTextureFilterAnisotropySupport() const bool Renderer9::getTextureFilterAnisotropySupport() const
{ {
return mSupportsTextureFilterAnisotropy; return mSupportsTextureFilterAnisotropy;
......
...@@ -125,6 +125,7 @@ class Renderer9 : public Renderer ...@@ -125,6 +125,7 @@ class Renderer9 : public Renderer
virtual bool getRGB565TextureSupport() const; virtual bool getRGB565TextureSupport() const;
virtual bool getLuminanceTextureSupport() const; virtual bool getLuminanceTextureSupport() const;
virtual bool getLuminanceAlphaTextureSupport() const; virtual bool getLuminanceAlphaTextureSupport() const;
virtual bool getRGTextureSupport() const;
virtual unsigned int getMaxVertexTextureImageUnits() const; virtual unsigned int getMaxVertexTextureImageUnits() const;
virtual unsigned int getMaxCombinedTextureImageUnits() const; virtual unsigned int getMaxCombinedTextureImageUnits() const;
virtual unsigned int getReservedVertexUniformVectors() const; virtual unsigned int getReservedVertexUniformVectors() const;
...@@ -300,6 +301,8 @@ class Renderer9 : public Renderer ...@@ -300,6 +301,8 @@ class Renderer9 : public Renderer
bool mLuminanceTextureSupport; bool mLuminanceTextureSupport;
bool mLuminanceAlphaTextureSupport; bool mLuminanceAlphaTextureSupport;
bool mRGTextureSupport;
struct MultisampleSupportInfo struct MultisampleSupportInfo
{ {
bool supportedSamples[D3DMULTISAMPLE_16_SAMPLES + 1]; bool supportedSamples[D3DMULTISAMPLE_16_SAMPLES + 1];
......
...@@ -100,12 +100,16 @@ static D3D9FormatMap BuildD3D9FormatMap() ...@@ -100,12 +100,16 @@ static D3D9FormatMap BuildD3D9FormatMap()
map.insert(D3D9FormatPair(GL_RGBA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_A32B32G32R32F>, SimpleLoad<loadToNative<GLfloat, 4> > ))); map.insert(D3D9FormatPair(GL_RGBA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_A32B32G32R32F>, SimpleLoad<loadToNative<GLfloat, 4> > )));
map.insert(D3D9FormatPair(GL_RGB32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_A32B32G32R32F>, SimpleLoad<loadToNative3To4<GLfloat, gl::Float32One> >))); map.insert(D3D9FormatPair(GL_RGB32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_A32B32G32R32F>, SimpleLoad<loadToNative3To4<GLfloat, gl::Float32One> >)));
map.insert(D3D9FormatPair(GL_RG32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_G32R32F>, D3D9Format<D3DFMT_G32R32F>, SimpleLoad<loadToNative<GLfloat, 2> > )));
map.insert(D3D9FormatPair(GL_R32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_R32F>, D3D9Format<D3DFMT_R32F>, SimpleLoad<loadToNative<GLfloat, 1> > )));
map.insert(D3D9FormatPair(GL_ALPHA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadAlphaFloatDataToRGBA> ))); map.insert(D3D9FormatPair(GL_ALPHA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadAlphaFloatDataToRGBA> )));
map.insert(D3D9FormatPair(GL_LUMINANCE32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceFloatDataToRGBA> ))); map.insert(D3D9FormatPair(GL_LUMINANCE32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceFloatDataToRGBA> )));
map.insert(D3D9FormatPair(GL_LUMINANCE_ALPHA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceAlphaFloatDataToRGBA> ))); map.insert(D3D9FormatPair(GL_LUMINANCE_ALPHA32F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A32B32G32R32F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceAlphaFloatDataToRGBA> )));
map.insert(D3D9FormatPair(GL_RGBA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_A16B16G16R16F>, SimpleLoad<loadToNative<GLhalf, 4>> ))); map.insert(D3D9FormatPair(GL_RGBA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_A16B16G16R16F>, SimpleLoad<loadToNative<GLhalf, 4> > )));
map.insert(D3D9FormatPair(GL_RGB16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_A16B16G16R16F>, SimpleLoad<loadRGBHalfFloatDataToRGBA> ))); map.insert(D3D9FormatPair(GL_RGB16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_A16B16G16R16F>, SimpleLoad<loadToNative3To4<GLhalf, gl::Float16One> >)));
map.insert(D3D9FormatPair(GL_RG16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_G16R16F>, D3D9Format<D3DFMT_G16R16F>, SimpleLoad<loadToNative<GLhalf, 2> > )));
map.insert(D3D9FormatPair(GL_R16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_R16F>, D3D9Format<D3DFMT_R16F>, SimpleLoad<loadToNative<GLhalf, 1> > )));
map.insert(D3D9FormatPair(GL_ALPHA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadAlphaHalfFloatDataToRGBA> ))); map.insert(D3D9FormatPair(GL_ALPHA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadAlphaHalfFloatDataToRGBA> )));
map.insert(D3D9FormatPair(GL_LUMINANCE16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceHalfFloatDataToRGBA> ))); map.insert(D3D9FormatPair(GL_LUMINANCE16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceHalfFloatDataToRGBA> )));
map.insert(D3D9FormatPair(GL_LUMINANCE_ALPHA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceAlphaHalfFloatDataToRGBA>))); map.insert(D3D9FormatPair(GL_LUMINANCE_ALPHA16F_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A16B16G16R16F>, D3D9Format<D3DFMT_UNKNOWN>, SimpleLoad<loadLuminanceAlphaHalfFloatDataToRGBA>)));
...@@ -117,6 +121,8 @@ static D3D9FormatMap BuildD3D9FormatMap() ...@@ -117,6 +121,8 @@ static D3D9FormatMap BuildD3D9FormatMap()
map.insert(D3D9FormatPair(GL_RGBA8_OES, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, FallbackLoadFunction<gl::supportsSSE2, loadRGBAUByteDataToBGRASSE2, loadRGBAUByteDataToBGRA>))); 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_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> ))); map.insert(D3D9FormatPair(GL_RGB5_A1, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA5551DataToBGRA> )));
map.insert(D3D9FormatPair(GL_R8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_X8R8G8B8>, D3D9Format<D3DFMT_X8R8G8B8>, SimpleLoad<loadRUByteDataToBGRX> )));
map.insert(D3D9FormatPair(GL_RG8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_X8R8G8B8>, D3D9Format<D3DFMT_X8R8G8B8>, SimpleLoad<loadRGUByteDataToBGRX> )));
map.insert(D3D9FormatPair(GL_BGRA8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadToNative<GLubyte, 4> > ))); map.insert(D3D9FormatPair(GL_BGRA8_EXT, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadToNative<GLubyte, 4> > )));
map.insert(D3D9FormatPair(GL_BGRA4_ANGLEX, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA4444DataToRGBA> ))); map.insert(D3D9FormatPair(GL_BGRA4_ANGLEX, D3D9FormatInfo(D3D9Format<D3DFMT_A8R8G8B8>, D3D9Format<D3DFMT_A8R8G8B8>, SimpleLoad<loadRGBA4444DataToRGBA> )));
...@@ -195,7 +201,11 @@ static D3D9FormatInfoMap BuildD3D9FormatInfoMap() ...@@ -195,7 +201,11 @@ static D3D9FormatInfoMap BuildD3D9FormatInfoMap()
map.insert(D3D9FormatInfoPair(D3DFMT_R5G6B5, D3DFormatInfo( 16, 1, 1, GL_RGB565, GenerateMip<R5G6B5>, ReadColor<R5G6B5, GLfloat> ))); map.insert(D3D9FormatInfoPair(D3DFMT_R5G6B5, D3DFormatInfo( 16, 1, 1, GL_RGB565, GenerateMip<R5G6B5>, ReadColor<R5G6B5, GLfloat> )));
map.insert(D3D9FormatInfoPair(D3DFMT_X8R8G8B8, D3DFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, ReadColor<B8G8R8A8, GLfloat> ))); map.insert(D3D9FormatInfoPair(D3DFMT_X8R8G8B8, D3DFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, ReadColor<B8G8R8A8, GLfloat> )));
map.insert(D3D9FormatInfoPair(D3DFMT_A8R8G8B8, D3DFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, ReadColor<B8G8R8A8, GLfloat> ))); map.insert(D3D9FormatInfoPair(D3DFMT_A8R8G8B8, D3DFormatInfo( 32, 1, 1, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, ReadColor<B8G8R8A8, GLfloat> )));
map.insert(D3D9FormatInfoPair(D3DFMT_R16F, D3DFormatInfo( 16, 1, 1, GL_R16F_EXT, GenerateMip<R16F>, ReadColor<R16F, GLfloat> )));
map.insert(D3D9FormatInfoPair(D3DFMT_G16R16F, D3DFormatInfo( 32, 1, 1, GL_RG16F_EXT, GenerateMip<R16G16F>, ReadColor<R16G16F, GLfloat> )));
map.insert(D3D9FormatInfoPair(D3DFMT_A16B16G16R16F, D3DFormatInfo( 64, 1, 1, GL_RGBA16F_EXT, GenerateMip<R16G16B16A16F>, ReadColor<R16G16B16A16F, GLfloat>))); map.insert(D3D9FormatInfoPair(D3DFMT_A16B16G16R16F, D3DFormatInfo( 64, 1, 1, GL_RGBA16F_EXT, GenerateMip<R16G16B16A16F>, ReadColor<R16G16B16A16F, GLfloat>)));
map.insert(D3D9FormatInfoPair(D3DFMT_R32F, D3DFormatInfo( 32, 1, 1, GL_R32F_EXT, GenerateMip<R32F>, ReadColor<R32F, GLfloat> )));
map.insert(D3D9FormatInfoPair(D3DFMT_G32R32F, D3DFormatInfo( 64, 1, 1, GL_RG32F_EXT, GenerateMip<R32G32F>, ReadColor<R32G32F, GLfloat> )));
map.insert(D3D9FormatInfoPair(D3DFMT_A32B32G32R32F, D3DFormatInfo(128, 1, 1, GL_RGBA32F_EXT, GenerateMip<R32G32B32A32F>, ReadColor<R32G32B32A32F, GLfloat>))); map.insert(D3D9FormatInfoPair(D3DFMT_A32B32G32R32F, D3DFormatInfo(128, 1, 1, GL_RGBA32F_EXT, GenerateMip<R32G32B32A32F>, ReadColor<R32G32B32A32F, GLfloat>)));
map.insert(D3D9FormatInfoPair(D3DFMT_D16, D3DFormatInfo( 16, 1, 1, GL_DEPTH_COMPONENT16, NULL, NULL ))); map.insert(D3D9FormatInfoPair(D3DFMT_D16, D3DFormatInfo( 16, 1, 1, GL_DEPTH_COMPONENT16, NULL, NULL )));
......
...@@ -6,34 +6,28 @@ ...@@ -6,34 +6,28 @@
sampler2D tex : s0; sampler2D tex : s0;
uniform float4 mode : c0; uniform float4 mult : c0;
uniform float4 add : c1;
// Passthrough Pixel Shader // Passthrough Pixel Shader
// Outputs texture 0 sampled at texcoord 0. // Outputs texture 0 sampled at texcoord 0.
float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR float4 passthroughps(float4 texcoord : TEXCOORD0) : COLOR
{ {
return tex2D(tex, texcoord.xy); return tex2D(tex, texcoord.xy);
}; };
// Luminance Conversion Pixel Shader // Luminance Conversion Pixel Shader
// Outputs sample(tex0, tc0).rrra. // Performs a mad operation using the LA data from the texture with mult.xw and add.xw.
// For LA output (pass A) set C0.X = 1, C0.Y = 0. // Returns data in the form of llla
// For L output (A = 1) set C0.X = 0, C0.Y = 1.
float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR float4 luminanceps(float4 texcoord : TEXCOORD0) : COLOR
{ {
float4 tmp = tex2D(tex, texcoord.xy); return (tex2D(tex, texcoord.xy).xw * mult.xw + add.xw).xxxy;
tmp.w = tmp.w * mode.x + mode.y;
return tmp.xxxw;
}; };
// RGB/A Component Mask Pixel Shader // RGB/A Component Mask Pixel Shader
// Outputs sample(tex0, tc0) with options to force RGB = 0 and/or A = 1. // Performs a mad operation using the texture's RGBA data with mult.xyzw and add.xyzw.
// To force RGB = 0, set C0.X = 0, otherwise C0.X = 1. // Returns data in the form of rgba
// To force A = 1, set C0.Z = 0, C0.W = 1, otherwise C0.Z = 1, C0.W = 0.
float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR float4 componentmaskps(float4 texcoord : TEXCOORD0) : COLOR
{ {
float4 tmp = tex2D(tex, texcoord.xy); return tex2D(tex, texcoord.xy) * mult + add;
tmp.xyz = tmp.xyz * mode.x;
tmp.w = tmp.w * mode.z + mode.w;
return tmp;
}; };
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
/// ///
// Parameters: // Parameters:
// //
// float4 mode; // float4 add;
// float4 mult;
// sampler2D tex; // sampler2D tex;
// //
// //
...@@ -13,7 +14,8 @@ ...@@ -13,7 +14,8 @@
// //
// Name Reg Size // Name Reg Size
// ------------ ----- ---- // ------------ ----- ----
// mode c0 1 // mult c0 1
// add c1 1
// tex s0 1 // tex s0 1
// //
...@@ -21,9 +23,9 @@ ...@@ -21,9 +23,9 @@
dcl t0.xy dcl t0.xy
dcl_2d s0 dcl_2d s0
texld r0, t0, s0 texld r0, t0, s0
mul r1.xyz, r0, c0.x mov r1, c0
mad r1.w, r0.w, c0.z, c0.w mad r0, r0, r1, c1
mov oC0, r1 mov oC0, r0
// approximately 4 instruction slots used (1 texture, 3 arithmetic) // approximately 4 instruction slots used (1 texture, 3 arithmetic)
#endif #endif
...@@ -31,23 +33,27 @@ ...@@ -31,23 +33,27 @@
const BYTE g_ps20_componentmaskps[] = const BYTE g_ps20_componentmaskps[] =
{ {
0, 2, 255, 255, 254, 255, 0, 2, 255, 255, 254, 255,
44, 0, 67, 84, 65, 66, 50, 0, 67, 84, 65, 66,
28, 0, 0, 0, 119, 0, 28, 0, 0, 0, 143, 0,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
2, 0, 0, 0, 28, 0, 3, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
112, 0, 0, 0, 68, 0, 136, 0, 0, 0, 88, 0,
0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 1, 0,
1, 0, 0, 0, 76, 0, 1, 0, 0, 0, 92, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92, 0, 0, 0, 3, 0, 108, 0, 0, 0, 2, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
96, 0, 0, 0, 0, 0, 92, 0, 0, 0, 0, 0,
0, 0, 109, 111, 100, 101, 0, 0, 113, 0, 0, 0,
0, 171, 171, 171, 1, 0, 3, 0, 0, 0, 1, 0,
3, 0, 1, 0, 4, 0, 0, 0, 120, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 100,
0, 0, 116, 101, 120, 0, 100, 0, 1, 0, 3, 0,
1, 0, 4, 0, 1, 0,
0, 0, 0, 0, 0, 0,
109, 117, 108, 116, 0, 116,
101, 120, 0, 171, 171, 171,
4, 0, 12, 0, 1, 0, 4, 0, 12, 0, 1, 0,
1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 112, 115, 0, 0, 0, 0, 112, 115,
...@@ -67,13 +73,13 @@ const BYTE g_ps20_componentmaskps[] = ...@@ -67,13 +73,13 @@ const BYTE g_ps20_componentmaskps[] =
0, 8, 15, 160, 66, 0, 0, 8, 15, 160, 66, 0,
0, 3, 0, 0, 15, 128, 0, 3, 0, 0, 15, 128,
0, 0, 228, 176, 0, 8, 0, 0, 228, 176, 0, 8,
228, 160, 5, 0, 0, 3, 228, 160, 1, 0, 0, 2,
1, 0, 7, 128, 0, 0, 1, 0, 15, 128, 0, 0,
228, 128, 0, 0, 0, 160, 228, 160, 4, 0, 0, 4,
4, 0, 0, 4, 1, 0, 0, 0, 15, 128, 0, 0,
8, 128, 0, 0, 255, 128, 228, 128, 1, 0, 228, 128,
0, 0, 170, 160, 0, 0, 1, 0, 228, 160, 1, 0,
255, 160, 1, 0, 0, 2, 0, 2, 0, 8, 15, 128,
0, 8, 15, 128, 1, 0, 0, 0, 228, 128, 255, 255,
228, 128, 255, 255, 0, 0 0, 0
}; };
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
/// ///
// Parameters: // Parameters:
// //
// float4 mode; // float4 add;
// float4 mult;
// sampler2D tex; // sampler2D tex;
// //
// //
...@@ -13,7 +14,8 @@ ...@@ -13,7 +14,8 @@
// //
// Name Reg Size // Name Reg Size
// ------------ ----- ---- // ------------ ----- ----
// mode c0 1 // mult c0 1
// add c1 1
// tex s0 1 // tex s0 1
// //
...@@ -21,33 +23,40 @@ ...@@ -21,33 +23,40 @@
dcl t0.xy dcl t0.xy
dcl_2d s0 dcl_2d s0
texld r0, t0, s0 texld r0, t0, s0
mad r1.w, r0.w, c0.x, c0.y mov r1.xw, c0
mad r0.x, r0.x, r1.x, c1.x
mad r0.y, r0.w, r1.w, c1.w
mov r1.xyz, r0.x mov r1.xyz, r0.x
mov r1.w, r0.y
mov oC0, r1 mov oC0, r1
// approximately 4 instruction slots used (1 texture, 3 arithmetic) // approximately 7 instruction slots used (1 texture, 6 arithmetic)
#endif #endif
const BYTE g_ps20_luminanceps[] = const BYTE g_ps20_luminanceps[] =
{ {
0, 2, 255, 255, 254, 255, 0, 2, 255, 255, 254, 255,
44, 0, 67, 84, 65, 66, 50, 0, 67, 84, 65, 66,
28, 0, 0, 0, 119, 0, 28, 0, 0, 0, 143, 0,
0, 0, 0, 2, 255, 255, 0, 0, 0, 2, 255, 255,
2, 0, 0, 0, 28, 0, 3, 0, 0, 0, 28, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
112, 0, 0, 0, 68, 0, 136, 0, 0, 0, 88, 0,
0, 0, 2, 0, 0, 0, 0, 0, 2, 0, 1, 0,
1, 0, 0, 0, 76, 0, 1, 0, 0, 0, 92, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
92, 0, 0, 0, 3, 0, 108, 0, 0, 0, 2, 0,
0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,
96, 0, 0, 0, 0, 0, 92, 0, 0, 0, 0, 0,
0, 0, 109, 111, 100, 101, 0, 0, 113, 0, 0, 0,
0, 171, 171, 171, 1, 0, 3, 0, 0, 0, 1, 0,
3, 0, 1, 0, 4, 0, 0, 0, 120, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 100,
0, 0, 116, 101, 120, 0, 100, 0, 1, 0, 3, 0,
1, 0, 4, 0, 1, 0,
0, 0, 0, 0, 0, 0,
109, 117, 108, 116, 0, 116,
101, 120, 0, 171, 171, 171,
4, 0, 12, 0, 1, 0, 4, 0, 12, 0, 1, 0,
1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0,
0, 0, 0, 0, 112, 115, 0, 0, 0, 0, 112, 115,
...@@ -67,13 +76,20 @@ const BYTE g_ps20_luminanceps[] = ...@@ -67,13 +76,20 @@ const BYTE g_ps20_luminanceps[] =
0, 8, 15, 160, 66, 0, 0, 8, 15, 160, 66, 0,
0, 3, 0, 0, 15, 128, 0, 3, 0, 0, 15, 128,
0, 0, 228, 176, 0, 8, 0, 0, 228, 176, 0, 8,
228, 160, 1, 0, 0, 2,
1, 0, 9, 128, 0, 0,
228, 160, 4, 0, 0, 4, 228, 160, 4, 0, 0, 4,
1, 0, 8, 128, 0, 0, 0, 0, 1, 128, 0, 0,
255, 128, 0, 0, 0, 160, 0, 128, 1, 0, 0, 128,
0, 0, 85, 160, 1, 0, 1, 0, 0, 160, 4, 0,
0, 2, 1, 0, 7, 128, 0, 4, 0, 0, 2, 128,
0, 0, 0, 128, 1, 0, 0, 0, 255, 128, 1, 0,
0, 2, 0, 8, 15, 128, 255, 128, 1, 0, 255, 160,
1, 0, 228, 128, 255, 255, 1, 0, 0, 2, 1, 0,
0, 0 7, 128, 0, 0, 0, 128,
1, 0, 0, 2, 1, 0,
8, 128, 0, 0, 85, 128,
1, 0, 0, 2, 0, 8,
15, 128, 1, 0, 228, 128,
255, 255, 0, 0
}; };
...@@ -331,6 +331,54 @@ void loadRGBUByteDataToBGRX(int width, int height, int depth, ...@@ -331,6 +331,54 @@ void loadRGBUByteDataToBGRX(int width, int height, int depth,
} }
} }
void loadRGUByteDataToBGRX(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
{
const unsigned char *source = NULL;
unsigned char *dest = NULL;
for (int z = 0; z < depth; z++)
{
for (int y = 0; y < height; y++)
{
source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
for (int x = 0; x < width; x++)
{
dest[4 * x + 0] = 0x00;
dest[4 * x + 1] = source[x * 2 + 1];
dest[4 * x + 2] = source[x * 2 + 0];
dest[4 * x + 3] = 0xFF;
}
}
}
}
void loadRUByteDataToBGRX(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
{
const unsigned char *source = NULL;
unsigned char *dest = NULL;
for (int z = 0; z < depth; z++)
{
for (int y = 0; y < height; y++)
{
source = offsetDataPointer<unsigned char>(input, y, z, inputRowPitch, inputDepthPitch);
dest = offsetDataPointer<unsigned char>(output, y, z, outputRowPitch, outputDepthPitch);
for (int x = 0; x < width; x++)
{
dest[4 * x + 0] = 0x00;
dest[4 * x + 1] = 0x00;
dest[4 * x + 2] = source[x];
dest[4 * x + 3] = 0xFF;
}
}
}
}
void loadRGBUByteDataToRGBA(int width, int height, int depth, void loadRGBUByteDataToRGBA(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch) void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch)
......
...@@ -86,6 +86,14 @@ void loadRGBUByteDataToBGRX(int width, int height, int depth, ...@@ -86,6 +86,14 @@ void loadRGBUByteDataToBGRX(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch); void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
void loadRGUByteDataToBGRX(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
void loadRUByteDataToBGRX(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
void loadRGBUByteDataToRGBA(int width, int height, int depth, void loadRGBUByteDataToRGBA(int width, int height, int depth,
const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch, const void *input, unsigned int inputRowPitch, unsigned int inputDepthPitch,
void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch); void *output, unsigned int outputRowPitch, unsigned int outputDepthPitch);
......
...@@ -286,6 +286,36 @@ bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint le ...@@ -286,6 +286,36 @@ bool ValidateES2TexImageParameters(gl::Context *context, GLenum target, GLint le
return gl::error(GL_INVALID_OPERATION, false); return gl::error(GL_INVALID_OPERATION, false);
} }
break; break;
case GL_RED:
if (!context->supportsRGTextures())
{
return gl::error(GL_INVALID_ENUM, false);
}
switch (type)
{
case GL_UNSIGNED_BYTE:
case GL_FLOAT:
case GL_HALF_FLOAT_OES:
break;
default:
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RG:
if (!context->supportsRGTextures())
{
return gl::error(GL_INVALID_ENUM, false);
}
switch (type)
{
case GL_UNSIGNED_BYTE:
case GL_FLOAT:
case GL_HALF_FLOAT_OES:
break;
default:
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RGB: case GL_RGB:
switch (type) switch (type)
{ {
...@@ -554,6 +584,40 @@ bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLin ...@@ -554,6 +584,40 @@ bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLin
} }
break; break;
case GL_LUMINANCE: case GL_LUMINANCE:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES)
{
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RED_EXT:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES)
{
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RG_EXT:
if (colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_RGBA8_OES)
{
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RGB: case GL_RGB:
if (colorbufferFormat != GL_RGB565 && if (colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES && colorbufferFormat != GL_RGB8_OES &&
...@@ -600,6 +664,43 @@ bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLin ...@@ -600,6 +664,43 @@ bool ValidateES2CopyTexImageParameters(gl::Context* context, GLenum target, GLin
} }
break; break;
case GL_LUMINANCE: case GL_LUMINANCE:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES)
{
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RED_EXT:
if (colorbufferFormat != GL_R8_EXT &&
colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES)
{
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RG_EXT:
if (colorbufferFormat != GL_RG8_EXT &&
colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES &&
colorbufferFormat != GL_RGBA4 &&
colorbufferFormat != GL_RGB5_A1 &&
colorbufferFormat != GL_BGRA8_EXT &&
colorbufferFormat != GL_RGBA8_OES)
{
return gl::error(GL_INVALID_OPERATION, false);
}
break;
case GL_RGB: case GL_RGB:
if (colorbufferFormat != GL_RGB565 && if (colorbufferFormat != GL_RGB565 &&
colorbufferFormat != GL_RGB8_OES && colorbufferFormat != GL_RGB8_OES &&
...@@ -774,6 +875,17 @@ bool ValidateES2TexStorageParameters(gl::Context *context, GLenum target, GLsize ...@@ -774,6 +875,17 @@ bool ValidateES2TexStorageParameters(gl::Context *context, GLenum target, GLsize
return gl::error(GL_INVALID_ENUM, false); return gl::error(GL_INVALID_ENUM, false);
} }
break; break;
case GL_R8_EXT:
case GL_RG8_EXT:
case GL_R16F_EXT:
case GL_RG16F_EXT:
case GL_R32F_EXT:
case GL_RG32F_EXT:
if (!context->supportsRGTextures())
{
return gl::error(GL_INVALID_ENUM, false);
}
break;
case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT16:
case GL_DEPTH_COMPONENT32_OES: case GL_DEPTH_COMPONENT32_OES:
case GL_DEPTH24_STENCIL8_OES: case GL_DEPTH24_STENCIL8_OES:
......
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