Commit 9a39224b by Jamie Madill Committed by Commit Bot

D3D11: Move the swizzle format set into ANGLEFormatSet.

The only piece of data left in the d3d11::TextureFormat is the initializer function, which could just as easily be in the ANGLEFormatSet. BUG=angleproject:1455 Change-Id: Iee8eb84f71807575c2a46bf4fcbf283aa1b7f565 Reviewed-on: https://chromium-review.googlesource.com/367090Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarZhenyao Mo <zmo@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 86e0b7f7
......@@ -247,7 +247,7 @@ gl::Error TextureStorage11::getCachedOrCreateSRV(const SRVKey &key,
ID3D11ShaderResourceView *srv = nullptr;
DXGI_FORMAT format =
(key.swizzle ? mFormatInfo.swizzleFormatSet.srvFormat : mFormatInfo.formatSet.srvFormat);
(key.swizzle ? mFormatInfo.formatSet.swizzle.srvFormat : mFormatInfo.formatSet.srvFormat);
ANGLE_TRY(createSRV(key.baseLevel, key.mipLevels, format, texture, &srv));
mSrvCache.insert(std::make_pair(key, srv));
......@@ -1333,7 +1333,7 @@ gl::Error TextureStorage11_2D::getSwizzleTexture(ID3D11Resource **outTexture)
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = 1;
desc.Format = mFormatInfo.swizzleFormatSet.texFormat;
desc.Format = mFormatInfo.formatSet.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
......@@ -1374,7 +1374,7 @@ gl::Error TextureStorage11_2D::getSwizzleRenderTarget(int mipLevel, ID3D11Render
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = mFormatInfo.swizzleFormatSet.rtvFormat;
rtvDesc.Format = mFormatInfo.formatSet.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
......@@ -1674,7 +1674,7 @@ gl::Error TextureStorage11_EGLImage::getSwizzleTexture(ID3D11Resource **outTextu
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = 1;
desc.Format = mFormatInfo.swizzleFormatSet.texFormat;
desc.Format = mFormatInfo.formatSet.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
......@@ -1716,7 +1716,7 @@ gl::Error TextureStorage11_EGLImage::getSwizzleRenderTarget(int mipLevel,
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = mFormatInfo.swizzleFormatSet.rtvFormat;
rtvDesc.Format = mFormatInfo.formatSet.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
......@@ -2516,7 +2516,7 @@ gl::Error TextureStorage11_Cube::getSwizzleTexture(ID3D11Resource **outTexture)
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = CUBE_FACE_COUNT;
desc.Format = mFormatInfo.swizzleFormatSet.texFormat;
desc.Format = mFormatInfo.formatSet.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
......@@ -2558,7 +2558,7 @@ gl::Error TextureStorage11_Cube::getSwizzleRenderTarget(int mipLevel,
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = mFormatInfo.swizzleFormatSet.rtvFormat;
rtvDesc.Format = mFormatInfo.formatSet.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture2DArray.FirstArraySlice = 0;
......@@ -2946,7 +2946,7 @@ gl::Error TextureStorage11_3D::getSwizzleTexture(ID3D11Resource **outTexture)
desc.Height = mTextureHeight;
desc.Depth = mTextureDepth;
desc.MipLevels = mMipLevels;
desc.Format = mFormatInfo.swizzleFormatSet.texFormat;
desc.Format = mFormatInfo.formatSet.swizzle.texFormat;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
desc.CPUAccessFlags = 0;
......@@ -2985,7 +2985,7 @@ gl::Error TextureStorage11_3D::getSwizzleRenderTarget(int mipLevel, ID3D11Render
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = mFormatInfo.swizzleFormatSet.rtvFormat;
rtvDesc.Format = mFormatInfo.formatSet.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture3D.FirstWSlice = 0;
......@@ -3397,7 +3397,7 @@ gl::Error TextureStorage11_2DArray::getSwizzleTexture(ID3D11Resource **outTextur
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = mTextureDepth;
desc.Format = mFormatInfo.swizzleFormatSet.texFormat;
desc.Format = mFormatInfo.formatSet.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
......@@ -3439,7 +3439,7 @@ gl::Error TextureStorage11_2DArray::getSwizzleRenderTarget(int mipLevel,
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
rtvDesc.Format = mFormatInfo.swizzleFormatSet.rtvFormat;
rtvDesc.Format = mFormatInfo.formatSet.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture2DArray.FirstArraySlice = 0;
......
......@@ -273,7 +273,8 @@ format_entry_template = """{space}{{
{space} {rtvFormat},
{space} {dsvFormat},
{space} {blitSRVFormat},
{space} angle::Format::ID::{swizzleFormat});
{space} angle::Format::ID::{swizzleFormat},
{space} deviceCaps);
{space} return info;
{space}}}
"""
......@@ -286,7 +287,8 @@ split_format_entry_template = """{space} {condition}
{space} {rtvFormat},
{space} {dsvFormat},
{space} {blitSRVFormat},
{space} angle::Format::ID::{swizzleFormat});
{space} angle::Format::ID::{swizzleFormat},
{space} deviceCaps);
{space} return info;
{space} }}
"""
......
......@@ -22,7 +22,7 @@ ANGLEFormatSet::ANGLEFormatSet()
rtvFormat(DXGI_FORMAT_UNKNOWN),
dsvFormat(DXGI_FORMAT_UNKNOWN),
blitSRVFormat(DXGI_FORMAT_UNKNOWN),
swizzleFormat(angle::Format::ID::NONE)
swizzle(*this)
{
}
......@@ -32,14 +32,15 @@ ANGLEFormatSet::ANGLEFormatSet(angle::Format::ID formatID,
DXGI_FORMAT rtvFormat,
DXGI_FORMAT dsvFormat,
DXGI_FORMAT blitSRVFormat,
angle::Format::ID swizzleFormat)
angle::Format::ID swizzleID,
const Renderer11DeviceCaps &deviceCaps)
: format(angle::Format::Get(formatID)),
texFormat(texFormat),
srvFormat(srvFormat),
rtvFormat(rtvFormat),
dsvFormat(dsvFormat),
blitSRVFormat(blitSRVFormat),
swizzleFormat(swizzleFormat)
swizzle(swizzleID == formatID ? *this : GetANGLEFormatSet(swizzleID, deviceCaps))
{
}
......@@ -53,7 +54,6 @@ TextureFormat::TextureFormat(GLenum internalFormat,
const Renderer11DeviceCaps &deviceCaps)
: internalFormat(internalFormat),
formatSet(GetANGLEFormatSet(angleFormatID, deviceCaps)),
swizzleFormatSet(GetANGLEFormatSet(formatSet.swizzleFormat, deviceCaps)),
dataInitializerFunction(internalFormatInitializer),
loadFunctions(GetLoadFunctionsMap(internalFormat, formatSet.texFormat))
{
......
......@@ -47,7 +47,8 @@ struct ANGLEFormatSet final : angle::NonCopyable
DXGI_FORMAT rtvFormat,
DXGI_FORMAT dsvFormat,
DXGI_FORMAT blitSRVFormat,
angle::Format::ID swizzleFormat);
angle::Format::ID swizzleID,
const Renderer11DeviceCaps &deviceCaps);
const angle::Format &format;
......@@ -58,7 +59,7 @@ struct ANGLEFormatSet final : angle::NonCopyable
DXGI_FORMAT blitSRVFormat;
angle::Format::ID swizzleFormat;
const ANGLEFormatSet &swizzle;
};
struct TextureFormat : public angle::NonCopyable
......@@ -70,7 +71,6 @@ struct TextureFormat : public angle::NonCopyable
GLenum internalFormat;
const ANGLEFormatSet &formatSet;
const ANGLEFormatSet &swizzleFormatSet;
InitializeTextureDataFunction dataInitializerFunction;
typedef std::map<GLenum, LoadImageFunctionInfo> LoadFunctionMap;
......
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