Bug 1109339. Fixup some ANGLE format stuff. r=jgilbert

This fixes the classic BGRA/RGBA mismatch with D3D11 by making Renderer11.cpp
do the same thing as Renderer9.cpp from bug 1096634

It also fixes an assertion failure that happens when building the stencil
map caused by Bug 1088345.

--HG--
extra : rebase_source : 0fbe2902ede19a5fdb4898c7d27c62e6f59e954a
This commit is contained in:
Jeff Muizelaar 2014-12-09 18:24:27 -05:00
parent 198e161e60
commit cbe7771956
2 changed files with 10 additions and 1 deletions

View File

@ -66,6 +66,12 @@ static const DXGI_FORMAT RenderTargetFormats[] =
DXGI_FORMAT_R8G8B8A8_UNORM
};
static const GLenum RenderTargetExposedFormats[] =
{
GL_RGBA8, // DXGI_FORMAT_B8G8R8A8_UNORM
GL_RGBA8, // DXGI_FORMAT_R8G8B8A8_UNORM
};
static const DXGI_FORMAT DepthStencilFormats[] =
{
DXGI_FORMAT_UNKNOWN,
@ -341,6 +347,7 @@ int Renderer11::generateConfigs(ConfigDesc **configDescList)
for (unsigned int formatIndex = 0; formatIndex < numRenderFormats; formatIndex++)
{
const d3d11::DXGIFormat &renderTargetFormatInfo = d3d11::GetDXGIFormatInfo(RenderTargetFormats[formatIndex]);
const GLenum renderTargetExposedFormat = RenderTargetExposedFormats[formatIndex];
const gl::TextureCaps &renderTargetFormatCaps = getRendererTextureCaps().get(renderTargetFormatInfo.internalFormat);
if (renderTargetFormatCaps.renderable)
{
@ -351,7 +358,7 @@ int Renderer11::generateConfigs(ConfigDesc **configDescList)
if (depthStencilFormatCaps.renderable || DepthStencilFormats[depthStencilIndex] == DXGI_FORMAT_UNKNOWN)
{
ConfigDesc newConfig;
newConfig.renderTargetFormat = renderTargetFormatInfo.internalFormat;
newConfig.renderTargetFormat = renderTargetExposedFormat;
newConfig.depthStencilFormat = depthStencilFormatInfo.internalFormat;
newConfig.multiSample = 0; // FIXME: enumerate multi-sampling
newConfig.fastConfig = true; // Assume all DX11 format conversions to be fast

View File

@ -381,6 +381,8 @@ static SwizzleInfoMap BuildSwizzleInfoMap()
{
SwizzleInfoMap map;
map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_UNSIGNED_BYTE ), SwizzleFormatInfo(DXGI_FORMAT_R24G8_TYPELESS, DXGI_FORMAT_X24_TYPELESS_G8_UINT,DXGI_FORMAT_UNKNOWN)));
map.insert(SwizzleInfoPair(SwizzleSizeType( 8, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_FORMAT_R8G8B8A8_UNORM )));
map.insert(SwizzleInfoPair(SwizzleSizeType(16, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM)));
map.insert(SwizzleInfoPair(SwizzleSizeType(24, GL_UNSIGNED_NORMALIZED), SwizzleFormatInfo(DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT)));