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