Commit 8e7c8a13 by Jamie Madill

Fix texture format support queries on AMD-D3D9.

We were allowing calls to the device to check support for D3DFMT_NULL, which AMD reports as a usable texture type. This was causing crashes with the WebGL CTS and angle_end2end_tests, when the user tries to use an sRGB or other type, which we incorrectly reported as available. BUG=angle:839 Change-Id: I4941baac6a2b14a09c0ad2c924f29189ccfc6a07 Reviewed-on: https://chromium-review.googlesource.com/232728Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 130e6e8f
......@@ -61,9 +61,6 @@
#define ANGLE_SUPPORT_SHADER_MODEL_2 0
#endif
const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
namespace rx
{
static const D3DFORMAT RenderTargetFormats[] =
......
......@@ -192,8 +192,8 @@ typedef std::pair<GLenum, TextureFormat> D3D9FormatPair;
typedef std::map<GLenum, TextureFormat> D3D9FormatMap;
TextureFormat::TextureFormat()
: texFormat(D3DFMT_NULL),
renderFormat(D3DFMT_NULL),
: texFormat(D3DFMT_UNKNOWN),
renderFormat(D3DFMT_UNKNOWN),
dataInitializerFunction(NULL),
loadFunction(UnreachableLoad)
{
......
......@@ -275,6 +275,9 @@ static gl::TextureCaps GenerateTextureFormatCaps(GLenum internalFormat, IDirect3
gl::TextureCaps textureCaps;
const d3d9::TextureFormat &d3dFormatInfo = d3d9::GetTextureFormatInfo(internalFormat);
if (d3dFormatInfo.texFormat != D3DFMT_UNKNOWN)
{
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
if (formatInfo.depthBits > 0 || formatInfo.stencilBits > 0)
{
......@@ -287,6 +290,10 @@ static gl::TextureCaps GenerateTextureFormatCaps(GLenum internalFormat, IDirect3
}
textureCaps.filterable = SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_QUERY_FILTER, D3DRTYPE_TEXTURE, d3dFormatInfo.texFormat));
}
if (d3dFormatInfo.renderFormat != D3DFMT_UNKNOWN)
{
textureCaps.renderable = SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat)) ||
SUCCEEDED(d3d9->CheckDeviceFormat(adapter, deviceType, adapterFormat, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
......@@ -301,6 +308,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(GLenum internalFormat, IDirect3
textureCaps.sampleCounts.insert(i);
}
}
}
return textureCaps;
}
......
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