Commit 8cf70d55 by Jamie Madill Committed by Commit Bot

D3D11: Rename ANGLEFormatSet to Format.

BUG=angleproject:1455 Change-Id: I896b3ed2d5e4ff3ad72de9a3a4b554841129e4e9 Reviewed-on: https://chromium-review.googlesource.com/367093Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent c98cd326
...@@ -442,7 +442,7 @@ D3D11_INPUT_ELEMENT_DESC quad3DLayout[] = { ...@@ -442,7 +442,7 @@ D3D11_INPUT_ELEMENT_DESC quad3DLayout[] = {
{"TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, {"TEXCOORD", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
}; };
DXGI_FORMAT GetStencilSRVFormat(const d3d11::ANGLEFormatSet &formatSet) DXGI_FORMAT GetStencilSRVFormat(const d3d11::Format &formatSet)
{ {
switch (formatSet.texFormat) switch (formatSet.texFormat)
{ {
...@@ -1984,8 +1984,7 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents) ...@@ -1984,8 +1984,7 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents)
releaseResolveDepthStencilResources(); releaseResolveDepthStencilResources();
} }
const auto &formatSet = const auto &formatSet = d3d11::Format::Get(GL_RG32F, mRenderer->getRenderer11DeviceCaps());
d3d11::GetANGLEFormatSet(GL_RG32F, mRenderer->getRenderer11DeviceCaps());
D3D11_TEXTURE2D_DESC textureDesc; D3D11_TEXTURE2D_DESC textureDesc;
textureDesc.Width = extents.width; textureDesc.Width = extents.width;
......
...@@ -67,8 +67,8 @@ gl::Error Image11::generateMipmap(Image11 *dest, ...@@ -67,8 +67,8 @@ gl::Error Image11::generateMipmap(Image11 *dest,
const uint8_t *sourceData = reinterpret_cast<const uint8_t*>(srcMapped.pData); const uint8_t *sourceData = reinterpret_cast<const uint8_t*>(srcMapped.pData);
uint8_t *destData = reinterpret_cast<uint8_t*>(destMapped.pData); uint8_t *destData = reinterpret_cast<uint8_t*>(destMapped.pData);
auto mipGenerationFunction = d3d11::GetANGLEFormatSet(src->getInternalFormat(), rendererCaps) auto mipGenerationFunction =
.format.mipGenerationFunction; d3d11::Format::Get(src->getInternalFormat(), rendererCaps).format.mipGenerationFunction;
mipGenerationFunction(src->getWidth(), src->getHeight(), src->getDepth(), sourceData, mipGenerationFunction(src->getWidth(), src->getHeight(), src->getDepth(), sourceData,
srcMapped.RowPitch, srcMapped.DepthPitch, destData, destMapped.RowPitch, srcMapped.RowPitch, srcMapped.DepthPitch, destData, destMapped.RowPitch,
destMapped.DepthPitch); destMapped.DepthPitch);
...@@ -90,7 +90,7 @@ bool Image11::isDirty() const ...@@ -90,7 +90,7 @@ bool Image11::isDirty() const
if (mDirty && !mStagingTexture && !mRecoverFromStorage) if (mDirty && !mStagingTexture && !mRecoverFromStorage)
{ {
const Renderer11DeviceCaps &deviceCaps = mRenderer->getRenderer11DeviceCaps(); const Renderer11DeviceCaps &deviceCaps = mRenderer->getRenderer11DeviceCaps();
const auto &formatInfo = d3d11::GetANGLEFormatSet(mInternalFormat, deviceCaps); const auto &formatInfo = d3d11::Format::Get(mInternalFormat, deviceCaps);
if (formatInfo.dataInitializerFunction == nullptr) if (formatInfo.dataInitializerFunction == nullptr)
{ {
return false; return false;
...@@ -220,8 +220,8 @@ bool Image11::redefine(GLenum target, GLenum internalformat, const gl::Extents & ...@@ -220,8 +220,8 @@ bool Image11::redefine(GLenum target, GLenum internalformat, const gl::Extents &
mTarget = target; mTarget = target;
// compute the d3d format that will be used // compute the d3d format that will be used
const d3d11::ANGLEFormatSet &formatInfo = const d3d11::Format &formatInfo =
d3d11::GetANGLEFormatSet(internalformat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(internalformat, mRenderer->getRenderer11DeviceCaps());
mDXGIFormat = formatInfo.texFormat; mDXGIFormat = formatInfo.texFormat;
mRenderable = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN); mRenderable = (formatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN);
...@@ -269,8 +269,8 @@ gl::Error Image11::loadData(const gl::Box &area, ...@@ -269,8 +269,8 @@ gl::Error Image11::loadData(const gl::Box &area,
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat); const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
GLuint outputPixelSize = dxgiFormatInfo.pixelBytes; GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
const d3d11::ANGLEFormatSet &d3dFormatInfo = const d3d11::Format &d3dFormatInfo =
d3d11::GetANGLEFormatSet(mInternalFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(type).loadFunction; LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(type).loadFunction;
D3D11_MAPPED_SUBRESOURCE mappedImage; D3D11_MAPPED_SUBRESOURCE mappedImage;
...@@ -308,8 +308,8 @@ gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input) ...@@ -308,8 +308,8 @@ gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input)
ASSERT(area.x % outputBlockWidth == 0); ASSERT(area.x % outputBlockWidth == 0);
ASSERT(area.y % outputBlockHeight == 0); ASSERT(area.y % outputBlockHeight == 0);
const d3d11::ANGLEFormatSet &d3dFormatInfo = const d3d11::Format &d3dFormatInfo =
d3d11::GetANGLEFormatSet(mInternalFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(GL_UNSIGNED_BYTE).loadFunction; LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions.at(GL_UNSIGNED_BYTE).loadFunction;
D3D11_MAPPED_SUBRESOURCE mappedImage; D3D11_MAPPED_SUBRESOURCE mappedImage;
...@@ -360,7 +360,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset, ...@@ -360,7 +360,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
GLenum sourceInternalFormat = srcAttachment->getFormat().asSized(); GLenum sourceInternalFormat = srcAttachment->getFormat().asSized();
const auto &d3d11Format = const auto &d3d11Format =
d3d11::GetANGLEFormatSet(sourceInternalFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(sourceInternalFormat, mRenderer->getRenderer11DeviceCaps());
if (d3d11Format.texFormat == mDXGIFormat && sourceInternalFormat == mInternalFormat) if (d3d11Format.texFormat == mDXGIFormat && sourceInternalFormat == mInternalFormat)
{ {
...@@ -401,7 +401,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset, ...@@ -401,7 +401,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
const gl::InternalFormat &destFormatInfo = gl::GetInternalFormatInfo(mInternalFormat); const gl::InternalFormat &destFormatInfo = gl::GetInternalFormatInfo(mInternalFormat);
const auto &destD3D11Format = const auto &destD3D11Format =
d3d11::GetANGLEFormatSet(mInternalFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
auto loadFunction = destD3D11Format.loadFunctions.at(destFormatInfo.type); auto loadFunction = destD3D11Format.loadFunctions.at(destFormatInfo.type);
if (loadFunction.requiresConversion) if (loadFunction.requiresConversion)
...@@ -566,7 +566,7 @@ gl::Error Image11::createStagingTexture() ...@@ -566,7 +566,7 @@ gl::Error Image11::createStagingTexture()
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
desc.MiscFlags = 0; desc.MiscFlags = 0;
if (d3d11::GetANGLEFormatSet(mInternalFormat, mRenderer->getRenderer11DeviceCaps()) if (d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps())
.dataInitializerFunction != NULL) .dataInitializerFunction != NULL)
{ {
std::vector<D3D11_SUBRESOURCE_DATA> initialData; std::vector<D3D11_SUBRESOURCE_DATA> initialData;
...@@ -607,7 +607,7 @@ gl::Error Image11::createStagingTexture() ...@@ -607,7 +607,7 @@ gl::Error Image11::createStagingTexture()
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
desc.MiscFlags = 0; desc.MiscFlags = 0;
if (d3d11::GetANGLEFormatSet(mInternalFormat, mRenderer->getRenderer11DeviceCaps()) if (d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps())
.dataInitializerFunction != NULL) .dataInitializerFunction != NULL)
{ {
std::vector<D3D11_SUBRESOURCE_DATA> initialData; std::vector<D3D11_SUBRESOURCE_DATA> initialData;
......
...@@ -196,8 +196,8 @@ gl::Error PixelTransfer11::copyBufferToTexture(const gl::PixelUnpackState &unpac ...@@ -196,8 +196,8 @@ gl::Error PixelTransfer11::copyBufferToTexture(const gl::PixelUnpackState &unpac
GLenum unsizedFormat = gl::GetInternalFormatInfo(destinationFormat).format; GLenum unsizedFormat = gl::GetInternalFormatInfo(destinationFormat).format;
GLenum sourceFormat = gl::GetSizedInternalFormat(unsizedFormat, sourcePixelsType); GLenum sourceFormat = gl::GetSizedInternalFormat(unsizedFormat, sourcePixelsType);
const d3d11::ANGLEFormatSet &sourceFormatInfo = const d3d11::Format &sourceFormatInfo =
d3d11::GetANGLEFormatSet(sourceFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(sourceFormat, mRenderer->getRenderer11DeviceCaps());
DXGI_FORMAT srvFormat = sourceFormatInfo.srvFormat; DXGI_FORMAT srvFormat = sourceFormatInfo.srvFormat;
ASSERT(srvFormat != DXGI_FORMAT_UNKNOWN); ASSERT(srvFormat != DXGI_FORMAT_UNKNOWN);
Buffer11 *bufferStorage11 = GetAs<Buffer11>(sourceBuffer.getImplementation()); Buffer11 *bufferStorage11 = GetAs<Buffer11>(sourceBuffer.getImplementation());
......
...@@ -186,17 +186,15 @@ GLenum GetSurfaceRTFormat(bool depth, SwapChain11 *swapChain) ...@@ -186,17 +186,15 @@ GLenum GetSurfaceRTFormat(bool depth, SwapChain11 *swapChain)
: swapChain->getRenderTargetInternalFormat()); : swapChain->getRenderTargetInternalFormat());
} }
const d3d11::ANGLEFormatSet &GetSurfaceFormatSet(bool depth, const d3d11::Format &GetSurfaceFormatSet(bool depth, SwapChain11 *swapChain, Renderer11 *renderer)
SwapChain11 *swapChain,
Renderer11 *renderer)
{ {
return d3d11::GetANGLEFormatSet(GetSurfaceRTFormat(depth, swapChain), return d3d11::Format::Get(GetSurfaceRTFormat(depth, swapChain),
renderer->getRenderer11DeviceCaps()); renderer->getRenderer11DeviceCaps());
} }
} // anonymous namespace } // anonymous namespace
RenderTarget11::RenderTarget11(const d3d11::ANGLEFormatSet &formatSet) : mFormatSet(formatSet) RenderTarget11::RenderTarget11(const d3d11::Format &formatSet) : mFormatSet(formatSet)
{ {
} }
...@@ -218,7 +216,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv, ...@@ -218,7 +216,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv,
ID3D11ShaderResourceView *srv, ID3D11ShaderResourceView *srv,
ID3D11ShaderResourceView *blitSRV, ID3D11ShaderResourceView *blitSRV,
GLenum internalFormat, GLenum internalFormat,
const d3d11::ANGLEFormatSet &formatSet, const d3d11::Format &formatSet,
GLsizei width, GLsizei width,
GLsizei height, GLsizei height,
GLsizei depth, GLsizei depth,
...@@ -267,7 +265,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv, ...@@ -267,7 +265,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv,
ID3D11Resource *resource, ID3D11Resource *resource,
ID3D11ShaderResourceView *srv, ID3D11ShaderResourceView *srv,
GLenum internalFormat, GLenum internalFormat,
const d3d11::ANGLEFormatSet &formatSet, const d3d11::Format &formatSet,
GLsizei width, GLsizei width,
GLsizei height, GLsizei height,
GLsizei depth, GLsizei depth,
......
...@@ -23,7 +23,7 @@ class Renderer11; ...@@ -23,7 +23,7 @@ class Renderer11;
class RenderTarget11 : public RenderTargetD3D class RenderTarget11 : public RenderTargetD3D
{ {
public: public:
RenderTarget11(const d3d11::ANGLEFormatSet &formatSet); RenderTarget11(const d3d11::Format &formatSet);
virtual ~RenderTarget11(); virtual ~RenderTarget11();
virtual ID3D11Resource *getTexture() const = 0; virtual ID3D11Resource *getTexture() const = 0;
...@@ -37,11 +37,11 @@ class RenderTarget11 : public RenderTargetD3D ...@@ -37,11 +37,11 @@ class RenderTarget11 : public RenderTargetD3D
void signalDirty() override; void signalDirty() override;
angle::BroadcastChannel *getBroadcastChannel() { return &mBroadcastChannel; } angle::BroadcastChannel *getBroadcastChannel() { return &mBroadcastChannel; }
const d3d11::ANGLEFormatSet &getFormatSet() const { return mFormatSet; } const d3d11::Format &getFormatSet() const { return mFormatSet; }
protected: protected:
angle::BroadcastChannel mBroadcastChannel; angle::BroadcastChannel mBroadcastChannel;
const d3d11::ANGLEFormatSet &mFormatSet; const d3d11::Format &mFormatSet;
}; };
class TextureRenderTarget11 : public RenderTarget11 class TextureRenderTarget11 : public RenderTarget11
...@@ -53,7 +53,7 @@ class TextureRenderTarget11 : public RenderTarget11 ...@@ -53,7 +53,7 @@ class TextureRenderTarget11 : public RenderTarget11
ID3D11ShaderResourceView *srv, ID3D11ShaderResourceView *srv,
ID3D11ShaderResourceView *blitSRV, ID3D11ShaderResourceView *blitSRV,
GLenum internalFormat, GLenum internalFormat,
const d3d11::ANGLEFormatSet &formatSet, const d3d11::Format &formatSet,
GLsizei width, GLsizei width,
GLsizei height, GLsizei height,
GLsizei depth, GLsizei depth,
...@@ -62,7 +62,7 @@ class TextureRenderTarget11 : public RenderTarget11 ...@@ -62,7 +62,7 @@ class TextureRenderTarget11 : public RenderTarget11
ID3D11Resource *resource, ID3D11Resource *resource,
ID3D11ShaderResourceView *srv, ID3D11ShaderResourceView *srv,
GLenum internalFormat, GLenum internalFormat,
const d3d11::ANGLEFormatSet &formatSet, const d3d11::Format &formatSet,
GLsizei width, GLsizei width,
GLsizei height, GLsizei height,
GLsizei depth, GLsizei depth,
......
...@@ -3123,8 +3123,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source, ...@@ -3123,8 +3123,7 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source,
gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT) gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT)
{ {
const d3d11::ANGLEFormatSet &formatInfo = const d3d11::Format &formatInfo = d3d11::Format::Get(format, mRenderer11DeviceCaps);
d3d11::GetANGLEFormatSet(format, mRenderer11DeviceCaps);
const gl::TextureCaps &textureCaps = getNativeTextureCaps().get(format); const gl::TextureCaps &textureCaps = getNativeTextureCaps().get(format);
GLuint supportedSamples = textureCaps.getNearestSamples(samples); GLuint supportedSamples = textureCaps.getNearestSamples(samples);
...@@ -3278,10 +3277,9 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G ...@@ -3278,10 +3277,9 @@ gl::Error Renderer11::createRenderTarget(int width, int height, GLenum format, G
} }
else else
{ {
*outRT = new TextureRenderTarget11(static_cast<ID3D11RenderTargetView *>(nullptr), nullptr, *outRT = new TextureRenderTarget11(
nullptr, nullptr, format, static_cast<ID3D11RenderTargetView *>(nullptr), nullptr, nullptr, nullptr, format,
d3d11::GetANGLEFormatSet(GL_NONE, mRenderer11DeviceCaps), d3d11::Format::Get(GL_NONE, mRenderer11DeviceCaps), width, height, 1, supportedSamples);
width, height, 1, supportedSamples);
} }
return gl::Error(GL_NO_ERROR); return gl::Error(GL_NO_ERROR);
...@@ -3517,8 +3515,8 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const ...@@ -3517,8 +3515,8 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
ASSERT(getNativeExtensions().pixelBufferObject); ASSERT(getNativeExtensions().pixelBufferObject);
const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
const d3d11::ANGLEFormatSet &d3d11FormatInfo = const d3d11::Format &d3d11FormatInfo =
d3d11::GetANGLEFormatSet(internalFormat, mRenderer11DeviceCaps); d3d11::Format::Get(internalFormat, mRenderer11DeviceCaps);
// sRGB formats do not work with D3D11 buffer SRVs // sRGB formats do not work with D3D11 buffer SRVs
if (internalFormatInfo.colorEncoding == GL_SRGB) if (internalFormatInfo.colorEncoding == GL_SRGB)
......
...@@ -177,8 +177,8 @@ EGLint SwapChain11::resetOffscreenColorBuffer(int backbufferWidth, int backbuffe ...@@ -177,8 +177,8 @@ EGLint SwapChain11::resetOffscreenColorBuffer(int backbufferWidth, int backbuffe
releaseOffscreenColorBuffer(); releaseOffscreenColorBuffer();
const d3d11::ANGLEFormatSet &backbufferFormatInfo = d3d11::GetANGLEFormatSet( const d3d11::Format &backbufferFormatInfo =
mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
// If the app passed in a share handle, open the resource // If the app passed in a share handle, open the resource
// See EGL_ANGLE_d3d_share_handle_client_buffer // See EGL_ANGLE_d3d_share_handle_client_buffer
...@@ -334,8 +334,8 @@ EGLint SwapChain11::resetOffscreenDepthBuffer(int backbufferWidth, int backbuffe ...@@ -334,8 +334,8 @@ EGLint SwapChain11::resetOffscreenDepthBuffer(int backbufferWidth, int backbuffe
if (mDepthBufferFormat != GL_NONE) if (mDepthBufferFormat != GL_NONE)
{ {
const d3d11::ANGLEFormatSet &depthBufferFormatInfo = const d3d11::Format &depthBufferFormatInfo =
d3d11::GetANGLEFormatSet(mDepthBufferFormat, mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(mDepthBufferFormat, mRenderer->getRenderer11DeviceCaps());
D3D11_TEXTURE2D_DESC depthStencilTextureDesc; D3D11_TEXTURE2D_DESC depthStencilTextureDesc;
depthStencilTextureDesc.Width = backbufferWidth; depthStencilTextureDesc.Width = backbufferWidth;
......
...@@ -49,7 +49,7 @@ TextureStorage11::TextureStorage11(Renderer11 *renderer, ...@@ -49,7 +49,7 @@ TextureStorage11::TextureStorage11(Renderer11 *renderer,
: mRenderer(renderer), : mRenderer(renderer),
mTopLevel(0), mTopLevel(0),
mMipLevels(0), mMipLevels(0),
mFormatInfo(d3d11::GetANGLEFormatSet(internalFormat, mRenderer->getRenderer11DeviceCaps())), mFormatInfo(d3d11::Format::Get(internalFormat, mRenderer->getRenderer11DeviceCaps())),
mTextureWidth(0), mTextureWidth(0),
mTextureHeight(0), mTextureHeight(0),
mTextureDepth(0), mTextureDepth(0),
...@@ -81,8 +81,7 @@ DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat, ...@@ -81,8 +81,7 @@ DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat,
{ {
UINT bindFlags = 0; UINT bindFlags = 0;
const d3d11::ANGLEFormatSet &formatInfo = const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
d3d11::GetANGLEFormatSet(internalFormat, renderer11DeviceCaps);
if (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN) if (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN)
{ {
bindFlags |= D3D11_BIND_SHADER_RESOURCE; bindFlags |= D3D11_BIND_SHADER_RESOURCE;
...@@ -106,8 +105,7 @@ DWORD TextureStorage11::GetTextureMiscFlags(GLenum internalFormat, ...@@ -106,8 +105,7 @@ DWORD TextureStorage11::GetTextureMiscFlags(GLenum internalFormat,
{ {
UINT miscFlags = 0; UINT miscFlags = 0;
const d3d11::ANGLEFormatSet &formatInfo = const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
d3d11::GetANGLEFormatSet(internalFormat, renderer11DeviceCaps);
if (renderTarget && levels > 1) if (renderTarget && levels > 1)
{ {
const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(formatInfo.texFormat); const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(formatInfo.texFormat);
...@@ -325,7 +323,7 @@ gl::Error TextureStorage11::getSRVLevels(GLint baseLevel, ...@@ -325,7 +323,7 @@ gl::Error TextureStorage11::getSRVLevels(GLint baseLevel,
return gl::NoError(); return gl::NoError();
} }
const d3d11::ANGLEFormatSet &TextureStorage11::getFormatSet() const const d3d11::Format &TextureStorage11::getFormatSet() const
{ {
return mFormatInfo; return mFormatInfo;
} }
...@@ -652,8 +650,8 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index, ...@@ -652,8 +650,8 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
unpack.skipRows, unpack.skipPixels, index.is3D()), unpack.skipRows, unpack.skipPixels, index.is3D()),
srcSkipBytes); srcSkipBytes);
const d3d11::ANGLEFormatSet &d3d11Format = const d3d11::Format &d3d11Format =
d3d11::GetANGLEFormatSet(image->getInternalFormat(), mRenderer->getRenderer11DeviceCaps()); d3d11::Format::Get(image->getInternalFormat(), mRenderer->getRenderer11DeviceCaps());
const d3d11::DXGIFormatSize &dxgiFormatInfo = const d3d11::DXGIFormatSize &dxgiFormatInfo =
d3d11::GetDXGIFormatSizeInfo(d3d11Format.texFormat); d3d11::GetDXGIFormatSizeInfo(d3d11Format.texFormat);
......
...@@ -79,7 +79,7 @@ class TextureStorage11 : public TextureStorage ...@@ -79,7 +79,7 @@ class TextureStorage11 : public TextureStorage
gl::Error getSRVLevels(GLint baseLevel, GLint maxLevel, ID3D11ShaderResourceView **outSRV); gl::Error getSRVLevels(GLint baseLevel, GLint maxLevel, ID3D11ShaderResourceView **outSRV);
const d3d11::ANGLEFormatSet &getFormatSet() const; const d3d11::Format &getFormatSet() const;
protected: protected:
TextureStorage11(Renderer11 *renderer, UINT bindFlags, UINT miscFlags, GLenum internalFormat); TextureStorage11(Renderer11 *renderer, UINT bindFlags, UINT miscFlags, GLenum internalFormat);
...@@ -107,7 +107,7 @@ class TextureStorage11 : public TextureStorage ...@@ -107,7 +107,7 @@ class TextureStorage11 : public TextureStorage
int mTopLevel; int mTopLevel;
unsigned int mMipLevels; unsigned int mMipLevels;
const d3d11::ANGLEFormatSet &mFormatInfo; const d3d11::Format &mFormatInfo;
unsigned int mTextureWidth; unsigned int mTextureWidth;
unsigned int mTextureHeight; unsigned int mTextureHeight;
unsigned int mTextureDepth; unsigned int mTextureDepth;
......
...@@ -43,8 +43,9 @@ namespace rx ...@@ -43,8 +43,9 @@ namespace rx
namespace d3d11 namespace d3d11
{{ {{
const ANGLEFormatSet &GetANGLEFormatSet(GLenum internalFormat, // static
const Renderer11DeviceCaps &deviceCaps) const Format &Format::Get(GLenum internalFormat,
const Renderer11DeviceCaps &deviceCaps)
{{ {{
// clang-format off // clang-format off
switch (internalFormat) switch (internalFormat)
...@@ -56,7 +57,7 @@ const ANGLEFormatSet &GetANGLEFormatSet(GLenum internalFormat, ...@@ -56,7 +57,7 @@ const ANGLEFormatSet &GetANGLEFormatSet(GLenum internalFormat,
// clang-format on // clang-format on
UNREACHABLE(); UNREACHABLE();
static const ANGLEFormatSet defaultInfo; static const Format defaultInfo;
return defaultInfo; return defaultInfo;
}} }}
...@@ -212,32 +213,32 @@ def get_blit_srv_format(angle_format): ...@@ -212,32 +213,32 @@ def get_blit_srv_format(angle_format):
format_entry_template = """{space}{{ format_entry_template = """{space}{{
{space} static const ANGLEFormatSet info({internalFormat}, {space} static const Format info({internalFormat},
{space} angle::Format::ID::{formatName}, {space} angle::Format::ID::{formatName},
{space} {texFormat}, {space} {texFormat},
{space} {srvFormat}, {space} {srvFormat},
{space} {rtvFormat}, {space} {rtvFormat},
{space} {dsvFormat}, {space} {dsvFormat},
{space} {blitSRVFormat}, {space} {blitSRVFormat},
{space} {swizzleFormat}, {space} {swizzleFormat},
{space} {initializer}, {space} {initializer},
{space} deviceCaps); {space} deviceCaps);
{space} return info; {space} return info;
{space}}} {space}}}
""" """
split_format_entry_template = """{space} {condition} split_format_entry_template = """{space} {condition}
{space} {{ {space} {{
{space} static const ANGLEFormatSet info({internalFormat}, {space} static const Format info({internalFormat},
{space} angle::Format::ID::{formatName}, {space} angle::Format::ID::{formatName},
{space} {texFormat}, {space} {texFormat},
{space} {srvFormat}, {space} {srvFormat},
{space} {rtvFormat}, {space} {rtvFormat},
{space} {dsvFormat}, {space} {dsvFormat},
{space} {blitSRVFormat}, {space} {blitSRVFormat},
{space} {swizzleFormat}, {space} {swizzleFormat},
{space} {initializer}, {space} {initializer},
{space} deviceCaps); {space} deviceCaps);
{space} return info; {space} return info;
{space} }} {space} }}
""" """
......
...@@ -349,8 +349,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(GLint maxClientVersion, GLenum ...@@ -349,8 +349,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(GLint maxClientVersion, GLenum
gl::TextureCaps textureCaps; gl::TextureCaps textureCaps;
DXGISupportHelper support(device, renderer11DeviceCaps.featureLevel); DXGISupportHelper support(device, renderer11DeviceCaps.featureLevel);
const d3d11::ANGLEFormatSet &formatInfo = const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
d3d11::GetANGLEFormatSet(internalFormat, renderer11DeviceCaps);
const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat);
...@@ -1368,8 +1367,7 @@ void GenerateInitialTextureData(GLint internalFormat, ...@@ -1368,8 +1367,7 @@ void GenerateInitialTextureData(GLint internalFormat,
std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData, std::vector<D3D11_SUBRESOURCE_DATA> *outSubresourceData,
std::vector<std::vector<BYTE>> *outData) std::vector<std::vector<BYTE>> *outData)
{ {
const d3d11::ANGLEFormatSet &d3dFormatInfo = const d3d11::Format &d3dFormatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
d3d11::GetANGLEFormatSet(internalFormat, renderer11DeviceCaps);
ASSERT(d3dFormatInfo.dataInitializerFunction != NULL); ASSERT(d3dFormatInfo.dataInitializerFunction != NULL);
const d3d11::DXGIFormatSize &dxgiFormatInfo = const d3d11::DXGIFormatSize &dxgiFormatInfo =
...@@ -1580,7 +1578,7 @@ TextureHelper11::TextureHelper11(TextureHelper11 &&toCopy) ...@@ -1580,7 +1578,7 @@ TextureHelper11::TextureHelper11(TextureHelper11 &&toCopy)
// static // static
TextureHelper11 TextureHelper11::MakeAndReference(ID3D11Resource *genericResource, TextureHelper11 TextureHelper11::MakeAndReference(ID3D11Resource *genericResource,
const d3d11::ANGLEFormatSet &formatSet) const d3d11::Format &formatSet)
{ {
TextureHelper11 newHelper; TextureHelper11 newHelper;
newHelper.mFormatSet = &formatSet; newHelper.mFormatSet = &formatSet;
...@@ -1593,7 +1591,7 @@ TextureHelper11 TextureHelper11::MakeAndReference(ID3D11Resource *genericResourc ...@@ -1593,7 +1591,7 @@ TextureHelper11 TextureHelper11::MakeAndReference(ID3D11Resource *genericResourc
// static // static
TextureHelper11 TextureHelper11::MakeAndPossess2D(ID3D11Texture2D *texToOwn, TextureHelper11 TextureHelper11::MakeAndPossess2D(ID3D11Texture2D *texToOwn,
const d3d11::ANGLEFormatSet &formatSet) const d3d11::Format &formatSet)
{ {
TextureHelper11 newHelper; TextureHelper11 newHelper;
newHelper.mFormatSet = &formatSet; newHelper.mFormatSet = &formatSet;
...@@ -1605,7 +1603,7 @@ TextureHelper11 TextureHelper11::MakeAndPossess2D(ID3D11Texture2D *texToOwn, ...@@ -1605,7 +1603,7 @@ TextureHelper11 TextureHelper11::MakeAndPossess2D(ID3D11Texture2D *texToOwn,
// static // static
TextureHelper11 TextureHelper11::MakeAndPossess3D(ID3D11Texture3D *texToOwn, TextureHelper11 TextureHelper11::MakeAndPossess3D(ID3D11Texture3D *texToOwn,
const d3d11::ANGLEFormatSet &formatSet) const d3d11::Format &formatSet)
{ {
TextureHelper11 newHelper; TextureHelper11 newHelper;
newHelper.mFormatSet = &formatSet; newHelper.mFormatSet = &formatSet;
...@@ -1689,7 +1687,7 @@ bool TextureHelper11::valid() const ...@@ -1689,7 +1687,7 @@ bool TextureHelper11::valid() const
} }
gl::ErrorOrResult<TextureHelper11> CreateStagingTexture(GLenum textureType, gl::ErrorOrResult<TextureHelper11> CreateStagingTexture(GLenum textureType,
const d3d11::ANGLEFormatSet &formatSet, const d3d11::Format &formatSet,
const gl::Extents &size, const gl::Extents &size,
StagingAccess readAndWriteAccess, StagingAccess readAndWriteAccess,
ID3D11Device *device) ID3D11Device *device)
......
...@@ -370,16 +370,16 @@ class TextureHelper11 : angle::NonCopyable ...@@ -370,16 +370,16 @@ class TextureHelper11 : angle::NonCopyable
TextureHelper11 &operator=(TextureHelper11 &&texture); TextureHelper11 &operator=(TextureHelper11 &&texture);
static TextureHelper11 MakeAndReference(ID3D11Resource *genericResource, static TextureHelper11 MakeAndReference(ID3D11Resource *genericResource,
const d3d11::ANGLEFormatSet &formatSet); const d3d11::Format &formatSet);
static TextureHelper11 MakeAndPossess2D(ID3D11Texture2D *texToOwn, static TextureHelper11 MakeAndPossess2D(ID3D11Texture2D *texToOwn,
const d3d11::ANGLEFormatSet &formatSet); const d3d11::Format &formatSet);
static TextureHelper11 MakeAndPossess3D(ID3D11Texture3D *texToOwn, static TextureHelper11 MakeAndPossess3D(ID3D11Texture3D *texToOwn,
const d3d11::ANGLEFormatSet &formatSet); const d3d11::Format &formatSet);
GLenum getTextureType() const { return mTextureType; } GLenum getTextureType() const { return mTextureType; }
gl::Extents getExtents() const { return mExtents; } gl::Extents getExtents() const { return mExtents; }
DXGI_FORMAT getFormat() const { return mFormat; } DXGI_FORMAT getFormat() const { return mFormat; }
const d3d11::ANGLEFormatSet &getFormatSet() const { return *mFormatSet; } const d3d11::Format &getFormatSet() const { return *mFormatSet; }
int getSampleCount() const { return mSampleCount; } int getSampleCount() const { return mSampleCount; }
ID3D11Texture2D *getTexture2D() const { return mTexture2D; } ID3D11Texture2D *getTexture2D() const { return mTexture2D; }
ID3D11Texture3D *getTexture3D() const { return mTexture3D; } ID3D11Texture3D *getTexture3D() const { return mTexture3D; }
...@@ -393,7 +393,7 @@ class TextureHelper11 : angle::NonCopyable ...@@ -393,7 +393,7 @@ class TextureHelper11 : angle::NonCopyable
GLenum mTextureType; GLenum mTextureType;
gl::Extents mExtents; gl::Extents mExtents;
DXGI_FORMAT mFormat; DXGI_FORMAT mFormat;
const d3d11::ANGLEFormatSet *mFormatSet; const d3d11::Format *mFormatSet;
int mSampleCount; int mSampleCount;
ID3D11Texture2D *mTexture2D; ID3D11Texture2D *mTexture2D;
ID3D11Texture3D *mTexture3D; ID3D11Texture3D *mTexture3D;
...@@ -406,7 +406,7 @@ enum class StagingAccess ...@@ -406,7 +406,7 @@ enum class StagingAccess
}; };
gl::ErrorOrResult<TextureHelper11> CreateStagingTexture(GLenum textureType, gl::ErrorOrResult<TextureHelper11> CreateStagingTexture(GLenum textureType,
const d3d11::ANGLEFormatSet &formatSet, const d3d11::Format &formatSet,
const gl::Extents &size, const gl::Extents &size,
StagingAccess readAndWriteAccess, StagingAccess readAndWriteAccess,
ID3D11Device *device); ID3D11Device *device);
......
...@@ -15,7 +15,7 @@ namespace rx ...@@ -15,7 +15,7 @@ namespace rx
namespace d3d11 namespace d3d11
{ {
ANGLEFormatSet::ANGLEFormatSet() Format::Format()
: internalFormat(GL_NONE), : internalFormat(GL_NONE),
format(angle::Format::Get(angle::Format::ID::NONE)), format(angle::Format::Get(angle::Format::ID::NONE)),
texFormat(DXGI_FORMAT_UNKNOWN), texFormat(DXGI_FORMAT_UNKNOWN),
...@@ -28,16 +28,16 @@ ANGLEFormatSet::ANGLEFormatSet() ...@@ -28,16 +28,16 @@ ANGLEFormatSet::ANGLEFormatSet()
{ {
} }
ANGLEFormatSet::ANGLEFormatSet(GLenum internalFormat, Format::Format(GLenum internalFormat,
angle::Format::ID formatID, angle::Format::ID formatID,
DXGI_FORMAT texFormat, DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat, DXGI_FORMAT srvFormat,
DXGI_FORMAT rtvFormat, DXGI_FORMAT rtvFormat,
DXGI_FORMAT dsvFormat, DXGI_FORMAT dsvFormat,
DXGI_FORMAT blitSRVFormat, DXGI_FORMAT blitSRVFormat,
GLenum swizzleFormat, GLenum swizzleFormat,
InitializeTextureDataFunction internalFormatInitializer, InitializeTextureDataFunction internalFormatInitializer,
const Renderer11DeviceCaps &deviceCaps) const Renderer11DeviceCaps &deviceCaps)
: internalFormat(internalFormat), : internalFormat(internalFormat),
format(angle::Format::Get(formatID)), format(angle::Format::Get(formatID)),
texFormat(texFormat), texFormat(texFormat),
...@@ -45,8 +45,7 @@ ANGLEFormatSet::ANGLEFormatSet(GLenum internalFormat, ...@@ -45,8 +45,7 @@ ANGLEFormatSet::ANGLEFormatSet(GLenum internalFormat,
rtvFormat(rtvFormat), rtvFormat(rtvFormat),
dsvFormat(dsvFormat), dsvFormat(dsvFormat),
blitSRVFormat(blitSRVFormat), blitSRVFormat(blitSRVFormat),
swizzle(swizzleFormat == internalFormat ? *this swizzle(swizzleFormat == internalFormat ? *this : Format::Get(swizzleFormat, deviceCaps)),
: GetANGLEFormatSet(swizzleFormat, deviceCaps)),
dataInitializerFunction(internalFormatInitializer), dataInitializerFunction(internalFormatInitializer),
loadFunctions(GetLoadFunctionsMap(internalFormat, texFormat)) loadFunctions(GetLoadFunctionsMap(internalFormat, texFormat))
{ {
......
...@@ -42,19 +42,21 @@ struct LoadImageFunctionInfo ...@@ -42,19 +42,21 @@ struct LoadImageFunctionInfo
// on device capabilities. // on device capabilities.
// This structure allows querying for the DXGI texture formats to use for textures, SRVs, RTVs and // This structure allows querying for the DXGI texture formats to use for textures, SRVs, RTVs and
// DSVs given a GL internal format. // DSVs given a GL internal format.
struct ANGLEFormatSet final : angle::NonCopyable struct Format final : angle::NonCopyable
{ {
ANGLEFormatSet(); Format();
ANGLEFormatSet(GLenum internalFormat, Format(GLenum internalFormat,
angle::Format::ID formatID, angle::Format::ID formatID,
DXGI_FORMAT texFormat, DXGI_FORMAT texFormat,
DXGI_FORMAT srvFormat, DXGI_FORMAT srvFormat,
DXGI_FORMAT rtvFormat, DXGI_FORMAT rtvFormat,
DXGI_FORMAT dsvFormat, DXGI_FORMAT dsvFormat,
DXGI_FORMAT blitSRVFormat, DXGI_FORMAT blitSRVFormat,
GLenum swizzleFormat, GLenum swizzleFormat,
InitializeTextureDataFunction internalFormatInitializer, InitializeTextureDataFunction internalFormatInitializer,
const Renderer11DeviceCaps &deviceCaps); const Renderer11DeviceCaps &deviceCaps);
static const Format &Get(GLenum internalFormat, const Renderer11DeviceCaps &deviceCaps);
GLenum internalFormat; GLenum internalFormat;
const angle::Format &format; const angle::Format &format;
...@@ -66,7 +68,7 @@ struct ANGLEFormatSet final : angle::NonCopyable ...@@ -66,7 +68,7 @@ struct ANGLEFormatSet final : angle::NonCopyable
DXGI_FORMAT blitSRVFormat; DXGI_FORMAT blitSRVFormat;
const ANGLEFormatSet &swizzle; const Format &swizzle;
InitializeTextureDataFunction dataInitializerFunction; InitializeTextureDataFunction dataInitializerFunction;
typedef std::map<GLenum, LoadImageFunctionInfo> LoadFunctionMap; typedef std::map<GLenum, LoadImageFunctionInfo> LoadFunctionMap;
...@@ -74,9 +76,6 @@ struct ANGLEFormatSet final : angle::NonCopyable ...@@ -74,9 +76,6 @@ struct ANGLEFormatSet final : angle::NonCopyable
LoadFunctionMap loadFunctions; LoadFunctionMap loadFunctions;
}; };
const ANGLEFormatSet &GetANGLEFormatSet(GLenum internalFormat,
const Renderer11DeviceCaps &deviceCaps);
} // namespace d3d11 } // namespace d3d11
} // namespace rx } // namespace rx
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -48,8 +48,8 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport) ...@@ -48,8 +48,8 @@ TEST_P(D3D11FormatTablesTest, TestFormatSupport)
const gl::FormatSet &allFormats = gl::GetAllSizedInternalFormats(); const gl::FormatSet &allFormats = gl::GetAllSizedInternalFormats();
for (GLenum internalFormat : allFormats) for (GLenum internalFormat : allFormats)
{ {
const rx::d3d11::ANGLEFormatSet &formatInfo = const rx::d3d11::Format &formatInfo =
rx::d3d11::GetANGLEFormatSet(internalFormat, renderer->getRenderer11DeviceCaps()); rx::d3d11::Format::Get(internalFormat, renderer->getRenderer11DeviceCaps());
const auto &textureInfo = textureCaps.get(internalFormat); const auto &textureInfo = textureCaps.get(internalFormat);
// Bits for texturing // Bits for texturing
......
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