Commit f706901e by Olli Etuaho Committed by Commit Bot

D3D11: Associate ANGLE formats with GL internal formats

Add a corresponding GL internal format to ANGLE format set. This is one step on the way to removing the problematic DXGI format to GL format mapping. This will also make it possible to stop storing the DXGIFormat field in RenderTarget11. The DXGIFormat field in RenderTarget11 can currently carry either the DSV format, the RTV format or the texture storage format of the resource it is managing, which makes code using it hard to understand. Also fills in missing componentType for some compressed ANGLE formats in texture_format_data.json. BUG=angleproject:1244 TEST=angle_end2end_tests Change-Id: I87eedca8736aeface3fa6a0ec3c9d355cf006b24 Reviewed-on: https://chromium-review.googlesource.com/328961Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent 6ad07236
......@@ -475,8 +475,7 @@ gl::Error Framebuffer11::blit(const gl::Rectangle &sourceArea, const gl::Rectang
GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
{
RenderTarget11 *renderTarget11 = GetAs<RenderTarget11>(renderTarget);
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(renderTarget11->getDXGIFormat());
return dxgiFormatInfo.internalFormat;
return d3d11::GetANGLEFormatSet(renderTarget11->getANGLEFormat()).glInternalFormat;
}
void Framebuffer11::updateColorRenderTarget(size_t colorIndex)
......
......@@ -3455,8 +3455,6 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
const d3d11::TextureFormat &d3d11FormatInfo = d3d11::GetTextureFormatInfo(internalFormat, mRenderer11DeviceCaps);
const d3d11::DXGIFormat &dxgiFormatInfo =
d3d11::GetDXGIFormatInfo(d3d11FormatInfo.formatSet.texFormat);
// sRGB formats do not work with D3D11 buffer SRVs
if (internalFormatInfo.colorEncoding == GL_SRGB)
......@@ -3477,7 +3475,7 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
}
// We don't support formats which we can't represent without conversion
if (dxgiFormatInfo.internalFormat != internalFormat)
if (d3d11FormatInfo.formatSet.glInternalFormat != internalFormat)
{
return false;
}
......
......@@ -137,6 +137,7 @@ bool SupportsFormat(const Renderer11DeviceCaps &deviceCaps)
ANGLEFormatSet::ANGLEFormatSet()
: format(ANGLE_FORMAT_NONE),
glInternalFormat(GL_NONE),
texFormat(DXGI_FORMAT_UNKNOWN),
srvFormat(DXGI_FORMAT_UNKNOWN),
rtvFormat(DXGI_FORMAT_UNKNOWN),
......@@ -164,12 +165,14 @@ TextureFormat::TextureFormat(GLenum internalFormat,
}}
ANGLEFormatSet::ANGLEFormatSet(ANGLEFormat format,
GLenum glInternalFormat,
DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat,
DXGI_FORMAT rtvFormat,
DXGI_FORMAT dsvFormat,
ANGLEFormat swizzleFormat)
: format(format),
glInternalFormat(glInternalFormat),
texFormat(texFormat),
srvFormat(srvFormat),
rtvFormat(rtvFormat),
......@@ -390,6 +393,7 @@ def parse_json_into_switch_angle_format_string(json_data):
for angle_format_item in sorted(json_data.iteritems()):
table_data += ' case ' + angle_format_item[0] + ':\n'
angle_format = angle_format_item[1]
gl_internal_format = angle_format["glInternalFormat"] if "glInternalFormat" in angle_format else "GL_NONE"
tex_format = angle_format["texFormat"] if "texFormat" in angle_format else "DXGI_FORMAT_UNKNOWN"
srv_format = angle_format["srvFormat"] if "srvFormat" in angle_format else "DXGI_FORMAT_UNKNOWN"
rtv_format = angle_format["rtvFormat"] if "rtvFormat" in angle_format else "DXGI_FORMAT_UNKNOWN"
......@@ -397,6 +401,7 @@ def parse_json_into_switch_angle_format_string(json_data):
swizzle_format = get_swizzle_format_id(angle_format_item[0], angle_format)
table_data += ' {\n'
table_data += ' static const ANGLEFormatSet formatInfo(' + angle_format_item[0] + ',\n'
table_data += ' ' + gl_internal_format + ',\n'
table_data += ' ' + tex_format + ',\n'
table_data += ' ' + srv_format + ',\n'
table_data += ' ' + rtv_format + ',\n'
......
......@@ -39,6 +39,7 @@ struct ANGLEFormatSet
{
ANGLEFormatSet();
ANGLEFormatSet(ANGLEFormat format,
GLenum glInternalFormat,
DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat,
DXGI_FORMAT rtvFormat,
......@@ -49,6 +50,10 @@ struct ANGLEFormatSet
ANGLEFormat format;
// The closest matching GL internal format for the DXGI formats this format uses. Note that this
// may be a different internal format than the one this ANGLE format is used for.
GLenum glInternalFormat;
DXGI_FORMAT texFormat;
DXGI_FORMAT srvFormat;
DXGI_FORMAT rtvFormat;
......
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