Commit 299fcf29 by Geoff Lang

Fix swizzle formats being assigned incorrectly.

* Non-4 component formats cannot be used as swizzle formats. * Unsized formats should not have swizzle formats. BUG=angle:721 Change-Id: Ic4e2642f5dc4c9811768961fbab00f6edd200ce1 Reviewed-on: https://chromium-review.googlesource.com/211241Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 592dbb8e
...@@ -658,8 +658,10 @@ static inline void InsertD3D11FormatInfo(D3D11ES3FormatMap *map, GLenum internal ...@@ -658,8 +658,10 @@ static inline void InsertD3D11FormatInfo(D3D11ES3FormatMap *map, GLenum internal
// Compute the swizzle formats // Compute the swizzle formats
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat); const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
if (internalFormat != GL_NONE && (formatInfo.componentCount == 4 || texFormat == DXGI_FORMAT_UNKNOWN || if (internalFormat != GL_NONE && formatInfo.pixelBytes > 0)
srvFormat == DXGI_FORMAT_UNKNOWN || rtvFormat == DXGI_FORMAT_UNKNOWN)) {
if (formatInfo.componentCount != 4 || texFormat == DXGI_FORMAT_UNKNOWN ||
srvFormat == DXGI_FORMAT_UNKNOWN || rtvFormat == DXGI_FORMAT_UNKNOWN)
{ {
// Get the maximum sized component // Get the maximum sized component
unsigned int maxBits = 1; unsigned int maxBits = 1;
...@@ -692,10 +694,19 @@ static inline void InsertD3D11FormatInfo(D3D11ES3FormatMap *map, GLenum internal ...@@ -692,10 +694,19 @@ static inline void InsertD3D11FormatInfo(D3D11ES3FormatMap *map, GLenum internal
} }
else else
{ {
// The original texture format is suitable for swizzle operations
info.swizzleTexFormat = texFormat; info.swizzleTexFormat = texFormat;
info.swizzleSRVFormat = srvFormat; info.swizzleSRVFormat = srvFormat;
info.swizzleRTVFormat = rtvFormat; info.swizzleRTVFormat = rtvFormat;
} }
}
else
{
// Not possible to swizzle with this texture format since it is either unsized or GL_NONE
info.swizzleTexFormat = DXGI_FORMAT_UNKNOWN;
info.swizzleSRVFormat = DXGI_FORMAT_UNKNOWN;
info.swizzleRTVFormat = DXGI_FORMAT_UNKNOWN;
}
// Check if there is an initialization function for this texture format // Check if there is an initialization function for this texture format
static const InternalFormatInitializerMap initializerMap = BuildInternalFormatInitializerMap(); static const InternalFormatInitializerMap initializerMap = BuildInternalFormatInitializerMap();
......
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