summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libANGLE/renderer/d3d
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
commitfc61780b35af913801d72086456f493f63197da6 (patch)
treef85891288a7bd988da9f0f15ae64e5c63f00d493 /gfx/angle/src/libANGLE/renderer/d3d
parent69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff)
parent50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff)
downloadUXP-2018.07.18.tar
UXP-2018.07.18.tar.gz
UXP-2018.07.18.tar.lz
UXP-2018.07.18.tar.xz
UXP-2018.07.18.zip
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts: # browser/app/profile/firefox.js # browser/components/preferences/jar.mn
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer/d3d')
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp10
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/BufferD3D.h2
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp32
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.h7
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp12
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp18
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp5
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp10
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/ImageD3D.h2
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp93
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/RendererD3D.h12
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp19
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.h6
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp44
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h7
-rw-r--r--gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp34
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h16
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp668
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/TextureD3D.h3
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/VaryingPacking.cpp36
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp1
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/WorkaroundsD3D.h36
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp143
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp360
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h39
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp537
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp4
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h2
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp54
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp23
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h2
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp304
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp66
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp3
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp4
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp1234
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h15
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp1
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp71
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp49
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h1
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp733
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h55
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp8
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp47
-rw-r--r--gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json118
-rw-r--r--gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp516
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json617
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp1303
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp871
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h45
-rw-r--r--gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py134
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_support_tables.py70
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py49
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp1589
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h1
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp39
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h65
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp2540
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp73
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp9
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h19
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp4
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h2
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp4
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp21
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp143
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h13
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp2
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp46
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h1
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp4
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp2
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp251
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h17
-rwxr-xr-xgfx/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp11
76 files changed, 5701 insertions, 7706 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp
index 250162726..5e89c5bf4 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.cpp
@@ -19,8 +19,8 @@ namespace rx
unsigned int BufferD3D::mNextSerial = 1;
-BufferD3D::BufferD3D(const gl::BufferState &state, BufferFactoryD3D *factory)
- : BufferImpl(state),
+BufferD3D::BufferD3D(BufferFactoryD3D *factory)
+ : BufferImpl(),
mFactory(factory),
mStaticIndexBuffer(nullptr),
mStaticBufferCacheTotalSize(0),
@@ -179,7 +179,11 @@ gl::Error BufferD3D::getIndexRange(GLenum type,
gl::IndexRange *outRange)
{
const uint8_t *data = nullptr;
- ANGLE_TRY(getData(&data));
+ gl::Error error = getData(&data);
+ if (error.isError())
+ {
+ return error;
+ }
*outRange = gl::ComputeIndexRange(type, data + offset, count, primitiveRestartEnabled);
return gl::Error(GL_NO_ERROR);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.h
index fdabe7b7e..3c43c0164 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/BufferD3D.h
@@ -30,7 +30,7 @@ enum class D3DBufferUsage
class BufferD3D : public BufferImpl
{
public:
- BufferD3D(const gl::BufferState &state, BufferFactoryD3D *factory);
+ BufferD3D(BufferFactoryD3D *factory);
virtual ~BufferD3D();
unsigned int getSerial() const { return mSerial; }
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp
index 474a08c65..f5cc97e95 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.cpp
@@ -29,6 +29,10 @@
# include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
#endif // ANGLE_ENABLE_D3D11
+#if defined (ANGLE_TEST_CONFIG)
+# define ANGLE_DEFAULT_D3D11 1
+#endif
+
#if !defined(ANGLE_DEFAULT_D3D11)
// Enables use of the Direct3D 11 API for a default display, when available
# define ANGLE_DEFAULT_D3D11 1
@@ -172,18 +176,16 @@ SurfaceImpl *DisplayD3D::createPbufferSurface(const egl::SurfaceState &state,
const egl::AttributeMap &attribs)
{
ASSERT(mRenderer != nullptr);
- return new PbufferSurfaceD3D(state, mRenderer, mDisplay, configuration, 0, nullptr, attribs);
+ return new PbufferSurfaceD3D(state, mRenderer, mDisplay, configuration, nullptr, attribs);
}
SurfaceImpl *DisplayD3D::createPbufferFromClientBuffer(const egl::SurfaceState &state,
const egl::Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
+ EGLClientBuffer shareHandle,
const egl::AttributeMap &attribs)
{
ASSERT(mRenderer != nullptr);
- return new PbufferSurfaceD3D(state, mRenderer, mDisplay, configuration, buftype, clientBuffer,
- attribs);
+ return new PbufferSurfaceD3D(state, mRenderer, mDisplay, configuration, shareHandle, attribs);
}
SurfaceImpl *DisplayD3D::createPixmapSurface(const egl::SurfaceState &state,
@@ -289,26 +291,6 @@ bool DisplayD3D::isValidNativeWindow(EGLNativeWindowType window) const
return mRenderer->isValidNativeWindow(window);
}
-egl::Error DisplayD3D::validateClientBuffer(const egl::Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
- const egl::AttributeMap &attribs) const
-{
- switch (buftype)
- {
- case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
- return mRenderer->validateShareHandle(configuration, static_cast<HANDLE>(clientBuffer),
- attribs);
-
- case EGL_D3D_TEXTURE_ANGLE:
- return mRenderer->getD3DTextureInfo(static_cast<IUnknown *>(clientBuffer), nullptr,
- nullptr, nullptr);
-
- default:
- return DisplayImpl::validateClientBuffer(configuration, buftype, clientBuffer, attribs);
- }
-}
-
void DisplayD3D::generateExtensions(egl::DisplayExtensions *outExtensions) const
{
mRenderer->generateDisplayExtensions(outExtensions);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.h
index 3801a8eb1..1bd6f1160 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/DisplayD3D.h
@@ -34,8 +34,7 @@ class DisplayD3D : public DisplayImpl
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
const egl::Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
+ EGLClientBuffer shareHandle,
const egl::AttributeMap &attribs) override;
SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
const egl::Config *configuration,
@@ -60,10 +59,6 @@ class DisplayD3D : public DisplayImpl
egl::Error restoreLostDevice() override;
bool isValidNativeWindow(EGLNativeWindowType window) const override;
- egl::Error validateClientBuffer(const egl::Config *configuration,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
- const egl::AttributeMap &attribs) const override;
egl::Error getDevice(DeviceImpl **device) override;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/gfx/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
index 1946585c1..cb3e582d1 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/DynamicHLSL.cpp
@@ -117,8 +117,8 @@ void WriteArrayString(std::stringstream &strstr, unsigned int i)
strstr << "]";
}
-constexpr const char *VERTEX_ATTRIBUTE_STUB_STRING = "@@ VERTEX ATTRIBUTES @@";
-constexpr const char *PIXEL_OUTPUT_STUB_STRING = "@@ PIXEL OUTPUT @@";
+const std::string VERTEX_ATTRIBUTE_STUB_STRING = "@@ VERTEX ATTRIBUTES @@";
+const std::string PIXEL_OUTPUT_STUB_STRING = "@@ PIXEL OUTPUT @@";
} // anonymous namespace
std::string GetVaryingSemantic(int majorShaderModel, bool programUsesPointSize)
@@ -295,7 +295,7 @@ std::string DynamicHLSL::generateVertexShaderForInputLayout(
std::string vertexHLSL(sourceShader);
size_t copyInsertionPos = vertexHLSL.find(VERTEX_ATTRIBUTE_STUB_STRING);
- vertexHLSL.replace(copyInsertionPos, strlen(VERTEX_ATTRIBUTE_STUB_STRING), structStream.str());
+ vertexHLSL.replace(copyInsertionPos, VERTEX_ATTRIBUTE_STUB_STRING.length(), structStream.str());
return vertexHLSL;
}
@@ -360,7 +360,7 @@ std::string DynamicHLSL::generatePixelShaderForOutputSignature(
std::string pixelHLSL(sourceShader);
size_t outputInsertionPos = pixelHLSL.find(PIXEL_OUTPUT_STUB_STRING);
- pixelHLSL.replace(outputInsertionPos, strlen(PIXEL_OUTPUT_STUB_STRING),
+ pixelHLSL.replace(outputInsertionPos, PIXEL_OUTPUT_STUB_STRING.length(),
declarationStream.str());
return pixelHLSL;
@@ -440,7 +440,7 @@ bool DynamicHLSL::generateShaderLinkHLSL(const gl::ContextState &data,
}
// Add stub string to be replaced when shader is dynamically defined by its layout
- vertexStream << "\n" << std::string(VERTEX_ATTRIBUTE_STUB_STRING) << "\n";
+ vertexStream << "\n" << VERTEX_ATTRIBUTE_STUB_STRING + "\n";
// Write the HLSL input/output declarations
vertexStream << "struct VS_OUTPUT\n";
@@ -597,7 +597,7 @@ bool DynamicHLSL::generateShaderLinkHLSL(const gl::ContextState &data,
generateVaryingLinkHLSL(SHADER_PIXEL, varyingPacking, pixelStream);
pixelStream << "\n";
- pixelStream << std::string(PIXEL_OUTPUT_STUB_STRING) << "\n";
+ pixelStream << PIXEL_OUTPUT_STUB_STRING + "\n";
if (fragmentShader->usesFrontFacing())
{
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
index cc8bb0ea7..a45c94538 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/FramebufferD3D.cpp
@@ -207,7 +207,7 @@ GLenum FramebufferD3D::getImplementationColorReadFormat() const
GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
const gl::InternalFormat &implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
- return implementationFormatInfo.getReadPixelsFormat();
+ return implementationFormatInfo.format;
}
GLenum FramebufferD3D::getImplementationColorReadType() const
@@ -229,7 +229,7 @@ GLenum FramebufferD3D::getImplementationColorReadType() const
GLenum implementationFormat = getRenderTargetImplementationFormat(attachmentRenderTarget);
const gl::InternalFormat &implementationFormatInfo = gl::GetInternalFormatInfo(implementationFormat);
- return implementationFormatInfo.getReadPixelsType();
+ return implementationFormatInfo.type;
}
gl::Error FramebufferD3D::readPixels(ContextImpl *context,
@@ -240,13 +240,15 @@ gl::Error FramebufferD3D::readPixels(ContextImpl *context,
{
const gl::PixelPackState &packState = context->getGLState().getPackState();
- const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type));
-
- GLuint outputPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, packState.alignment, packState.rowLength),
- outputPitch);
+ GLenum sizedInternalFormat = gl::GetSizedInternalFormat(format, type);
+ const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
+ GLuint outputPitch = 0;
+ ANGLE_TRY_RESULT(
+ sizedFormatInfo.computeRowPitch(type, area.width, packState.alignment, packState.rowLength),
+ outputPitch);
GLuint outputSkipBytes = 0;
- ANGLE_TRY_RESULT(formatInfo.computeSkipBytes(outputPitch, 0, packState, false),
+ ANGLE_TRY_RESULT(sizedFormatInfo.computeSkipBytes(outputPitch, 0, 0, packState.skipRows,
+ packState.skipPixels, false),
outputSkipBytes);
return readPixelsImpl(area, format, type, outputPitch, packState,
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp b/gfx/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
index 305b6c4e4..e8b1af312 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/HLSLCompiler.cpp
@@ -136,8 +136,7 @@ gl::Error HLSLCompiler::initialize()
if (!mD3DCompilerModule)
{
- ERR("D3D compiler module not found.");
- return gl::Error(GL_OUT_OF_MEMORY, "D3D compiler module not found.");
+ return gl::Error(GL_INVALID_OPERATION, "No D3D compiler module found - aborting!\n");
}
mD3DCompileFunc = reinterpret_cast<pD3DCompile>(GetProcAddress(mD3DCompilerModule, "D3DCompile"));
@@ -156,7 +155,7 @@ gl::Error HLSLCompiler::initialize()
if (mD3DCompileFunc == nullptr)
{
- return gl::Error(GL_OUT_OF_MEMORY, "Error finding D3DCompile entry point.");
+ return gl::Error(GL_INVALID_OPERATION, "Error finding D3DCompile entry point");
}
mInitialized = true;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp
index c9581ccaa..ead5db645 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.cpp
@@ -10,7 +10,6 @@
#include "libANGLE/renderer/d3d/ImageD3D.h"
-#include "libANGLE/formatutils.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/FramebufferAttachment.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
@@ -30,13 +29,4 @@ ImageD3D::ImageD3D()
{
}
-GLenum
-ImageD3D::getSizedInputFormat(GLenum inputType) const
-{
- const auto &internalFormat = gl::GetInternalFormatInfo(mInternalFormat);
- const auto &unsizedInternalFormat = internalFormat.format;
- const auto &sizedInputFormat = gl::GetSizedInternalFormat(unsizedInternalFormat, inputType);
- return sizedInputFormat;
-}
-
} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.h
index 79840c15b..947a8328f 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/ImageD3D.h
@@ -51,8 +51,6 @@ class ImageD3D : angle::NonCopyable
virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) = 0;
- GLenum getSizedInputFormat(GLenum inputType) const;
-
virtual gl::Error loadData(const gl::Box &area,
const gl::PixelUnpackState &unpack,
GLenum type,
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp
index d00a8738e..3ac82d941 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/ProgramD3D.cpp
@@ -739,14 +739,14 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
if (memcmp(&identifier, &binaryDeviceIdentifier, sizeof(DeviceIdentifier)) != 0)
{
infoLog << "Invalid program binary, device configuration has changed.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
int compileFlags = stream->readInt<int>();
if (compileFlags != ANGLE_COMPILE_OPTIMIZATION_LEVEL)
{
infoLog << "Mismatched compilation flags.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
for (int &index : mAttribLocationToD3DSemantic)
@@ -780,7 +780,7 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
if (stream->error())
{
infoLog << "Invalid program binary.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
const auto &linkedUniforms = mState.getUniforms();
@@ -804,7 +804,7 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
if (stream->error())
{
infoLog << "Invalid program binary.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
ASSERT(mD3DUniformBlocks.empty());
@@ -853,8 +853,6 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
const unsigned char *binary = reinterpret_cast<const unsigned char *>(stream->data());
- bool separateAttribs = (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS);
-
const unsigned int vertexShaderCount = stream->readInt<unsigned int>();
for (unsigned int vertexShaderIndex = 0; vertexShaderIndex < vertexShaderCount;
vertexShaderIndex++)
@@ -872,14 +870,18 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
ShaderExecutableD3D *shaderExecutable = nullptr;
- ANGLE_TRY(mRenderer->loadExecutable(vertexShaderFunction, vertexShaderSize, SHADER_VERTEX,
- mStreamOutVaryings, separateAttribs,
- &shaderExecutable));
+ gl::Error error = mRenderer->loadExecutable(
+ vertexShaderFunction, vertexShaderSize, SHADER_VERTEX, mStreamOutVaryings,
+ (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS), &shaderExecutable);
+ if (error.isError())
+ {
+ return LinkResult(false, error);
+ }
if (!shaderExecutable)
{
infoLog << "Could not create vertex shader.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
// generated converted input layout
@@ -907,14 +909,18 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
const unsigned char *pixelShaderFunction = binary + stream->offset();
ShaderExecutableD3D *shaderExecutable = nullptr;
- ANGLE_TRY(mRenderer->loadExecutable(pixelShaderFunction, pixelShaderSize, SHADER_PIXEL,
- mStreamOutVaryings, separateAttribs,
- &shaderExecutable));
+ gl::Error error = mRenderer->loadExecutable(
+ pixelShaderFunction, pixelShaderSize, SHADER_PIXEL, mStreamOutVaryings,
+ (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS), &shaderExecutable);
+ if (error.isError())
+ {
+ return LinkResult(false, error);
+ }
if (!shaderExecutable)
{
infoLog << "Could not create pixel shader.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
// add new binary
@@ -934,22 +940,27 @@ LinkResult ProgramD3D::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream)
}
const unsigned char *geometryShaderFunction = binary + stream->offset();
+ bool splitAttribs = (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS);
- ANGLE_TRY(mRenderer->loadExecutable(geometryShaderFunction, geometryShaderSize,
- SHADER_GEOMETRY, mStreamOutVaryings, separateAttribs,
- &mGeometryExecutables[geometryExeIndex]));
+ gl::Error error = mRenderer->loadExecutable(
+ geometryShaderFunction, geometryShaderSize, SHADER_GEOMETRY, mStreamOutVaryings,
+ splitAttribs, &mGeometryExecutables[geometryExeIndex]);
+ if (error.isError())
+ {
+ return LinkResult(false, error);
+ }
if (!mGeometryExecutables[geometryExeIndex])
{
infoLog << "Could not create geometry shader.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
stream->skip(geometryShaderSize);
}
initializeUniformStorage();
- return true;
+ return LinkResult(true, gl::Error(GL_NO_ERROR));
}
gl::Error ProgramD3D::save(gl::BinaryOutputStream *stream)
@@ -1278,14 +1289,22 @@ LinkResult ProgramD3D::compileProgramExecutables(const gl::ContextState &data, g
{
const gl::InputLayout &defaultInputLayout =
GetDefaultInputLayoutFromShader(mState.getAttachedVertexShader());
- ShaderExecutableD3D *defaultVertexExecutable = nullptr;
- ANGLE_TRY(
- getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &infoLog));
+ ShaderExecutableD3D *defaultVertexExecutable = NULL;
+ gl::Error error =
+ getVertexExecutableForInputLayout(defaultInputLayout, &defaultVertexExecutable, &infoLog);
+ if (error.isError())
+ {
+ return LinkResult(false, error);
+ }
std::vector<GLenum> defaultPixelOutput = GetDefaultOutputLayoutFromShader(getPixelShaderKey());
- ShaderExecutableD3D *defaultPixelExecutable = nullptr;
- ANGLE_TRY(
- getPixelExecutableForOutputLayout(defaultPixelOutput, &defaultPixelExecutable, &infoLog));
+ ShaderExecutableD3D *defaultPixelExecutable = NULL;
+ error =
+ getPixelExecutableForOutputLayout(defaultPixelOutput, &defaultPixelExecutable, &infoLog);
+ if (error.isError())
+ {
+ return LinkResult(false, error);
+ }
// Auto-generate the geometry shader here, if we expect to be using point rendering in D3D11.
ShaderExecutableD3D *pointGS = nullptr;
@@ -1318,8 +1337,9 @@ LinkResult ProgramD3D::compileProgramExecutables(const gl::ContextState &data, g
fragmentShaderD3D->appendDebugInfo(defaultPixelExecutable->getDebugInfo());
}
- return (defaultVertexExecutable && defaultPixelExecutable &&
- (!usesGeometryShader(GL_POINTS) || pointGS));
+ bool linkSuccess = (defaultVertexExecutable && defaultPixelExecutable &&
+ (!usesGeometryShader(GL_POINTS) || pointGS));
+ return LinkResult(linkSuccess, gl::Error(GL_NO_ERROR));
}
LinkResult ProgramD3D::link(const gl::ContextState &data, gl::InfoLog &infoLog)
@@ -1343,7 +1363,7 @@ LinkResult ProgramD3D::link(const gl::ContextState &data, gl::InfoLog &infoLog)
if (fragmentShaderD3D->usesFrontFacing())
{
infoLog << "The current renderer doesn't support gl_FrontFacing";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
}
@@ -1355,7 +1375,7 @@ LinkResult ProgramD3D::link(const gl::ContextState &data, gl::InfoLog &infoLog)
if (!varyingPacking.packVaryings(infoLog, packedVaryings,
mState.getTransformFeedbackVaryingNames()))
{
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
ProgramD3DMetadata metadata(mRenderer, vertexShaderD3D, fragmentShaderD3D);
@@ -1366,7 +1386,7 @@ LinkResult ProgramD3D::link(const gl::ContextState &data, gl::InfoLog &infoLog)
if (static_cast<GLuint>(varyingPacking.getRegisterCount()) > data.getCaps().maxVaryingVectors)
{
infoLog << "No varying registers left to support gl_FragCoord/gl_PointCoord";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
// TODO(jmadill): Implement more sophisticated component packing in D3D9.
@@ -1376,13 +1396,13 @@ LinkResult ProgramD3D::link(const gl::ContextState &data, gl::InfoLog &infoLog)
varyingPacking.getMaxSemanticIndex() > data.getCaps().maxVaryingVectors)
{
infoLog << "Cannot pack these varyings on D3D9.";
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
if (!mDynamicHLSL->generateShaderLinkHLSL(data, mState, metadata, varyingPacking, &mPixelHLSL,
&mVertexHLSL))
{
- return false;
+ return LinkResult(false, gl::Error(GL_NO_ERROR));
}
mUsesPointSize = vertexShaderD3D->usesPointSize();
@@ -1413,12 +1433,7 @@ LinkResult ProgramD3D::link(const gl::ContextState &data, gl::InfoLog &infoLog)
gatherTransformFeedbackVaryings(varyingPacking);
LinkResult result = compileProgramExecutables(data, infoLog);
- if (result.isError())
- {
- infoLog << result.getError().getMessage();
- return result;
- }
- else if (!result.getResult())
+ if (result.error.isError() || !result.linkSuccess)
{
infoLog << "Failed to create D3D shaders.";
return result;
@@ -1426,7 +1441,7 @@ LinkResult ProgramD3D::link(const gl::ContextState &data, gl::InfoLog &infoLog)
initUniformBlockInfo();
- return true;
+ return LinkResult(true, gl::Error(GL_NO_ERROR));
}
GLboolean ProgramD3D::validate(const gl::Caps & /*caps*/, gl::InfoLog * /*infoLog*/)
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/RendererD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/RendererD3D.h
index b63aba8a9..9378b68b3 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/RendererD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/RendererD3D.h
@@ -127,17 +127,9 @@ class RendererD3D : public BufferFactoryD3D
virtual SwapChainD3D *createSwapChain(NativeWindowD3D *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation) = 0;
- virtual egl::Error getD3DTextureInfo(IUnknown *d3dTexture,
- EGLint *width,
- EGLint *height,
- GLenum *fboFormat) const = 0;
- virtual egl::Error validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const = 0;
virtual gl::Error setSamplerState(gl::SamplerType type, int index, gl::Texture *texture, const gl::SamplerState &sampler) = 0;
virtual gl::Error setTexture(gl::SamplerType type, int index, gl::Texture *texture) = 0;
@@ -177,10 +169,6 @@ class RendererD3D : public BufferFactoryD3D
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha) = 0;
- virtual gl::Error copyCompressedTexture(const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) = 0;
// RenderTarget creation
virtual gl::Error createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT) = 0;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp
index fd7b13abb..326c198d7 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.cpp
@@ -59,14 +59,6 @@ ShaderD3D::ShaderD3D(const gl::ShaderState &data, const WorkaroundsD3D &workarou
{
mAdditionalOptions |= SH_REWRITE_TEXELFETCHOFFSET_TO_TEXELFETCH;
}
- if (workarounds.rewriteUnaryMinusOperator)
- {
- mAdditionalOptions |= SH_REWRITE_INTEGER_UNARY_MINUS_OPERATOR;
- }
- if (workarounds.emulateIsnanFloat)
- {
- mAdditionalOptions |= SH_EMULATE_ISNAN_FLOAT_FUNCTION;
- }
}
ShaderD3D::~ShaderD3D()
@@ -141,12 +133,12 @@ ShShaderOutput ShaderD3D::getCompilerOutputType() const
return mCompilerOutputType;
}
-ShCompileOptions ShaderD3D::prepareSourceAndReturnOptions(std::stringstream *shaderSourceStream,
- std::string *sourcePath)
+int ShaderD3D::prepareSourceAndReturnOptions(std::stringstream *shaderSourceStream,
+ std::string *sourcePath)
{
uncompile();
- ShCompileOptions additionalOptions = 0;
+ int additionalOptions = 0;
const std::string &source = mData.getSource();
@@ -201,7 +193,7 @@ bool ShaderD3D::postTranslateCompile(gl::Compiler *compiler, std::string *infoLo
ShHandle compilerHandle = compiler->getCompilerHandle(mData.getShaderType());
- mUniformRegisterMap = GetUniformRegisterMap(sh::GetUniformRegisterMap(compilerHandle));
+ mUniformRegisterMap = GetUniformRegisterMap(ShGetUniformRegisterMap(compilerHandle));
for (const sh::InterfaceBlock &interfaceBlock : mData.getInterfaceBlocks())
{
@@ -209,7 +201,8 @@ bool ShaderD3D::postTranslateCompile(gl::Compiler *compiler, std::string *infoLo
{
unsigned int index = static_cast<unsigned int>(-1);
bool blockRegisterResult =
- sh::GetInterfaceBlockRegister(compilerHandle, interfaceBlock.name, &index);
+ ShGetInterfaceBlockRegister(compilerHandle, interfaceBlock.name, &index);
+ UNUSED_ASSERTION_VARIABLE(blockRegisterResult);
ASSERT(blockRegisterResult);
mInterfaceBlockRegisterMap[interfaceBlock.name] = index;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.h
index 587c12173..bf6215872 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/ShaderD3D.h
@@ -28,8 +28,8 @@ class ShaderD3D : public ShaderImpl
virtual ~ShaderD3D();
// ShaderImpl implementation
- ShCompileOptions prepareSourceAndReturnOptions(std::stringstream *sourceStream,
- std::string *sourcePath) override;
+ int prepareSourceAndReturnOptions(std::stringstream *sourceStream,
+ std::string *sourcePath) override;
bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override;
std::string getDebugInfo() const override;
@@ -77,7 +77,7 @@ class ShaderD3D : public ShaderImpl
mutable std::string mDebugInfo;
std::map<std::string, unsigned int> mUniformRegisterMap;
std::map<std::string, unsigned int> mInterfaceBlockRegisterMap;
- ShCompileOptions mAdditionalOptions;
+ int mAdditionalOptions;
};
} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
index 8696ab0d7..3c02c4a68 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp
@@ -26,8 +26,7 @@ SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state,
egl::Display *display,
const egl::Config *config,
EGLNativeWindowType window,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
+ EGLClientBuffer shareHandle,
const egl::AttributeMap &attribs)
: SurfaceImpl(state),
mRenderer(renderer),
@@ -42,39 +41,19 @@ SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state,
mWidth(static_cast<EGLint>(attribs.get(EGL_WIDTH, 0))),
mHeight(static_cast<EGLint>(attribs.get(EGL_HEIGHT, 0))),
mSwapInterval(1),
- mShareHandle(0),
- mD3DTexture(nullptr)
+ mShareHandle(reinterpret_cast<HANDLE *>(shareHandle))
{
if (window != nullptr && !mFixedSize)
{
mWidth = -1;
mHeight = -1;
}
-
- switch (buftype)
- {
- case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
- mShareHandle = static_cast<HANDLE>(clientBuffer);
- break;
-
- case EGL_D3D_TEXTURE_ANGLE:
- mD3DTexture = static_cast<IUnknown *>(clientBuffer);
- ASSERT(mD3DTexture != nullptr);
- mD3DTexture->AddRef();
- mRenderer->getD3DTextureInfo(mD3DTexture, &mWidth, &mHeight, &mRenderTargetFormat);
- mDepthStencilFormat = GL_NONE;
- break;
-
- default:
- break;
- }
}
SurfaceD3D::~SurfaceD3D()
{
releaseSwapChain();
SafeDelete(mNativeWindow);
- SafeRelease(mD3DTexture);
}
void SurfaceD3D::releaseSwapChain()
@@ -143,8 +122,8 @@ egl::Error SurfaceD3D::resetSwapChain()
height = mHeight;
}
- mSwapChain = mRenderer->createSwapChain(mNativeWindow, mShareHandle, mD3DTexture,
- mRenderTargetFormat, mDepthStencilFormat, mOrientation);
+ mSwapChain = mRenderer->createSwapChain(mNativeWindow, mShareHandle, mRenderTargetFormat,
+ mDepthStencilFormat, mOrientation);
if (!mSwapChain)
{
return egl::Error(EGL_BAD_ALLOC);
@@ -362,14 +341,7 @@ WindowSurfaceD3D::WindowSurfaceD3D(const egl::SurfaceState &state,
const egl::Config *config,
EGLNativeWindowType window,
const egl::AttributeMap &attribs)
- : SurfaceD3D(state,
- renderer,
- display,
- config,
- window,
- 0,
- static_cast<EGLClientBuffer>(0),
- attribs)
+ : SurfaceD3D(state, renderer, display, config, window, static_cast<EGLClientBuffer>(0), attribs)
{
}
@@ -381,16 +353,14 @@ PbufferSurfaceD3D::PbufferSurfaceD3D(const egl::SurfaceState &state,
RendererD3D *renderer,
egl::Display *display,
const egl::Config *config,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
+ EGLClientBuffer shareHandle,
const egl::AttributeMap &attribs)
: SurfaceD3D(state,
renderer,
display,
config,
static_cast<EGLNativeWindowType>(0),
- buftype,
- clientBuffer,
+ shareHandle,
attribs)
{
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
index 768c60bd0..614b8f979 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h
@@ -61,8 +61,7 @@ class SurfaceD3D : public SurfaceImpl
egl::Display *display,
const egl::Config *config,
EGLNativeWindowType window,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
+ EGLClientBuffer shareHandle,
const egl::AttributeMap &attribs);
egl::Error swapRect(EGLint x, EGLint y, EGLint width, EGLint height);
@@ -88,7 +87,6 @@ class SurfaceD3D : public SurfaceImpl
EGLint mSwapInterval;
HANDLE mShareHandle;
- IUnknown *mD3DTexture;
};
class WindowSurfaceD3D : public SurfaceD3D
@@ -110,8 +108,7 @@ class PbufferSurfaceD3D : public SurfaceD3D
RendererD3D *renderer,
egl::Display *display,
const egl::Config *config,
- EGLenum buftype,
- EGLClientBuffer clientBuffer,
+ EGLClientBuffer shareHandle,
const egl::AttributeMap &attribs);
~PbufferSurfaceD3D() override;
};
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp
deleted file mode 100644
index de8534c3d..000000000
--- a/gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Copyright (c) 2016 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-
-// SwapChainD3D.cpp: Defines a back-end specific class that hides the details of the
-// implementation-specific swapchain.
-
-#include "libANGLE/renderer/d3d/SwapChainD3D.h"
-
-namespace rx
-{
-
-SwapChainD3D::SwapChainD3D(HANDLE shareHandle,
- IUnknown *d3dTexture,
- GLenum backBufferFormat,
- GLenum depthBufferFormat)
- : mOffscreenRenderTargetFormat(backBufferFormat),
- mDepthBufferFormat(depthBufferFormat),
- mShareHandle(shareHandle),
- mD3DTexture(d3dTexture)
-{
- if (mD3DTexture)
- {
- mD3DTexture->AddRef();
- }
-}
-
-SwapChainD3D::~SwapChainD3D()
-{
- SafeRelease(mD3DTexture);
-}
-} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h
index f49204527..992c68bc5 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/SwapChainD3D.h
@@ -27,11 +27,14 @@ class RenderTargetD3D;
class SwapChainD3D : angle::NonCopyable
{
public:
- SwapChainD3D(HANDLE shareHandle,
- IUnknown *d3dTexture,
- GLenum backBufferFormat,
- GLenum depthBufferFormat);
- virtual ~SwapChainD3D();
+ SwapChainD3D(HANDLE shareHandle, GLenum backBufferFormat, GLenum depthBufferFormat)
+ : mOffscreenRenderTargetFormat(backBufferFormat),
+ mDepthBufferFormat(depthBufferFormat),
+ mShareHandle(shareHandle)
+ {
+ }
+
+ virtual ~SwapChainD3D() {};
virtual EGLint resize(EGLint backbufferWidth, EGLint backbufferSize) = 0;
virtual EGLint reset(EGLint backbufferWidth, EGLint backbufferHeight, EGLint swapInterval) = 0;
@@ -52,8 +55,7 @@ class SwapChainD3D : angle::NonCopyable
const GLenum mDepthBufferFormat;
HANDLE mShareHandle;
- IUnknown *mD3DTexture;
};
-} // namespace rx
+}
#endif // LIBANGLE_RENDERER_D3D_SWAPCHAIND3D_H_
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp b/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
index 287700264..96e8e20ff 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.cpp
@@ -46,7 +46,12 @@ gl::Error GetUnpackPointer(const gl::PixelUnpackState &unpack, const uint8_t *pi
BufferD3D *bufferD3D = GetImplAs<BufferD3D>(pixelBuffer);
ASSERT(bufferD3D);
const uint8_t *bufferData = NULL;
- ANGLE_TRY(bufferD3D->getData(&bufferData));
+ gl::Error error = bufferD3D->getData(&bufferData);
+ if (error.isError())
+ {
+ return error;
+ }
+
*pointerOut = bufferData + offset;
}
else
@@ -87,17 +92,25 @@ TextureD3D::~TextureD3D()
gl::Error TextureD3D::getNativeTexture(TextureStorage **outStorage)
{
// ensure the underlying texture is created
- ANGLE_TRY(initializeStorage(false));
+ gl::Error error = initializeStorage(false);
+ if (error.isError())
+ {
+ return error;
+ }
if (mTexStorage)
{
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
ASSERT(outStorage);
*outStorage = mTexStorage;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
GLint TextureD3D::getLevelZeroWidth() const
@@ -182,24 +195,33 @@ gl::Error TextureD3D::setImageImpl(const gl::ImageIndex &index,
// We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
// From our image internal format we know how many channels to expect, and "type" gives the format of pixel's components.
const uint8_t *pixelData = NULL;
- ANGLE_TRY(GetUnpackPointer(unpack, pixels, layerOffset, &pixelData));
+ gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &pixelData);
+ if (error.isError())
+ {
+ return error;
+ }
if (pixelData != nullptr)
{
if (shouldUseSetData(image))
{
- ANGLE_TRY(mTexStorage->setData(index, image, NULL, type, unpack, pixelData));
+ error = mTexStorage->setData(index, image, NULL, type, unpack, pixelData);
}
else
{
gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
- ANGLE_TRY(image->loadData(fullImageArea, unpack, type, pixelData, index.is3D()));
+ error = image->loadData(fullImageArea, unpack, type, pixelData, index.is3D());
+ }
+
+ if (error.isError())
+ {
+ return error;
}
mDirtyImages = true;
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D::subImage(const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type,
@@ -207,7 +229,11 @@ gl::Error TextureD3D::subImage(const gl::ImageIndex &index, const gl::Box &area,
{
// CPU readback & copy where direct GPU copy is not supported
const uint8_t *pixelData = NULL;
- ANGLE_TRY(GetUnpackPointer(unpack, pixels, layerOffset, &pixelData));
+ gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &pixelData);
+ if (error.isError())
+ {
+ return error;
+ }
if (pixelData != NULL)
{
@@ -219,8 +245,18 @@ gl::Error TextureD3D::subImage(const gl::ImageIndex &index, const gl::Box &area,
return mTexStorage->setData(index, image, &area, type, unpack, pixelData);
}
- ANGLE_TRY(image->loadData(area, unpack, type, pixelData, index.is3D()));
- ANGLE_TRY(commitRegion(index, area));
+ error = image->loadData(area, unpack, type, pixelData, index.is3D());
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = commitRegion(index, area);
+ if (error.isError())
+ {
+ return error;
+ }
+
mDirtyImages = true;
}
@@ -243,12 +279,20 @@ gl::Error TextureD3D::setCompressedImageImpl(const gl::ImageIndex &index,
// We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
// From our image internal format we know how many channels to expect, and "type" gives the format of pixel's components.
const uint8_t *pixelData = NULL;
- ANGLE_TRY(GetUnpackPointer(unpack, pixels, layerOffset, &pixelData));
+ gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &pixelData);
+ if (error.isError())
+ {
+ return error;
+ }
if (pixelData != NULL)
{
gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth());
- ANGLE_TRY(image->loadCompressedData(fullImageArea, pixelData));
+ error = image->loadCompressedData(fullImageArea, pixelData);
+ if (error.isError())
+ {
+ return error;
+ }
mDirtyImages = true;
}
@@ -261,14 +305,22 @@ gl::Error TextureD3D::subImageCompressed(const gl::ImageIndex &index, const gl::
ptrdiff_t layerOffset)
{
const uint8_t *pixelData = NULL;
- ANGLE_TRY(GetUnpackPointer(unpack, pixels, layerOffset, &pixelData));
+ gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &pixelData);
+ if (error.isError())
+ {
+ return error;
+ }
if (pixelData != NULL)
{
ImageD3D *image = getImage(index);
ASSERT(image);
- ANGLE_TRY(image->loadCompressedData(area, pixelData));
+ error = image->loadCompressedData(area, pixelData);
+ if (error.isError())
+ {
+ return error;
+ }
mDirtyImages = true;
}
@@ -305,11 +357,13 @@ gl::Error TextureD3D::fastUnpackPixels(const gl::PixelUnpackState &unpack, const
uintptr_t offset = reinterpret_cast<uintptr_t>(pixels);
- ANGLE_TRY(mRenderer->fastCopyBufferToTexture(unpack, static_cast<unsigned int>(offset),
- destRenderTarget, sizedInternalFormat, type,
- destArea));
+ gl::Error error = mRenderer->fastCopyBufferToTexture(unpack, static_cast<unsigned int>(offset), destRenderTarget, sizedInternalFormat, type, destArea);
+ if (error.isError())
+ {
+ return error;
+ }
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
GLint TextureD3D::creationLevels(GLsizei width, GLsizei height, GLsizei depth) const
@@ -356,13 +410,23 @@ gl::Error TextureD3D::generateMipmap()
const GLuint baseLevel = mState.getEffectiveBaseLevel();
const GLuint maxLevel = mState.getMipmapMaxLevel();
ASSERT(maxLevel > baseLevel); // Should be checked before calling this.
+ UNUSED_ASSERTION_VARIABLE(baseLevel);
if (mTexStorage && mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
// Switch to using the mipmapped texture.
TextureStorage *textureStorage = NULL;
- ANGLE_TRY(getNativeTexture(&textureStorage));
- ANGLE_TRY(textureStorage->useLevelZeroWorkaroundTexture(false));
+ gl::Error error = getNativeTexture(&textureStorage);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = textureStorage->useLevelZeroWorkaroundTexture(false);
+ if (error.isError())
+ {
+ return error;
+ }
}
// Set up proper mipmap chain in our Image array.
@@ -370,15 +434,27 @@ gl::Error TextureD3D::generateMipmap()
if (mTexStorage && mTexStorage->supportsNativeMipmapFunction())
{
- ANGLE_TRY(updateStorage());
+ gl::Error error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
// Generate the mipmap chain using the ad-hoc DirectX function.
- ANGLE_TRY(mRenderer->generateMipmapUsingD3D(mTexStorage, mState));
+ error = mRenderer->generateMipmapUsingD3D(mTexStorage, mState);
+ if (error.isError())
+ {
+ return error;
+ }
}
else
{
// Generate the mipmap chain, one level at a time.
- ANGLE_TRY(generateMipmapUsingImages(maxLevel));
+ gl::Error error = generateMipmapUsingImages(maxLevel);
+ if (error.isError())
+ {
+ return error;
+ }
}
return gl::Error(GL_NO_ERROR);
@@ -402,12 +478,20 @@ gl::Error TextureD3D::generateMipmapUsingImages(const GLuint maxLevel)
gl::ImageIndex srcIndex = getImageIndex(mBaseLevel, layer);
ImageD3D *image = getImage(srcIndex);
- ANGLE_TRY(image->copyFromTexStorage(srcIndex, mTexStorage));
+ gl::Error error = image->copyFromTexStorage(srcIndex, mTexStorage);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
else
{
- ANGLE_TRY(updateStorage());
+ gl::Error error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -430,12 +514,20 @@ gl::Error TextureD3D::generateMipmapUsingImages(const GLuint maxLevel)
if (renderableStorage)
{
// GPU-side mipmapping
- ANGLE_TRY(mTexStorage->generateMipmap(sourceIndex, destIndex));
+ gl::Error error = mTexStorage->generateMipmap(sourceIndex, destIndex);
+ if (error.isError())
+ {
+ return error;
+ }
}
else
{
// CPU-side mipmapping
- ANGLE_TRY(mRenderer->generateMipmap(getImage(destIndex), getImage(sourceIndex)));
+ gl::Error error = mRenderer->generateMipmap(getImage(destIndex), getImage(sourceIndex));
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
@@ -445,7 +537,7 @@ gl::Error TextureD3D::generateMipmapUsingImages(const GLuint maxLevel)
updateStorage();
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool TextureD3D::isBaseImageZeroSize() const
@@ -477,7 +569,11 @@ bool TextureD3D::isBaseImageZeroSize() const
gl::Error TextureD3D::ensureRenderTarget()
{
- ANGLE_TRY(initializeStorage(true));
+ gl::Error error = initializeStorage(true);
+ if (error.isError())
+ {
+ return error;
+ }
if (!isBaseImageZeroSize())
{
@@ -485,9 +581,13 @@ gl::Error TextureD3D::ensureRenderTarget()
if (!mTexStorage->isRenderTarget())
{
TextureStorage *newRenderTargetStorage = NULL;
- ANGLE_TRY(createCompleteStorage(true, &newRenderTargetStorage));
+ error = createCompleteStorage(true, &newRenderTargetStorage);
+ if (error.isError())
+ {
+ return error;
+ }
- gl::Error error = mTexStorage->copyToStorage(newRenderTargetStorage);
+ error = mTexStorage->copyToStorage(newRenderTargetStorage);
if (error.isError())
{
SafeDelete(newRenderTargetStorage);
@@ -503,7 +603,7 @@ gl::Error TextureD3D::ensureRenderTarget()
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool TextureD3D::canCreateRenderTargetForImage(const gl::ImageIndex &index) const
@@ -519,11 +619,16 @@ gl::Error TextureD3D::commitRegion(const gl::ImageIndex &index, const gl::Box &r
{
ASSERT(isValidIndex(index));
ImageD3D *image = getImage(index);
- ANGLE_TRY(image->copyToStorage(mTexStorage, index, region));
+ gl::Error error = image->copyToStorage(mTexStorage, index, region);
+ if (error.isError())
+ {
+ return error;
+ }
+
image->markClean();
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target,
@@ -558,11 +663,6 @@ void TextureD3D::setBaseLevel(GLuint baseLevel)
}
}
-void TextureD3D::syncState(const gl::Texture::DirtyBits &dirtyBits)
-{
- // TODO(geofflang): Use dirty bits
-}
-
TextureD3D_2D::TextureD3D_2D(const gl::TextureState &state, RendererD3D *renderer)
: TextureD3D(state, renderer)
{
@@ -679,7 +779,7 @@ gl::Error TextureD3D_2D::setImage(GLenum target,
ANGLE_TRY(setImageImpl(index, type, unpack, pixels, 0));
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2D::setSubImage(GLenum target,
@@ -868,26 +968,6 @@ gl::Error TextureD3D_2D::copySubTexture(const gl::Offset &destOffset,
return gl::NoError();
}
-gl::Error TextureD3D_2D::copyCompressedTexture(const gl::Texture *source)
-{
- GLenum sourceTarget = source->getTarget();
- GLint sourceLevel = 0;
-
- GLint destLevel = 0;
-
- GLenum sizedInternalFormat = source->getFormat(sourceTarget, sourceLevel).asSized();
- gl::Extents size(static_cast<int>(source->getWidth(sourceTarget, sourceLevel)),
- static_cast<int>(source->getHeight(sourceTarget, sourceLevel)), 1);
- redefineImage(destLevel, sizedInternalFormat, size, false);
-
- ANGLE_TRY(initializeStorage(false));
- ASSERT(mTexStorage);
-
- ANGLE_TRY(mRenderer->copyCompressedTexture(source, sourceLevel, mTexStorage, destLevel));
-
- return gl::NoError();
-}
-
gl::Error TextureD3D_2D::setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &size)
{
ASSERT(GL_TEXTURE_2D && size.depth == 1);
@@ -917,11 +997,16 @@ gl::Error TextureD3D_2D::setStorage(GLenum target, size_t levels, GLenum interna
return error;
}
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+
+ if (error.isError())
+ {
+ return error;
+ }
mImmutable = true;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureD3D_2D::bindTexImage(egl::Surface *surface)
@@ -1006,8 +1091,17 @@ gl::Error TextureD3D_2D::getRenderTarget(const gl::ImageIndex &index, RenderTarg
ASSERT(!index.hasLayer());
// ensure the underlying texture is created
- ANGLE_TRY(ensureRenderTarget());
- ANGLE_TRY(updateStorageLevel(index.mipIndex));
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = updateStorageLevel(index.mipIndex);
+ if (error.isError())
+ {
+ return error;
+ }
return mTexStorage->getRenderTarget(index, outRT);
}
@@ -1082,9 +1176,13 @@ gl::Error TextureD3D_2D::initializeStorage(bool renderTarget)
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
TextureStorage *storage = NULL;
- ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+ gl::Error error = createCompleteStorage(createRenderTarget, &storage);
+ if (error.isError())
+ {
+ return error;
+ }
- gl::Error error = setCompleteTexStorage(storage);
+ error = setCompleteTexStorage(storage);
if (error.isError())
{
SafeDelete(storage);
@@ -1094,7 +1192,11 @@ gl::Error TextureD3D_2D::initializeStorage(bool renderTarget)
ASSERT(mTexStorage);
// flush image data to the storage
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
return gl::Error(GL_NO_ERROR);
}
@@ -1134,7 +1236,11 @@ gl::Error TextureD3D_2D::setCompleteTexStorage(TextureStorage *newCompleteTexSto
{
for (int level = 0; level < newCompleteTexStorage->getLevelCount(); level++)
{
- ANGLE_TRY(mImageArray[level]->setManagedSurface2D(newCompleteTexStorage, level));
+ gl::Error error = mImageArray[level]->setManagedSurface2D(newCompleteTexStorage, level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -1143,7 +1249,7 @@ gl::Error TextureD3D_2D::setCompleteTexStorage(TextureStorage *newCompleteTexSto
mDirtyImages = true;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2D::updateStorage()
@@ -1154,11 +1260,15 @@ gl::Error TextureD3D_2D::updateStorage()
{
if (mImageArray[level]->isDirty() && isLevelComplete(level))
{
- ANGLE_TRY(updateStorageLevel(level));
+ gl::Error error = updateStorageLevel(level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2D::updateStorageLevel(int level)
@@ -1170,10 +1280,14 @@ gl::Error TextureD3D_2D::updateStorageLevel(int level)
{
gl::ImageIndex index = gl::ImageIndex::Make2D(level);
gl::Box region(0, 0, 0, getWidth(level), getHeight(level), 1);
- ANGLE_TRY(commitRegion(index, region));
+ gl::Error error = commitRegion(index, region);
+ if (error.isError())
+ {
+ return error;
+ }
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureD3D_2D::redefineImage(size_t level,
@@ -1352,7 +1466,12 @@ gl::Error TextureD3D_Cube::setCompressedSubImage(GLenum target, size_t level, co
gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast<GLint>(level));
- ANGLE_TRY(TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0));
+ gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
+ if (error.isError())
+ {
+ return error;
+ }
+
return commitRegion(index, area);
}
@@ -1377,21 +1496,34 @@ gl::Error TextureD3D_Cube::copyImage(GLenum target,
// so we should use the non-rendering copy path.
if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
- ANGLE_TRY(
- mImageArray[faceIndex][level]->copyFromFramebuffer(destOffset, sourceArea, source));
+ gl::Error error =
+ mImageArray[faceIndex][level]->copyFromFramebuffer(destOffset, sourceArea, source);
+ if (error.isError())
+ {
+ return error;
+ }
+
mDirtyImages = true;
}
else
{
- ANGLE_TRY(ensureRenderTarget());
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
+
mImageArray[faceIndex][level]->markClean();
ASSERT(size.width == size.height);
if (size.width > 0 && isValidFaceLevel(faceIndex, level))
{
- ANGLE_TRY(mRenderer->copyImageCube(source, sourceArea, internalFormat, destOffset,
- mTexStorage, target, level));
+ error = mRenderer->copyImageCube(source, sourceArea, internalFormat, destOffset, mTexStorage, target, level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -1424,13 +1556,26 @@ gl::Error TextureD3D_Cube::copySubImage(GLenum target,
}
else
{
- ANGLE_TRY(ensureRenderTarget());
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
+
if (isValidFaceLevel(faceIndex, level))
{
- ANGLE_TRY(updateStorageFaceLevel(faceIndex, level));
- ANGLE_TRY(mRenderer->copyImageCube(
- source, sourceArea, gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
- destOffset, mTexStorage, target, level));
+ error = updateStorageFaceLevel(faceIndex, level);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = mRenderer->copyImageCube(source, sourceArea, gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
+ destOffset, mTexStorage, target, level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -1472,11 +1617,16 @@ gl::Error TextureD3D_Cube::setStorage(GLenum target, size_t levels, GLenum inter
return error;
}
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+
+ if (error.isError())
+ {
+ return error;
+ }
mImmutable = true;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
// Tests for cube texture completeness. [OpenGL ES 2.0.24] section 3.7.10 page 81.
@@ -1539,8 +1689,17 @@ gl::Error TextureD3D_Cube::getRenderTarget(const gl::ImageIndex &index, RenderTa
ASSERT(gl::IsCubeMapTextureTarget(index.type));
// ensure the underlying texture is created
- ANGLE_TRY(ensureRenderTarget());
- ANGLE_TRY(updateStorageFaceLevel(index.layerIndex, index.mipIndex));
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = updateStorageFaceLevel(index.layerIndex, index.mipIndex);
+ if (error.isError())
+ {
+ return error;
+ }
return mTexStorage->getRenderTarget(index, outRT);
}
@@ -1550,21 +1709,25 @@ gl::Error TextureD3D_Cube::initializeStorage(bool renderTarget)
// Only initialize the first time this texture is used as a render target or shader resource
if (mTexStorage)
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
// do not attempt to create storage for nonexistant data
if (!isFaceLevelComplete(0, getBaseLevel()))
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
TextureStorage *storage = NULL;
- ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+ gl::Error error = createCompleteStorage(createRenderTarget, &storage);
+ if (error.isError())
+ {
+ return error;
+ }
- gl::Error error = setCompleteTexStorage(storage);
+ error = setCompleteTexStorage(storage);
if (error.isError())
{
SafeDelete(storage);
@@ -1574,9 +1737,13 @@ gl::Error TextureD3D_Cube::initializeStorage(bool renderTarget)
ASSERT(mTexStorage);
// flush image data to the storage
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_Cube::createCompleteStorage(bool renderTarget, TextureStorage **outTexStorage) const
@@ -1617,8 +1784,11 @@ gl::Error TextureD3D_Cube::setCompleteTexStorage(TextureStorage *newCompleteTexS
{
for (int level = 0; level < newCompleteTexStorage->getLevelCount(); level++)
{
- ANGLE_TRY(mImageArray[faceIndex][level]->setManagedSurfaceCube(
- newCompleteTexStorage, faceIndex, level));
+ gl::Error error = mImageArray[faceIndex][level]->setManagedSurfaceCube(newCompleteTexStorage, faceIndex, level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
@@ -1640,12 +1810,16 @@ gl::Error TextureD3D_Cube::updateStorage()
{
if (mImageArray[face][level]->isDirty() && isFaceLevelComplete(face, level))
{
- ANGLE_TRY(updateStorageFaceLevel(face, level));
+ gl::Error error = updateStorageFaceLevel(face, level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool TextureD3D_Cube::isValidFaceLevel(int faceIndex, int level) const
@@ -1713,10 +1887,14 @@ gl::Error TextureD3D_Cube::updateStorageFaceLevel(int faceIndex, int level)
GLenum faceTarget = gl::LayerIndexToCubeMapTextureTarget(faceIndex);
gl::ImageIndex index = gl::ImageIndex::MakeCube(faceTarget, level);
gl::Box region(0, 0, 0, image->getWidth(), image->getHeight(), 1);
- ANGLE_TRY(commitRegion(index, region));
+ gl::Error error = commitRegion(index, region);
+ if (error.isError())
+ {
+ return error;
+ }
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureD3D_Cube::redefineImage(int faceIndex, GLint level, GLenum internalformat, const gl::Extents &size)
@@ -1882,12 +2060,19 @@ gl::Error TextureD3D_3D::setImage(GLenum target,
{
// Will try to create RT storage if it does not exist
RenderTargetD3D *destRenderTarget = NULL;
- ANGLE_TRY(getRenderTarget(index, &destRenderTarget));
+ gl::Error error = getRenderTarget(index, &destRenderTarget);
+ if (error.isError())
+ {
+ return error;
+ }
gl::Box destArea(0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
- ANGLE_TRY(fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type,
- destRenderTarget));
+ error = fastUnpackPixels(unpack, pixels, destArea, sizedInternalFormat, type, destRenderTarget);
+ if (error.isError())
+ {
+ return error;
+ }
// Ensure we don't overwrite our newly initialized data
mImageArray[level]->markClean();
@@ -1897,7 +2082,11 @@ gl::Error TextureD3D_3D::setImage(GLenum target,
if (!fastUnpacked)
{
- ANGLE_TRY(setImageImpl(index, type, unpack, pixels, 0));
+ gl::Error error = setImageImpl(index, type, unpack, pixels, 0);
+ if (error.isError())
+ {
+ return error;
+ }
}
return gl::Error(GL_NO_ERROR);
@@ -1920,7 +2109,12 @@ gl::Error TextureD3D_3D::setSubImage(GLenum target,
if (isFastUnpackable(unpack, getInternalFormat(level)) && isLevelComplete(level))
{
RenderTargetD3D *destRenderTarget = NULL;
- ANGLE_TRY(getRenderTarget(index, &destRenderTarget));
+ gl::Error error = getRenderTarget(index, &destRenderTarget);
+ if (error.isError())
+ {
+ return error;
+ }
+
ASSERT(!mImageArray[level]->isDirty());
return fastUnpackPixels(unpack, pixels, area, getInternalFormat(level), type, destRenderTarget);
@@ -1955,7 +2149,12 @@ gl::Error TextureD3D_3D::setCompressedSubImage(GLenum target, size_t level, cons
ASSERT(target == GL_TEXTURE_3D);
gl::ImageIndex index = gl::ImageIndex::Make3D(static_cast<GLint>(level));
- ANGLE_TRY(TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0));
+ gl::Error error = TextureD3D::subImageCompressed(index, area, format, unpack, pixels, 0);
+ if (error.isError())
+ {
+ return error;
+ }
+
return commitRegion(index, area);
}
@@ -1979,18 +2178,37 @@ gl::Error TextureD3D_3D::copySubImage(GLenum target,
if (canCreateRenderTargetForImage(index))
{
- ANGLE_TRY(mImageArray[level]->copyFromFramebuffer(destOffset, sourceArea, source));
+ gl::Error error = mImageArray[level]->copyFromFramebuffer(destOffset, sourceArea, source);
+ if (error.isError())
+ {
+ return error;
+ }
+
mDirtyImages = true;
}
else
{
- ANGLE_TRY(ensureRenderTarget());
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
+
if (isValidLevel(level))
{
- ANGLE_TRY(updateStorageLevel(level));
- ANGLE_TRY(mRenderer->copyImage3D(
- source, sourceArea, gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
- destOffset, mTexStorage, level));
+ error = updateStorageLevel(level);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = mRenderer->copyImage3D(source, sourceArea,
+ gl::GetInternalFormatInfo(getBaseLevelInternalFormat()).format,
+ destOffset, mTexStorage, level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -2027,11 +2245,16 @@ gl::Error TextureD3D_3D::setStorage(GLenum target, size_t levels, GLenum interna
return error;
}
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+
+ if (error.isError())
+ {
+ return error;
+ }
mImmutable = true;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureD3D_3D::bindTexImage(egl::Surface *surface)
@@ -2062,15 +2285,27 @@ void TextureD3D_3D::initMipmapImages()
gl::Error TextureD3D_3D::getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT)
{
// ensure the underlying texture is created
- ANGLE_TRY(ensureRenderTarget());
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
if (index.hasLayer())
{
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
else
{
- ANGLE_TRY(updateStorageLevel(index.mipIndex));
+ error = updateStorageLevel(index.mipIndex);
+ if (error.isError())
+ {
+ return error;
+ }
}
return mTexStorage->getRenderTarget(index, outRT);
@@ -2093,9 +2328,13 @@ gl::Error TextureD3D_3D::initializeStorage(bool renderTarget)
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
TextureStorage *storage = NULL;
- ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+ gl::Error error = createCompleteStorage(createRenderTarget, &storage);
+ if (error.isError())
+ {
+ return error;
+ }
- gl::Error error = setCompleteTexStorage(storage);
+ error = setCompleteTexStorage(storage);
if (error.isError())
{
SafeDelete(storage);
@@ -2105,9 +2344,13 @@ gl::Error TextureD3D_3D::initializeStorage(bool renderTarget)
ASSERT(mTexStorage);
// flush image data to the storage
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_3D::createCompleteStorage(bool renderTarget, TextureStorage **outStorage) const
@@ -2137,7 +2380,7 @@ gl::Error TextureD3D_3D::setCompleteTexStorage(TextureStorage *newCompleteTexSto
// We do not support managed 3D storage, as that is D3D9/ES2-only
ASSERT(!mTexStorage->isManaged());
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_3D::updateStorage()
@@ -2148,11 +2391,15 @@ gl::Error TextureD3D_3D::updateStorage()
{
if (mImageArray[level]->isDirty() && isLevelComplete(level))
{
- ANGLE_TRY(updateStorageLevel(level));
+ gl::Error error = updateStorageLevel(level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool TextureD3D_3D::isValidLevel(int level) const
@@ -2222,10 +2469,14 @@ gl::Error TextureD3D_3D::updateStorageLevel(int level)
{
gl::ImageIndex index = gl::ImageIndex::Make3D(level);
gl::Box region(0, 0, 0, getWidth(level), getHeight(level), getDepth(level));
- ANGLE_TRY(commitRegion(index, region));
+ gl::Error error = commitRegion(index, region);
+ if (error.isError())
+ {
+ return error;
+ }
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureD3D_3D::redefineImage(GLint level, GLenum internalformat, const gl::Extents &size)
@@ -2234,12 +2485,12 @@ void TextureD3D_3D::redefineImage(GLint level, GLenum internalformat, const gl::
const int storageWidth = std::max(1, getLevelZeroWidth() >> level);
const int storageHeight = std::max(1, getLevelZeroHeight() >> level);
const int storageDepth = std::max(1, getLevelZeroDepth() >> level);
- const GLenum storageFormat = getBaseLevelInternalFormat();
mImageArray[level]->redefine(GL_TEXTURE_3D, internalformat, size, false);
if (mTexStorage)
{
+ const GLenum storageFormat = getBaseLevelInternalFormat();
const int storageLevels = mTexStorage->getLevelCount();
if ((level >= storageLevels && storageLevels != 0) ||
@@ -2366,25 +2617,29 @@ gl::Error TextureD3D_2DArray::setImage(GLenum target,
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
- GLint level = static_cast<GLint>(imageLevel);
GLenum sizedInternalFormat = gl::GetSizedInternalFormat(internalFormat, type);
+
+ GLint level = static_cast<GLint>(imageLevel);
redefineImage(level, sizedInternalFormat, size);
- const auto sizedInputFormat = gl::GetSizedInternalFormat(format, type);
- const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(inputFormat.computeDepthPitch(size.width, size.height, unpack.alignment,
- unpack.rowLength, unpack.imageHeight),
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(sizedInternalFormat);
+ GLsizei inputDepthPitch = 0;
+ ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, size.width, size.height, unpack.alignment,
+ unpack.rowLength, unpack.imageHeight),
inputDepthPitch);
for (int i = 0; i < size.depth; i++)
{
const ptrdiff_t layerOffset = (inputDepthPitch * i);
gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, i);
- ANGLE_TRY(setImageImpl(index, type, unpack, pixels, layerOffset));
+ gl::Error error = setImageImpl(index, type, unpack, pixels, layerOffset);
+ if (error.isError())
+ {
+ return error;
+ }
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2DArray::setSubImage(GLenum target,
@@ -2396,12 +2651,11 @@ gl::Error TextureD3D_2DArray::setSubImage(GLenum target,
const uint8_t *pixels)
{
ASSERT(target == GL_TEXTURE_2D_ARRAY);
- GLint level = static_cast<GLint>(imageLevel);
- const auto sizedInputFormat = gl::GetSizedInternalFormat(format, type);
- const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
- GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(inputFormat.computeDepthPitch(area.width, area.height, unpack.alignment,
- unpack.rowLength, unpack.imageHeight),
+ GLint level = static_cast<GLint>(imageLevel);
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(getInternalFormat(level));
+ GLsizei inputDepthPitch = 0;
+ ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment,
+ unpack.rowLength, unpack.imageHeight),
inputDepthPitch);
for (int i = 0; i < area.depth; i++)
@@ -2412,11 +2666,14 @@ gl::Error TextureD3D_2DArray::setSubImage(GLenum target,
gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1);
gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
- ANGLE_TRY(
- TextureD3D::subImage(index, layerArea, format, type, unpack, pixels, layerOffset));
+ gl::Error error = TextureD3D::subImage(index, layerArea, format, type, unpack, pixels, layerOffset);
+ if (error.isError())
+ {
+ return error;
+ }
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target,
@@ -2436,7 +2693,7 @@ gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target,
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(
- formatInfo.computeDepthPitch(size.width, size.height, 1, 0, 0),
+ formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height, 1, 0, 0),
inputDepthPitch);
for (int i = 0; i < size.depth; i++)
@@ -2444,10 +2701,14 @@ gl::Error TextureD3D_2DArray::setCompressedImage(GLenum target,
const ptrdiff_t layerOffset = (inputDepthPitch * i);
gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, i);
- ANGLE_TRY(setCompressedImageImpl(index, unpack, pixels, layerOffset));
+ gl::Error error = setCompressedImageImpl(index, unpack, pixels, layerOffset);
+ if (error.isError())
+ {
+ return error;
+ }
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2DArray::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
@@ -2458,7 +2719,7 @@ gl::Error TextureD3D_2DArray::setCompressedSubImage(GLenum target, size_t level,
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(format);
GLsizei inputDepthPitch = 0;
ANGLE_TRY_RESULT(
- formatInfo.computeDepthPitch(area.width, area.height, 1, 0, 0),
+ formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0, 0),
inputDepthPitch);
for (int i = 0; i < area.depth; i++)
@@ -2469,9 +2730,17 @@ gl::Error TextureD3D_2DArray::setCompressedSubImage(GLenum target, size_t level,
gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1);
gl::ImageIndex index = gl::ImageIndex::Make2DArray(static_cast<GLint>(level), layer);
- ANGLE_TRY(
- TextureD3D::subImageCompressed(index, layerArea, format, unpack, pixels, layerOffset));
- ANGLE_TRY(commitRegion(index, layerArea));
+ gl::Error error = TextureD3D::subImageCompressed(index, layerArea, format, unpack, pixels, layerOffset);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = commitRegion(index, layerArea);
+ if (error.isError())
+ {
+ return error;
+ }
}
return gl::Error(GL_NO_ERROR);
@@ -2498,21 +2767,39 @@ gl::Error TextureD3D_2DArray::copySubImage(GLenum target,
if (canCreateRenderTargetForImage(index))
{
gl::Offset destLayerOffset(destOffset.x, destOffset.y, 0);
- ANGLE_TRY(mImageArray[level][destOffset.z]->copyFromFramebuffer(destLayerOffset, sourceArea,
- source));
+ gl::Error error = mImageArray[level][destOffset.z]->copyFromFramebuffer(destLayerOffset,
+ sourceArea, source);
+ if (error.isError())
+ {
+ return error;
+ }
+
mDirtyImages = true;
}
else
{
- ANGLE_TRY(ensureRenderTarget());
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
if (isValidLevel(level))
{
- ANGLE_TRY(updateStorageLevel(level));
- ANGLE_TRY(mRenderer->copyImage2DArray(
+ error = updateStorageLevel(level);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = mRenderer->copyImage2DArray(
source, sourceArea,
gl::GetInternalFormatInfo(getInternalFormat(getBaseLevel())).format, destOffset,
- mTexStorage, level));
+ mTexStorage, level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
return gl::Error(GL_NO_ERROR);
@@ -2558,11 +2845,16 @@ gl::Error TextureD3D_2DArray::setStorage(GLenum target, size_t levels, GLenum in
return error;
}
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+
+ if (error.isError())
+ {
+ return error;
+ }
mImmutable = true;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureD3D_2DArray::bindTexImage(egl::Surface *surface)
@@ -2599,8 +2891,18 @@ void TextureD3D_2DArray::initMipmapImages()
gl::Error TextureD3D_2DArray::getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT)
{
// ensure the underlying texture is created
- ANGLE_TRY(ensureRenderTarget());
- ANGLE_TRY(updateStorageLevel(index.mipIndex));
+ gl::Error error = ensureRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = updateStorageLevel(index.mipIndex);
+ if (error.isError())
+ {
+ return error;
+ }
+
return mTexStorage->getRenderTarget(index, outRT);
}
@@ -2609,21 +2911,25 @@ gl::Error TextureD3D_2DArray::initializeStorage(bool renderTarget)
// Only initialize the first time this texture is used as a render target or shader resource
if (mTexStorage)
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
// do not attempt to create storage for nonexistant data
if (!isLevelComplete(getBaseLevel()))
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool createRenderTarget = (renderTarget || IsRenderTargetUsage(mState.getUsage()));
- TextureStorage *storage = nullptr;
- ANGLE_TRY(createCompleteStorage(createRenderTarget, &storage));
+ TextureStorage *storage = NULL;
+ gl::Error error = createCompleteStorage(createRenderTarget, &storage);
+ if (error.isError())
+ {
+ return error;
+ }
- gl::Error error = setCompleteTexStorage(storage);
+ error = setCompleteTexStorage(storage);
if (error.isError())
{
SafeDelete(storage);
@@ -2633,9 +2939,13 @@ gl::Error TextureD3D_2DArray::initializeStorage(bool renderTarget)
ASSERT(mTexStorage);
// flush image data to the storage
- ANGLE_TRY(updateStorage());
+ error = updateStorage();
+ if (error.isError())
+ {
+ return error;
+ }
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2DArray::createCompleteStorage(bool renderTarget, TextureStorage **outStorage) const
@@ -2653,7 +2963,7 @@ gl::Error TextureD3D_2DArray::createCompleteStorage(bool renderTarget, TextureSt
// TODO(geofflang): Verify storage creation succeeds
*outStorage = mRenderer->createTextureStorage2DArray(internalFormat, renderTarget, width, height, depth, levels);
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2DArray::setCompleteTexStorage(TextureStorage *newCompleteTexStorage)
@@ -2665,7 +2975,7 @@ gl::Error TextureD3D_2DArray::setCompleteTexStorage(TextureStorage *newCompleteT
// We do not support managed 2D array storage, as managed storage is ES2/D3D9 only
ASSERT(!mTexStorage->isManaged());
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureD3D_2DArray::updateStorage()
@@ -2676,11 +2986,15 @@ gl::Error TextureD3D_2DArray::updateStorage()
{
if (isLevelComplete(level))
{
- ANGLE_TRY(updateStorageLevel(level));
+ gl::Error error = updateStorageLevel(level);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool TextureD3D_2DArray::isValidLevel(int level) const
@@ -2759,7 +3073,11 @@ gl::Error TextureD3D_2DArray::updateStorageLevel(int level)
{
gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer);
gl::Box region(0, 0, 0, getWidth(level), getHeight(level), 1);
- ANGLE_TRY(commitRegion(index, region));
+ gl::Error error = commitRegion(index, region);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -3083,4 +3401,4 @@ void TextureD3D_External::markAllImagesDirty()
{
UNREACHABLE();
}
-} // namespace rx
+}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.h
index 99343632a..7a8cad980 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/TextureD3D.h
@@ -69,8 +69,6 @@ class TextureD3D : public TextureImpl
void setBaseLevel(GLuint baseLevel) override;
- void syncState(const gl::Texture::DirtyBits &dirtyBits) override;
-
protected:
gl::Error setImageImpl(const gl::ImageIndex &index,
GLenum type,
@@ -172,7 +170,6 @@ class TextureD3D_2D : public TextureD3D
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha,
const gl::Texture *source) override;
- gl::Error copyCompressedTexture(const gl::Texture *source) override;
gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &size) override;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/VaryingPacking.cpp b/gfx/angle/src/libANGLE/renderer/d3d/VaryingPacking.cpp
index eea85fea7..0bd783414 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/VaryingPacking.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/VaryingPacking.cpp
@@ -271,37 +271,33 @@ bool VaryingPacking::packVaryings(gl::InfoLog &infoLog,
continue;
}
- bool found = false;
for (const PackedVarying &packedVarying : packedVaryings)
{
const auto &varying = *packedVarying.varying;
// Make sure transform feedback varyings aren't optimized out.
- if (uniqueVaryingNames.count(transformFeedbackVaryingName) > 0)
+ if (uniqueVaryingNames.count(transformFeedbackVaryingName) == 0)
{
- found = true;
- break;
- }
-
- if (transformFeedbackVaryingName == varying.name)
- {
- if (!packVarying(packedVarying))
+ bool found = false;
+ if (transformFeedbackVaryingName == varying.name)
+ {
+ if (!packVarying(packedVarying))
+ {
+ infoLog << "Could not pack varying " << varying.name;
+ return false;
+ }
+
+ found = true;
+ break;
+ }
+ if (!found)
{
- infoLog << "Could not pack varying " << varying.name;
+ infoLog << "Transform feedback varying " << transformFeedbackVaryingName
+ << " does not exist in the vertex shader.";
return false;
}
-
- found = true;
- break;
}
}
-
- if (!found)
- {
- infoLog << "Transform feedback varying " << transformFeedbackVaryingName
- << " does not exist in the vertex shader.";
- return false;
- }
}
// Sort the packed register list
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/gfx/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp
index 89dd4faf2..fff16e63a 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/VertexDataManager.cpp
@@ -431,6 +431,7 @@ gl::Error VertexDataManager::reserveSpaceForAttrib(const TranslatedAttribute &tr
gl::Buffer *buffer = attrib.buffer.get();
BufferD3D *bufferD3D = buffer ? GetImplAs<BufferD3D>(buffer) : nullptr;
ASSERT(!bufferD3D || bufferD3D->getStaticVertexBuffer(attrib) == nullptr);
+ UNUSED_ASSERTION_VARIABLE(bufferD3D);
size_t totalCount = ComputeVertexAttributeElementCount(attrib, count, instances);
ASSERT(!bufferD3D ||
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/WorkaroundsD3D.h b/gfx/angle/src/libANGLE/renderer/d3d/WorkaroundsD3D.h
index ede929ce8..a2faf71d9 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/WorkaroundsD3D.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/WorkaroundsD3D.h
@@ -67,43 +67,19 @@ struct WorkaroundsD3D
// Some drivers (NVIDIA) do not take into account the base level of the texture in the results
// of the HLSL GetDimensions builtin.
bool getDimensionsIgnoresBaseLevel = false;
+
+ // In the Intel driver, data with format DXGI_FORMAT_B5G6R5_UNORM will be parsed incorrectly.
+ // This workaroud will disable B5G6R5 support when it's Intel's driver. By default, we will
+ // use R8G8B8A8 as format.
+ bool disableB5G6R5Support = false;
// On some Intel drivers, HLSL's function texture.Load returns 0 when the parameter Location
// is negative, even if the sum of Offset and Location is in range. This may cause errors when
// translating GLSL's function texelFetchOffset into texture.Load, as it is valid for
// texelFetchOffset to use negative texture coordinates as its parameter P when the sum of P
- // and Offset is in range. To work around this, we translate texelFetchOffset into texelFetch
+ // and Offset is in range. To work around this, we translatie texelFetchOffset into texelFetch
// by adding Offset directly to Location before reading the texture.
bool preAddTexelFetchOffsets = false;
-
- // On some AMD drivers, 1x1 and 2x2 mips of depth/stencil textures aren't sampled correctly.
- // We can work around this bug by doing an internal blit to a temporary single-channel texture
- // before we sample.
- bool emulateTinyStencilTextures = false;
-
- // In Intel driver, the data with format DXGI_FORMAT_B5G6R5_UNORM will be parsed incorrectly.
- // This workaroud will disable B5G6R5 support when it's Intel driver. By default, it will use
- // R8G8B8A8 format.
- bool disableB5G6R5Support = false;
-
- // On some Intel drivers, evaluating unary minus operator on integer may get wrong answer in
- // vertex shaders. To work around this bug, we translate -(int) into ~(int)+1.
- bool rewriteUnaryMinusOperator = false;
-
- // On some Intel drivers, using isnan() on highp float will get wrong answer. To work around
- // this bug, we use an expression to emulate function isnan(). Tracking bug:
- // https://crbug.com/650547
- bool emulateIsnanFloat = false;
-
- // On some Intel drivers, using clear() may not take effect. To work around this bug, we call
- // clear() twice on these platforms. Tracking bug: https://crbug.com/655534
- bool callClearTwice = false;
-
- // On some Intel drivers, copying from staging storage to constant buffer storage does not
- // seem to work. Work around this by keeping system memory storage as a canonical reference
- // for buffer data.
- // D3D11-only workaround. See http://crbug.com/593024.
- bool useSystemMemoryForConstantBuffers = false;
};
} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
index f8a0ac597..d1e6a13f2 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp
@@ -274,93 +274,6 @@ void CopyDepthStencil(const gl::Box &sourceArea,
}
}
-void Depth32FStencil8ToDepth32F(const float *source, float *dest)
-{
- *dest = *source;
-}
-
-void Depth24Stencil8ToDepth32F(const uint32_t *source, float *dest)
-{
- uint32_t normDepth = source[0] & 0x00FFFFFF;
- float floatDepth = gl::normalizedToFloat<24>(normDepth);
- *dest = floatDepth;
-}
-
-void BlitD24S8ToD32F(const gl::Box &sourceArea,
- const gl::Box &destArea,
- const gl::Rectangle &clippedDestArea,
- const gl::Extents &sourceSize,
- unsigned int sourceRowPitch,
- unsigned int destRowPitch,
- ptrdiff_t readOffset,
- ptrdiff_t writeOffset,
- size_t copySize,
- size_t srcPixelStride,
- size_t destPixelStride,
- const uint8_t *sourceData,
- uint8_t *destData)
-{
- // No stretching or subregions are supported, only full blits.
- ASSERT(sourceArea == destArea);
- ASSERT(sourceSize.width == sourceArea.width && sourceSize.height == sourceArea.height &&
- sourceSize.depth == 1);
- ASSERT(clippedDestArea.width == sourceSize.width &&
- clippedDestArea.height == sourceSize.height);
- ASSERT(readOffset == 0 && writeOffset == 0);
- ASSERT(destArea.x == 0 && destArea.y == 0);
-
- for (int row = 0; row < destArea.height; ++row)
- {
- for (int column = 0; column < destArea.width; ++column)
- {
- ptrdiff_t offset = row * sourceRowPitch + column * srcPixelStride;
- const uint32_t *sourcePixel = reinterpret_cast<const uint32_t *>(sourceData + offset);
-
- float *destPixel =
- reinterpret_cast<float *>(destData + row * destRowPitch + column * destPixelStride);
-
- Depth24Stencil8ToDepth32F(sourcePixel, destPixel);
- }
- }
-}
-
-void BlitD32FS8ToD32F(const gl::Box &sourceArea,
- const gl::Box &destArea,
- const gl::Rectangle &clippedDestArea,
- const gl::Extents &sourceSize,
- unsigned int sourceRowPitch,
- unsigned int destRowPitch,
- ptrdiff_t readOffset,
- ptrdiff_t writeOffset,
- size_t copySize,
- size_t srcPixelStride,
- size_t destPixelStride,
- const uint8_t *sourceData,
- uint8_t *destData)
-{
- // No stretching or subregions are supported, only full blits.
- ASSERT(sourceArea == destArea);
- ASSERT(sourceSize.width == sourceArea.width && sourceSize.height == sourceArea.height &&
- sourceSize.depth == 1);
- ASSERT(clippedDestArea.width == sourceSize.width &&
- clippedDestArea.height == sourceSize.height);
- ASSERT(readOffset == 0 && writeOffset == 0);
- ASSERT(destArea.x == 0 && destArea.y == 0);
-
- for (int row = 0; row < destArea.height; ++row)
- {
- for (int column = 0; column < destArea.width; ++column)
- {
- ptrdiff_t offset = row * sourceRowPitch + column * srcPixelStride;
- const float *sourcePixel = reinterpret_cast<const float *>(sourceData + offset);
- float *destPixel =
- reinterpret_cast<float *>(destData + row * destRowPitch + column * destPixelStride);
-
- Depth32FStencil8ToDepth32F(sourcePixel, destPixel);
- }
- }
-}
-
Blit11::BlitConvertFunction *GetCopyDepthStencilFunction(GLenum internalFormat)
{
switch (internalFormat)
@@ -1022,7 +935,8 @@ gl::Error Blit11::swizzleTexture(ID3D11ShaderResourceView *source,
D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
source->GetDesc(&sourceSRVDesc);
- GLenum componentType = d3d11::GetComponentType(sourceSRVDesc.Format);
+ const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(sourceSRVDesc.Format);
+ GLenum componentType = dxgiFormatInfo.componentType;
if (componentType == GL_NONE)
{
// We're swizzling the depth component of a depth-stencil texture.
@@ -1182,7 +1096,8 @@ gl::Error Blit11::copyTexture(ID3D11ShaderResourceView *source,
D3D11_SHADER_RESOURCE_VIEW_DESC sourceSRVDesc;
source->GetDesc(&sourceSRVDesc);
- GLenum componentType = d3d11::GetComponentType(sourceSRVDesc.Format);
+ const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(sourceSRVDesc.Format);
+ GLenum componentType = dxgiFormatInfo.componentType;
ASSERT(componentType != GL_NONE);
ASSERT(componentType != GL_SIGNED_NORMALIZED);
@@ -1457,26 +1372,26 @@ gl::Error Blit11::copyDepthStencilImpl(const TextureHelper11 &source,
const gl::Rectangle *scissor,
bool stencilOnly)
{
- auto srcDXGIFormat = source.getFormat();
- const auto &srcSizeInfo = d3d11::GetDXGIFormatSizeInfo(srcDXGIFormat);
+ auto srcFormat = source.getFormat();
+ const auto &srcSizeInfo = d3d11::GetDXGIFormatSizeInfo(srcFormat);
unsigned int srcPixelSize = srcSizeInfo.pixelBytes;
- unsigned int copyOffset = 0;
+ unsigned int copyOffset = 0;
unsigned int copySize = srcPixelSize;
- auto destDXGIFormat = dest.getFormat();
- const auto &destSizeInfo = d3d11::GetDXGIFormatSizeInfo(destDXGIFormat);
+ auto destFormat = dest.getFormat();
+ const auto &destSizeInfo = d3d11::GetDXGIFormatSizeInfo(destFormat);
unsigned int destPixelSize = destSizeInfo.pixelBytes;
- ASSERT(srcDXGIFormat == destDXGIFormat || destDXGIFormat == DXGI_FORMAT_R32_TYPELESS);
+ ASSERT(srcFormat == destFormat);
if (stencilOnly)
{
- const auto &srcFormat = source.getFormatSet().format();
+ const d3d11::DXGIFormat &srcDXGIFormat = d3d11::GetDXGIFormatInfo(srcFormat);
// Stencil channel should be right after the depth channel. Some views to depth/stencil
// resources have red channel for depth, in which case the depth channel bit width is in
// redBits.
- ASSERT((srcFormat.redBits != 0) != (srcFormat.depthBits != 0));
- GLuint depthBits = srcFormat.redBits + srcFormat.depthBits;
+ ASSERT((srcDXGIFormat.redBits != 0) != (srcDXGIFormat.depthBits != 0));
+ GLuint depthBits = srcDXGIFormat.redBits + srcDXGIFormat.depthBits;
// Known formats have either 24 or 32 bits of depth.
ASSERT(depthBits == 24 || depthBits == 32);
copyOffset = depthBits / 8;
@@ -1485,22 +1400,6 @@ gl::Error Blit11::copyDepthStencilImpl(const TextureHelper11 &source,
copySize = 1;
}
- if (srcDXGIFormat != destDXGIFormat)
- {
- if (srcDXGIFormat == DXGI_FORMAT_R24G8_TYPELESS)
- {
- ASSERT(sourceArea == destArea && sourceSize == destSize && scissor == nullptr);
- return copyAndConvert(source, sourceSubresource, sourceArea, sourceSize, dest,
- destSubresource, destArea, destSize, scissor, copyOffset,
- copyOffset, copySize, srcPixelSize, destPixelSize,
- BlitD24S8ToD32F);
- }
- ASSERT(srcDXGIFormat == DXGI_FORMAT_R32G8X24_TYPELESS);
- return copyAndConvert(source, sourceSubresource, sourceArea, sourceSize, dest,
- destSubresource, destArea, destSize, scissor, copyOffset, copyOffset,
- copySize, srcPixelSize, destPixelSize, BlitD32FS8ToD32F);
- }
-
return copyAndConvert(source, sourceSubresource, sourceArea, sourceSize, dest, destSubresource,
destArea, destSize, scissor, copyOffset, copyOffset, copySize,
srcPixelSize, destPixelSize, StretchedBlitNearest);
@@ -2000,14 +1899,6 @@ gl::Error Blit11::getSwizzleShader(GLenum type,
gl::ErrorOrResult<TextureHelper11> Blit11::resolveDepth(RenderTarget11 *depth)
{
- // Multisampled depth stencil SRVs are not available in feature level 10.0
- if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_10_0)
- {
- return gl::Error(GL_INVALID_OPERATION,
- "Resolving multisampled depth stencil textures is not supported in "
- "feature level 10.0.");
- }
-
const auto &extents = depth->getExtents();
ID3D11Device *device = mRenderer->getDevice();
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
@@ -2136,14 +2027,6 @@ gl::Error Blit11::initResolveDepthStencil(const gl::Extents &extents)
gl::ErrorOrResult<TextureHelper11> Blit11::resolveStencil(RenderTarget11 *depthStencil,
bool alsoDepth)
{
- // Multisampled depth stencil SRVs are not available in feature level 10.0
- if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_10_0)
- {
- return gl::Error(GL_INVALID_OPERATION,
- "Resolving multisampled depth stencil textures is not supported in "
- "feature level 10.0.");
- }
-
const auto &extents = depthStencil->getExtents();
ANGLE_TRY(initResolveDepthStencil(extents));
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
index 90668b759..107a577e4 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp
@@ -38,34 +38,12 @@ enum class CopyResult
NOT_RECREATED,
};
-void CalculateConstantBufferParams(GLintptr offset,
- GLsizeiptr size,
- UINT *outFirstConstant,
- UINT *outNumConstants)
-{
- // The offset must be aligned to 256 bytes (should have been enforced by glBindBufferRange).
- ASSERT(offset % 256 == 0);
-
- // firstConstant and numConstants are expressed in constants of 16-bytes. Furthermore they must
- // be a multiple of 16 constants.
- *outFirstConstant = static_cast<UINT>(offset / 16);
-
- // The GL size is not required to be aligned to a 256 bytes boundary.
- // Round the size up to a 256 bytes boundary then express the results in constants of 16-bytes.
- *outNumConstants = static_cast<UINT>(rx::roundUp(size, static_cast<GLsizeiptr>(256)) / 16);
-
- // Since the size is rounded up, firstConstant + numConstants may be bigger than the actual size
- // of the buffer. This behaviour is explictly allowed according to the documentation on
- // ID3D11DeviceContext1::PSSetConstantBuffers1
- // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx
-}
-
} // anonymous namespace
namespace gl_d3d11
{
-D3D11_MAP GetD3DMapTypeFromBits(BufferUsage usage, GLbitfield access)
+D3D11_MAP GetD3DMapTypeFromBits(GLbitfield access)
{
bool readBit = ((access & GL_MAP_READ_BIT) != 0);
bool writeBit = ((access & GL_MAP_WRITE_BIT) != 0);
@@ -81,8 +59,7 @@ D3D11_MAP GetD3DMapTypeFromBits(BufferUsage usage, GLbitfield access)
}
else if (writeBit && !readBit)
{
- // Special case for uniform storage - we only allow full buffer updates.
- return usage == BUFFER_USAGE_UNIFORM ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE;
+ return D3D11_MAP_WRITE;
}
else if (writeBit && readBit)
{
@@ -111,7 +88,7 @@ class Buffer11::BufferStorage : angle::NonCopyable
size_t getSize() const { return mBufferSize; }
void setDataRevision(DataRevision rev) { mRevision = rev; }
- virtual bool isMappable(GLbitfield access) const = 0;
+ virtual bool isMappable() const = 0;
virtual gl::ErrorOrResult<CopyResult> copyFromStorage(BufferStorage *source,
size_t sourceOffset,
@@ -146,7 +123,7 @@ class Buffer11::NativeStorage : public Buffer11::BufferStorage
const angle::BroadcastChannel *onStorageChanged);
~NativeStorage() override;
- bool isMappable(GLbitfield access) const override;
+ bool isMappable() const override { return mUsage == BUFFER_USAGE_STAGING; }
ID3D11Buffer *getNativeStorage() const { return mNativeStorage; }
gl::ErrorOrResult<CopyResult> copyFromStorage(BufferStorage *source,
@@ -161,18 +138,14 @@ class Buffer11::NativeStorage : public Buffer11::BufferStorage
uint8_t **mapPointerOut) override;
void unmap() override;
- gl::ErrorOrResult<ID3D11ShaderResourceView *> getSRVForFormat(DXGI_FORMAT srvFormat);
-
private:
- static void FillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
+ static void fillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
Renderer11 *renderer,
BufferUsage usage,
unsigned int bufferSize);
- void clearSRVs();
ID3D11Buffer *mNativeStorage;
const angle::BroadcastChannel *mOnStorageChanged;
- std::map<DXGI_FORMAT, ID3D11ShaderResourceView *> mBufferResourceViews;
};
// A emulated indexed buffer storage represents an underlying D3D11 buffer for data
@@ -184,7 +157,7 @@ class Buffer11::EmulatedIndexedStorage : public Buffer11::BufferStorage
EmulatedIndexedStorage(Renderer11 *renderer);
~EmulatedIndexedStorage() override;
- bool isMappable(GLbitfield access) const override { return true; }
+ bool isMappable() const override { return true; }
gl::ErrorOrResult<ID3D11Buffer *> getNativeStorage(SourceIndexData *indexInfo,
const TranslatedAttribute &attribute,
@@ -217,7 +190,7 @@ class Buffer11::PackStorage : public Buffer11::BufferStorage
explicit PackStorage(Renderer11 *renderer);
~PackStorage() override;
- bool isMappable(GLbitfield access) const override { return true; }
+ bool isMappable() const override { return true; }
gl::ErrorOrResult<CopyResult> copyFromStorage(BufferStorage *source,
size_t sourceOffset,
size_t size,
@@ -252,7 +225,7 @@ class Buffer11::SystemMemoryStorage : public Buffer11::BufferStorage
explicit SystemMemoryStorage(Renderer11 *renderer);
~SystemMemoryStorage() override {}
- bool isMappable(GLbitfield access) const override { return true; }
+ bool isMappable() const override { return true; }
gl::ErrorOrResult<CopyResult> copyFromStorage(BufferStorage *source,
size_t sourceOffset,
size_t size,
@@ -271,16 +244,16 @@ class Buffer11::SystemMemoryStorage : public Buffer11::BufferStorage
MemoryBuffer mSystemCopy;
};
-Buffer11::Buffer11(const gl::BufferState &state, Renderer11 *renderer)
- : BufferD3D(state, renderer),
+Buffer11::Buffer11(Renderer11 *renderer)
+ : BufferD3D(renderer),
mRenderer(renderer),
mSize(0),
mMappedStorage(nullptr),
- mBufferStorages({}),
- mDeallocThresholds({}),
- mIdleness({}),
+ mBufferStorages(BUFFER_USAGE_COUNT, nullptr),
mConstantBufferStorageAdditionalSize(0),
- mMaxConstantBufferLruCount(0)
+ mMaxConstantBufferLruCount(0),
+ mReadUsageCount(0),
+ mSystemMemoryDeallocThreshold(0)
{
}
@@ -299,10 +272,10 @@ Buffer11::~Buffer11()
mRenderer->onBufferDelete(this);
}
-gl::Error Buffer11::setData(GLenum target, const void *data, size_t size, GLenum usage)
+gl::Error Buffer11::setData(const void *data, size_t size, GLenum usage)
{
updateD3DBufferUsage(usage);
- ANGLE_TRY(setSubData(target, data, size, 0));
+ ANGLE_TRY(setSubData(data, size, 0));
return gl::NoError();
}
@@ -311,6 +284,8 @@ gl::Error Buffer11::getData(const uint8_t **outData)
SystemMemoryStorage *systemMemoryStorage = nullptr;
ANGLE_TRY_RESULT(getSystemMemoryStorage(), systemMemoryStorage);
+ mReadUsageCount = 0;
+
ASSERT(systemMemoryStorage->getSize() >= mSize);
*outData = systemMemoryStorage->getSystemCopy()->data();
@@ -324,34 +299,16 @@ gl::ErrorOrResult<Buffer11::SystemMemoryStorage *> Buffer11::getSystemMemoryStor
return GetAs<SystemMemoryStorage>(storage);
}
-gl::Error Buffer11::setSubData(GLenum target, const void *data, size_t size, size_t offset)
+gl::Error Buffer11::setSubData(const void *data, size_t size, size_t offset)
{
size_t requiredSize = size + offset;
if (data && size > 0)
{
// Use system memory storage for dynamic buffers.
- // Try using a constant storage for constant buffers
+
BufferStorage *writeBuffer = nullptr;
- if (target == GL_UNIFORM_BUFFER)
- {
- // If we are a very large uniform buffer, keep system memory storage around so that we
- // aren't forced to read back from a constant buffer. We also check the workaround for
- // Intel - this requires us to use system memory so we don't end up having to copy from
- // a constant buffer to a staging buffer.
- // TODO(jmadill): Use Context caps.
- if (offset == 0 && size >= mSize &&
- size <= static_cast<UINT>(mRenderer->getNativeCaps().maxUniformBlockSize) &&
- !mRenderer->getWorkarounds().useSystemMemoryForConstantBuffers)
- {
- ANGLE_TRY_RESULT(getBufferStorage(BUFFER_USAGE_UNIFORM), writeBuffer);
- }
- else
- {
- ANGLE_TRY_RESULT(getSystemMemoryStorage(), writeBuffer);
- }
- }
- else if (supportsDirectBinding())
+ if (supportsDirectBinding())
{
ANGLE_TRY_RESULT(getStagingStorage(), writeBuffer);
}
@@ -406,12 +363,11 @@ gl::Error Buffer11::copySubData(BufferImpl *source,
// If copying to/from a pixel pack buffer, we must have a staging or
// pack buffer partner, because other native buffers can't be mapped
- if (copyDest->getUsage() == BUFFER_USAGE_PIXEL_PACK && !copySource->isMappable(GL_MAP_READ_BIT))
+ if (copyDest->getUsage() == BUFFER_USAGE_PIXEL_PACK && !copySource->isMappable())
{
ANGLE_TRY_RESULT(sourceBuffer->getStagingStorage(), copySource);
}
- else if (copySource->getUsage() == BUFFER_USAGE_PIXEL_PACK &&
- !copyDest->isMappable(GL_MAP_WRITE_BIT))
+ else if (copySource->getUsage() == BUFFER_USAGE_PIXEL_PACK && !copyDest->isMappable())
{
ANGLE_TRY_RESULT(getStagingStorage(), copyDest);
}
@@ -518,81 +474,50 @@ gl::Error Buffer11::markTransformFeedbackUsage()
return gl::NoError();
}
-void Buffer11::updateDeallocThreshold(BufferUsage usage)
+void Buffer11::updateSystemMemoryDeallocThreshold()
{
// The following strategy was tuned on the Oort online benchmark (http://oortonline.gl/)
// as well as a custom microbenchmark (IndexConversionPerfTest.Run/index_range_d3d11)
- // First readback: 8 unmodified uses before we free buffer memory.
+ // First readback: 8 unmodified uses before we free system memory.
// After that, double the threshold each time until we reach the max.
- if (mDeallocThresholds[usage] == 0)
+ if (mSystemMemoryDeallocThreshold == 0)
{
- mDeallocThresholds[usage] = 8;
+ mSystemMemoryDeallocThreshold = 8;
}
- else if (mDeallocThresholds[usage] < std::numeric_limits<unsigned int>::max() / 2u)
+ else if (mSystemMemoryDeallocThreshold < std::numeric_limits<unsigned int>::max() / 2u)
{
- mDeallocThresholds[usage] *= 2u;
+ mSystemMemoryDeallocThreshold *= 2u;
}
else
{
- mDeallocThresholds[usage] = std::numeric_limits<unsigned int>::max();
+ mSystemMemoryDeallocThreshold = std::numeric_limits<unsigned int>::max();
}
}
-// Free the storage if we decide it isn't being used very often.
-gl::Error Buffer11::checkForDeallocation(BufferUsage usage)
+gl::Error Buffer11::markBufferUsage()
{
- mIdleness[usage]++;
+ mReadUsageCount++;
- BufferStorage *&storage = mBufferStorages[usage];
- if (storage != nullptr && mIdleness[usage] > mDeallocThresholds[usage])
+ // Free the system memory storage if we decide it isn't being used very often.
+ BufferStorage *&sysMemStorage = mBufferStorages[BUFFER_USAGE_SYSTEM_MEMORY];
+ if (sysMemStorage != nullptr && mReadUsageCount > mSystemMemoryDeallocThreshold)
{
BufferStorage *latestStorage = nullptr;
ANGLE_TRY_RESULT(getLatestBufferStorage(), latestStorage);
- if (latestStorage != storage)
+ if (latestStorage != sysMemStorage)
{
- SafeDelete(storage);
+ SafeDelete(sysMemStorage);
}
}
return gl::NoError();
}
-// Keep system memory when we are using it for the canonical version of data.
-bool Buffer11::canDeallocateSystemMemory() const
-{
- // Must keep system memory on Intel.
- if (mRenderer->getWorkarounds().useSystemMemoryForConstantBuffers)
- {
- return false;
- }
-
- return (!mBufferStorages[BUFFER_USAGE_UNIFORM] ||
- mSize <= mRenderer->getNativeCaps().maxUniformBlockSize);
-}
-
-void Buffer11::markBufferUsage(BufferUsage usage)
-{
- mIdleness[usage] = 0;
-}
-
-gl::Error Buffer11::garbageCollection(BufferUsage currentUsage)
-{
- if (currentUsage != BUFFER_USAGE_SYSTEM_MEMORY && canDeallocateSystemMemory())
- {
- ANGLE_TRY(checkForDeallocation(BUFFER_USAGE_SYSTEM_MEMORY));
- }
-
- if (currentUsage != BUFFER_USAGE_STAGING)
- {
- ANGLE_TRY(checkForDeallocation(BUFFER_USAGE_STAGING));
- }
-
- return gl::NoError();
-}
-
gl::ErrorOrResult<ID3D11Buffer *> Buffer11::getBuffer(BufferUsage usage)
{
+ ANGLE_TRY(markBufferUsage());
+
BufferStorage *storage = nullptr;
ANGLE_TRY_RESULT(getBufferStorage(usage), storage);
return GetAs<NativeStorage>(storage)->getNativeStorage();
@@ -605,6 +530,8 @@ gl::ErrorOrResult<ID3D11Buffer *> Buffer11::getEmulatedIndexedBuffer(
{
ASSERT(indexInfo);
+ ANGLE_TRY(markBufferUsage());
+
BufferStorage *untypedStorage = nullptr;
ANGLE_TRY_RESULT(getBufferStorage(BUFFER_USAGE_EMULATED_INDEXED_VERTEX), untypedStorage);
@@ -617,37 +544,64 @@ gl::ErrorOrResult<ID3D11Buffer *> Buffer11::getEmulatedIndexedBuffer(
return nativeStorage;
}
-gl::Error Buffer11::getConstantBufferRange(GLintptr offset,
- GLsizeiptr size,
- ID3D11Buffer **bufferOut,
- UINT *firstConstantOut,
- UINT *numConstantsOut)
+gl::ErrorOrResult<ID3D11Buffer *> Buffer11::getConstantBufferRange(GLintptr offset, GLsizeiptr size)
{
+ ANGLE_TRY(markBufferUsage());
+
BufferStorage *bufferStorage = nullptr;
if (offset == 0 || mRenderer->getRenderer11DeviceCaps().supportsConstantBufferOffsets)
{
ANGLE_TRY_RESULT(getBufferStorage(BUFFER_USAGE_UNIFORM), bufferStorage);
- CalculateConstantBufferParams(offset, size, firstConstantOut, numConstantsOut);
}
else
{
ANGLE_TRY_RESULT(getConstantBufferRangeStorage(offset, size), bufferStorage);
- *firstConstantOut = 0;
- *numConstantsOut = 0;
}
- *bufferOut = GetAs<NativeStorage>(bufferStorage)->getNativeStorage();
-
- return gl::NoError();
+ return GetAs<NativeStorage>(bufferStorage)->getNativeStorage();
}
gl::ErrorOrResult<ID3D11ShaderResourceView *> Buffer11::getSRV(DXGI_FORMAT srvFormat)
{
BufferStorage *storage = nullptr;
ANGLE_TRY_RESULT(getBufferStorage(BUFFER_USAGE_PIXEL_UNPACK), storage);
- NativeStorage *nativeStorage = GetAs<NativeStorage>(storage);
- return nativeStorage->getSRVForFormat(srvFormat);
+ ID3D11Buffer *buffer = GetAs<NativeStorage>(storage)->getNativeStorage();
+
+ auto bufferSRVIt = mBufferResourceViews.find(srvFormat);
+
+ if (bufferSRVIt != mBufferResourceViews.end())
+ {
+ if (bufferSRVIt->second.first == buffer)
+ {
+ return bufferSRVIt->second.second;
+ }
+ else
+ {
+ // The underlying buffer has changed since the SRV was created: recreate the SRV.
+ SafeRelease(bufferSRVIt->second.second);
+ }
+ }
+
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11ShaderResourceView *bufferSRV = nullptr;
+
+ const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(srvFormat);
+
+ D3D11_SHADER_RESOURCE_VIEW_DESC bufferSRVDesc;
+ bufferSRVDesc.Buffer.ElementOffset = 0;
+ bufferSRVDesc.Buffer.ElementWidth =
+ static_cast<unsigned int>(mSize) / dxgiFormatInfo.pixelBytes;
+ bufferSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
+ bufferSRVDesc.Format = srvFormat;
+
+ HRESULT result = device->CreateShaderResourceView(buffer, &bufferSRVDesc, &bufferSRV);
+ UNUSED_ASSERTION_VARIABLE(result);
+ ASSERT(SUCCEEDED(result));
+
+ mBufferResourceViews[srvFormat] = BufferSRVPair(buffer, bufferSRV);
+
+ return bufferSRV;
}
gl::Error Buffer11::packPixels(const gl::FramebufferAttachment &readAttachment,
@@ -689,31 +643,28 @@ gl::ErrorOrResult<Buffer11::BufferStorage *> Buffer11::getBufferStorage(BufferUs
newStorage = allocateStorage(usage);
}
- markBufferUsage(usage);
-
// resize buffer
if (newStorage->getSize() < mSize)
{
ANGLE_TRY(newStorage->resize(mSize, true));
}
- ASSERT(newStorage);
-
ANGLE_TRY(updateBufferStorage(newStorage, 0, mSize));
- ANGLE_TRY(garbageCollection(usage));
return newStorage;
}
Buffer11::BufferStorage *Buffer11::allocateStorage(BufferUsage usage)
{
- updateDeallocThreshold(usage);
switch (usage)
{
case BUFFER_USAGE_PIXEL_PACK:
return new PackStorage(mRenderer);
case BUFFER_USAGE_SYSTEM_MEMORY:
+ {
+ updateSystemMemoryDeallocThreshold();
return new SystemMemoryStorage(mRenderer);
+ }
case BUFFER_USAGE_EMULATED_INDEXED_VERTEX:
return new EmulatedIndexedStorage(mRenderer);
case BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK:
@@ -744,8 +695,6 @@ gl::ErrorOrResult<Buffer11::BufferStorage *> Buffer11::getConstantBufferRangeSto
newStorage = cacheEntry->storage;
}
- markBufferUsage(BUFFER_USAGE_UNIFORM);
-
if (newStorage->getSize() < static_cast<size_t>(size))
{
size_t maximumAllowedAdditionalSize = 2 * getSize();
@@ -780,7 +729,6 @@ gl::ErrorOrResult<Buffer11::BufferStorage *> Buffer11::getConstantBufferRangeSto
}
ANGLE_TRY(updateBufferStorage(newStorage, offset, size));
- ANGLE_TRY(garbageCollection(BUFFER_USAGE_UNIFORM));
return newStorage;
}
@@ -791,8 +739,6 @@ gl::Error Buffer11::updateBufferStorage(BufferStorage *storage,
BufferStorage *latestBuffer = nullptr;
ANGLE_TRY_RESULT(getLatestBufferStorage(), latestBuffer);
- ASSERT(storage);
-
if (latestBuffer && latestBuffer->getDataRevision() > storage->getDataRevision())
{
// Copy through a staging buffer if we're copying from or to a non-staging, mappable
@@ -800,7 +746,7 @@ gl::Error Buffer11::updateBufferStorage(BufferStorage *storage,
// data directly. If we're already using a staging buffer we're fine.
if (latestBuffer->getUsage() != BUFFER_USAGE_STAGING &&
storage->getUsage() != BUFFER_USAGE_STAGING &&
- (!latestBuffer->isMappable(GL_MAP_READ_BIT) || !storage->isMappable(GL_MAP_WRITE_BIT)))
+ (!latestBuffer->isMappable() || !storage->isMappable()))
{
NativeStorage *stagingBuffer = nullptr;
ANGLE_TRY_RESULT(getStagingStorage(), stagingBuffer);
@@ -899,8 +845,6 @@ angle::BroadcastChannel *Buffer11::getDirectBroadcastChannel()
return &mDirectBroadcastChannel;
}
-// Buffer11::BufferStorage implementation
-
Buffer11::BufferStorage::BufferStorage(Renderer11 *renderer, BufferUsage usage)
: mRenderer(renderer), mRevision(0), mUsage(usage), mBufferSize(0)
{
@@ -908,24 +852,18 @@ Buffer11::BufferStorage::BufferStorage(Renderer11 *renderer, BufferUsage usage)
gl::Error Buffer11::BufferStorage::setData(const uint8_t *data, size_t offset, size_t size)
{
- ASSERT(isMappable(GL_MAP_WRITE_BIT));
-
- // Uniform storage can have a different internal size than the buffer size. Ensure we don't
- // overflow.
- size_t mapSize = std::min(size, mBufferSize - offset);
+ ASSERT(isMappable());
uint8_t *writePointer = nullptr;
- ANGLE_TRY(map(offset, mapSize, GL_MAP_WRITE_BIT, &writePointer));
+ ANGLE_TRY(map(offset, size, GL_MAP_WRITE_BIT, &writePointer));
- memcpy(writePointer, data, mapSize);
+ memcpy(writePointer, data, size);
unmap();
return gl::NoError();
}
-// Buffer11::NativeStorage implementation
-
Buffer11::NativeStorage::NativeStorage(Renderer11 *renderer,
BufferUsage usage,
const angle::BroadcastChannel *onStorageChanged)
@@ -936,18 +874,6 @@ Buffer11::NativeStorage::NativeStorage(Renderer11 *renderer,
Buffer11::NativeStorage::~NativeStorage()
{
SafeRelease(mNativeStorage);
- clearSRVs();
-}
-
-bool Buffer11::NativeStorage::isMappable(GLbitfield access) const
-{
- if ((access & GL_MAP_READ_BIT) != 0)
- {
- // Read is more exclusive than write mappability.
- return (mUsage == BUFFER_USAGE_STAGING);
- }
- ASSERT((access & GL_MAP_WRITE_BIT) != 0);
- return (mUsage == BUFFER_USAGE_STAGING || mUsage == BUFFER_USAGE_UNIFORM);
}
// Returns true if it recreates the direct buffer
@@ -962,38 +888,45 @@ gl::ErrorOrResult<CopyResult> Buffer11::NativeStorage::copyFromStorage(BufferSto
bool createBuffer = !mNativeStorage || mBufferSize < requiredSize;
// (Re)initialize D3D buffer if needed
- bool preserveData = (destOffset > 0);
if (createBuffer)
{
+ bool preserveData = (destOffset > 0);
resize(requiredSize, preserveData);
}
- size_t clampedSize = size;
- if (mUsage == BUFFER_USAGE_UNIFORM)
- {
- clampedSize = std::min(clampedSize, mBufferSize - destOffset);
- }
-
if (source->getUsage() == BUFFER_USAGE_PIXEL_PACK ||
source->getUsage() == BUFFER_USAGE_SYSTEM_MEMORY)
{
- ASSERT(source->isMappable(GL_MAP_READ_BIT) && isMappable(GL_MAP_WRITE_BIT));
-
- // Uniform buffers must be mapped with write/discard.
- ASSERT(!(preserveData && mUsage == BUFFER_USAGE_UNIFORM));
+ ASSERT(source->isMappable());
uint8_t *sourcePointer = nullptr;
- ANGLE_TRY(source->map(sourceOffset, clampedSize, GL_MAP_READ_BIT, &sourcePointer));
+ ANGLE_TRY(source->map(sourceOffset, size, GL_MAP_READ_BIT, &sourcePointer));
+
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT hr = context->Map(mNativeStorage, 0, D3D11_MAP_WRITE, 0, &mappedResource);
+ ASSERT(SUCCEEDED(hr));
+ if (FAILED(hr))
+ {
+ source->unmap();
+ return gl::Error(
+ GL_OUT_OF_MEMORY,
+ "Failed to map native storage in Buffer11::NativeStorage::copyFromStorage");
+ }
+
+ uint8_t *destPointer = static_cast<uint8_t *>(mappedResource.pData) + destOffset;
- setData(sourcePointer, destOffset, clampedSize);
+ // Offset bounds are validated at the API layer
+ ASSERT(sourceOffset + size <= destOffset + mBufferSize);
+ memcpy(destPointer, sourcePointer, size);
+ context->Unmap(mNativeStorage, 0);
source->unmap();
}
else
{
D3D11_BOX srcBox;
srcBox.left = static_cast<unsigned int>(sourceOffset);
- srcBox.right = static_cast<unsigned int>(sourceOffset + clampedSize);
+ srcBox.right = static_cast<unsigned int>(sourceOffset + size);
srcBox.top = 0;
srcBox.bottom = 1;
srcBox.front = 0;
@@ -1014,7 +947,7 @@ gl::Error Buffer11::NativeStorage::resize(size_t size, bool preserveData)
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
D3D11_BUFFER_DESC bufferDesc;
- FillBufferDesc(&bufferDesc, mRenderer, mUsage, static_cast<unsigned int>(size));
+ fillBufferDesc(&bufferDesc, mRenderer, mUsage, static_cast<unsigned int>(size));
ID3D11Buffer *newBuffer;
HRESULT result = device->CreateBuffer(&bufferDesc, nullptr, &newBuffer);
@@ -1049,9 +982,6 @@ gl::Error Buffer11::NativeStorage::resize(size_t size, bool preserveData)
mBufferSize = bufferDesc.ByteWidth;
- // Free the SRVs.
- clearSRVs();
-
// Notify that the storage has changed.
if (mOnStorageChanged)
{
@@ -1061,8 +991,7 @@ gl::Error Buffer11::NativeStorage::resize(size_t size, bool preserveData)
return gl::NoError();
}
-// static
-void Buffer11::NativeStorage::FillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
+void Buffer11::NativeStorage::fillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
Renderer11 *renderer,
BufferUsage usage,
unsigned int bufferSize)
@@ -1111,9 +1040,6 @@ void Buffer11::NativeStorage::FillBufferDesc(D3D11_BUFFER_DESC *bufferDesc,
// Constant buffers must be of a limited size, and aligned to 16 byte boundaries
// For our purposes we ignore any buffer data past the maximum constant buffer size
bufferDesc->ByteWidth = roundUp(bufferDesc->ByteWidth, 16u);
-
- // Note: it seems that D3D11 allows larger buffers on some platforms, but not all.
- // (Windows 10 seems to allow larger constant buffers, but not Windows 7)
bufferDesc->ByteWidth =
std::min<UINT>(bufferDesc->ByteWidth,
static_cast<UINT>(renderer->getNativeCaps().maxUniformBlockSize));
@@ -1129,11 +1055,11 @@ gl::Error Buffer11::NativeStorage::map(size_t offset,
GLbitfield access,
uint8_t **mapPointerOut)
{
- ASSERT(isMappable(access));
+ ASSERT(mUsage == BUFFER_USAGE_STAGING);
D3D11_MAPPED_SUBRESOURCE mappedResource;
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
- D3D11_MAP d3dMapType = gl_d3d11::GetD3DMapTypeFromBits(mUsage, access);
+ D3D11_MAP d3dMapType = gl_d3d11::GetD3DMapTypeFromBits(access);
UINT d3dMapFlag = ((access & GL_MAP_UNSYNCHRONIZED_BIT) != 0 ? D3D11_MAP_FLAG_DO_NOT_WAIT : 0);
HRESULT result = context->Map(mNativeStorage, 0, d3dMapType, d3dMapFlag, &mappedResource);
@@ -1150,56 +1076,11 @@ gl::Error Buffer11::NativeStorage::map(size_t offset,
void Buffer11::NativeStorage::unmap()
{
- ASSERT(isMappable(GL_MAP_WRITE_BIT) || isMappable(GL_MAP_READ_BIT));
+ ASSERT(mUsage == BUFFER_USAGE_STAGING);
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
context->Unmap(mNativeStorage, 0);
}
-gl::ErrorOrResult<ID3D11ShaderResourceView *> Buffer11::NativeStorage::getSRVForFormat(
- DXGI_FORMAT srvFormat)
-{
- auto bufferSRVIt = mBufferResourceViews.find(srvFormat);
-
- if (bufferSRVIt != mBufferResourceViews.end())
- {
- return bufferSRVIt->second;
- }
-
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11ShaderResourceView *bufferSRV = nullptr;
-
- const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(srvFormat);
-
- D3D11_SHADER_RESOURCE_VIEW_DESC bufferSRVDesc;
- bufferSRVDesc.Buffer.ElementOffset = 0;
- bufferSRVDesc.Buffer.ElementWidth = static_cast<UINT>(mBufferSize) / dxgiFormatInfo.pixelBytes;
- bufferSRVDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
- bufferSRVDesc.Format = srvFormat;
-
- HRESULT result = device->CreateShaderResourceView(mNativeStorage, &bufferSRVDesc, &bufferSRV);
- ASSERT(SUCCEEDED(result));
- if (FAILED(result))
- {
- return gl::Error(GL_OUT_OF_MEMORY,
- "Error creating buffer SRV in Buffer11::NativeStorage::getSRVForFormat");
- }
-
- mBufferResourceViews[srvFormat] = bufferSRV;
-
- return bufferSRV;
-}
-
-void Buffer11::NativeStorage::clearSRVs()
-{
- for (auto &srv : mBufferResourceViews)
- {
- SafeRelease(srv.second);
- }
- mBufferResourceViews.clear();
-}
-
-// Buffer11::EmulatedIndexStorage implementation
-
Buffer11::EmulatedIndexedStorage::EmulatedIndexedStorage(Renderer11 *renderer)
: BufferStorage(renderer, BUFFER_USAGE_EMULATED_INDEXED_VERTEX), mNativeStorage(nullptr)
{
@@ -1334,7 +1215,7 @@ gl::ErrorOrResult<CopyResult> Buffer11::EmulatedIndexedStorage::copyFromStorage(
size_t size,
size_t destOffset)
{
- ASSERT(source->isMappable(GL_MAP_READ_BIT));
+ ASSERT(source->isMappable());
uint8_t *sourceData = nullptr;
ANGLE_TRY(source->map(sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
ASSERT(destOffset + size <= mMemoryBuffer.size());
@@ -1372,8 +1253,6 @@ void Buffer11::EmulatedIndexedStorage::unmap()
// No-op
}
-// Buffer11::PackStorage implementation
-
Buffer11::PackStorage::PackStorage(Renderer11 *renderer)
: BufferStorage(renderer, BUFFER_USAGE_PIXEL_PACK), mStagingTexture(), mDataModified(false)
{
@@ -1390,8 +1269,9 @@ gl::ErrorOrResult<CopyResult> Buffer11::PackStorage::copyFromStorage(BufferStora
{
ANGLE_TRY(flushQueuedPackCommand());
- // For all use cases of pack buffers, we must copy through a readable buffer.
- ASSERT(source->isMappable(GL_MAP_READ_BIT));
+ // We copy through a staging buffer when drawing with a pack buffer, or for other cases where we
+ // access the pack buffer
+ ASSERT(source->isMappable() && source->getUsage() == BUFFER_USAGE_STAGING);
uint8_t *sourceData = nullptr;
ANGLE_TRY(source->map(sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
ASSERT(destOffset + size <= mMemoryBuffer.size());
@@ -1504,8 +1384,6 @@ gl::Error Buffer11::PackStorage::flushQueuedPackCommand()
return gl::NoError();
}
-// Buffer11::SystemMemoryStorage implementation
-
Buffer11::SystemMemoryStorage::SystemMemoryStorage(Renderer11 *renderer)
: Buffer11::BufferStorage(renderer, BUFFER_USAGE_SYSTEM_MEMORY)
{
@@ -1516,7 +1394,7 @@ gl::ErrorOrResult<CopyResult> Buffer11::SystemMemoryStorage::copyFromStorage(Buf
size_t size,
size_t destOffset)
{
- ASSERT(source->isMappable(GL_MAP_READ_BIT));
+ ASSERT(source->isMappable());
uint8_t *sourceData = nullptr;
ANGLE_TRY(source->map(sourceOffset, size, GL_MAP_READ_BIT, &sourceData));
ASSERT(destOffset + size <= mSystemCopy.size());
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
index 3210f05bc..6d56501d8 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Buffer11.h
@@ -9,7 +9,6 @@
#ifndef LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_BUFFER11_H_
-#include <array>
#include <map>
#include "libANGLE/angletypes.h"
@@ -28,16 +27,15 @@ class Renderer11;
struct SourceIndexData;
struct TranslatedAttribute;
-// The order of this enum governs priority of 'getLatestBufferStorage'.
enum BufferUsage
{
- BUFFER_USAGE_SYSTEM_MEMORY,
BUFFER_USAGE_STAGING,
BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK,
BUFFER_USAGE_INDEX,
BUFFER_USAGE_PIXEL_UNPACK,
BUFFER_USAGE_PIXEL_PACK,
BUFFER_USAGE_UNIFORM,
+ BUFFER_USAGE_SYSTEM_MEMORY,
BUFFER_USAGE_EMULATED_INDEXED_VERTEX,
BUFFER_USAGE_COUNT,
@@ -48,18 +46,14 @@ typedef size_t DataRevision;
class Buffer11 : public BufferD3D
{
public:
- Buffer11(const gl::BufferState &state, Renderer11 *renderer);
+ Buffer11(Renderer11 *renderer);
virtual ~Buffer11();
gl::ErrorOrResult<ID3D11Buffer *> getBuffer(BufferUsage usage);
gl::ErrorOrResult<ID3D11Buffer *> getEmulatedIndexedBuffer(SourceIndexData *indexInfo,
const TranslatedAttribute &attribute,
GLint startVertex);
- gl::Error getConstantBufferRange(GLintptr offset,
- GLsizeiptr size,
- ID3D11Buffer **bufferOut,
- UINT *firstConstantOut,
- UINT *numConstantsOut);
+ gl::ErrorOrResult<ID3D11Buffer *> getConstantBufferRange(GLintptr offset, GLsizeiptr size);
gl::ErrorOrResult<ID3D11ShaderResourceView *> getSRV(DXGI_FORMAT srvFormat);
bool isMapped() const { return mMappedStorage != nullptr; }
gl::Error packPixels(const gl::FramebufferAttachment &readAttachment,
@@ -74,8 +68,8 @@ class Buffer11 : public BufferD3D
void invalidateStaticData() override;
// BufferImpl implementation
- gl::Error setData(GLenum target, const void *data, size_t size, GLenum usage) override;
- gl::Error setSubData(GLenum target, const void *data, size_t size, size_t offset) override;
+ gl::Error setData(const void *data, size_t size, GLenum usage) override;
+ gl::Error setSubData(const void *data, size_t size, size_t offset) override;
gl::Error copySubData(BufferImpl *source,
GLintptr sourceOffset,
GLintptr destOffset,
@@ -106,8 +100,7 @@ class Buffer11 : public BufferD3D
unsigned int lruCount;
};
- void markBufferUsage(BufferUsage usage);
- gl::Error garbageCollection(BufferUsage currentUsage);
+ gl::Error markBufferUsage();
gl::ErrorOrResult<NativeStorage *> getStagingStorage();
gl::ErrorOrResult<PackStorage *> getPackStorage();
gl::ErrorOrResult<SystemMemoryStorage *> getSystemMemoryStorage();
@@ -120,24 +113,14 @@ class Buffer11 : public BufferD3D
GLsizeiptr size);
BufferStorage *allocateStorage(BufferUsage usage);
- void updateDeallocThreshold(BufferUsage usage);
-
- // Free the storage if we decide it isn't being used very often.
- gl::Error checkForDeallocation(BufferUsage usage);
-
- // For some cases of uniform buffer storage, we can't deallocate system memory storage.
- bool canDeallocateSystemMemory() const;
+ void updateSystemMemoryDeallocThreshold();
Renderer11 *mRenderer;
size_t mSize;
BufferStorage *mMappedStorage;
- std::array<BufferStorage *, BUFFER_USAGE_COUNT> mBufferStorages;
-
- // These two arrays are used to track when to free unused storage.
- std::array<unsigned int, BUFFER_USAGE_COUNT> mDeallocThresholds;
- std::array<unsigned int, BUFFER_USAGE_COUNT> mIdleness;
+ std::vector<BufferStorage *> mBufferStorages;
// Cache of D3D11 constant buffer for specific ranges of buffer data.
// This is used to emulate UBO ranges on 11.0 devices.
@@ -147,6 +130,12 @@ class Buffer11 : public BufferD3D
size_t mConstantBufferStorageAdditionalSize;
unsigned int mMaxConstantBufferLruCount;
+ typedef std::pair<ID3D11Buffer *, ID3D11ShaderResourceView *> BufferSRVPair;
+ std::map<DXGI_FORMAT, BufferSRVPair> mBufferResourceViews;
+
+ unsigned int mReadUsageCount;
+ unsigned int mSystemMemoryDeallocThreshold;
+
angle::BroadcastChannel mStaticBroadcastChannel;
angle::BroadcastChannel mDirectBroadcastChannel;
};
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
index f42a59ced..d2d813895 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Clear11.cpp
@@ -34,40 +34,29 @@ namespace rx
{
template <typename T>
-static void ApplyVertices(const gl::Extents &framebufferSize,
- const gl::Rectangle *scissor,
- const gl::Color<T> &color,
- float depth,
- void *buffer)
+static void ApplyVertices(const gl::Extents &framebufferSize, const gl::Rectangle *scissor, const gl::Color<T> &color, float depth, void *buffer)
{
- d3d11::PositionDepthColorVertex<T> *vertices =
- reinterpret_cast<d3d11::PositionDepthColorVertex<T> *>(buffer);
+ d3d11::PositionDepthColorVertex<T> *vertices = reinterpret_cast<d3d11::PositionDepthColorVertex<T>*>(buffer);
float depthClear = gl::clamp01(depth);
- float left = -1.0f;
- float right = 1.0f;
- float top = -1.0f;
- float bottom = 1.0f;
+ float left = -1.0f;
+ float right = 1.0f;
+ float top = -1.0f;
+ float bottom = 1.0f;
// Clip the quad coordinates to the scissor if needed
if (scissor != nullptr)
{
- left = std::max(left, (scissor->x / float(framebufferSize.width)) * 2.0f - 1.0f);
- right = std::min(
- right, ((scissor->x + scissor->width) / float(framebufferSize.width)) * 2.0f - 1.0f);
- top = std::max(top, ((framebufferSize.height - scissor->y - scissor->height) /
- float(framebufferSize.height)) *
- 2.0f -
- 1.0f);
- bottom = std::min(
- bottom,
- ((framebufferSize.height - scissor->y) / float(framebufferSize.height)) * 2.0f - 1.0f);
+ left = std::max(left, (scissor->x / float(framebufferSize.width)) * 2.0f - 1.0f);
+ right = std::min(right, ((scissor->x + scissor->width) / float(framebufferSize.width)) * 2.0f - 1.0f);
+ top = std::max(top, ((framebufferSize.height - scissor->y - scissor->height) / float(framebufferSize.height)) * 2.0f - 1.0f);
+ bottom = std::min(bottom, ((framebufferSize.height - scissor->y) / float(framebufferSize.height)) * 2.0f - 1.0f);
}
- d3d11::SetPositionDepthColorVertex<T>(vertices + 0, left, bottom, depthClear, color);
- d3d11::SetPositionDepthColorVertex<T>(vertices + 1, left, top, depthClear, color);
+ d3d11::SetPositionDepthColorVertex<T>(vertices + 0, left, bottom, depthClear, color);
+ d3d11::SetPositionDepthColorVertex<T>(vertices + 1, left, top, depthClear, color);
d3d11::SetPositionDepthColorVertex<T>(vertices + 2, right, bottom, depthClear, color);
- d3d11::SetPositionDepthColorVertex<T>(vertices + 3, right, top, depthClear, color);
+ d3d11::SetPositionDepthColorVertex<T>(vertices + 3, right, top, depthClear, color);
}
Clear11::ClearShader::ClearShader(DXGI_FORMAT colorType,
@@ -82,9 +71,10 @@ Clear11::ClearShader::ClearShader(DXGI_FORMAT colorType,
vertexShader(vsByteCode, vsSize, vsDebugName),
pixelShader(psByteCode, psSize, psDebugName)
{
- D3D11_INPUT_ELEMENT_DESC quadLayout[] = {
- {"POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0},
- {"COLOR", 0, colorType, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0},
+ D3D11_INPUT_ELEMENT_DESC quadLayout[] =
+ {
+ { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
+ { "COLOR", 0, colorType, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
};
inputLayout = new d3d11::LazyInputLayout(quadLayout, 2, vsByteCode, vsSize, inputLayoutName);
@@ -113,11 +103,11 @@ Clear11::Clear11(Renderer11 *renderer)
ID3D11Device *device = renderer->getDevice();
D3D11_BUFFER_DESC vbDesc;
- vbDesc.ByteWidth = sizeof(d3d11::PositionDepthColorVertex<float>) * 4;
- vbDesc.Usage = D3D11_USAGE_DYNAMIC;
- vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- vbDesc.MiscFlags = 0;
+ vbDesc.ByteWidth = sizeof(d3d11::PositionDepthColorVertex<float>) * 4;
+ vbDesc.Usage = D3D11_USAGE_DYNAMIC;
+ vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ vbDesc.MiscFlags = 0;
vbDesc.StructureByteStride = 0;
result = device->CreateBuffer(&vbDesc, nullptr, &mVertexBuffer);
@@ -125,15 +115,15 @@ Clear11::Clear11(Renderer11 *renderer)
d3d11::SetDebugName(mVertexBuffer, "Clear11 masked clear vertex buffer");
D3D11_RASTERIZER_DESC rsDesc;
- rsDesc.FillMode = D3D11_FILL_SOLID;
- rsDesc.CullMode = D3D11_CULL_NONE;
+ rsDesc.FillMode = D3D11_FILL_SOLID;
+ rsDesc.CullMode = D3D11_CULL_NONE;
rsDesc.FrontCounterClockwise = FALSE;
- rsDesc.DepthBias = 0;
- rsDesc.DepthBiasClamp = 0.0f;
- rsDesc.SlopeScaledDepthBias = 0.0f;
- rsDesc.DepthClipEnable = TRUE;
- rsDesc.ScissorEnable = FALSE;
- rsDesc.MultisampleEnable = FALSE;
+ rsDesc.DepthBias = 0;
+ rsDesc.DepthBiasClamp = 0.0f;
+ rsDesc.SlopeScaledDepthBias = 0.0f;
+ rsDesc.DepthClipEnable = TRUE;
+ rsDesc.ScissorEnable = FALSE;
+ rsDesc.MultisampleEnable = FALSE;
rsDesc.AntialiasedLineEnable = FALSE;
result = device->CreateRasterizerState(&rsDesc, &mRasterizerState);
@@ -142,36 +132,51 @@ Clear11::Clear11(Renderer11 *renderer)
if (mRenderer->getRenderer11DeviceCaps().featureLevel <= D3D_FEATURE_LEVEL_9_3)
{
- mFloatClearShader =
- new ClearShader(DXGI_FORMAT_R32G32B32A32_FLOAT, "Clear11 Float IL", g_VS_ClearFloat,
- ArraySize(g_VS_ClearFloat), "Clear11 Float VS", g_PS_ClearFloat_FL9,
- ArraySize(g_PS_ClearFloat_FL9), "Clear11 Float PS");
+ mFloatClearShader = new ClearShader(DXGI_FORMAT_R32G32B32A32_FLOAT,
+ "Clear11 Float IL",
+ g_VS_ClearFloat,
+ ArraySize(g_VS_ClearFloat),
+ "Clear11 Float VS",
+ g_PS_ClearFloat_FL9,
+ ArraySize(g_PS_ClearFloat_FL9),
+ "Clear11 Float PS");
}
else
{
- mFloatClearShader =
- new ClearShader(DXGI_FORMAT_R32G32B32A32_FLOAT, "Clear11 Float IL", g_VS_ClearFloat,
- ArraySize(g_VS_ClearFloat), "Clear11 Float VS", g_PS_ClearFloat,
- ArraySize(g_PS_ClearFloat), "Clear11 Float PS");
+ mFloatClearShader = new ClearShader(DXGI_FORMAT_R32G32B32A32_FLOAT,
+ "Clear11 Float IL",
+ g_VS_ClearFloat,
+ ArraySize(g_VS_ClearFloat),
+ "Clear11 Float VS",
+ g_PS_ClearFloat,
+ ArraySize(g_PS_ClearFloat),
+ "Clear11 Float PS");
}
if (renderer->isES3Capable())
{
- mUintClearShader =
- new ClearShader(DXGI_FORMAT_R32G32B32A32_UINT, "Clear11 UINT IL", g_VS_ClearUint,
- ArraySize(g_VS_ClearUint), "Clear11 UINT VS", g_PS_ClearUint,
- ArraySize(g_PS_ClearUint), "Clear11 UINT PS");
- mIntClearShader =
- new ClearShader(DXGI_FORMAT_R32G32B32A32_UINT, "Clear11 SINT IL", g_VS_ClearSint,
- ArraySize(g_VS_ClearSint), "Clear11 SINT VS", g_PS_ClearSint,
- ArraySize(g_PS_ClearSint), "Clear11 SINT PS");
+ mUintClearShader = new ClearShader(DXGI_FORMAT_R32G32B32A32_UINT,
+ "Clear11 UINT IL",
+ g_VS_ClearUint,
+ ArraySize(g_VS_ClearUint),
+ "Clear11 UINT VS",
+ g_PS_ClearUint,
+ ArraySize(g_PS_ClearUint),
+ "Clear11 UINT PS");
+ mIntClearShader = new ClearShader(DXGI_FORMAT_R32G32B32A32_UINT,
+ "Clear11 SINT IL",
+ g_VS_ClearSint,
+ ArraySize(g_VS_ClearSint),
+ "Clear11 SINT VS",
+ g_PS_ClearSint,
+ ArraySize(g_PS_ClearSint),
+ "Clear11 SINT PS");
}
}
Clear11::~Clear11()
{
- for (ClearBlendStateMap::iterator i = mClearBlendStates.begin(); i != mClearBlendStates.end();
- i++)
+ for (ClearBlendStateMap::iterator i = mClearBlendStates.begin(); i != mClearBlendStates.end(); i++)
{
SafeRelease(i->second);
}
@@ -181,8 +186,7 @@ Clear11::~Clear11()
SafeDelete(mUintClearShader);
SafeDelete(mIntClearShader);
- for (ClearDepthStencilStateMap::iterator i = mClearDepthStencilStates.begin();
- i != mClearDepthStencilStates.end(); i++)
+ for (ClearDepthStencilStateMap::iterator i = mClearDepthStencilStates.begin(); i != mClearDepthStencilStates.end(); i++)
{
SafeRelease(i->second);
}
@@ -195,9 +199,9 @@ Clear11::~Clear11()
gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
const gl::FramebufferState &fboData)
{
- const auto &colorAttachments = fboData.getColorAttachments();
- const auto &drawBufferStates = fboData.getDrawBufferStates();
- const auto *depthAttachment = fboData.getDepthAttachment();
+ const auto &colorAttachments = fboData.getColorAttachments();
+ const auto &drawBufferStates = fboData.getDrawBufferStates();
+ const auto *depthAttachment = fboData.getDepthAttachment();
const auto *stencilAttachment = fboData.getStencilAttachment();
ASSERT(colorAttachments.size() == drawBufferStates.size());
@@ -205,24 +209,20 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
// Iterate over the color buffers which require clearing and determine if they can be
// cleared with ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView.
// This requires:
- // 1) The render target is being cleared to a float value (will be cast to integer when clearing
- // integer
+ // 1) The render target is being cleared to a float value (will be cast to integer when clearing integer
// render targets as expected but does not work the other way around)
// 2) The format of the render target has no color channels that are currently masked out.
- // Clear the easy-to-clear buffers on the spot and accumulate the ones that require special
- // work.
+ // Clear the easy-to-clear buffers on the spot and accumulate the ones that require special work.
//
// If these conditions are met, and:
// - No scissored clear is needed, then clear using ID3D11DeviceContext::ClearRenderTargetView.
// - A scissored clear is needed then clear using ID3D11DeviceContext1::ClearView if available.
// Otherwise draw a quad.
//
- // Also determine if the depth stencil can be cleared with
- // ID3D11DeviceContext::ClearDepthStencilView
+ // Also determine if the depth stencil can be cleared with ID3D11DeviceContext::ClearDepthStencilView
// by checking if the stencil write mask covers the entire stencil.
//
- // To clear the remaining buffers, quads must be drawn containing an int, uint or float vertex
- // color
+ // To clear the remaining buffers, quads must be drawn containing an int, uint or float vertex color
// attribute.
gl::Extents framebufferSize;
@@ -246,7 +246,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
return gl::Error(GL_INVALID_OPERATION);
}
- if (clearParams.scissorEnabled && (clearParams.scissor.x >= framebufferSize.width ||
+ if (clearParams.scissorEnabled && (clearParams.scissor.x >= framebufferSize.width ||
clearParams.scissor.y >= framebufferSize.height ||
clearParams.scissor.x + clearParams.scissor.width <= 0 ||
clearParams.scissor.y + clearParams.scissor.height <= 0))
@@ -255,18 +255,16 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
return gl::Error(GL_NO_ERROR);
}
- bool needScissoredClear =
- clearParams.scissorEnabled &&
- (clearParams.scissor.x > 0 || clearParams.scissor.y > 0 ||
- clearParams.scissor.x + clearParams.scissor.width < framebufferSize.width ||
- clearParams.scissor.y + clearParams.scissor.height < framebufferSize.height);
+ bool needScissoredClear = clearParams.scissorEnabled && (clearParams.scissor.x > 0 || clearParams.scissor.y > 0 ||
+ clearParams.scissor.x + clearParams.scissor.width < framebufferSize.width ||
+ clearParams.scissor.y + clearParams.scissor.height < framebufferSize.height);
std::vector<MaskedRenderTarget> maskedClearRenderTargets;
- RenderTarget11 *maskedClearDepthStencil = nullptr;
+ RenderTarget11* maskedClearDepthStencil = nullptr;
- ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
+ ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported();
- ID3D11Device *device = mRenderer->getDevice();
+ ID3D11Device *device = mRenderer->getDevice();
for (size_t colorAttachmentIndex = 0; colorAttachmentIndex < colorAttachments.size();
colorAttachmentIndex++)
@@ -277,7 +275,11 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
drawBufferStates[colorAttachmentIndex] != GL_NONE)
{
RenderTarget11 *renderTarget = nullptr;
- ANGLE_TRY(attachment.getRenderTarget(&renderTarget));
+ gl::Error error = attachment.getRenderTarget(&renderTarget);
+ if (error.isError())
+ {
+ return error;
+ }
const gl::InternalFormat &formatInfo = *attachment.getFormat().info;
@@ -309,8 +311,7 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
(formatInfo.blueBits > 0 && !clearParams.colorMaskBlue) ||
(formatInfo.alphaBits > 0 && !clearParams.colorMaskAlpha))
{
- // A masked clear is required, or a scissored clear is required and
- // ID3D11DeviceContext1::ClearView is unavailable
+ // A masked clear is required, or a scissored clear is required and ID3D11DeviceContext1::ClearView is unavailable
MaskedRenderTarget maskAndRt;
bool clearColor = clearParams.clearColor[colorAttachmentIndex];
maskAndRt.colorMask[0] = (clearColor && clearParams.colorMaskRed);
@@ -322,40 +323,39 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
}
else
{
- // ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView is
- // possible
+ // ID3D11DeviceContext::ClearRenderTargetView or ID3D11DeviceContext1::ClearView is possible
ID3D11RenderTargetView *framebufferRTV = renderTarget->getRenderTargetView();
if (!framebufferRTV)
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Internal render target view pointer unexpectedly null.");
+ return gl::Error(GL_OUT_OF_MEMORY, "Internal render target view pointer unexpectedly null.");
}
- const auto &nativeFormat = renderTarget->getFormatSet().format();
+ const auto &dxgiFormatInfo =
+ d3d11::GetDXGIFormatInfo(renderTarget->getFormatSet().rtvFormat);
- // Check if the actual format has a channel that the internal format does not and
- // set them to the default values
+ // Check if the actual format has a channel that the internal format does not and set them to the
+ // default values
float clearValues[4] = {
- ((formatInfo.redBits == 0 && nativeFormat.redBits > 0)
+ ((formatInfo.redBits == 0 && dxgiFormatInfo.redBits > 0)
? 0.0f
: clearParams.colorFClearValue.red),
- ((formatInfo.greenBits == 0 && nativeFormat.greenBits > 0)
+ ((formatInfo.greenBits == 0 && dxgiFormatInfo.greenBits > 0)
? 0.0f
: clearParams.colorFClearValue.green),
- ((formatInfo.blueBits == 0 && nativeFormat.blueBits > 0)
+ ((formatInfo.blueBits == 0 && dxgiFormatInfo.blueBits > 0)
? 0.0f
: clearParams.colorFClearValue.blue),
- ((formatInfo.alphaBits == 0 && nativeFormat.alphaBits > 0)
+ ((formatInfo.alphaBits == 0 && dxgiFormatInfo.alphaBits > 0)
? 1.0f
: clearParams.colorFClearValue.alpha),
};
- if (formatInfo.alphaBits == 1)
+ if (dxgiFormatInfo.alphaBits == 1)
{
- // Some drivers do not correctly handle calling Clear() on a format with 1-bit
- // alpha. They can incorrectly round all non-zero values up to 1.0f. Note that
- // WARP does not do this. We should handle the rounding for them instead.
+ // Some drivers do not correctly handle calling Clear() on a format with 1-bit alpha.
+ // They can incorrectly round all non-zero values up to 1.0f. Note that WARP does not do this.
+ // We should handle the rounding for them instead.
clearValues[3] = (clearParams.colorFClearValue.alpha >= 0.5f) ? 1.0f : 0.0f;
}
@@ -365,26 +365,16 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
ASSERT(deviceContext1);
D3D11_RECT rect;
- rect.left = clearParams.scissor.x;
- rect.right = clearParams.scissor.x + clearParams.scissor.width;
- rect.top = clearParams.scissor.y;
+ rect.left = clearParams.scissor.x;
+ rect.right = clearParams.scissor.x + clearParams.scissor.width;
+ rect.top = clearParams.scissor.y;
rect.bottom = clearParams.scissor.y + clearParams.scissor.height;
deviceContext1->ClearView(framebufferRTV, clearValues, &rect, 1);
-
- if (mRenderer->getWorkarounds().callClearTwice)
- {
- deviceContext1->ClearView(framebufferRTV, clearValues, &rect, 1);
- }
}
else
{
deviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
-
- if (mRenderer->getWorkarounds().callClearTwice)
- {
- deviceContext->ClearRenderTargetView(framebufferRTV, clearValues);
- }
}
}
}
@@ -392,20 +382,21 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
if (clearParams.clearDepth || clearParams.clearStencil)
{
- const gl::FramebufferAttachment *attachment =
- (depthAttachment != nullptr) ? depthAttachment : stencilAttachment;
+ const gl::FramebufferAttachment *attachment = (depthAttachment != nullptr) ? depthAttachment : stencilAttachment;
ASSERT(attachment != nullptr);
RenderTarget11 *renderTarget = nullptr;
- ANGLE_TRY(attachment->getRenderTarget(&renderTarget));
+ gl::Error error = attachment->getRenderTarget(&renderTarget);
+ if (error.isError())
+ {
+ return error;
+ }
- const auto &nativeFormat = renderTarget->getFormatSet().format();
+ const auto &dxgiFormatInfo =
+ d3d11::GetDXGIFormatInfo(renderTarget->getFormatSet().dsvFormat);
- unsigned int stencilUnmasked =
- (stencilAttachment != nullptr) ? (1 << nativeFormat.stencilBits) - 1 : 0;
- bool needMaskedStencilClear =
- clearParams.clearStencil &&
- (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
+ unsigned int stencilUnmasked = (stencilAttachment != nullptr) ? (1 << dxgiFormatInfo.stencilBits) - 1 : 0;
+ bool needMaskedStencilClear = clearParams.clearStencil && (clearParams.stencilWriteMask & stencilUnmasked) != stencilUnmasked;
if (needScissoredClear || needMaskedStencilClear)
{
@@ -416,156 +407,144 @@ gl::Error Clear11::clearFramebuffer(const ClearParameters &clearParams,
ID3D11DepthStencilView *framebufferDSV = renderTarget->getDepthStencilView();
if (!framebufferDSV)
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Internal depth stencil view pointer unexpectedly null.");
+ return gl::Error(GL_OUT_OF_MEMORY, "Internal depth stencil view pointer unexpectedly null.");
}
- UINT clearFlags = (clearParams.clearDepth ? D3D11_CLEAR_DEPTH : 0) |
- (clearParams.clearStencil ? D3D11_CLEAR_STENCIL : 0);
- FLOAT depthClear = gl::clamp01(clearParams.depthClearValue);
+ UINT clearFlags = (clearParams.clearDepth ? D3D11_CLEAR_DEPTH : 0) |
+ (clearParams.clearStencil ? D3D11_CLEAR_STENCIL : 0);
+ FLOAT depthClear = gl::clamp01(clearParams.depthClearValue);
UINT8 stencilClear = clearParams.stencilClearValue & 0xFF;
- deviceContext->ClearDepthStencilView(framebufferDSV, clearFlags, depthClear,
- stencilClear);
+ deviceContext->ClearDepthStencilView(framebufferDSV, clearFlags, depthClear, stencilClear);
}
}
- if (maskedClearRenderTargets.empty() && !maskedClearDepthStencil)
+ if (maskedClearRenderTargets.size() > 0 || maskedClearDepthStencil)
{
- return gl::NoError();
- }
+ // To clear the render targets and depth stencil in one pass:
+ //
+ // Render a quad clipped to the scissor rectangle which draws the clear color and a blend
+ // state that will perform the required color masking.
+ //
+ // The quad's depth is equal to the depth clear value with a depth stencil state that
+ // will enable or disable depth test/writes if the depth buffer should be cleared or not.
+ //
+ // The rasterizer state's stencil is set to always pass or fail based on if the stencil
+ // should be cleared or not with a stencil write mask of the stencil clear value.
+ //
+ // ======================================================================================
+ //
+ // Luckily, the gl spec (ES 3.0.2 pg 183) states that the results of clearing a render-
+ // buffer that is not normalized fixed point or floating point with floating point values
+ // are undefined so we can just write floats to them and D3D11 will bit cast them to
+ // integers.
+ //
+ // Also, we don't have to worry about attempting to clear a normalized fixed/floating point
+ // buffer with integer values because there is no gl API call which would allow it,
+ // glClearBuffer* calls only clear a single renderbuffer at a time which is verified to
+ // be a compatible clear type.
+
+ // Bind all the render targets which need clearing
+ ASSERT(maskedClearRenderTargets.size() <= mRenderer->getNativeCaps().maxDrawBuffers);
+ std::vector<ID3D11RenderTargetView*> rtvs(maskedClearRenderTargets.size());
+ for (unsigned int i = 0; i < maskedClearRenderTargets.size(); i++)
+ {
+ RenderTarget11 *renderTarget = maskedClearRenderTargets[i].renderTarget;
+ ID3D11RenderTargetView *rtv = renderTarget->getRenderTargetView();
+ if (!rtv)
+ {
+ return gl::Error(GL_OUT_OF_MEMORY, "Internal render target view pointer unexpectedly null.");
+ }
- // To clear the render targets and depth stencil in one pass:
- //
- // Render a quad clipped to the scissor rectangle which draws the clear color and a blend
- // state that will perform the required color masking.
- //
- // The quad's depth is equal to the depth clear value with a depth stencil state that
- // will enable or disable depth test/writes if the depth buffer should be cleared or not.
- //
- // The rasterizer state's stencil is set to always pass or fail based on if the stencil
- // should be cleared or not with a stencil write mask of the stencil clear value.
- //
- // ======================================================================================
- //
- // Luckily, the gl spec (ES 3.0.2 pg 183) states that the results of clearing a render-
- // buffer that is not normalized fixed point or floating point with floating point values
- // are undefined so we can just write floats to them and D3D11 will bit cast them to
- // integers.
- //
- // Also, we don't have to worry about attempting to clear a normalized fixed/floating point
- // buffer with integer values because there is no gl API call which would allow it,
- // glClearBuffer* calls only clear a single renderbuffer at a time which is verified to
- // be a compatible clear type.
-
- // Bind all the render targets which need clearing
- ASSERT(maskedClearRenderTargets.size() <= mRenderer->getNativeCaps().maxDrawBuffers);
- std::vector<ID3D11RenderTargetView *> rtvs(maskedClearRenderTargets.size());
- for (unsigned int i = 0; i < maskedClearRenderTargets.size(); i++)
- {
- RenderTarget11 *renderTarget = maskedClearRenderTargets[i].renderTarget;
- ID3D11RenderTargetView *rtv = renderTarget->getRenderTargetView();
- if (!rtv)
+ rtvs[i] = rtv;
+ }
+ ID3D11DepthStencilView *dsv = maskedClearDepthStencil ? maskedClearDepthStencil->getDepthStencilView() : nullptr;
+
+ ID3D11BlendState *blendState = getBlendState(maskedClearRenderTargets);
+ const FLOAT blendFactors[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
+ const UINT sampleMask = 0xFFFFFFFF;
+
+ ID3D11DepthStencilState *dsState = getDepthStencilState(clearParams);
+ const UINT stencilClear = clearParams.stencilClearValue & 0xFF;
+
+ // Set the vertices
+ UINT vertexStride = 0;
+ const UINT startIdx = 0;
+ ClearShader *shader = nullptr;
+ D3D11_MAPPED_SUBRESOURCE mappedResource;
+ HRESULT result = deviceContext->Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
+ if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Internal render target view pointer unexpectedly null.");
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to map internal masked clear vertex buffer, HRESULT: 0x%X.", result);
}
- rtvs[i] = rtv;
- }
- ID3D11DepthStencilView *dsv =
- maskedClearDepthStencil ? maskedClearDepthStencil->getDepthStencilView() : nullptr;
-
- ID3D11BlendState *blendState = getBlendState(maskedClearRenderTargets);
- const FLOAT blendFactors[4] = {1.0f, 1.0f, 1.0f, 1.0f};
- const UINT sampleMask = 0xFFFFFFFF;
-
- ID3D11DepthStencilState *dsState = getDepthStencilState(clearParams);
- const UINT stencilClear = clearParams.stencilClearValue & 0xFF;
-
- // Set the vertices
- UINT vertexStride = 0;
- const UINT startIdx = 0;
- ClearShader *shader = nullptr;
- D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result =
- deviceContext->Map(mVertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
- if (FAILED(result))
- {
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to map internal masked clear vertex buffer, HRESULT: 0x%X.",
- result);
- }
-
- const gl::Rectangle *scissorPtr = clearParams.scissorEnabled ? &clearParams.scissor : nullptr;
- switch (clearParams.colorClearType)
- {
- case GL_FLOAT:
- ApplyVertices(framebufferSize, scissorPtr, clearParams.colorFClearValue,
- clearParams.depthClearValue, mappedResource.pData);
+ const gl::Rectangle *scissorPtr = clearParams.scissorEnabled ? &clearParams.scissor : nullptr;
+ switch (clearParams.colorClearType)
+ {
+ case GL_FLOAT:
+ ApplyVertices(framebufferSize, scissorPtr, clearParams.colorFClearValue, clearParams.depthClearValue, mappedResource.pData);
vertexStride = sizeof(d3d11::PositionDepthColorVertex<float>);
- shader = mFloatClearShader;
+ shader = mFloatClearShader;
break;
- case GL_UNSIGNED_INT:
- ApplyVertices(framebufferSize, scissorPtr, clearParams.colorUIClearValue,
- clearParams.depthClearValue, mappedResource.pData);
+ case GL_UNSIGNED_INT:
+ ApplyVertices(framebufferSize, scissorPtr, clearParams.colorUIClearValue, clearParams.depthClearValue, mappedResource.pData);
vertexStride = sizeof(d3d11::PositionDepthColorVertex<unsigned int>);
- shader = mUintClearShader;
+ shader = mUintClearShader;
break;
- case GL_INT:
- ApplyVertices(framebufferSize, scissorPtr, clearParams.colorIClearValue,
- clearParams.depthClearValue, mappedResource.pData);
+ case GL_INT:
+ ApplyVertices(framebufferSize, scissorPtr, clearParams.colorIClearValue, clearParams.depthClearValue, mappedResource.pData);
vertexStride = sizeof(d3d11::PositionDepthColorVertex<int>);
- shader = mIntClearShader;
+ shader = mIntClearShader;
break;
- default:
+ default:
UNREACHABLE();
break;
- }
-
- deviceContext->Unmap(mVertexBuffer, 0);
-
- // Set the viewport to be the same size as the framebuffer
- D3D11_VIEWPORT viewport;
- viewport.TopLeftX = 0;
- viewport.TopLeftY = 0;
- viewport.Width = static_cast<FLOAT>(framebufferSize.width);
- viewport.Height = static_cast<FLOAT>(framebufferSize.height);
- viewport.MinDepth = 0;
- viewport.MaxDepth = 1;
- deviceContext->RSSetViewports(1, &viewport);
-
- // Apply state
- deviceContext->OMSetBlendState(blendState, blendFactors, sampleMask);
- deviceContext->OMSetDepthStencilState(dsState, stencilClear);
- deviceContext->RSSetState(mRasterizerState);
-
- // Apply shaders
- deviceContext->IASetInputLayout(shader->inputLayout->resolve(device));
- deviceContext->VSSetShader(shader->vertexShader.resolve(device), nullptr, 0);
- deviceContext->PSSetShader(shader->pixelShader.resolve(device), nullptr, 0);
- deviceContext->GSSetShader(nullptr, nullptr, 0);
-
- // Apply vertex buffer
- deviceContext->IASetVertexBuffers(0, 1, &mVertexBuffer, &vertexStride, &startIdx);
- deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
-
- // Apply render targets
- mRenderer->getStateManager()->setOneTimeRenderTargets(rtvs, dsv);
-
- // Draw the clear quad
- deviceContext->Draw(4, 0);
+ }
- // Clean up
- mRenderer->markAllStateDirty();
+ deviceContext->Unmap(mVertexBuffer, 0);
+
+ // Set the viewport to be the same size as the framebuffer
+ D3D11_VIEWPORT viewport;
+ viewport.TopLeftX = 0;
+ viewport.TopLeftY = 0;
+ viewport.Width = static_cast<FLOAT>(framebufferSize.width);
+ viewport.Height = static_cast<FLOAT>(framebufferSize.height);
+ viewport.MinDepth = 0;
+ viewport.MaxDepth = 1;
+ deviceContext->RSSetViewports(1, &viewport);
+
+ // Apply state
+ deviceContext->OMSetBlendState(blendState, blendFactors, sampleMask);
+ deviceContext->OMSetDepthStencilState(dsState, stencilClear);
+ deviceContext->RSSetState(mRasterizerState);
+
+ // Apply shaders
+ deviceContext->IASetInputLayout(shader->inputLayout->resolve(device));
+ deviceContext->VSSetShader(shader->vertexShader.resolve(device), nullptr, 0);
+ deviceContext->PSSetShader(shader->pixelShader.resolve(device), nullptr, 0);
+ deviceContext->GSSetShader(nullptr, nullptr, 0);
+
+ // Apply vertex buffer
+ deviceContext->IASetVertexBuffers(0, 1, &mVertexBuffer, &vertexStride, &startIdx);
+ deviceContext->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
+
+ // Apply render targets
+ mRenderer->getStateManager()->setOneTimeRenderTargets(rtvs, dsv);
+
+ // Draw the clear quad
+ deviceContext->Draw(4, 0);
+
+ // Clean up
+ mRenderer->markAllStateDirty();
+ }
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
-ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget> &rts)
+ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget>& rts)
{
ClearBlendInfo blendKey = {};
for (unsigned int i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; i++)
@@ -573,12 +552,11 @@ ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget> &
if (i < rts.size())
{
RenderTarget11 *rt = rts[i].renderTarget;
- const gl::InternalFormat &formatInfo =
- gl::GetInternalFormatInfo(rt->getInternalFormat());
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(rt->getInternalFormat());
- blendKey.maskChannels[i][0] = (rts[i].colorMask[0] && formatInfo.redBits > 0);
+ blendKey.maskChannels[i][0] = (rts[i].colorMask[0] && formatInfo.redBits > 0);
blendKey.maskChannels[i][1] = (rts[i].colorMask[1] && formatInfo.greenBits > 0);
- blendKey.maskChannels[i][2] = (rts[i].colorMask[2] && formatInfo.blueBits > 0);
+ blendKey.maskChannels[i][2] = (rts[i].colorMask[2] && formatInfo.blueBits > 0);
blendKey.maskChannels[i][3] = (rts[i].colorMask[3] && formatInfo.alphaBits > 0);
}
else
@@ -597,21 +575,22 @@ ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget> &
}
else
{
- D3D11_BLEND_DESC blendDesc = {0};
- blendDesc.AlphaToCoverageEnable = FALSE;
+ D3D11_BLEND_DESC blendDesc = { 0 };
+ blendDesc.AlphaToCoverageEnable = FALSE;
blendDesc.IndependentBlendEnable = (rts.size() > 1) ? TRUE : FALSE;
for (unsigned int j = 0; j < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT; j++)
{
- blendDesc.RenderTarget[j].BlendEnable = FALSE;
- blendDesc.RenderTarget[j].RenderTargetWriteMask = gl_d3d11::ConvertColorMask(
- blendKey.maskChannels[j][0], blendKey.maskChannels[j][1],
- blendKey.maskChannels[j][2], blendKey.maskChannels[j][3]);
+ blendDesc.RenderTarget[j].BlendEnable = FALSE;
+ blendDesc.RenderTarget[j].RenderTargetWriteMask = gl_d3d11::ConvertColorMask(blendKey.maskChannels[j][0],
+ blendKey.maskChannels[j][1],
+ blendKey.maskChannels[j][2],
+ blendKey.maskChannels[j][3]);
}
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11BlendState *blendState = nullptr;
- HRESULT result = device->CreateBlendState(&blendDesc, &blendState);
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11BlendState* blendState = nullptr;
+ HRESULT result = device->CreateBlendState(&blendDesc, &blendState);
if (FAILED(result) || !blendState)
{
ERR("Unable to create a ID3D11BlendState, HRESULT: 0x%X.", result);
@@ -626,10 +605,10 @@ ID3D11BlendState *Clear11::getBlendState(const std::vector<MaskedRenderTarget> &
ID3D11DepthStencilState *Clear11::getDepthStencilState(const ClearParameters &clearParams)
{
- ClearDepthStencilInfo dsKey = {0};
- dsKey.clearDepth = clearParams.clearDepth;
- dsKey.clearStencil = clearParams.clearStencil;
- dsKey.stencilWriteMask = clearParams.stencilWriteMask & 0xFF;
+ ClearDepthStencilInfo dsKey = { 0 };
+ dsKey.clearDepth = clearParams.clearDepth;
+ dsKey.clearStencil = clearParams.clearStencil;
+ dsKey.stencilWriteMask = clearParams.stencilWriteMask & 0xFF;
ClearDepthStencilStateMap::const_iterator i = mClearDepthStencilStates.find(dsKey);
if (i != mClearDepthStencilStates.end())
@@ -638,26 +617,25 @@ ID3D11DepthStencilState *Clear11::getDepthStencilState(const ClearParameters &cl
}
else
{
- D3D11_DEPTH_STENCIL_DESC dsDesc = {0};
- dsDesc.DepthEnable = dsKey.clearDepth ? TRUE : FALSE;
- dsDesc.DepthWriteMask =
- dsKey.clearDepth ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
- dsDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
- dsDesc.StencilEnable = dsKey.clearStencil ? TRUE : FALSE;
- dsDesc.StencilReadMask = 0;
- dsDesc.StencilWriteMask = dsKey.stencilWriteMask;
- dsDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
+ D3D11_DEPTH_STENCIL_DESC dsDesc = { 0 };
+ dsDesc.DepthEnable = dsKey.clearDepth ? TRUE : FALSE;
+ dsDesc.DepthWriteMask = dsKey.clearDepth ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
+ dsDesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
+ dsDesc.StencilEnable = dsKey.clearStencil ? TRUE : FALSE;
+ dsDesc.StencilReadMask = 0;
+ dsDesc.StencilWriteMask = dsKey.stencilWriteMask;
+ dsDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
dsDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
- dsDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
- dsDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
- dsDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
- dsDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
- dsDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
- dsDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
-
- ID3D11Device *device = mRenderer->getDevice();
- ID3D11DepthStencilState *dsState = nullptr;
- HRESULT result = device->CreateDepthStencilState(&dsDesc, &dsState);
+ dsDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+ dsDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
+ dsDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
+
+ ID3D11Device *device = mRenderer->getDevice();
+ ID3D11DepthStencilState* dsState = nullptr;
+ HRESULT result = device->CreateDepthStencilState(&dsDesc, &dsState);
if (FAILED(result) || !dsState)
{
ERR("Unable to create a ID3D11DepthStencilState, HRESULT: 0x%X.", result);
@@ -669,4 +647,5 @@ ID3D11DepthStencilState *Clear11::getDepthStencilState(const ClearParameters &cl
return dsState;
}
}
+
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
index 05da453f0..304bbe8cb 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.cpp
@@ -94,9 +94,9 @@ RenderbufferImpl *Context11::createRenderbuffer()
return new RenderbufferD3D(mRenderer);
}
-BufferImpl *Context11::createBuffer(const gl::BufferState &state)
+BufferImpl *Context11::createBuffer()
{
- Buffer11 *buffer = new Buffer11(state, mRenderer);
+ Buffer11 *buffer = new Buffer11(mRenderer);
mRenderer->onBufferCreate(buffer);
return buffer;
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h
index e36a6e978..debf2f9be 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Context11.h
@@ -39,7 +39,7 @@ class Context11 : public ContextImpl
RenderbufferImpl *createRenderbuffer() override;
// Buffer creation
- BufferImpl *createBuffer(const gl::BufferState &state) override;
+ BufferImpl *createBuffer() override;
// Vertex Array creation
VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) override;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
index 1f0eedb6e..fb3a18336 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Fence11.cpp
@@ -4,8 +4,7 @@
// found in the LICENSE file.
//
-// Fence11.cpp: Defines the rx::FenceNV11 and rx::FenceSync11 classes which implement
-// rx::FenceNVImpl and rx::FenceSyncImpl.
+// Fence11.cpp: Defines the rx::FenceNV11 and rx::FenceSync11 classes which implement rx::FenceNVImpl and rx::FenceSyncImpl.
#include "libANGLE/renderer/d3d/d3d11/Fence11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
@@ -21,20 +20,19 @@ static const int kDeviceLostCheckPeriod = 64;
// Template helpers for set and test operations.
//
-template <class FenceClass>
+template<class FenceClass>
gl::Error FenceSetHelper(FenceClass *fence)
{
if (!fence->mQuery)
{
D3D11_QUERY_DESC queryDesc;
- queryDesc.Query = D3D11_QUERY_EVENT;
+ queryDesc.Query = D3D11_QUERY_EVENT;
queryDesc.MiscFlags = 0;
HRESULT result = fence->mRenderer->getDevice()->CreateQuery(&queryDesc, &fence->mQuery);
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY, "Failed to create event query, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create event query, result: 0x%X.", result);
}
}
@@ -48,8 +46,7 @@ gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean
ASSERT(fence->mQuery);
UINT getDataFlags = (flushCommandBuffer ? 0 : D3D11_ASYNC_GETDATA_DONOTFLUSH);
- HRESULT result =
- fence->mRenderer->getDeviceContext()->GetData(fence->mQuery, NULL, 0, getDataFlags);
+ HRESULT result = fence->mRenderer->getDeviceContext()->GetData(fence->mQuery, NULL, 0, getDataFlags);
if (FAILED(result))
{
@@ -65,7 +62,10 @@ gl::Error FenceTestHelper(FenceClass *fence, bool flushCommandBuffer, GLboolean
// FenceNV11
//
-FenceNV11::FenceNV11(Renderer11 *renderer) : FenceNVImpl(), mRenderer(renderer), mQuery(NULL)
+FenceNV11::FenceNV11(Renderer11 *renderer)
+ : FenceNVImpl(),
+ mRenderer(renderer),
+ mQuery(NULL)
{
}
@@ -92,7 +92,11 @@ gl::Error FenceNV11::finish()
while (finished != GL_TRUE)
{
loopCount++;
- ANGLE_TRY(FenceTestHelper(this, true, &finished));
+ gl::Error error = FenceTestHelper(this, true, &finished);
+ if (error.isError())
+ {
+ return error;
+ }
if (loopCount % kDeviceLostCheckPeriod == 0 && mRenderer->testDeviceLost())
{
@@ -103,7 +107,7 @@ gl::Error FenceNV11::finish()
ScheduleYield();
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
//
@@ -121,10 +125,14 @@ gl::Error FenceNV11::finish()
// We still opt to use QPC. In the present and moving forward, most newer systems will not suffer
// from buggy implementations.
-FenceSync11::FenceSync11(Renderer11 *renderer) : FenceSyncImpl(), mRenderer(renderer), mQuery(NULL)
+FenceSync11::FenceSync11(Renderer11 *renderer)
+ : FenceSyncImpl(),
+ mRenderer(renderer),
+ mQuery(NULL)
{
LARGE_INTEGER counterFreqency = {};
- BOOL success = QueryPerformanceFrequency(&counterFreqency);
+ BOOL success = QueryPerformanceFrequency(&counterFreqency);
+ UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
mCounterFrequency = counterFreqency.QuadPart;
@@ -148,7 +156,7 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
bool flushCommandBuffer = ((flags & GL_SYNC_FLUSH_COMMANDS_BIT) != 0);
GLboolean result = GL_FALSE;
- gl::Error error = FenceTestHelper(this, flushCommandBuffer, &result);
+ gl::Error error = FenceTestHelper(this, flushCommandBuffer, &result);
if (error.isError())
{
*outResult = GL_WAIT_FAILED;
@@ -168,11 +176,12 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
}
LARGE_INTEGER currentCounter = {};
- BOOL success = QueryPerformanceCounter(&currentCounter);
+ BOOL success = QueryPerformanceCounter(&currentCounter);
+ UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
LONGLONG timeoutInSeconds = static_cast<LONGLONG>(timeout) * static_cast<LONGLONG>(1000000ll);
- LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
+ LONGLONG endCounter = currentCounter.QuadPart + mCounterFrequency * timeoutInSeconds;
int loopCount = 0;
while (currentCounter.QuadPart < endCounter && !result)
@@ -180,6 +189,7 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
loopCount++;
ScheduleYield();
success = QueryPerformanceCounter(&currentCounter);
+ UNUSED_ASSERTION_VARIABLE(success);
ASSERT(success);
error = FenceTestHelper(this, flushCommandBuffer, &result);
@@ -212,19 +222,19 @@ gl::Error FenceSync11::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *ou
gl::Error FenceSync11::serverWait(GLbitfield flags, GLuint64 timeout)
{
// Because our API is currently designed to be called from a single thread, we don't need to do
- // extra work for a server-side fence. GPU commands issued after the fence is created will
- // always be processed after the fence is signaled.
+ // extra work for a server-side fence. GPU commands issued after the fence is created will always
+ // be processed after the fence is signaled.
return gl::Error(GL_NO_ERROR);
}
gl::Error FenceSync11::getStatus(GLint *outResult)
{
GLboolean result = GL_FALSE;
- gl::Error error = FenceTestHelper(this, false, &result);
+ gl::Error error = FenceTestHelper(this, false, &result);
if (error.isError())
{
- // The spec does not specify any way to report errors during the status test (e.g. device
- // lost) so we report the fence is unblocked in case of error or signaled.
+ // The spec does not specify any way to report errors during the status test (e.g. device lost)
+ // so we report the fence is unblocked in case of error or signaled.
*outResult = GL_SIGNALED;
return error;
@@ -234,4 +244,4 @@ gl::Error FenceSync11::getStatus(GLint *outResult)
return gl::Error(GL_NO_ERROR);
}
-} // namespace rx
+} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
index 90922914a..4e67fa1ef 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp
@@ -29,7 +29,7 @@ namespace rx
namespace
{
-gl::Error MarkAttachmentsDirty(const gl::FramebufferAttachment *attachment)
+gl::Error InvalidateAttachmentSwizzles(const gl::FramebufferAttachment *attachment)
{
if (attachment && attachment->type() == GL_TEXTURE)
{
@@ -45,7 +45,7 @@ gl::Error MarkAttachmentsDirty(const gl::FramebufferAttachment *attachment)
TextureStorage11 *texStorage11 = GetAs<TextureStorage11>(texStorage);
ASSERT(texStorage11);
- texStorage11->markLevelDirty(attachment->mipLevel());
+ texStorage11->invalidateSwizzleCacheLevel(attachment->mipLevel());
}
}
@@ -89,18 +89,18 @@ Framebuffer11::~Framebuffer11()
{
}
-gl::Error Framebuffer11::markAttachmentsDirty() const
+gl::Error Framebuffer11::invalidateSwizzles() const
{
for (const auto &colorAttachment : mState.getColorAttachments())
{
if (colorAttachment.isAttached())
{
- ANGLE_TRY(MarkAttachmentsDirty(&colorAttachment));
+ ANGLE_TRY(InvalidateAttachmentSwizzles(&colorAttachment));
}
}
- ANGLE_TRY(MarkAttachmentsDirty(mState.getDepthAttachment()));
- ANGLE_TRY(MarkAttachmentsDirty(mState.getStencilAttachment()));
+ ANGLE_TRY(InvalidateAttachmentSwizzles(mState.getDepthAttachment()));
+ ANGLE_TRY(InvalidateAttachmentSwizzles(mState.getStencilAttachment()));
return gl::NoError();
}
@@ -128,7 +128,7 @@ gl::Error Framebuffer11::clearImpl(ContextImpl *context, const ClearParameters &
ANGLE_TRY(clearer->clearFramebuffer(clearParams, mState));
}
- ANGLE_TRY(markAttachmentsDirty());
+ ANGLE_TRY(invalidateSwizzles());
return gl::NoError();
}
@@ -182,10 +182,7 @@ gl::Error Framebuffer11::invalidateBase(size_t count, const GLenum *attachments,
size_t colorIndex =
(attachments[i] == GL_COLOR ? 0u : (attachments[i] - GL_COLOR_ATTACHMENT0));
auto colorAttachment = mState.getColorAttachment(colorIndex);
- if (colorAttachment)
- {
- ANGLE_TRY(invalidateAttachment(colorAttachment));
- }
+ ANGLE_TRY(invalidateAttachment(colorAttachment));
break;
}
}
@@ -354,14 +351,14 @@ gl::Error Framebuffer11::blitImpl(const gl::Rectangle &sourceArea,
blitDepth, blitStencil));
}
- ANGLE_TRY(markAttachmentsDirty());
+ ANGLE_TRY(invalidateSwizzles());
return gl::NoError();
}
GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const
{
RenderTarget11 *renderTarget11 = GetAs<RenderTarget11>(renderTarget);
- return renderTarget11->getFormatSet().format().fboImplementationInternalFormat;
+ return renderTarget11->getFormatSet().format.fboImplementationInternalFormat;
}
void Framebuffer11::updateColorRenderTarget(size_t colorIndex)
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
index b1683a206..813e0f32f 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h
@@ -28,7 +28,7 @@ class Framebuffer11 : public FramebufferD3D, public angle::SignalReceiver
gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area) override;
// Invalidate the cached swizzles of all bound texture attachments.
- gl::Error markAttachmentsDirty() const;
+ gl::Error invalidateSwizzles() const;
void syncState(const gl::Framebuffer::DirtyBits &dirtyBits) override;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
index 3c797f820..d27a8d53a 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Image11.cpp
@@ -50,21 +50,25 @@ gl::Error Image11::generateMipmap(Image11 *dest,
ASSERT(src->getHeight() == 1 || src->getHeight() / 2 == dest->getHeight());
D3D11_MAPPED_SUBRESOURCE destMapped;
- ANGLE_TRY(dest->map(D3D11_MAP_WRITE, &destMapped));
+ gl::Error error = dest->map(D3D11_MAP_WRITE, &destMapped);
+ if (error.isError())
+ {
+ return error;
+ }
D3D11_MAPPED_SUBRESOURCE srcMapped;
- gl::Error error = src->map(D3D11_MAP_READ, &srcMapped);
+ error = src->map(D3D11_MAP_READ, &srcMapped);
if (error.isError())
{
dest->unmap();
return error;
}
- const uint8_t *sourceData = reinterpret_cast<const uint8_t *>(srcMapped.pData);
- uint8_t *destData = reinterpret_cast<uint8_t *>(destMapped.pData);
+ const uint8_t *sourceData = reinterpret_cast<const uint8_t*>(srcMapped.pData);
+ uint8_t *destData = reinterpret_cast<uint8_t*>(destMapped.pData);
auto mipGenerationFunction =
- d3d11::Format::Get(src->getInternalFormat(), rendererCaps).format().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);
@@ -74,14 +78,15 @@ gl::Error Image11::generateMipmap(Image11 *dest,
dest->markDirty();
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
bool Image11::isDirty() const
{
- // If mDirty is true AND mStagingTexture doesn't exist AND mStagingTexture doesn't need to be
- // recovered from TextureStorage AND the texture doesn't require init data (i.e. a blank new
- // texture will suffice) then isDirty should still return false.
+ // If mDirty is true
+ // AND mStagingTexture doesn't exist AND mStagingTexture doesn't need to be recovered from TextureStorage
+ // AND the texture doesn't require init data (i.e. a blank new texture will suffice)
+ // then isDirty should still return false.
if (mDirty && !mStagingTexture && !mRecoverFromStorage)
{
const Renderer11DeviceCaps &deviceCaps = mRenderer->getRenderer11DeviceCaps();
@@ -95,45 +100,54 @@ bool Image11::isDirty() const
return mDirty;
}
-gl::Error Image11::copyToStorage(TextureStorage *storage,
- const gl::ImageIndex &index,
- const gl::Box &region)
+gl::Error Image11::copyToStorage(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box &region)
{
TextureStorage11 *storage11 = GetAs<TextureStorage11>(storage);
- // If an app's behavior results in an Image11 copying its data to/from to a TextureStorage
- // multiple times, then we should just keep the staging texture around to prevent the copying
- // from impacting perf. We allow the Image11 to copy its data to/from TextureStorage once. This
- // accounts for an app making a late call to glGenerateMipmap.
+ // If an app's behavior results in an Image11 copying its data to/from to a TextureStorage multiple times,
+ // then we should just keep the staging texture around to prevent the copying from impacting perf.
+ // We allow the Image11 to copy its data to/from TextureStorage once.
+ // This accounts for an app making a late call to glGenerateMipmap.
bool attemptToReleaseStagingTexture = (mRecoveredFromStorageCount < 2);
if (attemptToReleaseStagingTexture)
{
- // If another image is relying on this Storage for its data, then we must let it recover its
- // data before we overwrite it.
- ANGLE_TRY(storage11->releaseAssociatedImage(index, this));
+ // If another image is relying on this Storage for its data, then we must let it recover its data before we overwrite it.
+ gl::Error error = storage11->releaseAssociatedImage(index, this);
+ if (error.isError())
+ {
+ return error;
+ }
}
- ID3D11Resource *stagingTexture = NULL;
+ ID3D11Resource *stagingTexture = NULL;
unsigned int stagingSubresourceIndex = 0;
- ANGLE_TRY(getStagingTexture(&stagingTexture, &stagingSubresourceIndex));
- ANGLE_TRY(
- storage11->updateSubresourceLevel(stagingTexture, stagingSubresourceIndex, index, region));
+ gl::Error error = getStagingTexture(&stagingTexture, &stagingSubresourceIndex);
+ if (error.isError())
+ {
+ return error;
+ }
+
+ error = storage11->updateSubresourceLevel(stagingTexture, stagingSubresourceIndex, index, region);
+ if (error.isError())
+ {
+ return error;
+ }
// Once the image data has been copied into the Storage, we can release it locally.
if (attemptToReleaseStagingTexture)
{
storage11->associateImage(this, index);
releaseStagingTexture();
- mRecoverFromStorage = true;
- mAssociatedStorage = storage11;
+ mRecoverFromStorage = true;
+ mAssociatedStorage = storage11;
mAssociatedImageIndex = index;
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
-bool Image11::isAssociatedStorageValid(TextureStorage11 *textureStorage) const
+bool Image11::isAssociatedStorageValid(TextureStorage11* textureStorage) const
{
return (mAssociatedStorage == textureStorage);
}
@@ -142,22 +156,28 @@ gl::Error Image11::recoverFromAssociatedStorage()
{
if (mRecoverFromStorage)
{
- ANGLE_TRY(createStagingTexture());
+ gl::Error error = createStagingTexture();
+ if (error.isError())
+ {
+ return error;
+ }
- bool textureStorageCorrect =
- mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this);
+ bool textureStorageCorrect = mAssociatedStorage->isAssociatedImageValid(mAssociatedImageIndex, this);
- // This means that the cached TextureStorage has been modified after this Image11 released
- // its copy of its data. This should not have happened. The TextureStorage should have told
- // this Image11 to recover its data before it was overwritten.
+ // This means that the cached TextureStorage has been modified after this Image11 released its copy of its data.
+ // This should not have happened. The TextureStorage should have told this Image11 to recover its data before it was overwritten.
ASSERT(textureStorageCorrect);
if (textureStorageCorrect)
{
// CopySubResource from the Storage to the Staging texture
gl::Box region(0, 0, 0, mWidth, mHeight, mDepth);
- ANGLE_TRY(mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource,
- mAssociatedImageIndex, region));
+ error = mAssociatedStorage->copySubresourceLevel(mStagingTexture, mStagingSubresource, mAssociatedImageIndex, region);
+ if (error.isError())
+ {
+ return error;
+ }
+
mRecoveredFromStorageCount += 1;
}
@@ -165,7 +185,7 @@ gl::Error Image11::recoverFromAssociatedStorage()
disassociateStorage();
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void Image11::disassociateStorage()
@@ -175,18 +195,17 @@ void Image11::disassociateStorage()
// Make the texturestorage release the Image11 too
mAssociatedStorage->disassociateImage(mAssociatedImageIndex, this);
- mRecoverFromStorage = false;
- mAssociatedStorage = NULL;
+ mRecoverFromStorage = false;
+ mAssociatedStorage = NULL;
mAssociatedImageIndex = gl::ImageIndex::MakeInvalid();
}
}
-bool Image11::redefine(GLenum target,
- GLenum internalformat,
- const gl::Extents &size,
- bool forceRelease)
+bool Image11::redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease)
{
- if (mWidth != size.width || mHeight != size.height || mInternalFormat != internalformat ||
+ if (mWidth != size.width ||
+ mHeight != size.height ||
+ mInternalFormat != internalformat ||
forceRelease)
{
// End the association with the TextureStorage, since that data will be out of date.
@@ -194,11 +213,11 @@ bool Image11::redefine(GLenum target,
disassociateStorage();
mRecoveredFromStorageCount = 0;
- mWidth = size.width;
- mHeight = size.height;
- mDepth = size.depth;
+ mWidth = size.width;
+ mHeight = size.height;
+ mDepth = size.depth;
mInternalFormat = internalformat;
- mTarget = target;
+ mTarget = target;
// compute the d3d format that will be used
const d3d11::Format &formatInfo =
@@ -224,87 +243,93 @@ DXGI_FORMAT Image11::getDXGIFormat() const
return mDXGIFormat;
}
-// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as
-// format/type at input
+// Store the pixel rectangle designated by xoffset,yoffset,width,height with pixels stored as format/type at input
// into the target pixel rectangle.
gl::Error Image11::loadData(const gl::Box &area,
const gl::PixelUnpackState &unpack,
- GLenum inputType,
+ GLenum type,
const void *input,
bool applySkipImages)
{
- const auto sizedInputFormat = getSizedInputFormat(inputType);
- const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
+ const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLuint inputRowPitch = 0;
ANGLE_TRY_RESULT(
- inputFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength),
+ formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
inputRowPitch);
GLuint inputDepthPitch = 0;
- ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, unpack.imageHeight, inputRowPitch),
+ ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment,
+ unpack.rowLength, unpack.imageHeight),
inputDepthPitch);
GLuint inputSkipBytes = 0;
ANGLE_TRY_RESULT(
- inputFormat.computeSkipBytes(inputRowPitch, inputDepthPitch, unpack, applySkipImages),
+ formatInfo.computeSkipBytes(inputRowPitch, inputDepthPitch, unpack.skipImages,
+ unpack.skipRows, unpack.skipPixels, applySkipImages),
inputSkipBytes);
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
- GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
+ GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
const d3d11::Format &d3dFormatInfo =
d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
- LoadImageFunction loadFunction = d3dFormatInfo.getLoadFunctions()(inputType).loadFunction;
+ LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions(type).loadFunction;
D3D11_MAPPED_SUBRESOURCE mappedImage;
- ANGLE_TRY(map(D3D11_MAP_WRITE, &mappedImage));
+ gl::Error error = map(D3D11_MAP_WRITE, &mappedImage);
+ if (error.isError())
+ {
+ return error;
+ }
- uint8_t *offsetMappedData = (reinterpret_cast<uint8_t *>(mappedImage.pData) +
- (area.y * mappedImage.RowPitch + area.x * outputPixelSize +
- area.z * mappedImage.DepthPitch));
+ uint8_t *offsetMappedData = (reinterpret_cast<uint8_t*>(mappedImage.pData) + (area.y * mappedImage.RowPitch + area.x * outputPixelSize + area.z * mappedImage.DepthPitch));
loadFunction(area.width, area.height, area.depth,
reinterpret_cast<const uint8_t *>(input) + inputSkipBytes, inputRowPitch,
inputDepthPitch, offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
unmap();
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Image11::loadCompressedData(const gl::Box &area, const void *input)
{
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLsizei inputRowPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, 1, 0), inputRowPitch);
+ ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch);
GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, 0, inputRowPitch), inputDepthPitch);
+ ANGLE_TRY_RESULT(
+ formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0, 0),
+ inputDepthPitch);
const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
- GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
- GLuint outputBlockWidth = dxgiFormatInfo.blockWidth;
- GLuint outputBlockHeight = dxgiFormatInfo.blockHeight;
+ GLuint outputPixelSize = dxgiFormatInfo.pixelBytes;
+ GLuint outputBlockWidth = dxgiFormatInfo.blockWidth;
+ GLuint outputBlockHeight = dxgiFormatInfo.blockHeight;
ASSERT(area.x % outputBlockWidth == 0);
ASSERT(area.y % outputBlockHeight == 0);
const d3d11::Format &d3dFormatInfo =
d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
- LoadImageFunction loadFunction =
- d3dFormatInfo.getLoadFunctions()(GL_UNSIGNED_BYTE).loadFunction;
+ LoadImageFunction loadFunction = d3dFormatInfo.loadFunctions(GL_UNSIGNED_BYTE).loadFunction;
D3D11_MAPPED_SUBRESOURCE mappedImage;
- ANGLE_TRY(map(D3D11_MAP_WRITE, &mappedImage));
+ gl::Error error = map(D3D11_MAP_WRITE, &mappedImage);
+ if (error.isError())
+ {
+ return error;
+ }
- uint8_t *offsetMappedData =
- reinterpret_cast<uint8_t *>(mappedImage.pData) +
- ((area.y / outputBlockHeight) * mappedImage.RowPitch +
- (area.x / outputBlockWidth) * outputPixelSize + area.z * mappedImage.DepthPitch);
+ uint8_t* offsetMappedData = reinterpret_cast<uint8_t*>(mappedImage.pData) + ((area.y / outputBlockHeight) * mappedImage.RowPitch +
+ (area.x / outputBlockWidth) * outputPixelSize +
+ area.z * mappedImage.DepthPitch);
- loadFunction(area.width, area.height, area.depth, reinterpret_cast<const uint8_t *>(input),
- inputRowPitch, inputDepthPitch, offsetMappedData, mappedImage.RowPitch,
- mappedImage.DepthPitch);
+ loadFunction(area.width, area.height, area.depth,
+ reinterpret_cast<const uint8_t*>(input), inputRowPitch, inputDepthPitch,
+ offsetMappedData, mappedImage.RowPitch, mappedImage.DepthPitch);
unmap();
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Image11::copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureStorage *source)
@@ -312,9 +337,13 @@ gl::Error Image11::copyFromTexStorage(const gl::ImageIndex &imageIndex, TextureS
TextureStorage11 *storage11 = GetAs<TextureStorage11>(source);
ID3D11Resource *resource = nullptr;
- ANGLE_TRY(storage11->getResource(&resource));
+ gl::Error error = storage11->getResource(&resource);
+ if (error.isError())
+ {
+ return error;
+ }
- UINT subresourceIndex = storage11->getSubresourceIndex(imageIndex);
+ UINT subresourceIndex = storage11->getSubresourceIndex(imageIndex);
TextureHelper11 textureHelper =
TextureHelper11::MakeAndReference(resource, storage11->getFormatSet());
@@ -336,7 +365,11 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
if (d3d11Format.texFormat == mDXGIFormat && sourceInternalFormat == mInternalFormat)
{
RenderTargetD3D *renderTarget = nullptr;
- ANGLE_TRY(srcAttachment->getRenderTarget(&renderTarget));
+ gl::Error error = srcAttachment->getRenderTarget(&renderTarget);
+ if (error.isError())
+ {
+ return error;
+ }
RenderTarget11 *rt11 = GetAs<RenderTarget11>(renderTarget);
ASSERT(rt11->getTexture());
@@ -352,7 +385,11 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
// This format requires conversion, so we must copy the texture to staging and manually convert
// via readPixels
D3D11_MAPPED_SUBRESOURCE mappedImage;
- ANGLE_TRY(map(D3D11_MAP_WRITE, &mappedImage));
+ gl::Error error = map(D3D11_MAP_WRITE, &mappedImage);
+ if (error.isError())
+ {
+ return error;
+ }
// determine the offset coordinate into the destination buffer
const auto &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat);
@@ -366,8 +403,7 @@ gl::Error Image11::copyFromFramebuffer(const gl::Offset &destOffset,
const auto &destD3D11Format =
d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps());
- auto loadFunction = destD3D11Format.getLoadFunctions()(destFormatInfo.type);
- gl::Error error = gl::NoError();
+ auto loadFunction = destD3D11Format.loadFunctions(destFormatInfo.type);
if (loadFunction.requiresConversion)
{
size_t bufferSize = destFormatInfo.pixelBytes * sourceArea.width * sourceArea.height;
@@ -404,7 +440,11 @@ gl::Error Image11::copyWithoutConversion(const gl::Offset &destOffset,
// No conversion needed-- use copyback fastpath
ID3D11Resource *stagingTexture = nullptr;
unsigned int stagingSubresourceIndex = 0;
- ANGLE_TRY(getStagingTexture(&stagingTexture, &stagingSubresourceIndex));
+ gl::Error error = getStagingTexture(&stagingTexture, &stagingSubresourceIndex);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
@@ -433,7 +473,7 @@ gl::Error Image11::copyWithoutConversion(const gl::Offset &destOffset,
resolveDesc.MiscFlags = 0;
ID3D11Texture2D *srcTex2D = NULL;
- HRESULT result = device->CreateTexture2D(&resolveDesc, NULL, &srcTex2D);
+ HRESULT result = device->CreateTexture2D(&resolveDesc, NULL, &srcTex2D);
if (FAILED(result))
{
return gl::Error(GL_OUT_OF_MEMORY,
@@ -469,17 +509,20 @@ gl::Error Image11::copyWithoutConversion(const gl::Offset &destOffset,
}
mDirty = true;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
-gl::Error Image11::getStagingTexture(ID3D11Resource **outStagingTexture,
- unsigned int *outSubresourceIndex)
+gl::Error Image11::getStagingTexture(ID3D11Resource **outStagingTexture, unsigned int *outSubresourceIndex)
{
- ANGLE_TRY(createStagingTexture());
+ gl::Error error = createStagingTexture();
+ if (error.isError())
+ {
+ return error;
+ }
- *outStagingTexture = mStagingTexture;
+ *outStagingTexture = mStagingTexture;
*outSubresourceIndex = mStagingSubresource;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void Image11::releaseStagingTexture()
@@ -501,8 +544,8 @@ gl::Error Image11::createStagingTexture()
ID3D11Device *device = mRenderer->getDevice();
HRESULT result;
- int lodOffset = 1;
- GLsizei width = mWidth;
+ int lodOffset = 1;
+ GLsizei width = mWidth;
GLsizei height = mHeight;
// adjust size if needed for compressed textures
@@ -513,24 +556,23 @@ gl::Error Image11::createStagingTexture()
ID3D11Texture3D *newTexture = NULL;
D3D11_TEXTURE3D_DESC desc;
- desc.Width = width;
- desc.Height = height;
- desc.Depth = mDepth;
- desc.MipLevels = lodOffset + 1;
- desc.Format = dxgiFormat;
- desc.Usage = D3D11_USAGE_STAGING;
- desc.BindFlags = 0;
+ desc.Width = width;
+ desc.Height = height;
+ desc.Depth = mDepth;
+ desc.MipLevels = lodOffset + 1;
+ desc.Format = dxgiFormat;
+ desc.Usage = D3D11_USAGE_STAGING;
+ desc.BindFlags = 0;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- desc.MiscFlags = 0;
+ desc.MiscFlags = 0;
if (d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps())
.dataInitializerFunction != NULL)
{
std::vector<D3D11_SUBRESOURCE_DATA> initialData;
std::vector<std::vector<BYTE>> textureData;
- d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(),
- width, height, mDepth, lodOffset + 1, &initialData,
- &textureData);
+ d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(), width, height, mDepth,
+ lodOffset + 1, &initialData, &textureData);
result = device->CreateTexture3D(&desc, initialData.data(), &newTexture);
}
@@ -542,39 +584,36 @@ gl::Error Image11::createStagingTexture()
if (FAILED(result))
{
ASSERT(result == E_OUTOFMEMORY);
- return gl::Error(GL_OUT_OF_MEMORY, "Failed to create staging texture, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create staging texture, result: 0x%X.", result);
}
- mStagingTexture = newTexture;
+ mStagingTexture = newTexture;
mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
}
- else if (mTarget == GL_TEXTURE_2D || mTarget == GL_TEXTURE_2D_ARRAY ||
- mTarget == GL_TEXTURE_CUBE_MAP)
+ else if (mTarget == GL_TEXTURE_2D || mTarget == GL_TEXTURE_2D_ARRAY || mTarget == GL_TEXTURE_CUBE_MAP)
{
ID3D11Texture2D *newTexture = NULL;
D3D11_TEXTURE2D_DESC desc;
- desc.Width = width;
- desc.Height = height;
- desc.MipLevels = lodOffset + 1;
- desc.ArraySize = 1;
- desc.Format = dxgiFormat;
- desc.SampleDesc.Count = 1;
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = lodOffset + 1;
+ desc.ArraySize = 1;
+ desc.Format = dxgiFormat;
+ desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
- desc.Usage = D3D11_USAGE_STAGING;
- desc.BindFlags = 0;
- desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
- desc.MiscFlags = 0;
+ desc.Usage = D3D11_USAGE_STAGING;
+ desc.BindFlags = 0;
+ desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
+ desc.MiscFlags = 0;
if (d3d11::Format::Get(mInternalFormat, mRenderer->getRenderer11DeviceCaps())
.dataInitializerFunction != NULL)
{
std::vector<D3D11_SUBRESOURCE_DATA> initialData;
std::vector<std::vector<BYTE>> textureData;
- d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(),
- width, height, 1, lodOffset + 1, &initialData,
- &textureData);
+ d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(), width, height, 1,
+ lodOffset + 1, &initialData, &textureData);
result = device->CreateTexture2D(&desc, initialData.data(), &newTexture);
}
@@ -586,11 +625,10 @@ gl::Error Image11::createStagingTexture()
if (FAILED(result))
{
ASSERT(result == E_OUTOFMEMORY);
- return gl::Error(GL_OUT_OF_MEMORY, "Failed to create staging texture, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create staging texture, result: 0x%X.", result);
}
- mStagingTexture = newTexture;
+ mStagingTexture = newTexture;
mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1);
}
else
@@ -605,11 +643,19 @@ gl::Error Image11::createStagingTexture()
gl::Error Image11::map(D3D11_MAP mapType, D3D11_MAPPED_SUBRESOURCE *map)
{
// We must recover from the TextureStorage if necessary, even for D3D11_MAP_WRITE.
- ANGLE_TRY(recoverFromAssociatedStorage());
+ gl::Error error = recoverFromAssociatedStorage();
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Resource *stagingTexture = NULL;
- unsigned int subresourceIndex = 0;
- ANGLE_TRY(getStagingTexture(&stagingTexture, &subresourceIndex));
+ unsigned int subresourceIndex = 0;
+ error = getStagingTexture(&stagingTexture, &subresourceIndex);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext();
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
index 58b18ded5..b256cd51c 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Query11.cpp
@@ -96,11 +96,17 @@ template <typename T>
gl::Error Query11::getResultBase(T *params)
{
ASSERT(mActiveQuery->query == nullptr);
- ANGLE_TRY(flush(true));
+
+ gl::Error error = flush(true);
+ if (error.isError())
+ {
+ return error;
+ }
+
ASSERT(mPendingQueries.empty());
*params = static_cast<T>(mResultSum);
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Query11::getResult(GLint *params)
@@ -125,10 +131,14 @@ gl::Error Query11::getResult(GLuint64 *params)
gl::Error Query11::isResultAvailable(bool *available)
{
- ANGLE_TRY(flush(false));
+ gl::Error error = flush(false);
+ if (error.isError())
+ {
+ return error;
+ }
*available = mPendingQueries.empty();
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Query11::pause()
@@ -157,7 +167,11 @@ gl::Error Query11::resume()
{
if (mActiveQuery->query == nullptr)
{
- ANGLE_TRY(flush(false));
+ gl::Error error = flush(false);
+ if (error.isError())
+ {
+ return error;
+ }
GLenum queryType = getType();
D3D11_QUERY d3dQueryType = gl_d3d11::ConvertQueryType(queryType);
@@ -181,7 +195,7 @@ gl::Error Query11::resume()
D3D11_QUERY_DESC desc;
desc.Query = D3D11_QUERY_TIMESTAMP;
desc.MiscFlags = 0;
- result = device->CreateQuery(&desc, &mActiveQuery->beginTimestamp);
+ result = device->CreateQuery(&desc, &mActiveQuery->beginTimestamp);
if (FAILED(result))
{
return gl::Error(GL_OUT_OF_MEMORY, "Internal query creation failed, result: 0x%X.",
@@ -220,7 +234,11 @@ gl::Error Query11::flush(bool force)
do
{
- ANGLE_TRY(testQuery(query));
+ gl::Error error = testQuery(query);
+ if (error.isError())
+ {
+ return error;
+ }
if (!query->finished && !force)
{
return gl::Error(GL_NO_ERROR);
@@ -231,7 +249,7 @@ gl::Error Query11::flush(bool force)
mPendingQueries.pop_front();
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Query11::testQuery(QueryState *queryState)
@@ -241,8 +259,8 @@ gl::Error Query11::testQuery(QueryState *queryState)
ID3D11DeviceContext *context = mRenderer->getDeviceContext();
switch (getType())
{
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
+ case GL_ANY_SAMPLES_PASSED_EXT:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
{
ASSERT(queryState->query);
UINT64 numPixels = 0;
@@ -250,35 +268,31 @@ gl::Error Query11::testQuery(QueryState *queryState)
context->GetData(queryState->query, &numPixels, sizeof(numPixels), 0);
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to get the data of an internal query, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to get the data of an internal query, result: 0x%X.", result);
}
if (result == S_OK)
{
queryState->finished = true;
- mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
+ mResult = (numPixels > 0) ? GL_TRUE : GL_FALSE;
}
}
break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
{
ASSERT(queryState->query);
- D3D11_QUERY_DATA_SO_STATISTICS soStats = {0};
+ D3D11_QUERY_DATA_SO_STATISTICS soStats = { 0 };
HRESULT result = context->GetData(queryState->query, &soStats, sizeof(soStats), 0);
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to get the data of an internal query, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to get the data of an internal query, result: 0x%X.", result);
}
if (result == S_OK)
{
queryState->finished = true;
- mResult = static_cast<GLuint64>(soStats.NumPrimitivesWritten);
+ mResult = static_cast<GLuint64>(soStats.NumPrimitivesWritten);
}
}
break;
@@ -355,7 +369,7 @@ gl::Error Query11::testQuery(QueryState *queryState)
// to have any sort of continuity outside of a disjoint timestamp query block, which
// GL depends on
ASSERT(queryState->query == nullptr);
- mResult = 0;
+ mResult = 0;
queryState->finished = true;
}
break;
@@ -382,9 +396,9 @@ gl::Error Query11::testQuery(QueryState *queryState)
}
break;
- default:
- UNREACHABLE();
- break;
+ default:
+ UNREACHABLE();
+ break;
}
if (!queryState->finished && mRenderer->testDeviceLost())
@@ -394,7 +408,7 @@ gl::Error Query11::testQuery(QueryState *queryState)
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
-} // namespace rx
+}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
index bd870bcbd..2ee25cfb6 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderStateCache.cpp
@@ -436,8 +436,7 @@ gl::Error RenderStateCache::getSamplerState(const gl::SamplerState &samplerState
samplerDesc.AddressV = gl_d3d11::ConvertTextureWrap(samplerState.wrapT);
samplerDesc.AddressW = gl_d3d11::ConvertTextureWrap(samplerState.wrapR);
samplerDesc.MipLODBias = 0;
- samplerDesc.MaxAnisotropy =
- gl_d3d11::ConvertMaxAnisotropy(samplerState.maxAnisotropy, mDevice->GetFeatureLevel());
+ samplerDesc.MaxAnisotropy = static_cast<UINT>(samplerState.maxAnisotropy);
samplerDesc.ComparisonFunc = gl_d3d11::ConvertComparison(samplerState.compareFunc);
samplerDesc.BorderColor[0] = 0.0f;
samplerDesc.BorderColor[1] = 0.0f;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp
index a042f447d..6449c9e6a 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp
@@ -258,7 +258,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11RenderTargetView *rtv,
{
mSubresourceIndex = GetRTVSubresourceIndex(mTexture, mRenderTarget);
}
- ASSERT(mFormatSet.formatID != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0);
+ ASSERT(mFormatSet.format.id != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0);
}
TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv,
@@ -302,7 +302,7 @@ TextureRenderTarget11::TextureRenderTarget11(ID3D11DepthStencilView *dsv,
{
mSubresourceIndex = GetDSVSubresourceIndex(mTexture, mDepthStencil);
}
- ASSERT(mFormatSet.formatID != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0);
+ ASSERT(mFormatSet.format.id != angle::Format::ID::NONE || mWidth == 0 || mHeight == 0);
}
TextureRenderTarget11::~TextureRenderTarget11()
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
index 8b4abaf9c..d03347d25 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp
@@ -98,6 +98,23 @@ enum
MAX_TEXTURE_IMAGE_UNITS_VTF_SM4 = 16
};
+void CalculateConstantBufferParams(GLintptr offset, GLsizeiptr size, UINT *outFirstConstant, UINT *outNumConstants)
+{
+ // The offset must be aligned to 256 bytes (should have been enforced by glBindBufferRange).
+ ASSERT(offset % 256 == 0);
+
+ // firstConstant and numConstants are expressed in constants of 16-bytes. Furthermore they must be a multiple of 16 constants.
+ *outFirstConstant = static_cast<UINT>(offset / 16);
+
+ // The GL size is not required to be aligned to a 256 bytes boundary.
+ // Round the size up to a 256 bytes boundary then express the results in constants of 16-bytes.
+ *outNumConstants = static_cast<UINT>(rx::roundUp(size, static_cast<GLsizeiptr>(256)) / 16);
+
+ // Since the size is rounded up, firstConstant + numConstants may be bigger than the actual size of the buffer.
+ // This behaviour is explictly allowed according to the documentation on ID3D11DeviceContext1::PSSetConstantBuffers1
+ // https://msdn.microsoft.com/en-us/library/windows/desktop/hh404649%28v=vs.85%29.aspx
+}
+
enum ANGLEFeatureLevel
{
ANGLE_FEATURE_LEVEL_INVALID,
@@ -113,20 +130,14 @@ ANGLEFeatureLevel GetANGLEFeatureLevel(D3D_FEATURE_LEVEL d3dFeatureLevel)
{
switch (d3dFeatureLevel)
{
- case D3D_FEATURE_LEVEL_9_3:
- return ANGLE_FEATURE_LEVEL_9_3;
- case D3D_FEATURE_LEVEL_10_0:
- return ANGLE_FEATURE_LEVEL_10_0;
- case D3D_FEATURE_LEVEL_10_1:
- return ANGLE_FEATURE_LEVEL_10_1;
- case D3D_FEATURE_LEVEL_11_0:
- return ANGLE_FEATURE_LEVEL_11_0;
- // Note: we don't ever request a 11_1 device, because this gives
- // an E_INVALIDARG error on systems that don't have the platform update.
- case D3D_FEATURE_LEVEL_11_1:
- return ANGLE_FEATURE_LEVEL_11_1;
- default:
- return ANGLE_FEATURE_LEVEL_INVALID;
+ case D3D_FEATURE_LEVEL_9_3: return ANGLE_FEATURE_LEVEL_9_3;
+ case D3D_FEATURE_LEVEL_10_0: return ANGLE_FEATURE_LEVEL_10_0;
+ case D3D_FEATURE_LEVEL_10_1: return ANGLE_FEATURE_LEVEL_10_1;
+ case D3D_FEATURE_LEVEL_11_0: return ANGLE_FEATURE_LEVEL_11_0;
+ // Note: we don't ever request a 11_1 device, because this gives
+ // an E_INVALIDARG error on systems that don't have the platform update.
+ case D3D_FEATURE_LEVEL_11_1: return ANGLE_FEATURE_LEVEL_11_1;
+ default: return ANGLE_FEATURE_LEVEL_INVALID;
}
}
@@ -394,13 +405,13 @@ Renderer11::Renderer11(egl::Display *display)
mAnnotator(nullptr)
{
mVertexDataManager = NULL;
- mIndexDataManager = NULL;
+ mIndexDataManager = NULL;
- mLineLoopIB = NULL;
- mTriangleFanIB = NULL;
+ mLineLoopIB = NULL;
+ mTriangleFanIB = NULL;
mAppliedIBChanged = false;
- mBlit = NULL;
+ mBlit = NULL;
mPixelTransfer = NULL;
mClear = NULL;
@@ -409,31 +420,31 @@ Renderer11::Renderer11(egl::Display *display)
mSyncQuery = NULL;
- mRenderer11DeviceCaps.supportsClearView = false;
+ mRenderer11DeviceCaps.supportsClearView = false;
mRenderer11DeviceCaps.supportsConstantBufferOffsets = false;
- mRenderer11DeviceCaps.supportsDXGI1_2 = false;
- mRenderer11DeviceCaps.B5G6R5support = 0;
- mRenderer11DeviceCaps.B4G4R4A4support = 0;
- mRenderer11DeviceCaps.B5G5R5A1support = 0;
+ mRenderer11DeviceCaps.supportsDXGI1_2 = false;
+ mRenderer11DeviceCaps.B5G6R5support = 0;
+ mRenderer11DeviceCaps.B4G4R4A4support = 0;
+ mRenderer11DeviceCaps.B5G5R5A1support = 0;
- mD3d11Module = NULL;
- mDxgiModule = NULL;
+ mD3d11Module = NULL;
+ mDxgiModule = NULL;
mDCompModule = NULL;
mCreatedWithDeviceEXT = false;
mEGLDevice = nullptr;
- mDevice = NULL;
- mDeviceContext = NULL;
+ mDevice = NULL;
+ mDeviceContext = NULL;
mDeviceContext1 = NULL;
- mDxgiAdapter = NULL;
- mDxgiFactory = NULL;
+ mDxgiAdapter = NULL;
+ mDxgiFactory = NULL;
mDriverConstantBufferVS = NULL;
mDriverConstantBufferPS = NULL;
- mAppliedVertexShader = NULL;
+ mAppliedVertexShader = NULL;
mAppliedGeometryShader = NULL;
- mAppliedPixelShader = NULL;
+ mAppliedPixelShader = NULL;
mAppliedTFObject = angle::DirtyPointer;
@@ -509,7 +520,7 @@ Renderer11::Renderer11(egl::Display *display)
// Also set EGL_PLATFORM_ANGLE_ANGLE variables, in case they're used elsewhere in ANGLE
// mAvailableFeatureLevels defaults to empty
- mRequestedDriverType = D3D_DRIVER_TYPE_UNKNOWN;
+ mRequestedDriverType = D3D_DRIVER_TYPE_UNKNOWN;
mPresentPathFastEnabled = false;
}
@@ -540,17 +551,20 @@ egl::Error Renderer11::initialize()
{
HRESULT result = S_OK;
- ANGLE_TRY(initializeD3DDevice());
+ egl::Error error = initializeD3DDevice();
+ if (error.isError())
+ {
+ return error;
+ }
#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
#if !ANGLE_SKIP_DXGI_1_2_CHECK
{
TRACE_EVENT0("gpu.angle", "Renderer11::initialize (DXGICheck)");
- // In order to create a swap chain for an HWND owned by another process, DXGI 1.2 is
- // required.
+ // In order to create a swap chain for an HWND owned by another process, DXGI 1.2 is required.
// The easiest way to check is to query for a IDXGIDevice2.
bool requireDXGI1_2 = false;
- HWND hwnd = WindowFromDC(mDisplay->getNativeDisplayId());
+ HWND hwnd = WindowFromDC(mDisplay->getNativeDisplayId());
if (hwnd)
{
DWORD currentProcessId = GetCurrentProcessId();
@@ -566,12 +580,12 @@ egl::Error Renderer11::initialize()
if (requireDXGI1_2)
{
IDXGIDevice2 *dxgiDevice2 = NULL;
- result = mDevice->QueryInterface(__uuidof(IDXGIDevice2), (void **)&dxgiDevice2);
+ result = mDevice->QueryInterface(__uuidof(IDXGIDevice2), (void**)&dxgiDevice2);
if (FAILED(result))
{
- return egl::Error(
- EGL_NOT_INITIALIZED, D3D11_INIT_INCOMPATIBLE_DXGI,
- "DXGI 1.2 required to present to HWNDs owned by another process.");
+ return egl::Error(EGL_NOT_INITIALIZED,
+ D3D11_INIT_INCOMPATIBLE_DXGI,
+ "DXGI 1.2 required to present to HWNDs owned by another process.");
}
SafeRelease(dxgiDevice2);
}
@@ -587,19 +601,21 @@ egl::Error Renderer11::initialize()
mDeviceContext1 = d3d11::DynamicCastComObject<ID3D11DeviceContext1>(mDeviceContext);
IDXGIDevice *dxgiDevice = NULL;
- result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void **)&dxgiDevice);
+ result = mDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice);
if (FAILED(result))
{
- return egl::Error(EGL_NOT_INITIALIZED, D3D11_INIT_OTHER_ERROR,
+ return egl::Error(EGL_NOT_INITIALIZED,
+ D3D11_INIT_OTHER_ERROR,
"Could not query DXGI device.");
}
- result = dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void **)&mDxgiAdapter);
+ result = dxgiDevice->GetParent(__uuidof(IDXGIAdapter), (void**)&mDxgiAdapter);
if (FAILED(result))
{
- return egl::Error(EGL_NOT_INITIALIZED, D3D11_INIT_OTHER_ERROR,
+ return egl::Error(EGL_NOT_INITIALIZED,
+ D3D11_INIT_OTHER_ERROR,
"Could not retrieve DXGI adapter");
}
@@ -607,28 +623,24 @@ egl::Error Renderer11::initialize()
IDXGIAdapter2 *dxgiAdapter2 = d3d11::DynamicCastComObject<IDXGIAdapter2>(mDxgiAdapter);
- // On D3D_FEATURE_LEVEL_9_*, IDXGIAdapter::GetDesc returns "Software Adapter" for the
- // description string.
- // If DXGI1.2 is available then IDXGIAdapter2::GetDesc2 can be used to get the actual
- // hardware values.
+ // On D3D_FEATURE_LEVEL_9_*, IDXGIAdapter::GetDesc returns "Software Adapter" for the description string.
+ // If DXGI1.2 is available then IDXGIAdapter2::GetDesc2 can be used to get the actual hardware values.
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3 && dxgiAdapter2 != NULL)
{
DXGI_ADAPTER_DESC2 adapterDesc2 = {};
- result = dxgiAdapter2->GetDesc2(&adapterDesc2);
+ result = dxgiAdapter2->GetDesc2(&adapterDesc2);
if (SUCCEEDED(result))
{
- // Copy the contents of the DXGI_ADAPTER_DESC2 into mAdapterDescription (a
- // DXGI_ADAPTER_DESC).
- memcpy(mAdapterDescription.Description, adapterDesc2.Description,
- sizeof(mAdapterDescription.Description));
- mAdapterDescription.VendorId = adapterDesc2.VendorId;
- mAdapterDescription.DeviceId = adapterDesc2.DeviceId;
- mAdapterDescription.SubSysId = adapterDesc2.SubSysId;
- mAdapterDescription.Revision = adapterDesc2.Revision;
- mAdapterDescription.DedicatedVideoMemory = adapterDesc2.DedicatedVideoMemory;
+ // Copy the contents of the DXGI_ADAPTER_DESC2 into mAdapterDescription (a DXGI_ADAPTER_DESC).
+ memcpy(mAdapterDescription.Description, adapterDesc2.Description, sizeof(mAdapterDescription.Description));
+ mAdapterDescription.VendorId = adapterDesc2.VendorId;
+ mAdapterDescription.DeviceId = adapterDesc2.DeviceId;
+ mAdapterDescription.SubSysId = adapterDesc2.SubSysId;
+ mAdapterDescription.Revision = adapterDesc2.Revision;
+ mAdapterDescription.DedicatedVideoMemory = adapterDesc2.DedicatedVideoMemory;
mAdapterDescription.DedicatedSystemMemory = adapterDesc2.DedicatedSystemMemory;
- mAdapterDescription.SharedSystemMemory = adapterDesc2.SharedSystemMemory;
- mAdapterDescription.AdapterLuid = adapterDesc2.AdapterLuid;
+ mAdapterDescription.SharedSystemMemory = adapterDesc2.SharedSystemMemory;
+ mAdapterDescription.AdapterLuid = adapterDesc2.AdapterLuid;
}
}
else
@@ -640,23 +652,25 @@ egl::Error Renderer11::initialize()
if (FAILED(result))
{
- return egl::Error(EGL_NOT_INITIALIZED, D3D11_INIT_OTHER_ERROR,
+ return egl::Error(EGL_NOT_INITIALIZED,
+ D3D11_INIT_OTHER_ERROR,
"Could not read DXGI adaptor description.");
}
memset(mDescription, 0, sizeof(mDescription));
wcstombs(mDescription, mAdapterDescription.Description, sizeof(mDescription) - 1);
- result = mDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void **)&mDxgiFactory);
+ result = mDxgiAdapter->GetParent(__uuidof(IDXGIFactory), (void**)&mDxgiFactory);
if (!mDxgiFactory || FAILED(result))
{
- return egl::Error(EGL_NOT_INITIALIZED, D3D11_INIT_OTHER_ERROR,
+ return egl::Error(EGL_NOT_INITIALIZED,
+ D3D11_INIT_OTHER_ERROR,
"Could not create DXGI factory.");
}
}
-// Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
+ // Disable some spurious D3D11 debug warnings to prevent them from flooding the output log
#if defined(ANGLE_SUPPRESS_D3D11_HAZARD_WARNINGS) && defined(_DEBUG)
{
TRACE_EVENT0("gpu.angle", "Renderer11::initialize (HideWarnings)");
@@ -665,12 +679,14 @@ egl::Error Renderer11::initialize()
if (SUCCEEDED(result))
{
- D3D11_MESSAGE_ID hideMessages[] = {
- D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET};
+ D3D11_MESSAGE_ID hideMessages[] =
+ {
+ D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET
+ };
D3D11_INFO_QUEUE_FILTER filter = {};
filter.DenyList.NumIDs = static_cast<unsigned int>(ArraySize(hideMessages));
- filter.DenyList.pIDList = hideMessages;
+ filter.DenyList.pIDList = hideMessages;
infoQueue->AddStorageFilterEntries(&filter);
SafeRelease(infoQueue);
@@ -760,8 +776,12 @@ egl::Error Renderer11::initializeD3DDevice()
else
{
// We should use the inputted D3D11 device instead
- void *device = nullptr;
- ANGLE_TRY(mEGLDevice->getDevice(&device));
+ void *device = nullptr;
+ egl::Error error = mEGLDevice->getDevice(&device);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *d3dDevice = reinterpret_cast<ID3D11Device *>(device);
if (FAILED(d3dDevice->GetDeviceRemovedReason()))
@@ -802,7 +822,7 @@ void Renderer11::initializeDevice()
ASSERT(!mVertexDataManager && !mIndexDataManager);
mVertexDataManager = new VertexDataManager(this);
- mIndexDataManager = new IndexDataManager(this, getRendererClass());
+ mIndexDataManager = new IndexDataManager(this, getRendererClass());
ASSERT(!mBlit);
mBlit = new Blit11(this);
@@ -856,7 +876,8 @@ void Renderer11::initializeDevice()
angleFeatureLevel = ANGLE_FEATURE_LEVEL_11_1;
}
- ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3D11FeatureLevel", angleFeatureLevel,
+ ANGLE_HISTOGRAM_ENUMERATION("GPU.ANGLE.D3D11FeatureLevel",
+ angleFeatureLevel,
NUM_ANGLE_FEATURE_LEVELS);
}
@@ -864,28 +885,14 @@ void Renderer11::populateRenderer11DeviceCaps()
{
HRESULT hr = S_OK;
- LARGE_INTEGER version;
- hr = mDxgiAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &version);
- if (FAILED(hr))
- {
- mRenderer11DeviceCaps.driverVersion.reset();
- ERR("Error querying driver version from DXGI Adapter.");
- }
- else
- {
- mRenderer11DeviceCaps.driverVersion = version;
- }
-
if (mDeviceContext1)
{
D3D11_FEATURE_DATA_D3D11_OPTIONS d3d11Options;
- HRESULT result = mDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &d3d11Options,
- sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS));
+ HRESULT result = mDevice->CheckFeatureSupport(D3D11_FEATURE_D3D11_OPTIONS, &d3d11Options, sizeof(D3D11_FEATURE_DATA_D3D11_OPTIONS));
if (SUCCEEDED(result))
{
mRenderer11DeviceCaps.supportsClearView = (d3d11Options.ClearView != FALSE);
- mRenderer11DeviceCaps.supportsConstantBufferOffsets =
- (d3d11Options.ConstantBufferOffsetting != FALSE);
+ mRenderer11DeviceCaps.supportsConstantBufferOffsets = (d3d11Options.ConstantBufferOffsetting != FALSE);
}
}
@@ -903,15 +910,13 @@ void Renderer11::populateRenderer11DeviceCaps()
}
}
- hr = mDevice->CheckFormatSupport(DXGI_FORMAT_B4G4R4A4_UNORM,
- &(mRenderer11DeviceCaps.B4G4R4A4support));
+ hr = mDevice->CheckFormatSupport(DXGI_FORMAT_B4G4R4A4_UNORM, &(mRenderer11DeviceCaps.B4G4R4A4support));
if (FAILED(hr))
{
mRenderer11DeviceCaps.B4G4R4A4support = 0;
}
- hr = mDevice->CheckFormatSupport(DXGI_FORMAT_B5G5R5A1_UNORM,
- &(mRenderer11DeviceCaps.B5G5R5A1support));
+ hr = mDevice->CheckFormatSupport(DXGI_FORMAT_B5G5R5A1_UNORM, &(mRenderer11DeviceCaps.B5G5R5A1support));
if (FAILED(hr))
{
mRenderer11DeviceCaps.B5G5R5A1support = 0;
@@ -920,6 +925,18 @@ void Renderer11::populateRenderer11DeviceCaps()
IDXGIAdapter2 *dxgiAdapter2 = d3d11::DynamicCastComObject<IDXGIAdapter2>(mDxgiAdapter);
mRenderer11DeviceCaps.supportsDXGI1_2 = (dxgiAdapter2 != nullptr);
SafeRelease(dxgiAdapter2);
+
+ LARGE_INTEGER version;
+ hr = mDxgiAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &version);
+ if (FAILED(hr))
+ {
+ mRenderer11DeviceCaps.driverVersion.reset();
+ ERR("Error querying driver version from DXGI Adapter.");
+ }
+ else
+ {
+ mRenderer11DeviceCaps.driverVersion = version;
+ }
}
egl::ConfigSet Renderer11::generateConfigs()
@@ -943,8 +960,11 @@ egl::ConfigSet Renderer11::generateConfigs()
colorBufferFormats.push_back(GL_RGB565);
}
- static const GLenum depthStencilBufferFormats[] = {
- GL_NONE, GL_DEPTH24_STENCIL8_OES, GL_DEPTH_COMPONENT16,
+ static const GLenum depthStencilBufferFormats[] =
+ {
+ GL_NONE,
+ GL_DEPTH24_STENCIL8_OES,
+ GL_DEPTH_COMPONENT16,
};
const gl::Caps &rendererCaps = getNativeCaps();
@@ -956,8 +976,7 @@ egl::ConfigSet Renderer11::generateConfigs()
egl::ConfigSet configs;
for (GLenum colorBufferInternalFormat : colorBufferFormats)
{
- const gl::TextureCaps &colorBufferFormatCaps =
- rendererTextureCaps.get(colorBufferInternalFormat);
+ const gl::TextureCaps &colorBufferFormatCaps = rendererTextureCaps.get(colorBufferInternalFormat);
if (!colorBufferFormatCaps.renderable)
{
continue;
@@ -977,7 +996,6 @@ egl::ConfigSet Renderer11::generateConfigs()
gl::GetInternalFormatInfo(colorBufferInternalFormat);
const gl::InternalFormat &depthStencilBufferFormatInfo =
gl::GetInternalFormatInfo(depthStencilBufferInternalFormat);
- const gl::Version &maxVersion = getMaxSupportedESVersion();
egl::Config config;
config.renderTargetFormat = colorBufferInternalFormat;
@@ -990,27 +1008,20 @@ egl::ConfigSet Renderer11::generateConfigs()
config.alphaSize = colorBufferFormatInfo.alphaBits;
config.alphaMaskSize = 0;
config.bindToTextureRGB = (colorBufferFormatInfo.format == GL_RGB);
- config.bindToTextureRGBA = (colorBufferFormatInfo.format == GL_RGBA ||
+ config.bindToTextureRGBA = (colorBufferFormatInfo.format == GL_RGBA ||
colorBufferFormatInfo.format == GL_BGRA_EXT);
config.colorBufferType = EGL_RGB_BUFFER;
config.configCaveat = EGL_NONE;
config.configID = static_cast<EGLint>(configs.size() + 1);
+ // Can only support a conformant ES2 with feature level greater than 10.0.
+ config.conformant = (mRenderer11DeviceCaps.featureLevel >= D3D_FEATURE_LEVEL_10_0)
+ ? (EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT_KHR)
+ : 0;
// PresentPathFast may not be conformant
- config.conformant = 0;
- if (!mPresentPathFastEnabled)
+ if (mPresentPathFastEnabled)
{
- // Can only support a conformant ES2 with feature level greater than 10.0.
- if (mRenderer11DeviceCaps.featureLevel >= D3D_FEATURE_LEVEL_10_0)
- {
- config.conformant |= EGL_OPENGL_ES2_BIT;
- }
-
- // We can only support conformant ES3 on FL 10.1+
- if (maxVersion.major >= 3)
- {
- config.conformant |= EGL_OPENGL_ES3_BIT_KHR;
- }
+ config.conformant = 0;
}
config.depthSize = depthStencilBufferFormatInfo.depthBits;
@@ -1018,24 +1029,21 @@ egl::ConfigSet Renderer11::generateConfigs()
config.matchNativePixmap = EGL_NONE;
config.maxPBufferWidth = rendererCaps.max2DTextureSize;
config.maxPBufferHeight = rendererCaps.max2DTextureSize;
- config.maxPBufferPixels = rendererCaps.max2DTextureSize * rendererCaps.max2DTextureSize;
- config.maxSwapInterval = 4;
- config.minSwapInterval = 0;
- config.nativeRenderable = EGL_FALSE;
- config.nativeVisualID = 0;
- config.nativeVisualType = EGL_NONE;
-
- // Can't support ES3 at all without feature level 10.1
- config.renderableType = EGL_OPENGL_ES2_BIT;
- if (maxVersion.major >= 3)
- {
- config.renderableType |= EGL_OPENGL_ES3_BIT_KHR;
- }
-
- config.sampleBuffers = 0; // FIXME: enumerate multi-sampling
- config.samples = 0;
- config.stencilSize = depthStencilBufferFormatInfo.stencilBits;
- config.surfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
+ config.maxPBufferPixels = rendererCaps.max2DTextureSize * rendererCaps.max2DTextureSize;
+ config.maxSwapInterval = 4;
+ config.minSwapInterval = 0;
+ config.nativeRenderable = EGL_FALSE;
+ config.nativeVisualID = 0;
+ config.nativeVisualType = EGL_NONE;
+ // Can't support ES3 at all without feature level 10.0
+ config.renderableType =
+ EGL_OPENGL_ES2_BIT | ((mRenderer11DeviceCaps.featureLevel >= D3D_FEATURE_LEVEL_10_0)
+ ? EGL_OPENGL_ES3_BIT_KHR
+ : 0);
+ config.sampleBuffers = 0; // FIXME: enumerate multi-sampling
+ config.samples = 0;
+ config.stencilSize = depthStencilBufferFormatInfo.stencilBits;
+ config.surfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT;
config.transparentType = EGL_NONE;
config.transparentRedValue = 0;
config.transparentGreenValue = 0;
@@ -1059,9 +1067,8 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions
outExtensions->d3dShareHandleClientBuffer = true;
outExtensions->surfaceD3DTexture2DShareHandle = true;
}
- outExtensions->d3dTextureClientBuffer = true;
- outExtensions->keyedMutex = true;
+ outExtensions->keyedMutex = true;
outExtensions->querySurfacePointer = true;
outExtensions->windowFixedSize = true;
@@ -1105,15 +1112,14 @@ gl::Error Renderer11::finish()
if (!mSyncQuery)
{
D3D11_QUERY_DESC queryDesc;
- queryDesc.Query = D3D11_QUERY_EVENT;
+ queryDesc.Query = D3D11_QUERY_EVENT;
queryDesc.MiscFlags = 0;
result = mDevice->CreateQuery(&queryDesc, &mSyncQuery);
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY, "Failed to create event query, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create event query, result: 0x%X.", result);
}
}
@@ -1129,8 +1135,7 @@ gl::Error Renderer11::finish()
result = mDeviceContext->GetData(mSyncQuery, NULL, 0, flags);
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY, "Failed to get event query data, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to get event query data, result: 0x%X.", result);
}
// Keep polling, but allow other threads to do something useful first
@@ -1141,7 +1146,8 @@ gl::Error Renderer11::finish()
mDisplay->notifyDeviceLost();
return gl::Error(GL_OUT_OF_MEMORY, "Device was lost while waiting for sync.");
}
- } while (result == S_FALSE);
+ }
+ while (result == S_FALSE);
return gl::Error(GL_NO_ERROR);
}
@@ -1169,124 +1175,19 @@ NativeWindowD3D *Renderer11::createNativeWindow(EGLNativeWindowType window,
#endif
}
-egl::Error Renderer11::getD3DTextureInfo(IUnknown *d3dTexture,
- EGLint *width,
- EGLint *height,
- GLenum *fboFormat) const
-{
- ID3D11Texture2D *texture = d3d11::DynamicCastComObject<ID3D11Texture2D>(d3dTexture);
- if (texture == nullptr)
- {
- return egl::Error(EGL_BAD_PARAMETER, "client buffer is not a ID3D11Texture2D");
- }
-
- ID3D11Device *textureDevice = nullptr;
- texture->GetDevice(&textureDevice);
- if (textureDevice != mDevice)
- {
- SafeRelease(texture);
- return egl::Error(EGL_BAD_PARAMETER, "Texture's device does not match.");
- }
- SafeRelease(textureDevice);
-
- D3D11_TEXTURE2D_DESC desc = {0};
- texture->GetDesc(&desc);
- SafeRelease(texture);
-
- if (width)
- {
- *width = static_cast<EGLint>(desc.Width);
- }
- if (height)
- {
- *height = static_cast<EGLint>(desc.Height);
- }
-
- // From table egl.restrictions in EGL_ANGLE_d3d_texture_client_buffer.
- switch (desc.Format)
- {
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- break;
-
- default:
- return egl::Error(EGL_BAD_PARAMETER, "Unknown client buffer texture format: %u.",
- desc.Format);
- }
-
- if (fboFormat)
- {
- const angle::Format &angleFormat = d3d11_angle::GetFormat(desc.Format);
- *fboFormat = angleFormat.fboImplementationInternalFormat;
- }
-
- return egl::Error(EGL_SUCCESS);
-}
-
-egl::Error Renderer11::validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const
-{
- if (shareHandle == nullptr)
- {
- return egl::Error(EGL_BAD_PARAMETER, "NULL share handle.");
- }
-
- ID3D11Resource *tempResource11 = nullptr;
- HRESULT result = mDevice->OpenSharedResource(shareHandle, __uuidof(ID3D11Resource),
- (void **)&tempResource11);
- if (FAILED(result))
- {
- return egl::Error(EGL_BAD_PARAMETER, "Failed to open share handle, result: 0x%X.", result);
- }
-
- ID3D11Texture2D *texture2D = d3d11::DynamicCastComObject<ID3D11Texture2D>(tempResource11);
- SafeRelease(tempResource11);
-
- if (texture2D == nullptr)
- {
- return egl::Error(EGL_BAD_PARAMETER,
- "Failed to query ID3D11Texture2D object from share handle.");
- }
-
- D3D11_TEXTURE2D_DESC desc = {0};
- texture2D->GetDesc(&desc);
- SafeRelease(texture2D);
-
- EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
- EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
- ASSERT(width != 0 && height != 0);
-
- const d3d11::Format &backbufferFormatInfo =
- d3d11::Format::Get(config->renderTargetFormat, getRenderer11DeviceCaps());
-
- if (desc.Width != static_cast<UINT>(width) || desc.Height != static_cast<UINT>(height) ||
- desc.Format != backbufferFormatInfo.texFormat || desc.MipLevels != 1 || desc.ArraySize != 1)
- {
- return egl::Error(EGL_BAD_PARAMETER, "Invalid texture parameters in share handle texture.");
- }
-
- return egl::Error(EGL_SUCCESS);
-}
-
SwapChainD3D *Renderer11::createSwapChain(NativeWindowD3D *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation)
{
- return new SwapChain11(this, GetAs<NativeWindow11>(nativeWindow), shareHandle, d3dTexture,
- backBufferFormat, depthBufferFormat, orientation);
+ return new SwapChain11(this, GetAs<NativeWindow11>(nativeWindow), shareHandle, backBufferFormat,
+ depthBufferFormat, orientation);
}
void *Renderer11::getD3DDevice()
{
- return reinterpret_cast<void *>(mDevice);
+ return reinterpret_cast<void*>(mDevice);
}
gl::Error Renderer11::generateSwizzle(gl::Texture *texture)
@@ -1297,13 +1198,21 @@ gl::Error Renderer11::generateSwizzle(gl::Texture *texture)
ASSERT(textureD3D);
TextureStorage *texStorage = nullptr;
- ANGLE_TRY(textureD3D->getNativeTexture(&texStorage));
+ gl::Error error = textureD3D->getNativeTexture(&texStorage);
+ if (error.isError())
+ {
+ return error;
+ }
if (texStorage)
{
- TextureStorage11 *storage11 = GetAs<TextureStorage11>(texStorage);
+ TextureStorage11 *storage11 = GetAs<TextureStorage11>(texStorage);
const gl::TextureState &textureState = texture->getTextureState();
- ANGLE_TRY(storage11->generateSwizzles(textureState.getSwizzleState()));
+ error = storage11->generateSwizzles(textureState.getSwizzleState());
+ if (error.isError())
+ {
+ return error;
+ }
}
}
@@ -1349,7 +1258,11 @@ gl::Error Renderer11::setSamplerState(gl::SamplerType type,
TextureD3D *textureD3D = GetImplAs<TextureD3D>(texture);
TextureStorage *storage = nullptr;
- ANGLE_TRY(textureD3D->getNativeTexture(&storage));
+ gl::Error error = textureD3D->getNativeTexture(&storage);
+ if (error.isError())
+ {
+ return error;
+ }
// Storage should exist, texture should be complete
ASSERT(storage);
@@ -1367,7 +1280,11 @@ gl::Error Renderer11::setSamplerState(gl::SamplerType type,
memcmp(&samplerState, &mCurPixelSamplerStates[index], sizeof(gl::SamplerState)) != 0)
{
ID3D11SamplerState *dxSamplerState = NULL;
- ANGLE_TRY(mStateCache.getSamplerState(samplerState, &dxSamplerState));
+ error = mStateCache.getSamplerState(samplerState, &dxSamplerState);
+ if (error.isError())
+ {
+ return error;
+ }
ASSERT(dxSamplerState != NULL);
mDeviceContext->PSSetSamplers(index, 1, &dxSamplerState);
@@ -1387,7 +1304,11 @@ gl::Error Renderer11::setSamplerState(gl::SamplerType type,
memcmp(&samplerState, &mCurVertexSamplerStates[index], sizeof(gl::SamplerState)) != 0)
{
ID3D11SamplerState *dxSamplerState = NULL;
- ANGLE_TRY(mStateCache.getSamplerState(samplerState, &dxSamplerState));
+ error = mStateCache.getSamplerState(samplerState, &dxSamplerState);
+ if (error.isError())
+ {
+ return error;
+ }
ASSERT(dxSamplerState != NULL);
mDeviceContext->VSSetSamplers(index, 1, &dxSamplerState);
@@ -1399,13 +1320,12 @@ gl::Error Renderer11::setSamplerState(gl::SamplerType type,
metadata = &mSamplerMetadataVS;
}
- else
- UNREACHABLE();
+ else UNREACHABLE();
ASSERT(metadata != nullptr);
metadata->update(index, *texture);
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *texture)
@@ -1417,7 +1337,11 @@ gl::Error Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *t
TextureD3D *textureImpl = GetImplAs<TextureD3D>(texture);
TextureStorage *texStorage = nullptr;
- ANGLE_TRY(textureImpl->getNativeTexture(&texStorage));
+ gl::Error error = textureImpl->getNativeTexture(&texStorage);
+ if (error.isError())
+ {
+ return error;
+ }
// Texture should be complete and have a storage
ASSERT(texStorage);
@@ -1426,8 +1350,8 @@ gl::Error Renderer11::setTexture(gl::SamplerType type, int index, gl::Texture *t
ANGLE_TRY(storage11->getSRV(texture->getTextureState(), &textureSRV));
- // If we get NULL back from getSRV here, something went wrong in the texture class and we're
- // unexpectedly missing the shader resource view
+ // If we get NULL back from getSRV here, something went wrong in the texture class and we're unexpectedly
+ // missing the shader resource view
ASSERT(textureSRV != NULL);
textureImpl->resetDirty();
@@ -1447,8 +1371,7 @@ gl::Error Renderer11::setUniformBuffers(const gl::ContextState &data,
const std::vector<GLint> &vertexUniformBuffers,
const std::vector<GLint> &fragmentUniformBuffers)
{
- for (size_t uniformBufferIndex = 0; uniformBufferIndex < vertexUniformBuffers.size();
- uniformBufferIndex++)
+ for (size_t uniformBufferIndex = 0; uniformBufferIndex < vertexUniformBuffers.size(); uniformBufferIndex++)
{
GLint binding = vertexUniformBuffers[uniformBufferIndex];
@@ -1469,12 +1392,10 @@ gl::Error Renderer11::setUniformBuffers(const gl::ContextState &data,
Buffer11 *bufferStorage = GetImplAs<Buffer11>(uniformBuffer.get());
ID3D11Buffer *constantBuffer = nullptr;
- UINT firstConstant = 0;
- UINT numConstants = 0;
- ANGLE_TRY(bufferStorage->getConstantBufferRange(uniformBufferOffset, uniformBufferSize,
- &constantBuffer, &firstConstant,
- &numConstants));
+ ANGLE_TRY_RESULT(
+ bufferStorage->getConstantBufferRange(uniformBufferOffset, uniformBufferSize),
+ constantBuffer);
if (!constantBuffer)
{
@@ -1485,9 +1406,11 @@ gl::Error Renderer11::setUniformBuffers(const gl::ContextState &data,
mCurrentConstantBufferVSOffset[uniformBufferIndex] != uniformBufferOffset ||
mCurrentConstantBufferVSSize[uniformBufferIndex] != uniformBufferSize)
{
- if (firstConstant != 0 && uniformBufferSize != 0)
+ if (mRenderer11DeviceCaps.supportsConstantBufferOffsets && uniformBufferSize != 0)
{
- ASSERT(numConstants != 0);
+ UINT firstConstant = 0, numConstants = 0;
+ CalculateConstantBufferParams(uniformBufferOffset, uniformBufferSize,
+ &firstConstant, &numConstants);
mDeviceContext1->VSSetConstantBuffers1(
getReservedVertexUniformBuffers() +
static_cast<unsigned int>(uniformBufferIndex),
@@ -1507,8 +1430,7 @@ gl::Error Renderer11::setUniformBuffers(const gl::ContextState &data,
}
}
- for (size_t uniformBufferIndex = 0; uniformBufferIndex < fragmentUniformBuffers.size();
- uniformBufferIndex++)
+ for (size_t uniformBufferIndex = 0; uniformBufferIndex < fragmentUniformBuffers.size(); uniformBufferIndex++)
{
GLint binding = fragmentUniformBuffers[uniformBufferIndex];
@@ -1529,12 +1451,10 @@ gl::Error Renderer11::setUniformBuffers(const gl::ContextState &data,
Buffer11 *bufferStorage = GetImplAs<Buffer11>(uniformBuffer.get());
ID3D11Buffer *constantBuffer = nullptr;
- UINT firstConstant = 0;
- UINT numConstants = 0;
- ANGLE_TRY(bufferStorage->getConstantBufferRange(uniformBufferOffset, uniformBufferSize,
- &constantBuffer, &firstConstant,
- &numConstants));
+ ANGLE_TRY_RESULT(
+ bufferStorage->getConstantBufferRange(uniformBufferOffset, uniformBufferSize),
+ constantBuffer);
if (!constantBuffer)
{
@@ -1545,8 +1465,11 @@ gl::Error Renderer11::setUniformBuffers(const gl::ContextState &data,
mCurrentConstantBufferPSOffset[uniformBufferIndex] != uniformBufferOffset ||
mCurrentConstantBufferPSSize[uniformBufferIndex] != uniformBufferSize)
{
- if (firstConstant != 0 && uniformBufferSize != 0)
+ if (mRenderer11DeviceCaps.supportsConstantBufferOffsets && uniformBufferSize != 0)
{
+ UINT firstConstant = 0, numConstants = 0;
+ CalculateConstantBufferParams(uniformBufferOffset, uniformBufferSize,
+ &firstConstant, &numConstants);
mDeviceContext1->PSSetConstantBuffers1(
getReservedFragmentUniformBuffers() +
static_cast<unsigned int>(uniformBufferIndex),
@@ -1592,17 +1515,7 @@ gl::Error Renderer11::updateState(const gl::ContextState &data, GLenum drawMode)
mStateManager.setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
// Applying rasterizer state to D3D11 device
- // Since framebuffer->getSamples will return the original samples which may be different with
- // the sample counts that we set in render target view, here we use renderTarget->getSamples to
- // get the actual samples.
- GLsizei samples = 0;
- if (firstColorAttachment)
- {
- ASSERT(firstColorAttachment->isAttached());
- RenderTarget11 *renderTarget = nullptr;
- ANGLE_TRY(firstColorAttachment->getRenderTarget(&renderTarget));
- samples = renderTarget->getSamples();
- }
+ int samples = framebuffer->getSamples(data);
gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0);
@@ -1628,44 +1541,22 @@ bool Renderer11::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSi
switch (mode)
{
- case GL_POINTS:
- primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST;
- minCount = 1;
- break;
- case GL_LINES:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINELIST;
- minCount = 2;
- break;
- case GL_LINE_LOOP:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
- minCount = 2;
- break;
- case GL_LINE_STRIP:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
- minCount = 2;
- break;
- case GL_TRIANGLES:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- minCount = 3;
- break;
- case GL_TRIANGLE_STRIP:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
- minCount = 3;
- break;
- // emulate fans via rewriting index buffer
- case GL_TRIANGLE_FAN:
- primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
- minCount = 3;
- break;
- default:
- UNREACHABLE();
- return false;
+ case GL_POINTS: primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; minCount = 1; break;
+ case GL_LINES: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINELIST; minCount = 2; break;
+ case GL_LINE_LOOP: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; minCount = 2; break;
+ case GL_LINE_STRIP: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; minCount = 2; break;
+ case GL_TRIANGLES: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; minCount = 3; break;
+ case GL_TRIANGLE_STRIP: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; minCount = 3; break;
+ // emulate fans via rewriting index buffer
+ case GL_TRIANGLE_FAN: primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; minCount = 3; break;
+ default:
+ UNREACHABLE();
+ return false;
}
// If instanced pointsprite emulation is being used and If gl_PointSize is used in the shader,
// GL_POINTS mode is expected to render pointsprites.
- // Instanced PointSprite emulation requires that the topology to be
- // D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST.
+ // Instanced PointSprite emulation requires that the topology to be D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST.
if (mode == GL_POINTS && usesPointSize && getWorkarounds().useInstancedPointSpriteEmulation)
{
primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
@@ -1695,10 +1586,18 @@ gl::Error Renderer11::applyVertexBuffer(const gl::State &state,
const auto &vertexArray = state.getVertexArray();
auto *vertexArray11 = GetImplAs<VertexArray11>(vertexArray);
- ANGLE_TRY(vertexArray11->updateDirtyAndDynamicAttribs(mVertexDataManager, state, first, count,
- instances));
+ gl::Error error = vertexArray11->updateDirtyAndDynamicAttribs(mVertexDataManager, state, first,
+ count, instances);
+ if (error.isError())
+ {
+ return error;
+ }
- ANGLE_TRY(mStateManager.updateCurrentValueAttribs(state, mVertexDataManager));
+ error = mStateManager.updateCurrentValueAttribs(state, mVertexDataManager);
+ if (error.isError())
+ {
+ return error;
+ }
// If index information is passed, mark it with the current changed status.
if (indexInfo)
@@ -1742,8 +1641,7 @@ gl::Error Renderer11::applyIndexBuffer(const gl::ContextState &data,
indexInfo, glState.isPrimitiveRestartEnabled()));
ID3D11Buffer *buffer = nullptr;
- DXGI_FORMAT bufferFormat =
- (indexInfo->indexType == GL_UNSIGNED_INT) ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
+ DXGI_FORMAT bufferFormat = (indexInfo->indexType == GL_UNSIGNED_INT) ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT;
if (indexInfo->storage)
{
@@ -1752,19 +1650,18 @@ gl::Error Renderer11::applyIndexBuffer(const gl::ContextState &data,
}
else
{
- IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(indexInfo->indexBuffer);
- buffer = indexBuffer->getBuffer();
+ IndexBuffer11* indexBuffer = GetAs<IndexBuffer11>(indexInfo->indexBuffer);
+ buffer = indexBuffer->getBuffer();
}
mAppliedIBChanged = false;
- if (buffer != mAppliedIB || bufferFormat != mAppliedIBFormat ||
- indexInfo->startOffset != mAppliedIBOffset)
+ if (buffer != mAppliedIB || bufferFormat != mAppliedIBFormat || indexInfo->startOffset != mAppliedIBOffset)
{
mDeviceContext->IASetIndexBuffer(buffer, bufferFormat, indexInfo->startOffset);
- mAppliedIB = buffer;
- mAppliedIBFormat = bufferFormat;
- mAppliedIBOffset = indexInfo->startOffset;
+ mAppliedIB = buffer;
+ mAppliedIBFormat = bufferFormat;
+ mAppliedIBOffset = indexInfo->startOffset;
mAppliedIBChanged = true;
}
@@ -1834,8 +1731,12 @@ gl::Error Renderer11::drawArraysImpl(const gl::ContextState &data,
}
rx::ShaderExecutableD3D *pixelExe = nullptr;
- ANGLE_TRY(
- programD3D->getPixelExecutableForFramebuffer(glState.getDrawFramebuffer(), &pixelExe));
+ gl::Error error =
+ programD3D->getPixelExecutableForFramebuffer(glState.getDrawFramebuffer(), &pixelExe);
+ if (error.isError())
+ {
+ return error;
+ }
// Skip the draw call if rasterizer discard is enabled (or no fragment shader).
if (!pixelExe || glState.getRasterizerState().rasterizerDiscard)
@@ -1849,8 +1750,12 @@ gl::Error Renderer11::drawArraysImpl(const gl::ContextState &data,
// Retrieve the geometry shader.
rx::ShaderExecutableD3D *geometryExe = nullptr;
- ANGLE_TRY(
- programD3D->getGeometryExecutableForPrimitiveType(data, mode, &geometryExe, nullptr));
+ error =
+ programD3D->getGeometryExecutableForPrimitiveType(data, mode, &geometryExe, nullptr);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11GeometryShader *geometryShader =
(geometryExe ? GetAs<ShaderExecutable11>(geometryExe)->getGeometryShader() : NULL);
@@ -2009,10 +1914,14 @@ gl::Error Renderer11::drawLineLoop(const gl::ContextState &data,
if (type != GL_NONE && elementArrayBuffer)
{
BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
- intptr_t offset = reinterpret_cast<intptr_t>(indices);
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
const uint8_t *bufferData = NULL;
- ANGLE_TRY(storage->getData(&bufferData));
+ gl::Error error = storage->getData(&bufferData);
+ if (error.isError())
+ {
+ return error;
+ }
indices = bufferData + offset;
}
@@ -2020,8 +1929,7 @@ gl::Error Renderer11::drawLineLoop(const gl::ContextState &data,
if (!mLineLoopIB)
{
mLineLoopIB = new StreamingIndexBufferInterface(this);
- gl::Error error =
- mLineLoopIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
+ gl::Error error = mLineLoopIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
if (error.isError())
{
SafeDelete(mLineLoopIB);
@@ -2032,12 +1940,9 @@ gl::Error Renderer11::drawLineLoop(const gl::ContextState &data,
// Checked by Renderer11::applyPrimitiveType
ASSERT(count >= 0);
- if (static_cast<unsigned int>(count) + 1 >
- (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
+ if (static_cast<unsigned int>(count) + 1 > (std::numeric_limits<unsigned int>::max() / sizeof(unsigned int)))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create a 32-bit looping index buffer for GL_LINE_LOOP, too "
- "many indices required.");
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create a 32-bit looping index buffer for GL_LINE_LOOP, too many indices required.");
}
GetLineLoopIndices(indices, type, static_cast<GLuint>(count),
@@ -2045,33 +1950,45 @@ gl::Error Renderer11::drawLineLoop(const gl::ContextState &data,
unsigned int spaceNeeded =
static_cast<unsigned int>(sizeof(GLuint) * mScratchIndexDataBuffer.size());
- ANGLE_TRY(mLineLoopIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT));
+ gl::Error error = mLineLoopIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
+ if (error.isError())
+ {
+ return error;
+ }
- void *mappedMemory = NULL;
+ void* mappedMemory = NULL;
unsigned int offset;
- ANGLE_TRY(mLineLoopIB->mapBuffer(spaceNeeded, &mappedMemory, &offset));
+ error = mLineLoopIB->mapBuffer(spaceNeeded, &mappedMemory, &offset);
+ if (error.isError())
+ {
+ return error;
+ }
// Copy over the converted index data.
memcpy(mappedMemory, &mScratchIndexDataBuffer[0],
sizeof(GLuint) * mScratchIndexDataBuffer.size());
- ANGLE_TRY(mLineLoopIB->unmapBuffer());
+ error = mLineLoopIB->unmapBuffer();
+ if (error.isError())
+ {
+ return error;
+ }
- IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(mLineLoopIB->getIndexBuffer());
+ IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(mLineLoopIB->getIndexBuffer());
ID3D11Buffer *d3dIndexBuffer = indexBuffer->getBuffer();
- DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat ||
mAppliedIBOffset != offset)
{
mDeviceContext->IASetIndexBuffer(d3dIndexBuffer, indexFormat, offset);
- mAppliedIB = d3dIndexBuffer;
+ mAppliedIB = d3dIndexBuffer;
mAppliedIBFormat = indexFormat;
mAppliedIBOffset = offset;
}
INT baseVertexLocation = (indexInfo ? -static_cast<int>(indexInfo->indexRange.start) : 0);
- UINT indexCount = static_cast<UINT>(mScratchIndexDataBuffer.size());
+ UINT indexCount = static_cast<UINT>(mScratchIndexDataBuffer.size());
if (instances > 0)
{
@@ -2082,7 +1999,7 @@ gl::Error Renderer11::drawLineLoop(const gl::ContextState &data,
mDeviceContext->DrawIndexed(indexCount, 0, baseVertexLocation);
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
@@ -2101,10 +2018,14 @@ gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
if (type != GL_NONE && elementArrayBuffer)
{
BufferD3D *storage = GetImplAs<BufferD3D>(elementArrayBuffer);
- intptr_t offset = reinterpret_cast<intptr_t>(indices);
+ intptr_t offset = reinterpret_cast<intptr_t>(indices);
const uint8_t *bufferData = NULL;
- ANGLE_TRY(storage->getData(&bufferData));
+ gl::Error error = storage->getData(&bufferData);
+ if (error.isError())
+ {
+ return error;
+ }
indexPointer = bufferData + offset;
}
@@ -2112,8 +2033,7 @@ gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
if (!mTriangleFanIB)
{
mTriangleFanIB = new StreamingIndexBufferInterface(this);
- gl::Error error =
- mTriangleFanIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
+ gl::Error error = mTriangleFanIB->reserveBufferSpace(INITIAL_INDEX_BUFFER_SIZE, GL_UNSIGNED_INT);
if (error.isError())
{
SafeDelete(mTriangleFanIB);
@@ -2128,9 +2048,7 @@ gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
if (numTris > (std::numeric_limits<unsigned int>::max() / (sizeof(unsigned int) * 3)))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create a scratch index buffer for GL_TRIANGLE_FAN, too many "
- "indices required.");
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create a scratch index buffer for GL_TRIANGLE_FAN, too many indices required.");
}
GetTriFanIndices(indexPointer, type, count, data.getState().isPrimitiveRestartEnabled(),
@@ -2138,25 +2056,37 @@ gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
const unsigned int spaceNeeded =
static_cast<unsigned int>(mScratchIndexDataBuffer.size() * sizeof(unsigned int));
- ANGLE_TRY(mTriangleFanIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT));
+ gl::Error error = mTriangleFanIB->reserveBufferSpace(spaceNeeded, GL_UNSIGNED_INT);
+ if (error.isError())
+ {
+ return error;
+ }
void *mappedMemory = nullptr;
unsigned int offset;
- ANGLE_TRY(mTriangleFanIB->mapBuffer(spaceNeeded, &mappedMemory, &offset));
+ error = mTriangleFanIB->mapBuffer(spaceNeeded, &mappedMemory, &offset);
+ if (error.isError())
+ {
+ return error;
+ }
memcpy(mappedMemory, &mScratchIndexDataBuffer[0], spaceNeeded);
- ANGLE_TRY(mTriangleFanIB->unmapBuffer());
+ error = mTriangleFanIB->unmapBuffer();
+ if (error.isError())
+ {
+ return error;
+ }
- IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(mTriangleFanIB->getIndexBuffer());
+ IndexBuffer11 *indexBuffer = GetAs<IndexBuffer11>(mTriangleFanIB->getIndexBuffer());
ID3D11Buffer *d3dIndexBuffer = indexBuffer->getBuffer();
- DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
+ DXGI_FORMAT indexFormat = indexBuffer->getIndexFormat();
if (mAppliedIB != d3dIndexBuffer || mAppliedIBFormat != indexFormat ||
mAppliedIBOffset != offset)
{
mDeviceContext->IASetIndexBuffer(d3dIndexBuffer, indexFormat, offset);
- mAppliedIB = d3dIndexBuffer;
+ mAppliedIB = d3dIndexBuffer;
mAppliedIBFormat = indexFormat;
mAppliedIBOffset = offset;
}
@@ -2172,7 +2102,7 @@ gl::Error Renderer11::drawTriangleFan(const gl::ContextState &data,
mDeviceContext->DrawIndexed(indexCount, 0, -minIndex);
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error Renderer11::applyShaders(const gl::ContextState &data, GLenum drawMode)
@@ -2224,21 +2154,21 @@ gl::Error Renderer11::applyShaders(const gl::ContextState &data, GLenum drawMode
{
mDeviceContext->VSSetShader(vertexShader, nullptr, 0);
mAppliedVertexShader = reinterpret_cast<uintptr_t>(vertexShader);
- dirtyUniforms = true;
+ dirtyUniforms = true;
}
if (reinterpret_cast<uintptr_t>(geometryShader) != mAppliedGeometryShader)
{
mDeviceContext->GSSetShader(geometryShader, nullptr, 0);
mAppliedGeometryShader = reinterpret_cast<uintptr_t>(geometryShader);
- dirtyUniforms = true;
+ dirtyUniforms = true;
}
if (reinterpret_cast<uintptr_t>(pixelShader) != mAppliedPixelShader)
{
mDeviceContext->PSSetShader(pixelShader, nullptr, 0);
mAppliedPixelShader = reinterpret_cast<uintptr_t>(pixelShader);
- dirtyUniforms = true;
+ dirtyUniforms = true;
}
if (dirtyUniforms)
@@ -2257,7 +2187,7 @@ gl::Error Renderer11::applyUniforms(const ProgramD3D &programD3D,
unsigned int totalRegisterCountPS = 0;
bool vertexUniformsDirty = false;
- bool pixelUniformsDirty = false;
+ bool pixelUniformsDirty = false;
for (const D3DUniform *uniform : uniformArray)
{
@@ -2282,16 +2212,16 @@ gl::Error Renderer11::applyUniforms(const ProgramD3D &programD3D,
ASSERT(fragmentUniformStorage);
ID3D11Buffer *vertexConstantBuffer = vertexUniformStorage->getConstantBuffer();
- ID3D11Buffer *pixelConstantBuffer = fragmentUniformStorage->getConstantBuffer();
+ ID3D11Buffer *pixelConstantBuffer = fragmentUniformStorage->getConstantBuffer();
- float(*mapVS)[4] = NULL;
- float(*mapPS)[4] = NULL;
+ float (*mapVS)[4] = NULL;
+ float (*mapPS)[4] = NULL;
if (totalRegisterCountVS > 0 && vertexUniformsDirty)
{
D3D11_MAPPED_SUBRESOURCE map = {0};
- HRESULT result =
- mDeviceContext->Map(vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
+ HRESULT result = mDeviceContext->Map(vertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mapVS = (float(*)[4])map.pData;
}
@@ -2299,8 +2229,8 @@ gl::Error Renderer11::applyUniforms(const ProgramD3D &programD3D,
if (totalRegisterCountPS > 0 && pixelUniformsDirty)
{
D3D11_MAPPED_SUBRESOURCE map = {0};
- HRESULT result =
- mDeviceContext->Map(pixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
+ HRESULT result = mDeviceContext->Map(pixelConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &map);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
mapPS = (float(*)[4])map.pData;
}
@@ -2363,9 +2293,7 @@ gl::Error Renderer11::applyUniforms(const ProgramD3D &programD3D,
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create vertex shader constant buffer, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create vertex shader constant buffer, result: 0x%X.", result);
}
mDeviceContext->VSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
&mDriverConstantBufferVS);
@@ -2380,9 +2308,7 @@ gl::Error Renderer11::applyUniforms(const ProgramD3D &programD3D,
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create pixel shader constant buffer, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create pixel shader constant buffer, result: 0x%X.", result);
}
mDeviceContext->PSSetConstantBuffers(d3d11::RESERVED_CONSTANT_BUFFER_SLOT_DRIVER, 1,
&mDriverConstantBufferPS);
@@ -2391,13 +2317,13 @@ gl::Error Renderer11::applyUniforms(const ProgramD3D &programD3D,
// Sampler metadata and driver constants need to coexist in the same constant buffer to conserve
// constant buffer slots. We update both in the constant buffer if needed.
const dx_VertexConstants11 &vertexConstants = mStateManager.getVertexConstants();
- size_t samplerMetadataReferencedBytesVS = sizeof(SamplerMetadataD3D11::dx_SamplerMetadata) *
+ size_t samplerMetadataReferencedBytesVS = sizeof(SamplerMetadataD3D11::dx_SamplerMetadata) *
programD3D.getUsedSamplerRange(gl::SAMPLER_VERTEX);
applyDriverConstantsIfNeeded(&mAppliedVertexConstants, vertexConstants, &mSamplerMetadataVS,
samplerMetadataReferencedBytesVS, mDriverConstantBufferVS);
const dx_PixelConstants11 &pixelConstants = mStateManager.getPixelConstants();
- size_t samplerMetadataReferencedBytesPS = sizeof(SamplerMetadataD3D11::dx_SamplerMetadata) *
+ size_t samplerMetadataReferencedBytesPS = sizeof(SamplerMetadataD3D11::dx_SamplerMetadata) *
programD3D.getUsedSamplerRange(gl::SAMPLER_PIXEL);
applyDriverConstantsIfNeeded(&mAppliedPixelConstants, pixelConstants, &mSamplerMetadataPS,
samplerMetadataReferencedBytesPS, mDriverConstantBufferPS);
@@ -2469,7 +2395,7 @@ void Renderer11::SamplerMetadataD3D11::update(unsigned int samplerIndex, const g
case GL_R16I:
case GL_R16UI:
needIntegerTextureMetadata = true;
- internalFormatBits = 16;
+ internalFormatBits = 16;
break;
case GL_RGBA8I:
case GL_RGBA8UI:
@@ -2480,11 +2406,11 @@ void Renderer11::SamplerMetadataD3D11::update(unsigned int samplerIndex, const g
case GL_R8I:
case GL_R8UI:
needIntegerTextureMetadata = true;
- internalFormatBits = 8;
+ internalFormatBits = 8;
break;
case GL_RGB10_A2UI:
needIntegerTextureMetadata = true;
- internalFormatBits = 10;
+ internalFormatBits = 10;
break;
default:
break;
@@ -2538,6 +2464,7 @@ void Renderer11::applyDriverConstantsIfNeeded(TShaderConstants *appliedConstants
HRESULT result =
mDeviceContext->Map(driverConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapping);
ASSERT(SUCCEEDED(result));
+ UNUSED_ASSERTION_VARIABLE(result);
memcpy(mapping.pData, appliedConstants, sizeof(TShaderConstants));
// Previous buffer contents were discarded, so we need to refresh also the area of the
// buffer that isn't used by this program.
@@ -2578,7 +2505,7 @@ void Renderer11::markAllStateDirty()
mStateManager.invalidateEverything();
- mAppliedIB = NULL;
+ mAppliedIB = NULL;
mAppliedIBFormat = DXGI_FORMAT_UNKNOWN;
mAppliedIBOffset = 0;
@@ -2595,16 +2522,16 @@ void Renderer11::markAllStateDirty()
for (unsigned int i = 0; i < gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; i++)
{
- mCurrentConstantBufferVS[i] = static_cast<unsigned int>(-1);
+ mCurrentConstantBufferVS[i] = static_cast<unsigned int>(-1);
mCurrentConstantBufferVSOffset[i] = 0;
- mCurrentConstantBufferVSSize[i] = 0;
- mCurrentConstantBufferPS[i] = static_cast<unsigned int>(-1);
+ mCurrentConstantBufferVSSize[i] = 0;
+ mCurrentConstantBufferPS[i] = static_cast<unsigned int>(-1);
mCurrentConstantBufferPSOffset[i] = 0;
- mCurrentConstantBufferPSSize[i] = 0;
+ mCurrentConstantBufferPSSize[i] = 0;
}
- mCurrentVertexConstantBuffer = NULL;
- mCurrentPixelConstantBuffer = NULL;
+ mCurrentVertexConstantBuffer = NULL;
+ mCurrentPixelConstantBuffer = NULL;
mCurrentGeometryConstantBuffer = NULL;
mCurrentPrimitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED;
@@ -2635,14 +2562,13 @@ bool Renderer11::testDeviceLost()
{
bool isLost = false;
- if (!mDevice)
- {
+ if (!mDevice) {
return true;
}
// GetRemovedReason is used to test if the device is removed
HRESULT result = mDevice->GetDeviceRemovedReason();
- isLost = d3d11::isDeviceLostError(result);
+ isLost = d3d11::isDeviceLostError(result);
if (isLost)
{
@@ -2655,26 +2581,25 @@ bool Renderer11::testDeviceLost()
bool Renderer11::testDeviceResettable()
{
// determine if the device is resettable by creating a dummy device
- PFN_D3D11_CREATE_DEVICE D3D11CreateDevice =
- (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
+ PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
if (D3D11CreateDevice == NULL)
{
return false;
}
- ID3D11Device *dummyDevice;
+ ID3D11Device* dummyDevice;
D3D_FEATURE_LEVEL dummyFeatureLevel;
- ID3D11DeviceContext *dummyContext;
+ ID3D11DeviceContext* dummyContext;
ASSERT(mRequestedDriverType != D3D_DRIVER_TYPE_UNKNOWN);
HRESULT result = D3D11CreateDevice(
NULL, mRequestedDriverType, NULL,
-#if defined(_DEBUG)
+ #if defined(_DEBUG)
D3D11_CREATE_DEVICE_DEBUG,
-#else
+ #else
0,
-#endif
+ #endif
mAvailableFeatureLevels.data(), static_cast<unsigned int>(mAvailableFeatureLevels.size()),
D3D11_SDK_VERSION, &dummyDevice, &dummyFeatureLevel, &dummyContext);
@@ -2763,6 +2688,11 @@ bool Renderer11::resetDevice()
return true;
}
+VendorID Renderer11::getVendorId() const
+{
+ return static_cast<VendorID>(mAdapterDescription.VendorId);
+}
+
SIZE_T Renderer11::getMaxResourceSize() const
{
// This formula comes from http://msdn.microsoft.com/en-us/library/windows/desktop/ff819065%28v=vs.85%29.aspx
@@ -2776,10 +2706,8 @@ std::string Renderer11::getRendererDescription() const
rendererString << mDescription;
rendererString << " Direct3D11";
- rendererString << " vs_" << getMajorShaderModel() << "_" << getMinorShaderModel()
- << getShaderModelSuffix();
- rendererString << " ps_" << getMajorShaderModel() << "_" << getMinorShaderModel()
- << getShaderModelSuffix();
+ rendererString << " vs_" << getMajorShaderModel() << "_" << getMinorShaderModel() << getShaderModelSuffix();
+ rendererString << " ps_" << getMajorShaderModel() << "_" << getMinorShaderModel() << getShaderModelSuffix();
return rendererString.str();
}
@@ -2787,12 +2715,12 @@ std::string Renderer11::getRendererDescription() const
DeviceIdentifier Renderer11::getAdapterIdentifier() const
{
// Don't use the AdapterLuid here, since that doesn't persist across reboot.
- DeviceIdentifier deviceIdentifier = {0};
- deviceIdentifier.VendorId = mAdapterDescription.VendorId;
- deviceIdentifier.DeviceId = mAdapterDescription.DeviceId;
- deviceIdentifier.SubSysId = mAdapterDescription.SubSysId;
- deviceIdentifier.Revision = mAdapterDescription.Revision;
- deviceIdentifier.FeatureLevel = static_cast<UINT>(mRenderer11DeviceCaps.featureLevel);
+ DeviceIdentifier deviceIdentifier = { 0 };
+ deviceIdentifier.VendorId = mAdapterDescription.VendorId;
+ deviceIdentifier.DeviceId = mAdapterDescription.DeviceId;
+ deviceIdentifier.SubSysId = mAdapterDescription.SubSysId;
+ deviceIdentifier.Revision = mAdapterDescription.Revision;
+ deviceIdentifier.FeatureLevel = static_cast<UINT>(mRenderer11DeviceCaps.featureLevel);
return deviceIdentifier;
}
@@ -2865,8 +2793,7 @@ bool Renderer11::getShareHandleSupport() const
return false;
}
- // Also disable share handles on Feature Level 9_3, since it doesn't support share handles on
- // RGBA8 textures/swapchains.
+ // Also disable share handles on Feature Level 9_3, since it doesn't support share handles on RGBA8 textures/swapchains.
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)
{
mSupportsShareHandles = false;
@@ -2929,17 +2856,11 @@ int Renderer11::getMajorShaderModel() const
{
switch (mRenderer11DeviceCaps.featureLevel)
{
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_SHADER_MAJOR_VERSION; // 5
- case D3D_FEATURE_LEVEL_10_1:
- return D3D10_1_SHADER_MAJOR_VERSION; // 4
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SHADER_MAJOR_VERSION; // 4
- case D3D_FEATURE_LEVEL_9_3:
- return D3D10_SHADER_MAJOR_VERSION; // 4
- default:
- UNREACHABLE();
- return 0;
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MAJOR_VERSION; // 5
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MAJOR_VERSION; // 4
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MAJOR_VERSION; // 4
+ case D3D_FEATURE_LEVEL_9_3: return D3D10_SHADER_MAJOR_VERSION; // 4
+ default: UNREACHABLE(); return 0;
}
}
@@ -2947,17 +2868,11 @@ int Renderer11::getMinorShaderModel() const
{
switch (mRenderer11DeviceCaps.featureLevel)
{
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_SHADER_MINOR_VERSION; // 0
- case D3D_FEATURE_LEVEL_10_1:
- return D3D10_1_SHADER_MINOR_VERSION; // 1
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SHADER_MINOR_VERSION; // 0
- case D3D_FEATURE_LEVEL_9_3:
- return D3D10_SHADER_MINOR_VERSION; // 0
- default:
- UNREACHABLE();
- return 0;
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SHADER_MINOR_VERSION; // 0
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SHADER_MINOR_VERSION; // 1
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_SHADER_MINOR_VERSION; // 0
+ case D3D_FEATURE_LEVEL_9_3: return D3D10_SHADER_MINOR_VERSION; // 0
+ default: UNREACHABLE(); return 0;
}
}
@@ -2965,17 +2880,11 @@ std::string Renderer11::getShaderModelSuffix() const
{
switch (mRenderer11DeviceCaps.featureLevel)
{
- case D3D_FEATURE_LEVEL_11_0:
- return "";
- case D3D_FEATURE_LEVEL_10_1:
- return "";
- case D3D_FEATURE_LEVEL_10_0:
- return "";
- case D3D_FEATURE_LEVEL_9_3:
- return "_level_9_3";
- default:
- UNREACHABLE();
- return "";
+ case D3D_FEATURE_LEVEL_11_0: return "";
+ case D3D_FEATURE_LEVEL_10_1: return "";
+ case D3D_FEATURE_LEVEL_10_0: return "";
+ case D3D_FEATURE_LEVEL_9_3: return "_level_9_3";
+ default: UNREACHABLE(); return "";
}
}
@@ -3048,73 +2957,60 @@ gl::Error Renderer11::copyImage2D(const gl::Framebuffer *framebuffer,
ANGLE_TRY(copyImageInternal(framebuffer, sourceRect, destFormat, destOffset, destRenderTarget));
- storage11->markLevelDirty(level);
+ storage11->invalidateSwizzleCacheLevel(level);
return gl::NoError();
}
-gl::Error Renderer11::copyImageCube(const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLenum target,
- GLint level)
+gl::Error Renderer11::copyImageCube(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ const gl::Offset &destOffset, TextureStorage *storage, GLenum target, GLint level)
{
TextureStorage11_Cube *storage11 = GetAs<TextureStorage11_Cube>(storage);
ASSERT(storage11);
- gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
+ gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level);
RenderTargetD3D *destRenderTarget = nullptr;
ANGLE_TRY(storage11->getRenderTarget(index, &destRenderTarget));
ASSERT(destRenderTarget);
ANGLE_TRY(copyImageInternal(framebuffer, sourceRect, destFormat, destOffset, destRenderTarget));
- storage11->markLevelDirty(level);
+ storage11->invalidateSwizzleCacheLevel(level);
return gl::NoError();
}
-gl::Error Renderer11::copyImage3D(const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+gl::Error Renderer11::copyImage3D(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
TextureStorage11_3D *storage11 = GetAs<TextureStorage11_3D>(storage);
ASSERT(storage11);
- gl::ImageIndex index = gl::ImageIndex::Make3D(level, destOffset.z);
+ gl::ImageIndex index = gl::ImageIndex::Make3D(level, destOffset.z);
RenderTargetD3D *destRenderTarget = nullptr;
ANGLE_TRY(storage11->getRenderTarget(index, &destRenderTarget));
ASSERT(destRenderTarget);
ANGLE_TRY(copyImageInternal(framebuffer, sourceRect, destFormat, destOffset, destRenderTarget));
- storage11->markLevelDirty(level);
+ storage11->invalidateSwizzleCacheLevel(level);
return gl::NoError();
}
-gl::Error Renderer11::copyImage2DArray(const gl::Framebuffer *framebuffer,
- const gl::Rectangle &sourceRect,
- GLenum destFormat,
- const gl::Offset &destOffset,
- TextureStorage *storage,
- GLint level)
+gl::Error Renderer11::copyImage2DArray(const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, GLenum destFormat,
+ const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
TextureStorage11_2DArray *storage11 = GetAs<TextureStorage11_2DArray>(storage);
ASSERT(storage11);
- gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z);
+ gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z);
RenderTargetD3D *destRenderTarget = nullptr;
ANGLE_TRY(storage11->getRenderTarget(index, &destRenderTarget));
ASSERT(destRenderTarget);
ANGLE_TRY(copyImageInternal(framebuffer, sourceRect, destFormat, destOffset, destRenderTarget));
- storage11->markLevelDirty(level);
+ storage11->invalidateSwizzleCacheLevel(level);
return gl::NoError();
}
@@ -3204,44 +3100,9 @@ gl::Error Renderer11::copyTexture(const gl::Texture *source,
unpackUnmultiplyAlpha));
}
- destStorage11->markLevelDirty(destLevel);
-
- return gl::NoError();
-}
-
-gl::Error Renderer11::copyCompressedTexture(const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel)
-{
- TextureStorage11_2D *destStorage11 = GetAs<TextureStorage11_2D>(storage);
- ASSERT(destStorage11);
-
- ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(destStorage11->getResource(&destResource));
-
- gl::ImageIndex destIndex = gl::ImageIndex::Make2D(destLevel);
- UINT destSubresource = destStorage11->getSubresourceIndex(destIndex);
-
- TextureD3D *sourceD3D = GetImplAs<TextureD3D>(source);
- ASSERT(sourceD3D);
+ destStorage11->invalidateSwizzleCacheLevel(destLevel);
- TextureStorage *sourceStorage = nullptr;
- ANGLE_TRY(sourceD3D->getNativeTexture(&sourceStorage));
-
- TextureStorage11_2D *sourceStorage11 = GetAs<TextureStorage11_2D>(sourceStorage);
- ASSERT(sourceStorage11);
-
- ID3D11Resource *sourceResource = nullptr;
- ANGLE_TRY(sourceStorage11->getResource(&sourceResource));
-
- gl::ImageIndex sourceIndex = gl::ImageIndex::Make2D(sourceLevel);
- UINT sourceSubresource = sourceStorage11->getSubresourceIndex(sourceIndex);
-
- mDeviceContext->CopySubresourceRegion(destResource, destSubresource, 0, 0, 0, sourceResource,
- sourceSubresource, nullptr);
-
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
UINT64 EstimateSize(D3D11_TEXTURE2D_DESC &desc)
@@ -3253,31 +3114,27 @@ UINT64 EstimateSize(D3D11_TEXTURE2D_DESC &desc)
return total;
}
-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::Format &formatInfo = d3d11::Format::Get(format, mRenderer11DeviceCaps);
const gl::TextureCaps &textureCaps = getNativeTextureCaps().get(format);
- GLuint supportedSamples = textureCaps.getNearestSamples(samples);
+ GLuint supportedSamples = textureCaps.getNearestSamples(samples);
if (width > 0 && height > 0)
{
// Create texture resource
D3D11_TEXTURE2D_DESC desc;
- desc.Width = width;
- desc.Height = height;
- desc.MipLevels = 1;
- desc.ArraySize = 1;
+ desc.Width = width;
+ desc.Height = height;
+ desc.MipLevels = 1;
+ desc.ArraySize = 1;
desc.Format = formatInfo.texFormat;
- desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
+ desc.SampleDesc.Count = (supportedSamples == 0) ? 1 : supportedSamples;
desc.SampleDesc.Quality = 0;
- desc.Usage = D3D11_USAGE_DEFAULT;
- desc.CPUAccessFlags = 0;
- desc.MiscFlags = 0;
+ desc.Usage = D3D11_USAGE_DEFAULT;
+ desc.CPUAccessFlags = 0;
+ desc.MiscFlags = 0;
// If a rendertarget or depthstencil format exists for this texture format,
// we'll flag it to allow binding that way. Shader resource views are a little
@@ -3287,18 +3144,8 @@ gl::Error Renderer11::createRenderTarget(int width,
bindDSV = (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN);
bindSRV = (formatInfo.srvFormat != DXGI_FORMAT_UNKNOWN);
- // D3D feature level 10.0 no longer allows creation of textures with both the bind SRV and
- // DSV flags when multisampled. crbug.com/656989
- bool supportsMultisampledDepthStencilSRVs =
- mRenderer11DeviceCaps.featureLevel > D3D_FEATURE_LEVEL_10_0;
- bool isMultisampledDepthStencil = bindDSV && desc.SampleDesc.Count > 1;
- if (isMultisampledDepthStencil && !supportsMultisampledDepthStencilSRVs)
- {
- bindSRV = false;
- }
-
- desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) |
- (bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) |
+ desc.BindFlags = (bindRTV ? D3D11_BIND_RENDER_TARGET : 0) |
+ (bindDSV ? D3D11_BIND_DEPTH_STENCIL : 0) |
(bindSRV ? D3D11_BIND_SHADER_RESOURCE : 0);
// The format must be either an RTV or a DSV
@@ -3320,8 +3167,7 @@ gl::Error Renderer11::createRenderTarget(int width,
if (FAILED(result))
{
ASSERT(result == E_OUTOFMEMORY);
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create render target texture, result: 0x%X.", result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create render target texture, result: 0x%X.", result);
}
ID3D11ShaderResourceView *srv = nullptr;
@@ -3329,20 +3175,17 @@ gl::Error Renderer11::createRenderTarget(int width,
if (bindSRV)
{
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;
- srvDesc.Format = formatInfo.srvFormat;
- srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D
- : D3D11_SRV_DIMENSION_TEXTURE2DMS;
+ srvDesc.Format = formatInfo.srvFormat;
+ srvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_SRV_DIMENSION_TEXTURE2D : D3D11_SRV_DIMENSION_TEXTURE2DMS;
srvDesc.Texture2D.MostDetailedMip = 0;
- srvDesc.Texture2D.MipLevels = 1;
+ srvDesc.Texture2D.MipLevels = 1;
result = mDevice->CreateShaderResourceView(texture, &srvDesc, &srv);
if (FAILED(result))
{
ASSERT(result == E_OUTOFMEMORY);
SafeRelease(texture);
- return gl::Error(
- GL_OUT_OF_MEMORY,
- "Failed to create render target shader resource view, result: 0x%X.", result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create render target shader resource view, result: 0x%X.", result);
}
if (formatInfo.blitSRVFormat != formatInfo.srvFormat)
@@ -3377,23 +3220,20 @@ gl::Error Renderer11::createRenderTarget(int width,
if (bindDSV)
{
D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
- dsvDesc.Format = formatInfo.dsvFormat;
- dsvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_DSV_DIMENSION_TEXTURE2D
- : D3D11_DSV_DIMENSION_TEXTURE2DMS;
+ dsvDesc.Format = formatInfo.dsvFormat;
+ dsvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_DSV_DIMENSION_TEXTURE2D : D3D11_DSV_DIMENSION_TEXTURE2DMS;
dsvDesc.Texture2D.MipSlice = 0;
- dsvDesc.Flags = 0;
+ dsvDesc.Flags = 0;
ID3D11DepthStencilView *dsv = NULL;
- result = mDevice->CreateDepthStencilView(texture, &dsvDesc, &dsv);
+ result = mDevice->CreateDepthStencilView(texture, &dsvDesc, &dsv);
if (FAILED(result))
{
ASSERT(result == E_OUTOFMEMORY);
SafeRelease(texture);
SafeRelease(srv);
SafeRelease(blitSRV);
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create render target depth stencil view, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create render target depth stencil view, result: 0x%X.", result);
}
*outRT = new TextureRenderTarget11(dsv, texture, srv, format, formatInfo, width, height,
@@ -3404,27 +3244,24 @@ gl::Error Renderer11::createRenderTarget(int width,
else if (bindRTV)
{
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format = formatInfo.rtvFormat;
- rtvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_RTV_DIMENSION_TEXTURE2D
- : D3D11_RTV_DIMENSION_TEXTURE2DMS;
+ rtvDesc.Format = formatInfo.rtvFormat;
+ rtvDesc.ViewDimension = (supportedSamples == 0) ? D3D11_RTV_DIMENSION_TEXTURE2D : D3D11_RTV_DIMENSION_TEXTURE2DMS;
rtvDesc.Texture2D.MipSlice = 0;
ID3D11RenderTargetView *rtv = NULL;
- result = mDevice->CreateRenderTargetView(texture, &rtvDesc, &rtv);
+ result = mDevice->CreateRenderTargetView(texture, &rtvDesc, &rtv);
if (FAILED(result))
{
ASSERT(result == E_OUTOFMEMORY);
SafeRelease(texture);
SafeRelease(srv);
SafeRelease(blitSRV);
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create render target render target view, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create render target render target view, result: 0x%X.", result);
}
if (formatInfo.dataInitializerFunction != NULL)
{
- const float clearValues[4] = {0.0f, 0.0f, 0.0f, 1.0f};
+ const float clearValues[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
mDeviceContext->ClearRenderTargetView(rtv, clearValues);
}
@@ -3457,8 +3294,12 @@ gl::Error Renderer11::createRenderTargetCopy(RenderTargetD3D *source, RenderTarg
ASSERT(source != nullptr);
RenderTargetD3D *newRT = nullptr;
- ANGLE_TRY(createRenderTarget(source->getWidth(), source->getHeight(),
- source->getInternalFormat(), source->getSamples(), &newRT));
+ gl::Error error = createRenderTarget(source->getWidth(), source->getHeight(),
+ source->getInternalFormat(), source->getSamples(), &newRT);
+ if (error.isError())
+ {
+ return error;
+ }
RenderTarget11 *source11 = GetAs<RenderTarget11>(source);
RenderTarget11 *dest11 = GetAs<RenderTarget11>(newRT);
@@ -3479,17 +3320,16 @@ gl::Error Renderer11::loadExecutable(const void *function,
{
switch (type)
{
- case SHADER_VERTEX:
+ case SHADER_VERTEX:
{
- ID3D11VertexShader *vertexShader = NULL;
+ ID3D11VertexShader *vertexShader = NULL;
ID3D11GeometryShader *streamOutShader = NULL;
HRESULT result = mDevice->CreateVertexShader(function, length, NULL, &vertexShader);
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY, "Failed to create vertex shader, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create vertex shader, result: 0x%X.", result);
}
if (!streamOutVaryings.empty())
@@ -3504,8 +3344,8 @@ gl::Error Renderer11::loadExecutable(const void *function,
entry.SemanticName = streamOutVarying.semanticName.c_str();
entry.SemanticIndex = streamOutVarying.semanticIndex;
entry.StartComponent = 0;
- entry.ComponentCount = static_cast<BYTE>(streamOutVarying.componentCount);
- entry.OutputSlot = static_cast<BYTE>(
+ entry.ComponentCount = static_cast<BYTE>(streamOutVarying.componentCount);
+ entry.OutputSlot = static_cast<BYTE>(
(separatedOutputBuffers ? streamOutVarying.outputSlot : 0));
soDeclaration.push_back(entry);
}
@@ -3517,16 +3357,14 @@ gl::Error Renderer11::loadExecutable(const void *function,
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create steam output shader, result: 0x%X.", result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create steam output shader, result: 0x%X.", result);
}
}
- *outExecutable =
- new ShaderExecutable11(function, length, vertexShader, streamOutShader);
+ *outExecutable = new ShaderExecutable11(function, length, vertexShader, streamOutShader);
}
break;
- case SHADER_PIXEL:
+ case SHADER_PIXEL:
{
ID3D11PixelShader *pixelShader = NULL;
@@ -3534,14 +3372,13 @@ gl::Error Renderer11::loadExecutable(const void *function,
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY, "Failed to create pixel shader, result: 0x%X.",
- result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create pixel shader, result: 0x%X.", result);
}
*outExecutable = new ShaderExecutable11(function, length, pixelShader);
}
break;
- case SHADER_GEOMETRY:
+ case SHADER_GEOMETRY:
{
ID3D11GeometryShader *geometryShader = NULL;
@@ -3549,16 +3386,15 @@ gl::Error Renderer11::loadExecutable(const void *function,
ASSERT(SUCCEEDED(result));
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to create geometry shader, result: 0x%X.", result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to create geometry shader, result: 0x%X.", result);
}
*outExecutable = new ShaderExecutable11(function, length, geometryShader);
}
break;
- default:
- UNREACHABLE();
- return gl::Error(GL_INVALID_OPERATION);
+ default:
+ UNREACHABLE();
+ return gl::Error(GL_INVALID_OPERATION);
}
return gl::Error(GL_NO_ERROR);
@@ -3575,22 +3411,21 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog,
const char *profileType = NULL;
switch (type)
{
- case SHADER_VERTEX:
- profileType = "vs";
- break;
- case SHADER_PIXEL:
- profileType = "ps";
- break;
- case SHADER_GEOMETRY:
- profileType = "gs";
- break;
- default:
- UNREACHABLE();
- return gl::Error(GL_INVALID_OPERATION);
+ case SHADER_VERTEX:
+ profileType = "vs";
+ break;
+ case SHADER_PIXEL:
+ profileType = "ps";
+ break;
+ case SHADER_GEOMETRY:
+ profileType = "gs";
+ break;
+ default:
+ UNREACHABLE();
+ return gl::Error(GL_INVALID_OPERATION);
}
- std::string profile = FormatString("%s_%d_%d%s", profileType, getMajorShaderModel(),
- getMinorShaderModel(), getShaderModelSuffix().c_str());
+ std::string profile = FormatString("%s_%d_%d%s", profileType, getMajorShaderModel(), getMinorShaderModel(), getShaderModelSuffix().c_str());
UINT flags = D3DCOMPILE_OPTIMIZATION_LEVEL2;
@@ -3606,12 +3441,11 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog,
if (workarounds.enableIEEEStrictness)
flags |= D3DCOMPILE_IEEE_STRICTNESS;
- // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders
- // when it would otherwise pass with alternative options.
+ // Sometimes D3DCompile will fail with the default compilation flags for complicated shaders when it would otherwise pass with alternative options.
// Try the default flags first and if compilation fails, try some alternatives.
std::vector<CompileConfig> configs;
- configs.push_back(CompileConfig(flags, "default"));
- configs.push_back(CompileConfig(flags | D3DCOMPILE_SKIP_VALIDATION, "skip validation"));
+ configs.push_back(CompileConfig(flags, "default" ));
+ configs.push_back(CompileConfig(flags | D3DCOMPILE_SKIP_VALIDATION, "skip validation" ));
configs.push_back(CompileConfig(flags | D3DCOMPILE_SKIP_OPTIMIZATION, "skip optimization"));
if (getMajorShaderModel() == 4 && getShaderModelSuffix() != "")
@@ -3623,24 +3457,26 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog,
CompileConfig(flags | D3DCOMPILE_AVOID_FLOW_CONTROL, "avoid flow control"));
}
- D3D_SHADER_MACRO loopMacros[] = {{"ANGLE_ENABLE_LOOP_FLATTEN", "1"}, {0, 0}};
+ D3D_SHADER_MACRO loopMacros[] = { {"ANGLE_ENABLE_LOOP_FLATTEN", "1"}, {0, 0} };
ID3DBlob *binary = NULL;
std::string debugInfo;
- ANGLE_TRY(mCompiler.compileToBinary(infoLog, shaderHLSL, profile, configs, loopMacros, &binary,
- &debugInfo));
+ gl::Error error = mCompiler.compileToBinary(infoLog, shaderHLSL, profile, configs, loopMacros, &binary, &debugInfo);
+ if (error.isError())
+ {
+ return error;
+ }
- // It's possible that binary is NULL if the compiler failed in all configurations. Set the
- // executable to NULL and return GL_NO_ERROR to signify that there was a link error but the
- // internal state is still OK.
+ // It's possible that binary is NULL if the compiler failed in all configurations. Set the executable to NULL
+ // and return GL_NO_ERROR to signify that there was a link error but the internal state is still OK.
if (!binary)
{
*outExectuable = NULL;
return gl::Error(GL_NO_ERROR);
}
- gl::Error error = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type,
- streamOutVaryings, separatedOutputBuffers, outExectuable);
+ error = loadExecutable(binary->GetBufferPointer(), binary->GetBufferSize(), type,
+ streamOutVaryings, separatedOutputBuffers, outExectuable);
SafeRelease(binary);
if (error.isError())
@@ -3653,7 +3489,7 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog,
(*outExectuable)->appendDebugInfo(debugInfo);
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
UniformStorageD3D *Renderer11::createUniformStorage(size_t storageSize)
@@ -3705,19 +3541,14 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
}
// We don't support formats which we can't represent without conversion
- if (d3d11FormatInfo.format().glInternalFormat != internalFormat)
+ if (d3d11FormatInfo.format.glInternalFormat != internalFormat)
{
return false;
}
- // Buffer SRV creation for this format was not working on Windows 10.
- if (d3d11FormatInfo.texFormat == DXGI_FORMAT_B5G5R5A1_UNORM)
- {
- return false;
- }
-
- // This format is not supported as a buffer SRV.
- if (d3d11FormatInfo.texFormat == DXGI_FORMAT_A8_UNORM)
+ // Buffer SRV creation in this format was not working on Windows 10, repro at least on Intel
+ // and NVIDIA.
+ if (internalFormat == GL_RGB5_A1)
{
return false;
}
@@ -3725,16 +3556,11 @@ bool Renderer11::supportsFastCopyBufferToTexture(GLenum internalFormat) const
return true;
}
-gl::Error Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack,
- unsigned int offset,
- RenderTargetD3D *destRenderTarget,
- GLenum destinationFormat,
- GLenum sourcePixelsType,
- const gl::Box &destArea)
+gl::Error Renderer11::fastCopyBufferToTexture(const gl::PixelUnpackState &unpack, unsigned int offset, RenderTargetD3D *destRenderTarget,
+ GLenum destinationFormat, GLenum sourcePixelsType, const gl::Box &destArea)
{
ASSERT(supportsFastCopyBufferToTexture(destinationFormat));
- return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat,
- sourcePixelsType, destArea);
+ return mPixelTransfer->copyBufferToTexture(unpack, offset, destRenderTarget, destinationFormat, sourcePixelsType, destArea);
}
ImageD3D *Renderer11::createImage()
@@ -3745,7 +3571,7 @@ ImageD3D *Renderer11::createImage()
gl::Error Renderer11::generateMipmap(ImageD3D *dest, ImageD3D *src)
{
Image11 *dest11 = GetAs<Image11>(dest);
- Image11 *src11 = GetAs<Image11>(src);
+ Image11 *src11 = GetAs<Image11>(src);
return Image11::generateMipmap(dest11, src11, mRenderer11DeviceCaps);
}
@@ -3758,12 +3584,16 @@ gl::Error Renderer11::generateMipmapUsingD3D(TextureStorage *storage,
ASSERT(storage11->supportsNativeMipmapFunction());
ID3D11ShaderResourceView *srv;
- ANGLE_TRY(storage11->getSRVLevels(textureState.getEffectiveBaseLevel(),
- textureState.getEffectiveMaxLevel(), &srv));
+ gl::Error error = storage11->getSRVLevels(textureState.getEffectiveBaseLevel(),
+ textureState.getEffectiveMaxLevel(), &srv);
+ if (error.isError())
+ {
+ return error;
+ }
mDeviceContext->GenerateMips(srv);
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
TextureStorage *Renderer11::createTextureStorage2D(SwapChainD3D *swapChain)
@@ -3785,47 +3615,24 @@ TextureStorage *Renderer11::createTextureStorageExternal(
return new TextureStorage11_External(this, stream, desc);
}
-TextureStorage *Renderer11::createTextureStorage2D(GLenum internalformat,
- bool renderTarget,
- GLsizei width,
- GLsizei height,
- int levels,
- bool hintLevelZeroOnly)
+TextureStorage *Renderer11::createTextureStorage2D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly)
{
- return new TextureStorage11_2D(this, internalformat, renderTarget, width, height, levels,
- hintLevelZeroOnly);
+ return new TextureStorage11_2D(this, internalformat, renderTarget, width, height, levels, hintLevelZeroOnly);
}
-TextureStorage *Renderer11::createTextureStorageCube(GLenum internalformat,
- bool renderTarget,
- int size,
- int levels,
- bool hintLevelZeroOnly)
+TextureStorage *Renderer11::createTextureStorageCube(GLenum internalformat, bool renderTarget, int size, int levels, bool hintLevelZeroOnly)
{
- return new TextureStorage11_Cube(this, internalformat, renderTarget, size, levels,
- hintLevelZeroOnly);
+ return new TextureStorage11_Cube(this, internalformat, renderTarget, size, levels, hintLevelZeroOnly);
}
-TextureStorage *Renderer11::createTextureStorage3D(GLenum internalformat,
- bool renderTarget,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- int levels)
+TextureStorage *Renderer11::createTextureStorage3D(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
{
- return new TextureStorage11_3D(this, internalformat, renderTarget, width, height, depth,
- levels);
+ return new TextureStorage11_3D(this, internalformat, renderTarget, width, height, depth, levels);
}
-TextureStorage *Renderer11::createTextureStorage2DArray(GLenum internalformat,
- bool renderTarget,
- GLsizei width,
- GLsizei height,
- GLsizei depth,
- int levels)
+TextureStorage *Renderer11::createTextureStorage2DArray(GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, GLsizei depth, int levels)
{
- return new TextureStorage11_2DArray(this, internalformat, renderTarget, width, height, depth,
- levels);
+ return new TextureStorage11_2DArray(this, internalformat, renderTarget, width, height, depth, levels);
}
gl::Error Renderer11::readFromAttachment(const gl::FramebufferAttachment &srcAttachment,
@@ -3897,15 +3704,15 @@ gl::Error Renderer11::readFromAttachment(const gl::FramebufferAttachment &srcAtt
D3D11_TEXTURE2D_DESC resolveDesc;
resolveDesc.Width = static_cast<UINT>(texSize.width);
resolveDesc.Height = static_cast<UINT>(texSize.height);
- resolveDesc.MipLevels = 1;
- resolveDesc.ArraySize = 1;
+ resolveDesc.MipLevels = 1;
+ resolveDesc.ArraySize = 1;
resolveDesc.Format = textureHelper.getFormat();
- resolveDesc.SampleDesc.Count = 1;
+ resolveDesc.SampleDesc.Count = 1;
resolveDesc.SampleDesc.Quality = 0;
- resolveDesc.Usage = D3D11_USAGE_DEFAULT;
- resolveDesc.BindFlags = 0;
- resolveDesc.CPUAccessFlags = 0;
- resolveDesc.MiscFlags = 0;
+ resolveDesc.Usage = D3D11_USAGE_DEFAULT;
+ resolveDesc.BindFlags = 0;
+ resolveDesc.CPUAccessFlags = 0;
+ resolveDesc.MiscFlags = 0;
ID3D11Texture2D *resolveTex2D = nullptr;
HRESULT result = mDevice->CreateTexture2D(&resolveDesc, nullptr, &resolveTex2D);
@@ -3977,17 +3784,16 @@ gl::Error Renderer11::packPixels(const TextureHelper11 &textureHelper,
if (FAILED(hr))
{
ASSERT(hr == E_OUTOFMEMORY);
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to map internal texture for reading, result: 0x%X.", hr);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to map internal texture for reading, result: 0x%X.", hr);
}
uint8_t *source = static_cast<uint8_t *>(mapping.pData);
int inputPitch = static_cast<int>(mapping.RowPitch);
const auto &formatInfo = textureHelper.getFormatSet();
- ASSERT(formatInfo.format().glInternalFormat != GL_NONE);
+ ASSERT(formatInfo.format.glInternalFormat != GL_NONE);
- PackPixels(params, formatInfo.format(), inputPitch, source, pixelsOut);
+ PackPixels(params, formatInfo.format, inputPitch, source, pixelsOut);
mDeviceContext->Unmap(readResource, 0);
@@ -4012,27 +3818,23 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
RenderTarget11 *drawRenderTarget11 = GetAs<RenderTarget11>(drawRenderTarget);
if (!drawRenderTarget11)
{
- return gl::Error(
- GL_OUT_OF_MEMORY,
- "Failed to retrieve the internal draw render target from the draw framebuffer.");
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the internal draw render target from the draw framebuffer.");
}
TextureHelper11 drawTexture = TextureHelper11::MakeAndReference(
drawRenderTarget11->getTexture(), drawRenderTarget11->getFormatSet());
- unsigned int drawSubresource = drawRenderTarget11->getSubresourceIndex();
+ unsigned int drawSubresource = drawRenderTarget11->getSubresourceIndex();
ID3D11RenderTargetView *drawRTV = drawRenderTarget11->getRenderTargetView();
ID3D11DepthStencilView *drawDSV = drawRenderTarget11->getDepthStencilView();
RenderTarget11 *readRenderTarget11 = GetAs<RenderTarget11>(readRenderTarget);
if (!readRenderTarget11)
{
- return gl::Error(
- GL_OUT_OF_MEMORY,
- "Failed to retrieve the internal read render target from the read framebuffer.");
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to retrieve the internal read render target from the read framebuffer.");
}
TextureHelper11 readTexture;
- unsigned int readSubresource = 0;
+ unsigned int readSubresource = 0;
ID3D11ShaderResourceView *readSRV = nullptr;
if (readRenderTarget->getSamples() > 1)
@@ -4066,7 +3868,7 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
readTexture = TextureHelper11::MakeAndReference(readRenderTarget11->getTexture(),
readRenderTarget11->getFormatSet());
readSubresource = readRenderTarget11->getSubresourceIndex();
- readSRV = readRenderTarget11->getBlitShaderResourceView();
+ readSRV = readRenderTarget11->getBlitShaderResourceView();
if (readSRV == nullptr)
{
ASSERT(depthBlit || stencilBlit);
@@ -4090,7 +3892,8 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
// by internally scaling the read and draw rectangles.
gl::Rectangle readRect = readRectIn;
gl::Rectangle drawRect = drawRectIn;
- auto readToDrawX = [&drawRectIn, &readRectIn](int readOffset) {
+ auto readToDrawX = [&drawRectIn, &readRectIn](int readOffset)
+ {
double readToDrawScale =
static_cast<double>(drawRectIn.width) / static_cast<double>(readRectIn.width);
return static_cast<int>(round(static_cast<double>(readOffset) * readToDrawScale));
@@ -4106,7 +3909,8 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
drawRect.width -= drawOffset;
}
- auto readToDrawY = [&drawRectIn, &readRectIn](int readOffset) {
+ auto readToDrawY = [&drawRectIn, &readRectIn](int readOffset)
+ {
double readToDrawScale =
static_cast<double>(drawRectIn.height) / static_cast<double>(readRectIn.height);
return static_cast<int>(round(static_cast<double>(readOffset) * readToDrawScale));
@@ -4145,20 +3949,21 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
const auto &destFormatInfo = gl::GetInternalFormatInfo(drawRenderTarget->getInternalFormat());
const auto &srcFormatInfo = gl::GetInternalFormatInfo(readRenderTarget->getInternalFormat());
const auto &formatSet = drawRenderTarget11->getFormatSet();
- const auto &nativeFormat = formatSet.format();
+ const DXGI_FORMAT drawDXGIFormat = colorBlit ? formatSet.rtvFormat : formatSet.dsvFormat;
+ const auto &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(drawDXGIFormat);
// Some blits require masking off emulated texture channels. eg: from RGBA8 to RGB8, we
// emulate RGB8 with RGBA8, so we need to mask off the alpha channel when we copy.
gl::Color<bool> colorMask;
- colorMask.red =
- (srcFormatInfo.redBits > 0) && (destFormatInfo.redBits == 0) && (nativeFormat.redBits > 0);
+ colorMask.red = (srcFormatInfo.redBits > 0) && (destFormatInfo.redBits == 0) &&
+ (dxgiFormatInfo.redBits > 0);
colorMask.green = (srcFormatInfo.greenBits > 0) && (destFormatInfo.greenBits == 0) &&
- (nativeFormat.greenBits > 0);
+ (dxgiFormatInfo.greenBits > 0);
colorMask.blue = (srcFormatInfo.blueBits > 0) && (destFormatInfo.blueBits == 0) &&
- (nativeFormat.blueBits > 0);
+ (dxgiFormatInfo.blueBits > 0);
colorMask.alpha = (srcFormatInfo.alphaBits > 0) && (destFormatInfo.alphaBits == 0) &&
- (nativeFormat.alphaBits > 0);
+ (dxgiFormatInfo.alphaBits > 0);
// We only currently support masking off the alpha channel.
bool colorMaskingNeeded = colorMask.alpha;
@@ -4172,19 +3977,17 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
bool stretchRequired = readRect.width != drawRect.width || readRect.height != drawRect.height;
- bool flipRequired =
- readRect.width < 0 || readRect.height < 0 || drawRect.width < 0 || drawRect.height < 0;
+ bool flipRequired = readRect.width < 0 || readRect.height < 0 || drawRect.width < 0 || drawRect.height < 0;
bool outOfBounds = readRect.x < 0 || readRect.x + readRect.width > readSize.width ||
readRect.y < 0 || readRect.y + readRect.height > readSize.height ||
drawRect.x < 0 || drawRect.x + drawRect.width > drawSize.width ||
drawRect.y < 0 || drawRect.y + drawRect.height > drawSize.height;
- bool partialDSBlit =
- (nativeFormat.depthBits > 0 && depthBlit) != (nativeFormat.stencilBits > 0 && stencilBlit);
+ bool partialDSBlit = (dxgiFormatInfo.depthBits > 0 && depthBlit) != (dxgiFormatInfo.stencilBits > 0 && stencilBlit);
- if (readRenderTarget11->getFormatSet().formatID ==
- drawRenderTarget11->getFormatSet().formatID &&
+ if (readRenderTarget11->getFormatSet().format.id ==
+ drawRenderTarget11->getFormatSet().format.id &&
!stretchRequired && !outOfBounds && !flipRequired && !partialDSBlit &&
!colorMaskingNeeded && (!(depthBlit || stencilBlit) || wholeBufferCopy))
{
@@ -4192,17 +3995,16 @@ gl::Error Renderer11::blitRenderbufferRect(const gl::Rectangle &readRectIn,
UINT dstY = drawRect.y;
D3D11_BOX readBox;
- readBox.left = readRect.x;
- readBox.right = readRect.x + readRect.width;
- readBox.top = readRect.y;
+ readBox.left = readRect.x;
+ readBox.right = readRect.x + readRect.width;
+ readBox.top = readRect.y;
readBox.bottom = readRect.y + readRect.height;
- readBox.front = 0;
- readBox.back = 1;
+ readBox.front = 0;
+ readBox.back = 1;
if (scissorNeeded)
{
- // drawRect is guaranteed to have positive width and height because stretchRequired is
- // false.
+ // drawRect is guaranteed to have positive width and height because stretchRequired is false.
ASSERT(drawRect.width >= 0 || drawRect.height >= 0);
if (drawRect.x < scissor->x)
@@ -4282,7 +4084,7 @@ void Renderer11::onSwap()
// Send histogram updates every half hour
const double kHistogramUpdateInterval = 30 * 60;
- const double currentTime = ANGLEPlatformCurrent()->monotonicallyIncreasingTime();
+ const double currentTime = ANGLEPlatformCurrent()->monotonicallyIncreasingTime();
const double timeSinceLastUpdate = currentTime - mLastHistogramUpdateTime;
if (timeSinceLastUpdate > kHistogramUpdateInterval)
@@ -4363,7 +4165,7 @@ Renderer11::resolveMultisampledTexture(RenderTarget11 *renderTarget, bool depth,
bool Renderer11::getLUID(LUID *adapterLuid) const
{
adapterLuid->HighPart = 0;
- adapterLuid->LowPart = 0;
+ adapterLuid->LowPart = 0;
if (!mDxgiAdapter)
{
@@ -4380,18 +4182,14 @@ bool Renderer11::getLUID(LUID *adapterLuid) const
return true;
}
-VertexConversionType Renderer11::getVertexConversionType(
- gl::VertexFormatType vertexFormatType) const
+VertexConversionType Renderer11::getVertexConversionType(gl::VertexFormatType vertexFormatType) const
{
- return d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel)
- .conversionType;
+ return d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel).conversionType;
}
GLenum Renderer11::getVertexComponentType(gl::VertexFormatType vertexFormatType) const
{
- const auto &format =
- d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel);
- return d3d11::GetComponentType(format.nativeFormat);
+ return d3d11::GetDXGIFormatInfo(d3d11::GetVertexFormatInfo(vertexFormatType, mRenderer11DeviceCaps.featureLevel).nativeFormat).componentType;
}
gl::ErrorOrResult<unsigned int> Renderer11::getVertexSpaceRequired(
@@ -4430,10 +4228,8 @@ gl::ErrorOrResult<unsigned int> Renderer11::getVertexSpaceRequired(
return elementSize * elementCount;
}
-void Renderer11::generateCaps(gl::Caps *outCaps,
- gl::TextureCapsMap *outTextureCaps,
- gl::Extensions *outExtensions,
- gl::Limitations *outLimitations) const
+void Renderer11::generateCaps(gl::Caps *outCaps, gl::TextureCapsMap *outTextureCaps,
+ gl::Extensions *outExtensions, gl::Limitations *outLimitations) const
{
d3d11_gl::GenerateCaps(mDevice, mDeviceContext, mRenderer11DeviceCaps, outCaps, outTextureCaps,
outExtensions, outLimitations);
@@ -4576,7 +4372,7 @@ gl::Error Renderer11::getScratchMemoryBuffer(size_t requestedSize, MemoryBuffer
if (mScratchMemoryBuffer.size() == requestedSize)
{
mScratchMemoryBufferResetCounter = ScratchMemoryBufferLifetime;
- *bufferOut = &mScratchMemoryBuffer;
+ *bufferOut = &mScratchMemoryBuffer;
return gl::NoError();
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
index 576fe3215..2f536bfd8 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h
@@ -123,17 +123,9 @@ class Renderer11 : public RendererD3D
SwapChainD3D *createSwapChain(NativeWindowD3D *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation) override;
- egl::Error getD3DTextureInfo(IUnknown *d3dTexture,
- EGLint *width,
- EGLint *height,
- GLenum *fboFormat) const override;
- egl::Error validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const override;
gl::Error setSamplerState(gl::SamplerType type,
int index,
@@ -170,6 +162,7 @@ class Renderer11 : public RendererD3D
bool testDeviceLost() override;
bool testDeviceResettable() override;
+ VendorID getVendorId() const;
SIZE_T getMaxResourceSize() const;
std::string getRendererDescription() const;
DeviceIdentifier getAdapterIdentifier() const override;
@@ -224,10 +217,6 @@ class Renderer11 : public RendererD3D
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha) override;
- gl::Error copyCompressedTexture(const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) override;
// RenderTarget creation
gl::Error createRenderTarget(int width,
@@ -343,7 +332,7 @@ class Renderer11 : public RendererD3D
bool colorBlit, bool depthBlit, bool stencilBlit);
bool isES3Capable() const;
- const Renderer11DeviceCaps &getRenderer11DeviceCaps() const { return mRenderer11DeviceCaps; };
+ const Renderer11DeviceCaps &getRenderer11DeviceCaps() { return mRenderer11DeviceCaps; };
RendererClass getRendererClass() const override { return RENDERER_D3D11; }
InputLayoutCache *getInputLayoutCache() { return &mInputLayoutCache; }
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
index e20b161ef..4da51afe4 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/ShaderExecutable11.cpp
@@ -85,6 +85,7 @@ UniformStorage11::UniformStorage11(Renderer11 *renderer, size_t initialSize)
constantBufferDescription.StructureByteStride = 0;
HRESULT result = d3d11Device->CreateBuffer(&constantBufferDescription, NULL, &mConstantBuffer);
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
index 0e28c8c18..b8b0e45c4 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
@@ -492,11 +492,16 @@ gl::Error StateManager11::setBlendState(const gl::Framebuffer *framebuffer,
{
if (!mBlendStateIsDirty && sampleMask == mCurSampleMask)
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
ID3D11BlendState *dxBlendState = nullptr;
- ANGLE_TRY(mRenderer->getStateCache().getBlendState(framebuffer, blendState, &dxBlendState));
+ gl::Error error =
+ mRenderer->getStateCache().getBlendState(framebuffer, blendState, &dxBlendState);
+ if (error.isError())
+ {
+ return error;
+ }
ASSERT(dxBlendState != nullptr);
@@ -527,7 +532,7 @@ gl::Error StateManager11::setBlendState(const gl::Framebuffer *framebuffer,
mBlendStateIsDirty = false;
- return gl::NoError();
+ return error;
}
gl::Error StateManager11::setDepthStencilState(const gl::State &glState)
@@ -547,7 +552,7 @@ gl::Error StateManager11::setDepthStencilState(const gl::State &glState)
disableDepth == mCurDisableDepth.value() && mCurDisableStencil.valid() &&
disableStencil == mCurDisableStencil.value())
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
const auto &depthStencilState = glState.getDepthStencilState();
@@ -567,8 +572,12 @@ gl::Error StateManager11::setDepthStencilState(const gl::State &glState)
(depthStencilState.stencilBackMask & maxStencil));
ID3D11DepthStencilState *dxDepthStencilState = NULL;
- ANGLE_TRY(mRenderer->getStateCache().getDepthStencilState(
- depthStencilState, disableDepth, disableStencil, &dxDepthStencilState));
+ gl::Error error = mRenderer->getStateCache().getDepthStencilState(
+ depthStencilState, disableDepth, disableStencil, &dxDepthStencilState);
+ if (error.isError())
+ {
+ return error;
+ }
ASSERT(dxDepthStencilState);
@@ -592,7 +601,7 @@ gl::Error StateManager11::setDepthStencilState(const gl::State &glState)
mDepthStencilStateIsDirty = false;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error StateManager11::setRasterizerState(const gl::RasterizerState &rasterState)
@@ -601,10 +610,11 @@ gl::Error StateManager11::setRasterizerState(const gl::RasterizerState &rasterSt
if (!mRasterizerStateIsDirty && rasterState.pointDrawMode == mCurRasterState.pointDrawMode &&
rasterState.multiSample == mCurRasterState.multiSample)
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
ID3D11RasterizerState *dxRasterState = nullptr;
+ gl::Error error(GL_NO_ERROR);
if (mCurPresentPathFastEnabled)
{
@@ -623,13 +633,18 @@ gl::Error StateManager11::setRasterizerState(const gl::RasterizerState &rasterSt
modifiedRasterState.frontFace = GL_CCW;
}
- ANGLE_TRY(mRenderer->getStateCache().getRasterizerState(
- modifiedRasterState, mCurScissorEnabled, &dxRasterState));
+ error = mRenderer->getStateCache().getRasterizerState(modifiedRasterState,
+ mCurScissorEnabled, &dxRasterState);
}
else
{
- ANGLE_TRY(mRenderer->getStateCache().getRasterizerState(rasterState, mCurScissorEnabled,
- &dxRasterState));
+ error = mRenderer->getStateCache().getRasterizerState(rasterState, mCurScissorEnabled,
+ &dxRasterState);
+ }
+
+ if (error.isError())
+ {
+ return error;
}
mRenderer->getDeviceContext()->RSSetState(dxRasterState);
@@ -637,7 +652,7 @@ gl::Error StateManager11::setRasterizerState(const gl::RasterizerState &rasterSt
mCurRasterState = rasterState;
mRasterizerStateIsDirty = false;
- return gl::NoError();
+ return error;
}
void StateManager11::setScissorRectangle(const gl::Rectangle &scissor, bool enabled)
@@ -852,7 +867,7 @@ gl::Error StateManager11::onMakeCurrent(const gl::ContextState &data)
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void StateManager11::setShaderResource(gl::SamplerType shaderType,
@@ -886,7 +901,7 @@ gl::Error StateManager11::clearTextures(gl::SamplerType samplerType,
{
if (rangeStart == rangeEnd)
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
auto &currentSRVs = (samplerType == gl::SAMPLER_VERTEX ? mCurVertexSRVs : mCurPixelSRVs);
@@ -896,7 +911,7 @@ gl::Error StateManager11::clearTextures(gl::SamplerType samplerType,
if (clearRange.empty())
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
auto deviceContext = mRenderer->getDeviceContext();
@@ -918,7 +933,7 @@ gl::Error StateManager11::clearTextures(gl::SamplerType samplerType,
currentSRVs.update(samplerIndex, nullptr);
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void StateManager11::unsetConflictingSRVs(gl::SamplerType samplerType,
@@ -974,7 +989,11 @@ void StateManager11::deinitialize()
gl::Error StateManager11::syncFramebuffer(gl::Framebuffer *framebuffer)
{
Framebuffer11 *framebuffer11 = GetImplAs<Framebuffer11>(framebuffer);
- ANGLE_TRY(framebuffer11->markAttachmentsDirty());
+ gl::Error error = framebuffer11->invalidateSwizzles();
+ if (error.isError())
+ {
+ return error;
+ }
if (framebuffer11->hasAnyInternalDirtyBit())
{
@@ -984,7 +1003,7 @@ gl::Error StateManager11::syncFramebuffer(gl::Framebuffer *framebuffer)
if (!mRenderTargetIsDirty)
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
mRenderTargetIsDirty = false;
@@ -998,7 +1017,7 @@ gl::Error StateManager11::syncFramebuffer(gl::Framebuffer *framebuffer)
const gl::Extents &size = framebuffer->getFirstColorbuffer()->getSize();
if (size.width == 0 || size.height == 0)
{
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
}
@@ -1082,7 +1101,7 @@ gl::Error StateManager11::syncFramebuffer(gl::Framebuffer *framebuffer)
setViewportBounds(renderTargetWidth, renderTargetHeight);
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error StateManager11::updateCurrentValueAttribs(const gl::State &state,
@@ -1105,11 +1124,15 @@ gl::Error StateManager11::updateCurrentValueAttribs(const gl::State &state,
currentValueAttrib->currentValueType = currentValue.Type;
currentValueAttrib->attribute = &vertexAttributes[attribIndex];
- ANGLE_TRY(vertexDataManager->storeCurrentValue(currentValue, currentValueAttrib,
- static_cast<size_t>(attribIndex)));
+ gl::Error error = vertexDataManager->storeCurrentValue(currentValue, currentValueAttrib,
+ static_cast<size_t>(attribIndex));
+ if (error.isError())
+ {
+ return error;
+ }
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
const std::vector<TranslatedAttribute> &StateManager11::getCurrentValueAttribs() const
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
index a410c425d..b12fd80d2 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp
@@ -45,11 +45,10 @@ bool NeedsOffscreenTexture(Renderer11 *renderer, NativeWindow11 *nativeWindow, E
SwapChain11::SwapChain11(Renderer11 *renderer,
NativeWindow11 *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation)
- : SwapChainD3D(shareHandle, d3dTexture, backBufferFormat, depthBufferFormat),
+ : SwapChainD3D(shareHandle, backBufferFormat, depthBufferFormat),
mRenderer(renderer),
mWidth(-1),
mHeight(-1),
@@ -181,29 +180,43 @@ EGLint SwapChain11::resetOffscreenColorBuffer(int backbufferWidth, int backbuffe
const d3d11::Format &backbufferFormatInfo =
d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps());
- // If the app passed in a share handle or D3D texture, open the resource
- // See EGL_ANGLE_d3d_share_handle_client_buffer and EGL_ANGLE_d3d_texture_client_buffer
- if (mAppCreatedShareHandle || mD3DTexture != nullptr)
+ // If the app passed in a share handle, open the resource
+ // See EGL_ANGLE_d3d_share_handle_client_buffer
+ if (mAppCreatedShareHandle)
{
- if (mAppCreatedShareHandle)
- {
- ID3D11Resource *tempResource11;
- HRESULT result = device->OpenSharedResource(mShareHandle, __uuidof(ID3D11Resource),
- (void **)&tempResource11);
- ASSERT(SUCCEEDED(result));
+ ID3D11Resource *tempResource11;
+ HRESULT result = device->OpenSharedResource(mShareHandle, __uuidof(ID3D11Resource), (void**)&tempResource11);
- mOffscreenTexture = d3d11::DynamicCastComObject<ID3D11Texture2D>(tempResource11);
- SafeRelease(tempResource11);
+ if (FAILED(result))
+ {
+ ERR("Failed to open the swap chain pbuffer share handle: %08lX", result);
+ release();
+ return EGL_BAD_PARAMETER;
}
- else if (mD3DTexture != nullptr)
+
+ result = tempResource11->QueryInterface(__uuidof(ID3D11Texture2D), (void**)&mOffscreenTexture);
+ SafeRelease(tempResource11);
+
+ if (FAILED(result))
{
- mOffscreenTexture = d3d11::DynamicCastComObject<ID3D11Texture2D>(mD3DTexture);
+ ERR("Failed to query texture2d interface in pbuffer share handle: %08lX", result);
+ release();
+ return EGL_BAD_PARAMETER;
}
- else
+
+ // Validate offscreen texture parameters
+ D3D11_TEXTURE2D_DESC offscreenTextureDesc = {0};
+ mOffscreenTexture->GetDesc(&offscreenTextureDesc);
+
+ if (offscreenTextureDesc.Width != (UINT)backbufferWidth ||
+ offscreenTextureDesc.Height != (UINT)backbufferHeight ||
+ offscreenTextureDesc.Format != backbufferFormatInfo.texFormat ||
+ offscreenTextureDesc.MipLevels != 1 || offscreenTextureDesc.ArraySize != 1)
{
- UNREACHABLE();
+ ERR("Invalid texture parameters in the shared offscreen texture pbuffer");
+ release();
+ return EGL_BAD_PARAMETER;
}
- ASSERT(mOffscreenTexture != nullptr);
}
else
{
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h
index 1d7e57b7c..1ea608054 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h
@@ -24,7 +24,6 @@ class SwapChain11 final : public SwapChainD3D
SwapChain11(Renderer11 *renderer,
NativeWindow11 *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
index 36c888dd3..738dae13f 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp
@@ -31,15 +31,15 @@
namespace rx
{
-TextureStorage11::SRVKey::SRVKey(int baseLevel, int mipLevels, bool swizzle, bool dropStencil)
- : baseLevel(baseLevel), mipLevels(mipLevels), swizzle(swizzle), dropStencil(dropStencil)
+TextureStorage11::SRVKey::SRVKey(int baseLevel, int mipLevels, bool swizzle)
+ : baseLevel(baseLevel), mipLevels(mipLevels), swizzle(swizzle)
{
}
bool TextureStorage11::SRVKey::operator<(const SRVKey &rhs) const
{
- return std::tie(baseLevel, mipLevels, swizzle, dropStencil) <
- std::tie(rhs.baseLevel, rhs.mipLevels, rhs.swizzle, rhs.dropStencil);
+ return std::tie(baseLevel, mipLevels, swizzle) <
+ std::tie(rhs.baseLevel, rhs.mipLevels, rhs.swizzle);
}
TextureStorage11::TextureStorage11(Renderer11 *renderer,
@@ -53,7 +53,6 @@ TextureStorage11::TextureStorage11(Renderer11 *renderer,
mTextureWidth(0),
mTextureHeight(0),
mTextureDepth(0),
- mDropStencilTexture(nullptr),
mBindFlags(bindFlags),
mMiscFlags(miscFlags)
{
@@ -74,7 +73,6 @@ TextureStorage11::~TextureStorage11()
SafeRelease(i->second);
}
mSrvCache.clear();
- SafeRelease(mDropStencilTexture);
}
DWORD TextureStorage11::GetTextureBindFlags(GLenum internalFormat,
@@ -110,7 +108,9 @@ DWORD TextureStorage11::GetTextureMiscFlags(GLenum internalFormat,
const d3d11::Format &formatInfo = d3d11::Format::Get(internalFormat, renderer11DeviceCaps);
if (renderTarget && levels > 1)
{
- if (d3d11::SupportsMipGen(formatInfo.texFormat, renderer11DeviceCaps.featureLevel))
+ const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(formatInfo.texFormat);
+
+ if (dxgiFormatInfo.nativeMipmapSupport(renderer11DeviceCaps.featureLevel))
{
miscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;
}
@@ -185,8 +185,8 @@ gl::Error TextureStorage11::getSRV(const gl::TextureState &textureState,
{
// Make sure to add the level offset for our tiny compressed texture workaround
const GLuint effectiveBaseLevel = textureState.getEffectiveBaseLevel();
- bool swizzleRequired = textureState.swizzleRequired();
- bool mipmapping = gl::IsMipmapFiltered(textureState.getSamplerState());
+ bool swizzleRequired = textureState.swizzleRequired();
+ bool mipmapping = gl::IsMipmapFiltered(textureState.getSamplerState());
unsigned int mipLevels =
mipmapping ? (textureState.getEffectiveMaxLevel() - effectiveBaseLevel + 1) : 1;
@@ -203,7 +203,11 @@ gl::Error TextureStorage11::getSRV(const gl::TextureState &textureState,
if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
// We must ensure that the level zero texture is in sync with mipped texture.
- ANGLE_TRY(useLevelZeroWorkaroundTexture(mipLevels == 1));
+ gl::Error error = useLevelZeroWorkaroundTexture(mipLevels == 1);
+ if (error.isError())
+ {
+ return error;
+ }
}
if (swizzleRequired)
@@ -211,22 +215,7 @@ gl::Error TextureStorage11::getSRV(const gl::TextureState &textureState,
verifySwizzleExists(textureState.getSwizzleState());
}
- // We drop the stencil when sampling from the SRV if three conditions hold:
- // 1. the drop stencil workaround is enabled.
- bool workaround = mRenderer->getWorkarounds().emulateTinyStencilTextures;
- // 2. this is a stencil texture.
- bool hasStencil = (mFormatInfo.format().stencilBits > 0);
- // 3. the texture has a 1x1 or 2x2 mip.
- bool hasSmallMips = (getLevelWidth(mMipLevels - 1) <= 2 || getLevelHeight(mMipLevels - 1) <= 2);
-
- bool useDropStencil = (workaround && hasStencil && hasSmallMips);
- if (useDropStencil)
- {
- // Ensure drop texture gets re-created, if SRV is cached.
- ANGLE_TRY(createDropStencilTexture());
- }
-
- SRVKey key(effectiveBaseLevel, mipLevels, swizzleRequired, useDropStencil);
+ SRVKey key(effectiveBaseLevel, mipLevels, swizzleRequired);
ANGLE_TRY(getCachedOrCreateSRV(key, outSRV));
return gl::NoError();
@@ -243,30 +232,17 @@ gl::Error TextureStorage11::getCachedOrCreateSRV(const SRVKey &key,
}
ID3D11Resource *texture = nullptr;
- DXGI_FORMAT format = DXGI_FORMAT_UNKNOWN;
-
if (key.swizzle)
{
- const auto &swizzleFormat =
- mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps());
- ASSERT(!key.dropStencil || swizzleFormat.format().stencilBits == 0);
ANGLE_TRY(getSwizzleTexture(&texture));
- format = swizzleFormat.srvFormat;
- }
- else if (key.dropStencil)
- {
- ASSERT(mDropStencilTexture);
- texture = mDropStencilTexture;
- format = DXGI_FORMAT_R32_FLOAT;
}
else
{
ANGLE_TRY(getResource(&texture));
- format = mFormatInfo.srvFormat;
}
ID3D11ShaderResourceView *srv = nullptr;
-
+ DXGI_FORMAT format = (key.swizzle ? mFormatInfo.swizzle.srvFormat : mFormatInfo.srvFormat);
ANGLE_TRY(createSRV(key.baseLevel, key.mipLevels, format, texture, &srv));
mSrvCache.insert(std::make_pair(key, srv));
@@ -295,17 +271,25 @@ gl::Error TextureStorage11::getSRVLevel(int mipLevel,
else
{
ID3D11Resource *resource = nullptr;
- ANGLE_TRY(getResource(&resource));
+ gl::Error error = getResource(&resource);
+ if (error.isError())
+ {
+ return error;
+ }
DXGI_FORMAT resourceFormat =
blitSRV ? mFormatInfo.blitSRVFormat : mFormatInfo.srvFormat;
- ANGLE_TRY(createSRV(mipLevel, 1, resourceFormat, resource, &levelSRVs[mipLevel]));
+ error = createSRV(mipLevel, 1, resourceFormat, resource, &levelSRVs[mipLevel]);
+ if (error.isError())
+ {
+ return error;
+ }
}
}
*outSRV = levelSRVs[mipLevel];
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11::getSRVLevels(GLint baseLevel,
@@ -326,12 +310,14 @@ gl::Error TextureStorage11::getSRVLevels(GLint baseLevel,
if (mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
// We must ensure that the level zero texture is in sync with mipped texture.
- ANGLE_TRY(useLevelZeroWorkaroundTexture(mipLevels == 1));
+ gl::Error error = useLevelZeroWorkaroundTexture(mipLevels == 1);
+ if (error.isError())
+ {
+ return error;
+ }
}
- // TODO(jmadill): Assert we don't need to drop stencil.
-
- SRVKey key(baseLevel, mipLevels, false, false);
+ SRVKey key(baseLevel, mipLevels, false);
ANGLE_TRY(getCachedOrCreateSRV(key, outSRV));
return gl::NoError();
@@ -351,25 +337,38 @@ gl::Error TextureStorage11::generateSwizzles(const gl::SwizzleState &swizzleTarg
{
// Need to re-render the swizzle for this level
ID3D11ShaderResourceView *sourceSRV = nullptr;
- ANGLE_TRY(getSRVLevel(level, true, &sourceSRV));
+ gl::Error error = getSRVLevel(level, true, &sourceSRV);
+
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11RenderTargetView *destRTV = nullptr;
- ANGLE_TRY(getSwizzleRenderTarget(level, &destRTV));
+ error = getSwizzleRenderTarget(level, &destRTV);
+ if (error.isError())
+ {
+ return error;
+ }
gl::Extents size(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
Blit11 *blitter = mRenderer->getBlitter();
- ANGLE_TRY(blitter->swizzleTexture(sourceSRV, destRTV, size, swizzleTarget));
+ error = blitter->swizzleTexture(sourceSRV, destRTV, size, swizzleTarget);
+ if (error.isError())
+ {
+ return error;
+ }
mSwizzleCache[level] = swizzleTarget;
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
-void TextureStorage11::markLevelDirty(int mipLevel)
+void TextureStorage11::invalidateSwizzleCacheLevel(int mipLevel)
{
if (mipLevel >= 0 && static_cast<unsigned int>(mipLevel) < ArraySize(mSwizzleCache))
{
@@ -377,15 +376,13 @@ void TextureStorage11::markLevelDirty(int mipLevel)
// not a valid swizzle combination
mSwizzleCache[mipLevel] = gl::SwizzleState();
}
-
- SafeRelease(mDropStencilTexture);
}
-void TextureStorage11::markDirty()
+void TextureStorage11::invalidateSwizzleCache()
{
for (unsigned int mipLevel = 0; mipLevel < ArraySize(mSwizzleCache); mipLevel++)
{
- markLevelDirty(mipLevel);
+ invalidateSwizzleCacheLevel(mipLevel);
}
}
@@ -398,7 +395,7 @@ gl::Error TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture,
const GLint level = index.mipIndex;
- markLevelDirty(level);
+ invalidateSwizzleCacheLevel(level);
gl::Extents texSize(getLevelWidth(level), getLevelHeight(level), getLevelDepth(level));
@@ -428,7 +425,7 @@ gl::Error TextureStorage11::updateSubresourceLevel(ID3D11Resource *srcTexture,
if (!fullCopy && mFormatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
{
// CopySubresourceRegion cannot copy partial depth stencils, use the blitter instead
- Blit11 *blitter = mRenderer->getBlitter();
+ Blit11 *blitter = mRenderer->getBlitter();
TextureHelper11 source = TextureHelper11::MakeAndReference(srcTexture, getFormatSet());
TextureHelper11 dest = TextureHelper11::MakeAndReference(dstTexture, getFormatSet());
return blitter->copyDepthStencil(source, sourceSubresource, copyArea, texSize, dest,
@@ -460,16 +457,22 @@ gl::Error TextureStorage11::copySubresourceLevel(ID3D11Resource *dstTexture,
ASSERT(dstTexture);
ID3D11Resource *srcTexture = nullptr;
+ gl::Error error(GL_NO_ERROR);
// If the zero-LOD workaround is active and we want to update a level greater than zero, then we
// should update the mipmapped texture, even if mapmaps are currently disabled.
if (index.mipIndex > 0 && mRenderer->getWorkarounds().zeroMaxLodWorkaround)
{
- ANGLE_TRY(getMippedResource(&srcTexture));
+ error = getMippedResource(&srcTexture);
}
else
{
- ANGLE_TRY(getResource(&srcTexture));
+ error = getResource(&srcTexture);
+ }
+
+ if (error.isError())
+ {
+ return error;
}
ASSERT(srcTexture);
@@ -508,17 +511,25 @@ gl::Error TextureStorage11::generateMipmap(const gl::ImageIndex &sourceIndex,
{
ASSERT(sourceIndex.layerIndex == destIndex.layerIndex);
- markLevelDirty(destIndex.mipIndex);
+ invalidateSwizzleCacheLevel(destIndex.mipIndex);
RenderTargetD3D *source = nullptr;
- ANGLE_TRY(getRenderTarget(sourceIndex, &source));
+ gl::Error error = getRenderTarget(sourceIndex, &source);
+ if (error.isError())
+ {
+ return error;
+ }
RenderTargetD3D *dest = nullptr;
- ANGLE_TRY(getRenderTarget(destIndex, &dest));
+ error = getRenderTarget(destIndex, &dest);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *sourceSRV =
GetAs<RenderTarget11>(source)->getBlitShaderResourceView();
- ID3D11RenderTargetView *destRTV = GetAs<RenderTarget11>(dest)->getRenderTargetView();
+ ID3D11RenderTargetView *destRTV = GetAs<RenderTarget11>(dest)->getRenderTargetView();
gl::Box sourceArea(0, 0, 0, source->getWidth(), source->getHeight(), source->getDepth());
gl::Extents sourceSize(source->getWidth(), source->getHeight(), source->getDepth());
@@ -543,7 +554,7 @@ void TextureStorage11::verifySwizzleExists(const gl::SwizzleState &swizzleState)
void TextureStorage11::clearSRVCache()
{
- markDirty();
+ invalidateSwizzleCache();
auto iter = mSrvCache.begin();
while (iter != mSrvCache.end())
@@ -571,64 +582,72 @@ gl::Error TextureStorage11::copyToStorage(TextureStorage *destStorage)
ASSERT(destStorage);
ID3D11Resource *sourceResouce = nullptr;
- ANGLE_TRY(getResource(&sourceResouce));
+ gl::Error error = getResource(&sourceResouce);
+ if (error.isError())
+ {
+ return error;
+ }
TextureStorage11 *dest11 = GetAs<TextureStorage11>(destStorage);
ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
immediateContext->CopyResource(destResource, sourceResouce);
- dest11->markDirty();
+ dest11->invalidateSwizzleCache();
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
ImageD3D *image,
const gl::Box *destBox,
- GLenum inputType,
+ GLenum type,
const gl::PixelUnpackState &unpack,
const uint8_t *pixelData)
{
ASSERT(!image->isDirty());
- markLevelDirty(index.mipIndex);
-
ID3D11Resource *resource = nullptr;
ANGLE_TRY(getResource(&resource));
ASSERT(resource);
UINT destSubresource = getSubresourceIndex(index);
- const auto sizedInputFormat = image->getSizedInputFormat(inputType);
- const gl::InternalFormat &inputFormat = gl::GetInternalFormatInfo(sizedInputFormat);
+ const gl::InternalFormat &internalFormatInfo =
+ gl::GetInternalFormatInfo(image->getInternalFormat());
gl::Box levelBox(0, 0, 0, getLevelWidth(index.mipIndex), getLevelHeight(index.mipIndex),
getLevelDepth(index.mipIndex));
bool fullUpdate = (destBox == nullptr || *destBox == levelBox);
- ASSERT(inputFormat.depthBits == 0 || fullUpdate);
+ ASSERT(internalFormatInfo.depthBits == 0 || fullUpdate);
// TODO(jmadill): Handle compressed formats
// Compressed formats have different load syntax, so we'll have to handle them with slightly
// different logic. Will implemnent this in a follow-up patch, and ensure we do not use SetData
// with compressed formats in the calling logic.
- ASSERT(!inputFormat.compressed);
+ ASSERT(!internalFormatInfo.compressed);
- const int width = destBox ? destBox->width : static_cast<int>(image->getWidth());
- const int height = destBox ? destBox->height : static_cast<int>(image->getHeight());
- const int depth = destBox ? destBox->depth : static_cast<int>(image->getDepth());
+ const int width = destBox ? destBox->width : static_cast<int>(image->getWidth());
+ const int height = destBox ? destBox->height : static_cast<int>(image->getHeight());
+ const int depth = destBox ? destBox->depth : static_cast<int>(image->getDepth());
GLuint srcRowPitch = 0;
ANGLE_TRY_RESULT(
- inputFormat.computeRowPitch(width, unpack.alignment, unpack.rowLength),
+ internalFormatInfo.computeRowPitch(type, width, unpack.alignment, unpack.rowLength),
srcRowPitch);
GLuint srcDepthPitch = 0;
- ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(height, unpack.imageHeight, srcRowPitch),
+ ANGLE_TRY_RESULT(internalFormatInfo.computeDepthPitch(type, width, height, unpack.alignment,
+ unpack.rowLength, unpack.imageHeight),
srcDepthPitch);
GLuint srcSkipBytes = 0;
ANGLE_TRY_RESULT(
- inputFormat.computeSkipBytes(srcRowPitch, srcDepthPitch, unpack, index.is3D()),
+ internalFormatInfo.computeSkipBytes(srcRowPitch, srcDepthPitch, unpack.skipImages,
+ unpack.skipRows, unpack.skipPixels, index.is3D()),
srcSkipBytes);
const d3d11::Format &d3d11Format =
@@ -645,7 +664,7 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
MemoryBuffer *conversionBuffer = nullptr;
const uint8_t *data = nullptr;
- LoadImageFunctionInfo loadFunctionInfo = d3d11Format.getLoadFunctions()(inputType);
+ LoadImageFunctionInfo loadFunctionInfo = d3d11Format.loadFunctions(type);
if (loadFunctionInfo.requiresConversion)
{
ANGLE_TRY(mRenderer->getScratchMemoryBuffer(neededSize, &conversionBuffer));
@@ -687,12 +706,6 @@ gl::Error TextureStorage11::setData(const gl::ImageIndex &index,
return gl::NoError();
}
-gl::Error TextureStorage11::createDropStencilTexture()
-{
- UNIMPLEMENTED();
- return gl::Error(GL_INVALID_OPERATION, "Drop stencil texture not implemented.");
-}
-
TextureStorage11_2D::TextureStorage11_2D(Renderer11 *renderer, SwapChain11 *swapchain)
: TextureStorage11(renderer,
D3D11_BIND_RENDER_TARGET | D3D11_BIND_SHADER_RESOURCE,
@@ -778,7 +791,6 @@ TextureStorage11_2D::~TextureStorage11_2D()
if (error.isError())
{
// TODO: Find a way to report this back to the context
- ERR("Error initialization texture storage: %x", error.getCode());
}
}
}
@@ -817,37 +829,63 @@ gl::Error TextureStorage11_2D::copyToStorage(TextureStorage *destStorage)
// corresponding textures in destStorage.
if (mTexture)
{
- ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(false));
+ gl::Error error = dest11->useLevelZeroWorkaroundTexture(false);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
immediateContext->CopyResource(destResource, mTexture);
}
if (mLevelZeroTexture)
{
- ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(true));
+ gl::Error error = dest11->useLevelZeroWorkaroundTexture(true);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
immediateContext->CopyResource(destResource, mLevelZeroTexture);
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
+ else
+ {
+ ID3D11Resource *sourceResouce = nullptr;
+ gl::Error error = getResource(&sourceResouce);
+ if (error.isError())
+ {
+ return error;
+ }
- ID3D11Resource *sourceResouce = nullptr;
- ANGLE_TRY(getResource(&sourceResouce));
-
- ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ ID3D11Resource *destResource = nullptr;
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
- immediateContext->CopyResource(destResource, sourceResouce);
- dest11->markDirty();
+ immediateContext->CopyResource(destResource, sourceResouce);
+ dest11->invalidateSwizzleCache();
+ }
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(bool useLevelZeroTexture)
@@ -858,7 +896,11 @@ gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(bool useLevelZeroTe
{
if (!mUseLevelZeroTexture && mTexture)
{
- ANGLE_TRY(ensureTextureExists(1));
+ gl::Error error = ensureTextureExists(1);
+ if (error.isError())
+ {
+ return error;
+ }
// Pull data back from the mipped texture if necessary.
ASSERT(mLevelZeroTexture);
@@ -872,7 +914,11 @@ gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(bool useLevelZeroTe
{
if (mUseLevelZeroTexture && mLevelZeroTexture)
{
- ANGLE_TRY(ensureTextureExists(mMipLevels));
+ gl::Error error = ensureTextureExists(mMipLevels);
+ if (error.isError())
+ {
+ return error;
+ }
// Pull data back from the level zero texture if necessary.
ASSERT(mTexture);
@@ -899,7 +945,7 @@ gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(bool useLevelZeroTe
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureStorage11_2D::associateImage(Image11 *image, const gl::ImageIndex &index)
@@ -972,28 +1018,42 @@ gl::Error TextureStorage11_2D::releaseAssociatedImage(const gl::ImageIndex &inde
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
- ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage());
+ gl::Error error = mAssociatedImages[level]->recoverFromAssociatedStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_2D::getResource(ID3D11Resource **outResource)
{
if (mUseLevelZeroTexture && mMipLevels > 1)
{
- ANGLE_TRY(ensureTextureExists(1));
+ gl::Error error = ensureTextureExists(1);
+ if (error.isError())
+ {
+ return error;
+ }
*outResource = mLevelZeroTexture;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
+ else
+ {
+ gl::Error error = ensureTextureExists(mMipLevels);
+ if (error.isError())
+ {
+ return error;
+ }
- ANGLE_TRY(ensureTextureExists(mMipLevels));
-
- *outResource = mTexture;
- return gl::NoError();
+ *outResource = mTexture;
+ return gl::Error(GL_NO_ERROR);
+ }
}
gl::Error TextureStorage11_2D::getMippedResource(ID3D11Resource **outResource)
@@ -1001,10 +1061,14 @@ gl::Error TextureStorage11_2D::getMippedResource(ID3D11Resource **outResource)
// This shouldn't be called unless the zero max LOD workaround is active.
ASSERT(mRenderer->getWorkarounds().zeroMaxLodWorkaround);
- ANGLE_TRY(ensureTextureExists(mMipLevels));
+ gl::Error error = ensureTextureExists(mMipLevels);
+ if (error.isError())
+ {
+ return error;
+ }
*outResource = mTexture;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_2D::ensureTextureExists(int mipLevels)
@@ -1078,17 +1142,29 @@ gl::Error TextureStorage11_2D::getRenderTarget(const gl::ImageIndex &index, Rend
if (mRenderTarget[level])
{
*outRT = mRenderTarget[level];
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
ID3D11Resource *texture = nullptr;
- ANGLE_TRY(getResource(&texture));
+ gl::Error error = getResource(&texture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *srv = nullptr;
- ANGLE_TRY(getSRVLevel(level, false, &srv));
+ error = getSRVLevel(level, false, &srv);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *blitSRV = nullptr;
- ANGLE_TRY(getSRVLevel(level, true, &blitSRV));
+ error = getSRVLevel(level, true, &blitSRV);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
@@ -1122,7 +1198,7 @@ gl::Error TextureStorage11_2D::getRenderTarget(const gl::ImageIndex &index, Rend
}
*outRT = mLevelZeroRenderTarget;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
if (mFormatInfo.rtvFormat != DXGI_FORMAT_UNKNOWN)
@@ -1183,7 +1259,7 @@ gl::Error TextureStorage11_2D::getRenderTarget(const gl::ImageIndex &index, Rend
SafeRelease(dsv);
*outRT = mRenderTarget[level];
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_2D::createSRV(int baseLevel,
@@ -1251,7 +1327,7 @@ gl::Error TextureStorage11_2D::getSwizzleTexture(ID3D11Resource **outTexture)
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = 1;
- desc.Format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).texFormat;
+ desc.Format = mFormatInfo.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
@@ -1283,13 +1359,16 @@ gl::Error TextureStorage11_2D::getSwizzleRenderTarget(int mipLevel, ID3D11Render
if (!mSwizzleRenderTargets[mipLevel])
{
ID3D11Resource *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&swizzleTexture));
+ gl::Error error = getSwizzleTexture(&swizzleTexture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format =
- mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.Format = mFormatInfo.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
@@ -1306,41 +1385,7 @@ gl::Error TextureStorage11_2D::getSwizzleRenderTarget(int mipLevel, ID3D11Render
}
*outRTV = mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2D::createDropStencilTexture()
-{
- if (mDropStencilTexture)
- {
- return gl::NoError();
- }
-
- D3D11_TEXTURE2D_DESC dropDesc = {};
- dropDesc.ArraySize = 1;
- dropDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_DEPTH_STENCIL;
- dropDesc.CPUAccessFlags = 0;
- dropDesc.Format = DXGI_FORMAT_R32_TYPELESS;
- dropDesc.Height = mTextureHeight;
- dropDesc.MipLevels = mMipLevels;
- dropDesc.MiscFlags = 0;
- dropDesc.SampleDesc.Count = 1;
- dropDesc.SampleDesc.Quality = 0;
- dropDesc.Usage = D3D11_USAGE_DEFAULT;
- dropDesc.Width = mTextureWidth;
-
- ID3D11Device *device = mRenderer->getDevice();
-
- HRESULT hr = device->CreateTexture2D(&dropDesc, nullptr, &mDropStencilTexture);
- if (FAILED(hr))
- {
- return gl::Error(GL_INVALID_OPERATION, "Error creating drop stencil texture.");
- }
- d3d11::SetDebugName(mDropStencilTexture, "TexStorage2D.DropStencil");
-
- ANGLE_TRY(initDropStencilTexture(gl::ImageIndexIterator::Make2D(0, mMipLevels)));
-
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
TextureStorage11_External::TextureStorage11_External(
@@ -1352,15 +1397,15 @@ TextureStorage11_External::TextureStorage11_External(
ASSERT(stream->getProducerType() == egl::Stream::ProducerType::D3D11TextureNV12);
StreamProducerNV12 *producer = static_cast<StreamProducerNV12 *>(stream->getImplementation());
mTexture = producer->getD3DTexture();
- mSubresourceIndex = producer->getArraySlice();
+ mSubresourceIndex = producer->getArraySlice();
mTexture->AddRef();
mMipLevels = 1;
D3D11_TEXTURE2D_DESC desc;
mTexture->GetDesc(&desc);
- mTextureWidth = desc.Width;
- mTextureHeight = desc.Height;
- mTextureDepth = 1;
+ mTextureWidth = desc.Width;
+ mTextureHeight = desc.Height;
+ mTextureDepth = 1;
mHasKeyedMutex = (desc.MiscFlags & D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX) != 0;
}
@@ -1504,10 +1549,10 @@ TextureStorage11_EGLImage::TextureStorage11_EGLImage(Renderer11 *renderer,
{
mCurrentRenderTarget = reinterpret_cast<uintptr_t>(renderTarget11);
- mMipLevels = 1;
- mTextureWidth = renderTarget11->getWidth();
- mTextureHeight = renderTarget11->getHeight();
- mTextureDepth = 1;
+ mMipLevels = 1;
+ mTextureWidth = renderTarget11->getWidth();
+ mTextureHeight = renderTarget11->getHeight();
+ mTextureDepth = 1;
}
TextureStorage11_EGLImage::~TextureStorage11_EGLImage()
@@ -1549,8 +1594,13 @@ gl::Error TextureStorage11_EGLImage::getRenderTarget(const gl::ImageIndex &index
{
ASSERT(!index.hasLayer());
ASSERT(index.mipIndex == 0);
+ UNUSED_ASSERTION_VARIABLE(index);
- ANGLE_TRY(checkForUpdatedRenderTarget());
+ gl::Error error = checkForUpdatedRenderTarget();
+ if (error.isError())
+ {
+ return error;
+ }
return mImage->getRenderTarget(outRT);
}
@@ -1558,19 +1608,27 @@ gl::Error TextureStorage11_EGLImage::getRenderTarget(const gl::ImageIndex &index
gl::Error TextureStorage11_EGLImage::copyToStorage(TextureStorage *destStorage)
{
ID3D11Resource *sourceResouce = nullptr;
- ANGLE_TRY(getResource(&sourceResouce));
+ gl::Error error = getResource(&sourceResouce);
+ if (error.isError())
+ {
+ return error;
+ }
ASSERT(destStorage);
TextureStorage11_2D *dest11 = GetAs<TextureStorage11_2D>(destStorage);
ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
immediateContext->CopyResource(destResource, sourceResouce);
- dest11->markDirty();
+ dest11->invalidateSwizzleCache();
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureStorage11_EGLImage::associateImage(Image11 *, const gl::ImageIndex &)
@@ -1610,7 +1668,7 @@ gl::Error TextureStorage11_EGLImage::getSwizzleTexture(ID3D11Resource **outTextu
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = 1;
- desc.Format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).texFormat;
+ desc.Format = mFormatInfo.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
@@ -1643,13 +1701,16 @@ gl::Error TextureStorage11_EGLImage::getSwizzleRenderTarget(int mipLevel,
if (!mSwizzleRenderTargets[mipLevel])
{
ID3D11Resource *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&swizzleTexture));
+ gl::Error error = getSwizzleTexture(&swizzleTexture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format =
- mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.Format = mFormatInfo.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtvDesc.Texture2D.MipSlice = mTopLevel + mipLevel;
@@ -1666,7 +1727,7 @@ gl::Error TextureStorage11_EGLImage::getSwizzleRenderTarget(int mipLevel,
}
*outRTV = mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_EGLImage::checkForUpdatedRenderTarget()
@@ -1719,7 +1780,11 @@ gl::Error TextureStorage11_EGLImage::createSRV(int baseLevel,
else
{
RenderTarget11 *renderTarget = nullptr;
- ANGLE_TRY(getImageRenderTarget(&renderTarget));
+ gl::Error error = getImageRenderTarget(&renderTarget);
+ if (error.isError())
+ {
+ return error;
+ }
ASSERT(texture == renderTarget->getTexture());
@@ -1860,20 +1925,36 @@ gl::Error TextureStorage11_Cube::copyToStorage(TextureStorage *destStorage)
// corresponding textures in destStorage.
if (mTexture)
{
- ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(false));
+ gl::Error error = dest11->useLevelZeroWorkaroundTexture(false);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
immediateContext->CopyResource(destResource, mTexture);
}
if (mLevelZeroTexture)
{
- ANGLE_TRY(dest11->useLevelZeroWorkaroundTexture(true));
+ gl::Error error = dest11->useLevelZeroWorkaroundTexture(true);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
immediateContext->CopyResource(destResource, mLevelZeroTexture);
}
@@ -1881,18 +1962,26 @@ gl::Error TextureStorage11_Cube::copyToStorage(TextureStorage *destStorage)
else
{
ID3D11Resource *sourceResouce = nullptr;
- ANGLE_TRY(getResource(&sourceResouce));
+ gl::Error error = getResource(&sourceResouce);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Resource *destResource = nullptr;
- ANGLE_TRY(dest11->getResource(&destResource));
+ error = dest11->getResource(&destResource);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11DeviceContext *immediateContext = mRenderer->getDeviceContext();
immediateContext->CopyResource(destResource, sourceResouce);
}
- dest11->markDirty();
+ dest11->invalidateSwizzleCache();
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_Cube::useLevelZeroWorkaroundTexture(bool useLevelZeroTexture)
@@ -1901,7 +1990,11 @@ gl::Error TextureStorage11_Cube::useLevelZeroWorkaroundTexture(bool useLevelZero
{
if (!mUseLevelZeroTexture && mTexture)
{
- ANGLE_TRY(ensureTextureExists(1));
+ gl::Error error = ensureTextureExists(1);
+ if (error.isError())
+ {
+ return error;
+ }
// Pull data back from the mipped texture if necessary.
ASSERT(mLevelZeroTexture);
@@ -1920,7 +2013,11 @@ gl::Error TextureStorage11_Cube::useLevelZeroWorkaroundTexture(bool useLevelZero
{
if (mUseLevelZeroTexture && mLevelZeroTexture)
{
- ANGLE_TRY(ensureTextureExists(mMipLevels));
+ gl::Error error = ensureTextureExists(mMipLevels);
+ if (error.isError())
+ {
+ return error;
+ }
// Pull data back from the level zero texture if necessary.
ASSERT(mTexture);
@@ -1936,7 +2033,7 @@ gl::Error TextureStorage11_Cube::useLevelZeroWorkaroundTexture(bool useLevelZero
mUseLevelZeroTexture = false;
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
void TextureStorage11_Cube::associateImage(Image11 *image, const gl::ImageIndex &index)
@@ -2029,29 +2126,43 @@ gl::Error TextureStorage11_Cube::releaseAssociatedImage(const gl::ImageIndex &in
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
- ANGLE_TRY(
- mAssociatedImages[layerTarget][level]->recoverFromAssociatedStorage());
+ gl::Error error =
+ mAssociatedImages[layerTarget][level]->recoverFromAssociatedStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_Cube::getResource(ID3D11Resource **outResource)
{
if (mUseLevelZeroTexture && mMipLevels > 1)
{
- ANGLE_TRY(ensureTextureExists(1));
+ gl::Error error = ensureTextureExists(1);
+ if (error.isError())
+ {
+ return error;
+ }
+
*outResource = mLevelZeroTexture;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
else
{
- ANGLE_TRY(ensureTextureExists(mMipLevels));
+ gl::Error error = ensureTextureExists(mMipLevels);
+ if (error.isError())
+ {
+ return error;
+ }
+
*outResource = mTexture;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
}
@@ -2060,9 +2171,14 @@ gl::Error TextureStorage11_Cube::getMippedResource(ID3D11Resource **outResource)
// This shouldn't be called unless the zero max LOD workaround is active.
ASSERT(mRenderer->getWorkarounds().zeroMaxLodWorkaround);
- ANGLE_TRY(ensureTextureExists(mMipLevels));
+ gl::Error error = ensureTextureExists(mMipLevels);
+ if (error.isError())
+ {
+ return error;
+ }
+
*outResource = mTexture;
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_Cube::ensureTextureExists(int mipLevels)
@@ -2113,7 +2229,7 @@ gl::Error TextureStorage11_Cube::ensureTextureExists(int mipLevels)
d3d11::SetDebugName(*outputTexture, "TexStorageCube.Texture");
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_Cube::createRenderTargetSRV(ID3D11Resource *texture,
@@ -2167,7 +2283,11 @@ gl::Error TextureStorage11_Cube::getRenderTarget(const gl::ImageIndex &index,
HRESULT result;
ID3D11Resource *texture = nullptr;
- ANGLE_TRY(getResource(&texture));
+ gl::Error error = getResource(&texture);
+ if (error.isError())
+ {
+ return error;
+ }
if (mUseLevelZeroTexture)
{
@@ -2206,12 +2326,15 @@ gl::Error TextureStorage11_Cube::getRenderTarget(const gl::ImageIndex &index,
}
ID3D11ShaderResourceView *srv = nullptr;
- ANGLE_TRY(createRenderTargetSRV(texture, index, mFormatInfo.srvFormat, &srv));
+ error = createRenderTargetSRV(texture, index, mFormatInfo.srvFormat, &srv);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *blitSRV = nullptr;
if (mFormatInfo.blitSRVFormat != mFormatInfo.srvFormat)
{
- gl::Error error =
- createRenderTargetSRV(texture, index, mFormatInfo.blitSRVFormat, &blitSRV);
+ error = createRenderTargetSRV(texture, index, mFormatInfo.blitSRVFormat, &blitSRV);
if (error.isError())
{
SafeRelease(srv);
@@ -2319,8 +2442,8 @@ gl::Error TextureStorage11_Cube::createSRV(int baseLevel,
// Unnormalized integer cube maps are not supported by DX11; we emulate them as an array of six
// 2D textures
- const GLenum componentType = d3d11::GetComponentType(format);
- if (componentType == GL_INT || componentType == GL_UNSIGNED_INT)
+ const d3d11::DXGIFormat &dxgiFormatInfo = d3d11::GetDXGIFormatInfo(format);
+ if (dxgiFormatInfo.componentType == GL_INT || dxgiFormatInfo.componentType == GL_UNSIGNED_INT)
{
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY;
srvDesc.Texture2DArray.MostDetailedMip = mTopLevel + baseLevel;
@@ -2386,7 +2509,7 @@ gl::Error TextureStorage11_Cube::getSwizzleTexture(ID3D11Resource **outTexture)
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = CUBE_FACE_COUNT;
- desc.Format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).texFormat;
+ desc.Format = mFormatInfo.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
@@ -2419,13 +2542,16 @@ gl::Error TextureStorage11_Cube::getSwizzleRenderTarget(int mipLevel,
if (!mSwizzleRenderTargets[mipLevel])
{
ID3D11Resource *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&swizzleTexture));
+ gl::Error error = getSwizzleTexture(&swizzleTexture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format =
- mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.Format = mFormatInfo.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture2DArray.FirstArraySlice = 0;
@@ -2444,67 +2570,7 @@ gl::Error TextureStorage11_Cube::getSwizzleRenderTarget(int mipLevel,
}
*outRTV = mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-gl::Error TextureStorage11::initDropStencilTexture(const gl::ImageIndexIterator &it)
-{
- ID3D11Resource *resource = nullptr;
- ANGLE_TRY(getResource(&resource));
- TextureHelper11 sourceTexture = TextureHelper11::MakeAndReference(resource, mFormatInfo);
- TextureHelper11 destTexture = TextureHelper11::MakeAndReference(
- mDropStencilTexture,
- d3d11::Format::Get(GL_DEPTH_COMPONENT32F, mRenderer->getRenderer11DeviceCaps()));
-
- gl::ImageIndexIterator itCopy = it;
-
- while (itCopy.hasNext())
- {
- gl::ImageIndex index = itCopy.next();
- gl::Box wholeArea(0, 0, 0, getLevelWidth(index.mipIndex), getLevelHeight(index.mipIndex),
- 1);
- gl::Extents wholeSize(wholeArea.width, wholeArea.height, 1);
- UINT subresource = getSubresourceIndex(index);
- ANGLE_TRY(mRenderer->getBlitter()->copyDepthStencil(sourceTexture, subresource, wholeArea,
- wholeSize, destTexture, subresource,
- wholeArea, wholeSize, nullptr));
- }
-
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_Cube::createDropStencilTexture()
-{
- if (mDropStencilTexture)
- {
- return gl::NoError();
- }
-
- D3D11_TEXTURE2D_DESC dropDesc = {};
- dropDesc.ArraySize = 6;
- dropDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_DEPTH_STENCIL;
- dropDesc.CPUAccessFlags = 0;
- dropDesc.Format = DXGI_FORMAT_R32_TYPELESS;
- dropDesc.Height = mTextureHeight;
- dropDesc.MipLevels = mMipLevels;
- dropDesc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
- dropDesc.SampleDesc.Count = 1;
- dropDesc.SampleDesc.Quality = 0;
- dropDesc.Usage = D3D11_USAGE_DEFAULT;
- dropDesc.Width = mTextureWidth;
-
- ID3D11Device *device = mRenderer->getDevice();
-
- HRESULT hr = device->CreateTexture2D(&dropDesc, nullptr, &mDropStencilTexture);
- if (FAILED(hr))
- {
- return gl::Error(GL_INVALID_OPERATION, "Error creating drop stencil texture.");
- }
- d3d11::SetDebugName(mDropStencilTexture, "TexStorageCube.DropStencil");
-
- ANGLE_TRY(initDropStencilTexture(gl::ImageIndexIterator::MakeCube(0, mMipLevels)));
-
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
TextureStorage11_3D::TextureStorage11_3D(Renderer11 *renderer,
@@ -2647,12 +2713,16 @@ gl::Error TextureStorage11_3D::releaseAssociatedImage(const gl::ImageIndex &inde
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
- ANGLE_TRY(mAssociatedImages[level]->recoverFromAssociatedStorage());
+ gl::Error error = mAssociatedImages[level]->recoverFromAssociatedStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_3D::getResource(ID3D11Resource **outResource)
@@ -2740,13 +2810,25 @@ gl::Error TextureStorage11_3D::getRenderTarget(const gl::ImageIndex &index, Rend
if (!mLevelRenderTargets[mipLevel])
{
ID3D11Resource *texture = nullptr;
- ANGLE_TRY(getResource(&texture));
+ gl::Error error = getResource(&texture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *srv = nullptr;
- ANGLE_TRY(getSRVLevel(mipLevel, false, &srv));
+ error = getSRVLevel(mipLevel, false, &srv);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *blitSRV = nullptr;
- ANGLE_TRY(getSRVLevel(mipLevel, true, &blitSRV));
+ error = getSRVLevel(mipLevel, true, &blitSRV);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
@@ -2796,10 +2878,14 @@ gl::Error TextureStorage11_3D::getRenderTarget(const gl::ImageIndex &index, Rend
HRESULT result;
ID3D11Resource *texture = nullptr;
- ANGLE_TRY(getResource(&texture));
+ gl::Error error = getResource(&texture);
+ if (error.isError())
+ {
+ return error;
+ }
// TODO, what kind of SRV is expected here?
- ID3D11ShaderResourceView *srv = nullptr;
+ ID3D11ShaderResourceView *srv = nullptr;
ID3D11ShaderResourceView *blitSRV = nullptr;
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
@@ -2836,7 +2922,7 @@ gl::Error TextureStorage11_3D::getRenderTarget(const gl::ImageIndex &index, Rend
ASSERT(outRT);
*outRT = mLevelLayerRenderTargets[key];
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
}
@@ -2853,7 +2939,7 @@ gl::Error TextureStorage11_3D::getSwizzleTexture(ID3D11Resource **outTexture)
desc.Height = mTextureHeight;
desc.Depth = mTextureDepth;
desc.MipLevels = mMipLevels;
- desc.Format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).texFormat;
+ desc.Format = mFormatInfo.swizzle.texFormat;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
desc.CPUAccessFlags = 0;
@@ -2883,13 +2969,16 @@ gl::Error TextureStorage11_3D::getSwizzleRenderTarget(int mipLevel, ID3D11Render
if (!mSwizzleRenderTargets[mipLevel])
{
ID3D11Resource *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&swizzleTexture));
+ gl::Error error = getSwizzleTexture(&swizzleTexture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format =
- mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.Format = mFormatInfo.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D;
rtvDesc.Texture3D.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture3D.FirstWSlice = 0;
@@ -3052,12 +3141,16 @@ gl::Error TextureStorage11_2DArray::releaseAssociatedImage(const gl::ImageIndex
{
// Force the image to recover from storage before its data is overwritten.
// This will reset mAssociatedImages[level] to nullptr too.
- ANGLE_TRY(mAssociatedImages[key]->recoverFromAssociatedStorage());
+ gl::Error error = mAssociatedImages[key]->recoverFromAssociatedStorage();
+ if (error.isError())
+ {
+ return error;
+ }
}
}
}
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_2DArray::getResource(ID3D11Resource **outResource)
@@ -3180,14 +3273,21 @@ gl::Error TextureStorage11_2DArray::getRenderTarget(const gl::ImageIndex &index,
HRESULT result;
ID3D11Resource *texture = nullptr;
- ANGLE_TRY(getResource(&texture));
+ gl::Error error = getResource(&texture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *srv;
- ANGLE_TRY(createRenderTargetSRV(texture, index, mFormatInfo.srvFormat, &srv));
+ error = createRenderTargetSRV(texture, index, mFormatInfo.srvFormat, &srv);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11ShaderResourceView *blitSRV;
if (mFormatInfo.blitSRVFormat != mFormatInfo.srvFormat)
{
- gl::Error error =
- createRenderTargetSRV(texture, index, mFormatInfo.blitSRVFormat, &blitSRV);
+ error = createRenderTargetSRV(texture, index, mFormatInfo.blitSRVFormat, &blitSRV);
if (error.isError())
{
SafeRelease(srv);
@@ -3275,7 +3375,7 @@ gl::Error TextureStorage11_2DArray::getRenderTarget(const gl::ImageIndex &index,
ASSERT(outRT);
*outRT = mRenderTargets[key];
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
gl::Error TextureStorage11_2DArray::getSwizzleTexture(ID3D11Resource **outTexture)
@@ -3289,7 +3389,7 @@ gl::Error TextureStorage11_2DArray::getSwizzleTexture(ID3D11Resource **outTextur
desc.Height = mTextureHeight;
desc.MipLevels = mMipLevels;
desc.ArraySize = mTextureDepth;
- desc.Format = mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).texFormat;
+ desc.Format = mFormatInfo.swizzle.texFormat;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Usage = D3D11_USAGE_DEFAULT;
@@ -3322,13 +3422,16 @@ gl::Error TextureStorage11_2DArray::getSwizzleRenderTarget(int mipLevel,
if (!mSwizzleRenderTargets[mipLevel])
{
ID3D11Resource *swizzleTexture = nullptr;
- ANGLE_TRY(getSwizzleTexture(&swizzleTexture));
+ gl::Error error = getSwizzleTexture(&swizzleTexture);
+ if (error.isError())
+ {
+ return error;
+ }
ID3D11Device *device = mRenderer->getDevice();
D3D11_RENDER_TARGET_VIEW_DESC rtvDesc;
- rtvDesc.Format =
- mFormatInfo.getSwizzleFormat(mRenderer->getRenderer11DeviceCaps()).rtvFormat;
+ rtvDesc.Format = mFormatInfo.swizzle.rtvFormat;
rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY;
rtvDesc.Texture2DArray.MipSlice = mTopLevel + mipLevel;
rtvDesc.Texture2DArray.FirstArraySlice = 0;
@@ -3347,44 +3450,6 @@ gl::Error TextureStorage11_2DArray::getSwizzleRenderTarget(int mipLevel,
}
*outRTV = mSwizzleRenderTargets[mipLevel];
- return gl::NoError();
-}
-
-gl::Error TextureStorage11_2DArray::createDropStencilTexture()
-{
- if (mDropStencilTexture)
- {
- return gl::NoError();
- }
-
- D3D11_TEXTURE2D_DESC dropDesc = {};
- dropDesc.ArraySize = mTextureDepth;
- dropDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_DEPTH_STENCIL;
- dropDesc.CPUAccessFlags = 0;
- dropDesc.Format = DXGI_FORMAT_R32_TYPELESS;
- dropDesc.Height = mTextureHeight;
- dropDesc.MipLevels = mMipLevels;
- dropDesc.MiscFlags = 0;
- dropDesc.SampleDesc.Count = 1;
- dropDesc.SampleDesc.Quality = 0;
- dropDesc.Usage = D3D11_USAGE_DEFAULT;
- dropDesc.Width = mTextureWidth;
-
- ID3D11Device *device = mRenderer->getDevice();
-
- HRESULT hr = device->CreateTexture2D(&dropDesc, nullptr, &mDropStencilTexture);
- if (FAILED(hr))
- {
- return gl::Error(GL_INVALID_OPERATION, "Error creating drop stencil texture.");
- }
- d3d11::SetDebugName(mDropStencilTexture, "TexStorage2DArray.DropStencil");
-
- std::vector<GLsizei> layerCounts(mMipLevels, mTextureDepth);
-
- ANGLE_TRY(initDropStencilTexture(
- gl::ImageIndexIterator::Make2DArray(0, mMipLevels, layerCounts.data())));
-
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
-
} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
index 46eb8458b..8d968adb0 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.h
@@ -59,8 +59,8 @@ class TextureStorage11 : public TextureStorage
virtual UINT getSubresourceIndex(const gl::ImageIndex &index) const;
gl::Error generateSwizzles(const gl::SwizzleState &swizzleTarget);
- void markLevelDirty(int mipLevel);
- void markDirty();
+ void invalidateSwizzleCacheLevel(int mipLevel);
+ void invalidateSwizzleCache();
gl::Error updateSubresourceLevel(ID3D11Resource *texture, unsigned int sourceSubresource,
const gl::ImageIndex &index, const gl::Box &copyArea);
@@ -94,10 +94,6 @@ class TextureStorage11 : public TextureStorage
virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV) = 0;
gl::Error getSRVLevel(int mipLevel, bool blitSRV, ID3D11ShaderResourceView **outSRV);
- // Get a version of a depth texture with only depth information, not stencil.
- virtual gl::Error createDropStencilTexture();
- gl::Error initDropStencilTexture(const gl::ImageIndexIterator &it);
-
// The baseLevel parameter should *not* have mTopLevel applied.
virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const = 0;
@@ -117,7 +113,6 @@ class TextureStorage11 : public TextureStorage
unsigned int mTextureDepth;
gl::SwizzleState mSwizzleCache[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
- ID3D11Texture2D *mDropStencilTexture;
private:
const UINT mBindFlags;
@@ -125,14 +120,13 @@ class TextureStorage11 : public TextureStorage
struct SRVKey
{
- SRVKey(int baseLevel, int mipLevels, bool swizzle, bool dropStencil);
+ SRVKey(int baseLevel = 0, int mipLevels = 0, bool swizzle = false);
bool operator<(const SRVKey &rhs) const;
- int baseLevel = 0; // Without mTopLevel applied.
- int mipLevels = 0;
- bool swizzle = false;
- bool dropStencil = false;
+ int baseLevel; // Without mTopLevel applied.
+ int mipLevels;
+ bool swizzle;
};
typedef std::map<SRVKey, ID3D11ShaderResourceView *> SRVCache;
@@ -148,35 +142,30 @@ class TextureStorage11_2D : public TextureStorage11
public:
TextureStorage11_2D(Renderer11 *renderer, SwapChain11 *swapchain);
TextureStorage11_2D(Renderer11 *renderer, GLenum internalformat, bool renderTarget, GLsizei width, GLsizei height, int levels, bool hintLevelZeroOnly = false);
- ~TextureStorage11_2D() override;
+ virtual ~TextureStorage11_2D();
- gl::Error getResource(ID3D11Resource **outResource) override;
- gl::Error getMippedResource(ID3D11Resource **outResource) override;
- gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT) override;
+ virtual gl::Error getResource(ID3D11Resource **outResource);
+ virtual gl::Error getMippedResource(ID3D11Resource **outResource);
+ virtual gl::Error getRenderTarget(const gl::ImageIndex &index, RenderTargetD3D **outRT);
- gl::Error copyToStorage(TextureStorage *destStorage) override;
+ virtual gl::Error copyToStorage(TextureStorage *destStorage);
- void associateImage(Image11 *image, const gl::ImageIndex &index) override;
- void disassociateImage(const gl::ImageIndex &index, Image11 *expectedImage) override;
- bool isAssociatedImageValid(const gl::ImageIndex &index, Image11 *expectedImage) override;
- gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11 *incomingImage) override;
+ virtual void associateImage(Image11* image, const gl::ImageIndex &index);
+ virtual void disassociateImage(const gl::ImageIndex &index, Image11* expectedImage);
+ virtual bool isAssociatedImageValid(const gl::ImageIndex &index, Image11* expectedImage);
+ virtual gl::Error releaseAssociatedImage(const gl::ImageIndex &index, Image11* incomingImage);
- gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture) override;
+ virtual gl::Error useLevelZeroWorkaroundTexture(bool useLevelZeroTexture);
protected:
- gl::Error getSwizzleTexture(ID3D11Resource **outTexture) override;
- gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV) override;
-
- gl::Error createDropStencilTexture() override;
+ virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
+ virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
gl::Error ensureTextureExists(int mipLevels);
private:
- gl::Error createSRV(int baseLevel,
- int mipLevels,
- DXGI_FORMAT format,
- ID3D11Resource *texture,
- ID3D11ShaderResourceView **outSRV) const override;
+ virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
+ ID3D11ShaderResourceView **outSRV) const;
ID3D11Texture2D *mTexture;
RenderTarget11 *mRenderTarget[gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS];
@@ -312,8 +301,6 @@ class TextureStorage11_Cube : public TextureStorage11
virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
- gl::Error createDropStencilTexture() override;
-
gl::Error ensureTextureExists(int mipLevels);
private:
@@ -397,8 +384,6 @@ class TextureStorage11_2DArray : public TextureStorage11
virtual gl::Error getSwizzleTexture(ID3D11Resource **outTexture);
virtual gl::Error getSwizzleRenderTarget(int mipLevel, ID3D11RenderTargetView **outRTV);
- gl::Error createDropStencilTexture() override;
-
private:
virtual gl::Error createSRV(int baseLevel, int mipLevels, DXGI_FORMAT format, ID3D11Resource *texture,
ID3D11ShaderResourceView **outSRV) const;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
index e06a6b22b..8f0fe8496 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp
@@ -182,8 +182,12 @@ gl::Error VertexArray11::updateDirtyAndDynamicAttribs(VertexDataManager *vertexD
break;
case VertexStorageType::STATIC:
{
- ANGLE_TRY(
- VertexDataManager::StoreStaticAttrib(translatedAttrib, count, instances));
+ auto error =
+ VertexDataManager::StoreStaticAttrib(translatedAttrib, count, instances);
+ if (error.isError())
+ {
+ return error;
+ }
break;
}
case VertexStorageType::CURRENT_VALUE:
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
index 6cd91bd35..8e2d119d2 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp
@@ -21,9 +21,9 @@ namespace rx
VertexBuffer11::VertexBuffer11(Renderer11 *const renderer) : mRenderer(renderer)
{
- mBuffer = NULL;
- mBufferSize = 0;
- mDynamicUsage = false;
+ mBuffer = NULL;
+ mBufferSize = 0;
+ mDynamicUsage = false;
mMappedResourceData = NULL;
}
@@ -41,21 +41,20 @@ gl::Error VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
if (size > 0)
{
- ID3D11Device *dxDevice = mRenderer->getDevice();
+ ID3D11Device* dxDevice = mRenderer->getDevice();
D3D11_BUFFER_DESC bufferDesc;
- bufferDesc.ByteWidth = size;
- bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
- bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
- bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
- bufferDesc.MiscFlags = 0;
+ bufferDesc.ByteWidth = size;
+ bufferDesc.Usage = D3D11_USAGE_DYNAMIC;
+ bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
+ bufferDesc.MiscFlags = 0;
bufferDesc.StructureByteStride = 0;
HRESULT result = dxDevice->CreateBuffer(&bufferDesc, NULL, &mBuffer);
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to allocate internal vertex buffer of size, %lu.", size);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to allocate internal vertex buffer of size, %lu.", size);
}
if (dynamicUsage)
@@ -68,7 +67,7 @@ gl::Error VertexBuffer11::initialize(unsigned int size, bool dynamicUsage)
}
}
- mBufferSize = size;
+ mBufferSize = size;
mDynamicUsage = dynamicUsage;
return gl::Error(GL_NO_ERROR);
@@ -82,15 +81,13 @@ gl::Error VertexBuffer11::mapResource()
D3D11_MAPPED_SUBRESOURCE mappedResource;
- HRESULT result =
- dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
+ HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &mappedResource);
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to map internal vertex buffer, HRESULT: 0x%08x.", result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to map internal vertex buffer, HRESULT: 0x%08x.", result);
}
- mMappedResourceData = reinterpret_cast<uint8_t *>(mappedResource.pData);
+ mMappedResourceData = reinterpret_cast<uint8_t*>(mappedResource.pData);
}
return gl::Error(GL_NO_ERROR);
@@ -123,7 +120,11 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri
int inputStride = static_cast<int>(ComputeVertexAttributeStride(attrib));
// This will map the resource if it isn't already mapped.
- ANGLE_TRY(mapResource());
+ gl::Error error = mapResource();
+ if (error.isError())
+ {
+ return error;
+ }
uint8_t *output = mMappedResourceData + offset;
@@ -135,13 +136,12 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri
}
gl::VertexFormatType vertexFormatType = gl::GetVertexFormatType(attrib, currentValueType);
- const D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel;
- const d3d11::VertexFormat &vertexFormatInfo =
- d3d11::GetVertexFormatInfo(vertexFormatType, featureLevel);
+ const D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel;
+ const d3d11::VertexFormat &vertexFormatInfo = d3d11::GetVertexFormatInfo(vertexFormatType, featureLevel);
ASSERT(vertexFormatInfo.copyFunction != NULL);
vertexFormatInfo.copyFunction(input, inputStride, count, output);
- return gl::NoError();
+ return gl::Error(GL_NO_ERROR);
}
unsigned int VertexBuffer11::getBufferSize() const
@@ -174,8 +174,7 @@ gl::Error VertexBuffer11::discard()
HRESULT result = dxContext->Map(mBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
- return gl::Error(GL_OUT_OF_MEMORY,
- "Failed to map internal buffer for discarding, HRESULT: 0x%08x", result);
+ return gl::Error(GL_OUT_OF_MEMORY, "Failed to map internal buffer for discarding, HRESULT: 0x%08x", result);
}
dxContext->Unmap(mBuffer, 0);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json
deleted file mode 100644
index 5b8d73568..000000000
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_data.json
+++ /dev/null
@@ -1,118 +0,0 @@
-{
- "UNKNOWN": "NONE",
- "R32G32B32A32_TYPELESS": "",
- "R32G32B32A32_FLOAT": "",
- "R32G32B32A32_UINT": "",
- "R32G32B32A32_SINT": "",
- "R32G32B32_TYPELESS": "",
- "R32G32B32_FLOAT": "",
- "R32G32B32_UINT": "",
- "R32G32B32_SINT": "",
- "R16G16B16A16_TYPELESS": "",
- "R16G16B16A16_FLOAT": "",
- "R16G16B16A16_UNORM": "",
- "R16G16B16A16_UINT": "",
- "R16G16B16A16_SNORM": "",
- "R16G16B16A16_SINT": "",
- "R32G32_TYPELESS": "",
- "R32G32_FLOAT": "",
- "R32G32_UINT": "",
- "R32G32_SINT": "",
- "R32G8X24_TYPELESS": "",
- "D32_FLOAT_S8X24_UINT": "",
- "R32_FLOAT_X8X24_TYPELESS": "",
- "X32_TYPELESS_G8X24_UINT": "",
- "R10G10B10A2_TYPELESS": "",
- "R10G10B10A2_UNORM": "",
- "R10G10B10A2_UINT": "",
- "R11G11B10_FLOAT": "",
- "R8G8B8A8_TYPELESS": "",
- "R8G8B8A8_UNORM": "",
- "R8G8B8A8_UNORM_SRGB": "",
- "R8G8B8A8_UINT": "",
- "R8G8B8A8_SNORM": "",
- "R8G8B8A8_SINT": "",
- "R16G16_TYPELESS": "",
- "R16G16_FLOAT": "",
- "R16G16_UNORM": "",
- "R16G16_UINT": "",
- "R16G16_SNORM": "",
- "R16G16_SINT": "",
- "R32_TYPELESS": "",
- "D32_FLOAT": "",
- "R32_FLOAT": "",
- "R32_UINT": "",
- "R32_SINT": "",
- "R24G8_TYPELESS": "",
- "D24_UNORM_S8_UINT": "",
- "R24_UNORM_X8_TYPELESS": "",
- "X24_TYPELESS_G8_UINT": "",
- "R8G8_TYPELESS": "",
- "R8G8_UNORM": "",
- "R8G8_UINT": "",
- "R8G8_SNORM": "",
- "R8G8_SINT": "",
- "R16_TYPELESS": "",
- "R16_FLOAT": "",
- "D16_UNORM": "",
- "R16_UNORM": "",
- "R16_UINT": "",
- "R16_SNORM": "",
- "R16_SINT": "",
- "R8_TYPELESS": "",
- "R8_UNORM": "",
- "R8_UINT": "",
- "R8_SNORM": "",
- "R8_SINT": "",
- "A8_UNORM": "",
- "R1_UNORM": "",
- "R9G9B9E5_SHAREDEXP": "",
- "R8G8_B8G8_UNORM": "",
- "G8R8_G8B8_UNORM": "",
- "BC1_TYPELESS": "",
- "BC1_UNORM": "BC1_RGBA_UNORM_BLOCK",
- "BC1_UNORM_SRGB": "",
- "BC2_TYPELESS": "",
- "BC2_UNORM": "BC2_RGBA_UNORM_BLOCK",
- "BC2_UNORM_SRGB": "",
- "BC3_TYPELESS": "",
- "BC3_UNORM": "BC3_RGBA_UNORM_BLOCK",
- "BC3_UNORM_SRGB": "",
- "BC4_TYPELESS": "",
- "BC4_UNORM": "",
- "BC4_SNORM": "",
- "BC5_TYPELESS": "",
- "BC5_UNORM": "",
- "BC5_SNORM": "",
- "B5G6R5_UNORM": "",
- "B5G5R5A1_UNORM": "",
- "B8G8R8A8_UNORM": "",
- "B8G8R8X8_UNORM": "",
- "R10G10B10_XR_BIAS_A2_UNORM": "",
- "B8G8R8A8_TYPELESS": "",
- "B8G8R8A8_UNORM_SRGB": "",
- "B8G8R8X8_TYPELESS": "",
- "B8G8R8X8_UNORM_SRGB": "",
- "BC6H_TYPELESS": "",
- "BC6H_UF16": "",
- "BC6H_SF16": "",
- "BC7_TYPELESS": "",
- "BC7_UNORM": "",
- "BC7_UNORM_SRGB": "",
- "AYUV": "",
- "Y410": "",
- "Y416": "",
- "NV12": "",
- "P010": "",
- "P016": "",
- "420_OPAQUE": "",
- "YUY2": "",
- "Y210": "",
- "Y216": "",
- "NV11": "",
- "AI44": "",
- "IA44": "",
- "P8": "",
- "A8P8": "",
- "B4G4R4A4_UNORM": ""
-}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
deleted file mode 100644
index 66610cac9..000000000
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_format_map_autogen.cpp
+++ /dev/null
@@ -1,516 +0,0 @@
-// GENERATED FILE - DO NOT EDIT.
-// Generated by gen_dxgi_format_table.py using data from dxgi_format_data.json.
-//
-// Copyright 2016 The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// DXGI format info:
-// Determining metadata about a DXGI format.
-
-#include "libANGLE/renderer/Format.h"
-
-using namespace angle;
-
-namespace rx
-{
-
-namespace d3d11
-{
-
-GLenum GetComponentType(DXGI_FORMAT dxgiFormat)
-{
- switch (dxgiFormat)
- {
- case DXGI_FORMAT_420_OPAQUE:
- break;
- case DXGI_FORMAT_A8P8:
- break;
- case DXGI_FORMAT_A8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_AI44:
- break;
- case DXGI_FORMAT_AYUV:
- break;
- case DXGI_FORMAT_B4G4R4A4_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_B5G5R5A1_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_B5G6R5_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_B8G8R8A8_TYPELESS:
- break;
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_B8G8R8X8_TYPELESS:
- break;
- case DXGI_FORMAT_B8G8R8X8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC1_TYPELESS:
- break;
- case DXGI_FORMAT_BC1_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC2_TYPELESS:
- break;
- case DXGI_FORMAT_BC2_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC3_TYPELESS:
- break;
- case DXGI_FORMAT_BC3_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC4_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_BC4_TYPELESS:
- break;
- case DXGI_FORMAT_BC4_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC5_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_BC5_TYPELESS:
- break;
- case DXGI_FORMAT_BC5_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC6H_SF16:
- break;
- case DXGI_FORMAT_BC6H_TYPELESS:
- break;
- case DXGI_FORMAT_BC6H_UF16:
- break;
- case DXGI_FORMAT_BC7_TYPELESS:
- break;
- case DXGI_FORMAT_BC7_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_D16_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- break;
- case DXGI_FORMAT_D32_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- break;
- case DXGI_FORMAT_G8R8_G8B8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_IA44:
- break;
- case DXGI_FORMAT_NV11:
- break;
- case DXGI_FORMAT_NV12:
- break;
- case DXGI_FORMAT_P010:
- break;
- case DXGI_FORMAT_P016:
- break;
- case DXGI_FORMAT_P8:
- break;
- case DXGI_FORMAT_R10G10B10A2_TYPELESS:
- break;
- case DXGI_FORMAT_R10G10B10A2_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R10G10B10A2_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R11G11B10_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R16G16B16A16_SINT:
- return GL_INT;
- case DXGI_FORMAT_R16G16B16A16_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_R16G16B16A16_TYPELESS:
- break;
- case DXGI_FORMAT_R16G16B16A16_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R16G16B16A16_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R16G16_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R16G16_SINT:
- return GL_INT;
- case DXGI_FORMAT_R16G16_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_R16G16_TYPELESS:
- break;
- case DXGI_FORMAT_R16G16_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R16G16_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R16_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R16_SINT:
- return GL_INT;
- case DXGI_FORMAT_R16_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_R16_TYPELESS:
- break;
- case DXGI_FORMAT_R16_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R16_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R1_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R24G8_TYPELESS:
- break;
- case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R32G32B32A32_SINT:
- return GL_INT;
- case DXGI_FORMAT_R32G32B32A32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32B32A32_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R32G32B32_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R32G32B32_SINT:
- return GL_INT;
- case DXGI_FORMAT_R32G32B32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32B32_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R32G32_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R32G32_SINT:
- return GL_INT;
- case DXGI_FORMAT_R32G32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R32G8X24_TYPELESS:
- break;
- case DXGI_FORMAT_R32_FLOAT:
- return GL_FLOAT;
- case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
- return GL_FLOAT;
- case DXGI_FORMAT_R32_SINT:
- return GL_INT;
- case DXGI_FORMAT_R32_TYPELESS:
- break;
- case DXGI_FORMAT_R32_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R8G8B8A8_SINT:
- return GL_INT;
- case DXGI_FORMAT_R8G8B8A8_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_R8G8B8A8_TYPELESS:
- break;
- case DXGI_FORMAT_R8G8B8A8_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R8G8_B8G8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R8G8_SINT:
- return GL_INT;
- case DXGI_FORMAT_R8G8_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_R8G8_TYPELESS:
- break;
- case DXGI_FORMAT_R8G8_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R8G8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R8_SINT:
- return GL_INT;
- case DXGI_FORMAT_R8_SNORM:
- return GL_SIGNED_NORMALIZED;
- case DXGI_FORMAT_R8_TYPELESS:
- break;
- case DXGI_FORMAT_R8_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_R8_UNORM:
- return GL_UNSIGNED_NORMALIZED;
- case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
- return GL_FLOAT;
- case DXGI_FORMAT_UNKNOWN:
- break;
- case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
- return GL_UNSIGNED_INT;
- case DXGI_FORMAT_Y210:
- break;
- case DXGI_FORMAT_Y216:
- break;
- case DXGI_FORMAT_Y410:
- break;
- case DXGI_FORMAT_Y416:
- break;
- case DXGI_FORMAT_YUY2:
- break;
- default:
- break;
- }
-
- UNREACHABLE();
- return GL_NONE;
-}
-
-} // namespace d3d11
-
-namespace d3d11_angle
-{
-
-const Format &GetFormat(DXGI_FORMAT dxgiFormat)
-{
- switch (dxgiFormat)
- {
- case DXGI_FORMAT_420_OPAQUE:
- break;
- case DXGI_FORMAT_A8P8:
- break;
- case DXGI_FORMAT_A8_UNORM:
- return Format::Get(Format::ID::A8_UNORM);
- case DXGI_FORMAT_AI44:
- break;
- case DXGI_FORMAT_AYUV:
- break;
- case DXGI_FORMAT_B4G4R4A4_UNORM:
- return Format::Get(Format::ID::B4G4R4A4_UNORM);
- case DXGI_FORMAT_B5G5R5A1_UNORM:
- return Format::Get(Format::ID::B5G5R5A1_UNORM);
- case DXGI_FORMAT_B5G6R5_UNORM:
- return Format::Get(Format::ID::B5G6R5_UNORM);
- case DXGI_FORMAT_B8G8R8A8_TYPELESS:
- break;
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- return Format::Get(Format::ID::B8G8R8A8_UNORM);
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- break;
- case DXGI_FORMAT_B8G8R8X8_TYPELESS:
- break;
- case DXGI_FORMAT_B8G8R8X8_UNORM:
- return Format::Get(Format::ID::B8G8R8X8_UNORM);
- case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
- break;
- case DXGI_FORMAT_BC1_TYPELESS:
- break;
- case DXGI_FORMAT_BC1_UNORM:
- return Format::Get(Format::ID::BC1_RGBA_UNORM_BLOCK);
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- break;
- case DXGI_FORMAT_BC2_TYPELESS:
- break;
- case DXGI_FORMAT_BC2_UNORM:
- return Format::Get(Format::ID::BC2_RGBA_UNORM_BLOCK);
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- break;
- case DXGI_FORMAT_BC3_TYPELESS:
- break;
- case DXGI_FORMAT_BC3_UNORM:
- return Format::Get(Format::ID::BC3_RGBA_UNORM_BLOCK);
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- break;
- case DXGI_FORMAT_BC4_SNORM:
- break;
- case DXGI_FORMAT_BC4_TYPELESS:
- break;
- case DXGI_FORMAT_BC4_UNORM:
- break;
- case DXGI_FORMAT_BC5_SNORM:
- break;
- case DXGI_FORMAT_BC5_TYPELESS:
- break;
- case DXGI_FORMAT_BC5_UNORM:
- break;
- case DXGI_FORMAT_BC6H_SF16:
- break;
- case DXGI_FORMAT_BC6H_TYPELESS:
- break;
- case DXGI_FORMAT_BC6H_UF16:
- break;
- case DXGI_FORMAT_BC7_TYPELESS:
- break;
- case DXGI_FORMAT_BC7_UNORM:
- break;
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- break;
- case DXGI_FORMAT_D16_UNORM:
- return Format::Get(Format::ID::D16_UNORM);
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- return Format::Get(Format::ID::D24_UNORM_S8_UINT);
- case DXGI_FORMAT_D32_FLOAT:
- return Format::Get(Format::ID::D32_FLOAT);
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- return Format::Get(Format::ID::D32_FLOAT_S8X24_UINT);
- case DXGI_FORMAT_G8R8_G8B8_UNORM:
- break;
- case DXGI_FORMAT_IA44:
- break;
- case DXGI_FORMAT_NV11:
- break;
- case DXGI_FORMAT_NV12:
- break;
- case DXGI_FORMAT_P010:
- break;
- case DXGI_FORMAT_P016:
- break;
- case DXGI_FORMAT_P8:
- break;
- case DXGI_FORMAT_R10G10B10A2_TYPELESS:
- break;
- case DXGI_FORMAT_R10G10B10A2_UINT:
- return Format::Get(Format::ID::R10G10B10A2_UINT);
- case DXGI_FORMAT_R10G10B10A2_UNORM:
- return Format::Get(Format::ID::R10G10B10A2_UNORM);
- case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
- break;
- case DXGI_FORMAT_R11G11B10_FLOAT:
- return Format::Get(Format::ID::R11G11B10_FLOAT);
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- return Format::Get(Format::ID::R16G16B16A16_FLOAT);
- case DXGI_FORMAT_R16G16B16A16_SINT:
- return Format::Get(Format::ID::R16G16B16A16_SINT);
- case DXGI_FORMAT_R16G16B16A16_SNORM:
- return Format::Get(Format::ID::R16G16B16A16_SNORM);
- case DXGI_FORMAT_R16G16B16A16_TYPELESS:
- break;
- case DXGI_FORMAT_R16G16B16A16_UINT:
- return Format::Get(Format::ID::R16G16B16A16_UINT);
- case DXGI_FORMAT_R16G16B16A16_UNORM:
- return Format::Get(Format::ID::R16G16B16A16_UNORM);
- case DXGI_FORMAT_R16G16_FLOAT:
- return Format::Get(Format::ID::R16G16_FLOAT);
- case DXGI_FORMAT_R16G16_SINT:
- return Format::Get(Format::ID::R16G16_SINT);
- case DXGI_FORMAT_R16G16_SNORM:
- return Format::Get(Format::ID::R16G16_SNORM);
- case DXGI_FORMAT_R16G16_TYPELESS:
- break;
- case DXGI_FORMAT_R16G16_UINT:
- return Format::Get(Format::ID::R16G16_UINT);
- case DXGI_FORMAT_R16G16_UNORM:
- return Format::Get(Format::ID::R16G16_UNORM);
- case DXGI_FORMAT_R16_FLOAT:
- return Format::Get(Format::ID::R16_FLOAT);
- case DXGI_FORMAT_R16_SINT:
- return Format::Get(Format::ID::R16_SINT);
- case DXGI_FORMAT_R16_SNORM:
- return Format::Get(Format::ID::R16_SNORM);
- case DXGI_FORMAT_R16_TYPELESS:
- break;
- case DXGI_FORMAT_R16_UINT:
- return Format::Get(Format::ID::R16_UINT);
- case DXGI_FORMAT_R16_UNORM:
- return Format::Get(Format::ID::R16_UNORM);
- case DXGI_FORMAT_R1_UNORM:
- break;
- case DXGI_FORMAT_R24G8_TYPELESS:
- break;
- case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- return Format::Get(Format::ID::R32G32B32A32_FLOAT);
- case DXGI_FORMAT_R32G32B32A32_SINT:
- return Format::Get(Format::ID::R32G32B32A32_SINT);
- case DXGI_FORMAT_R32G32B32A32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32B32A32_UINT:
- return Format::Get(Format::ID::R32G32B32A32_UINT);
- case DXGI_FORMAT_R32G32B32_FLOAT:
- return Format::Get(Format::ID::R32G32B32_FLOAT);
- case DXGI_FORMAT_R32G32B32_SINT:
- return Format::Get(Format::ID::R32G32B32_SINT);
- case DXGI_FORMAT_R32G32B32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32B32_UINT:
- return Format::Get(Format::ID::R32G32B32_UINT);
- case DXGI_FORMAT_R32G32_FLOAT:
- return Format::Get(Format::ID::R32G32_FLOAT);
- case DXGI_FORMAT_R32G32_SINT:
- return Format::Get(Format::ID::R32G32_SINT);
- case DXGI_FORMAT_R32G32_TYPELESS:
- break;
- case DXGI_FORMAT_R32G32_UINT:
- return Format::Get(Format::ID::R32G32_UINT);
- case DXGI_FORMAT_R32G8X24_TYPELESS:
- break;
- case DXGI_FORMAT_R32_FLOAT:
- return Format::Get(Format::ID::R32_FLOAT);
- case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
- break;
- case DXGI_FORMAT_R32_SINT:
- return Format::Get(Format::ID::R32_SINT);
- case DXGI_FORMAT_R32_TYPELESS:
- break;
- case DXGI_FORMAT_R32_UINT:
- return Format::Get(Format::ID::R32_UINT);
- case DXGI_FORMAT_R8G8B8A8_SINT:
- return Format::Get(Format::ID::R8G8B8A8_SINT);
- case DXGI_FORMAT_R8G8B8A8_SNORM:
- return Format::Get(Format::ID::R8G8B8A8_SNORM);
- case DXGI_FORMAT_R8G8B8A8_TYPELESS:
- break;
- case DXGI_FORMAT_R8G8B8A8_UINT:
- return Format::Get(Format::ID::R8G8B8A8_UINT);
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- return Format::Get(Format::ID::R8G8B8A8_UNORM);
- case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
- return Format::Get(Format::ID::R8G8B8A8_UNORM_SRGB);
- case DXGI_FORMAT_R8G8_B8G8_UNORM:
- break;
- case DXGI_FORMAT_R8G8_SINT:
- return Format::Get(Format::ID::R8G8_SINT);
- case DXGI_FORMAT_R8G8_SNORM:
- return Format::Get(Format::ID::R8G8_SNORM);
- case DXGI_FORMAT_R8G8_TYPELESS:
- break;
- case DXGI_FORMAT_R8G8_UINT:
- return Format::Get(Format::ID::R8G8_UINT);
- case DXGI_FORMAT_R8G8_UNORM:
- return Format::Get(Format::ID::R8G8_UNORM);
- case DXGI_FORMAT_R8_SINT:
- return Format::Get(Format::ID::R8_SINT);
- case DXGI_FORMAT_R8_SNORM:
- return Format::Get(Format::ID::R8_SNORM);
- case DXGI_FORMAT_R8_TYPELESS:
- break;
- case DXGI_FORMAT_R8_UINT:
- return Format::Get(Format::ID::R8_UINT);
- case DXGI_FORMAT_R8_UNORM:
- return Format::Get(Format::ID::R8_UNORM);
- case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
- return Format::Get(Format::ID::R9G9B9E5_SHAREDEXP);
- case DXGI_FORMAT_UNKNOWN:
- return Format::Get(Format::ID::NONE);
- case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
- break;
- case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
- break;
- case DXGI_FORMAT_Y210:
- break;
- case DXGI_FORMAT_Y216:
- break;
- case DXGI_FORMAT_Y410:
- break;
- case DXGI_FORMAT_Y416:
- break;
- case DXGI_FORMAT_YUY2:
- break;
- default:
- break;
- }
-
- UNREACHABLE();
- return Format::Get(Format::ID::NONE);
-}
-
-} // namespace d3d11_angle
-
-} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json
index dce0997d9..e81b4deea 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_data.json
@@ -8,8 +8,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32A32_TYPELESS":
{
@@ -19,8 +18,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32A32_FLOAT":
{
@@ -30,30 +28,27 @@
"shaderSample": "10_0check10_1always",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32A32_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32A32_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32_TYPELESS":
{
@@ -63,8 +58,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32_FLOAT":
{
@@ -74,8 +68,7 @@
"shaderSample": "11_0check",
"renderTarget": "check",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32_UINT":
{
@@ -85,8 +78,7 @@
"shaderSample": "never",
"renderTarget": "check",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32B32_SINT":
{
@@ -96,8 +88,7 @@
"shaderSample": "never",
"renderTarget": "check",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16B16A16_TYPELESS":
{
@@ -107,63 +98,57 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16B16A16_FLOAT":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "9_3check_10_0always",
+ "shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16B16A16_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16B16A16_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16B16A16_SNORM":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "10_0",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16B16A16_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32_TYPELESS":
{
@@ -173,8 +158,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32_FLOAT":
{
@@ -184,41 +168,37 @@
"shaderSample": "10_0check10_1always",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G32_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32G8X24_TYPELESS":
{
- "texture2D": "10_0",
+ "texture2D": "always",
"texture3D": "never",
- "textureCube": "10_0",
+ "textureCube": "always",
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_D32_FLOAT_S8X24_UINT":
{
@@ -228,8 +208,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "check",
- "depthStencil": "10_0",
- "mipAutoGen": "never"
+ "depthStencil": "always"
},
"DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS":
{
@@ -239,8 +218,7 @@
"shaderSample": "10_0check10_1always",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_X32_TYPELESS_G8X24_UINT":
{
@@ -250,52 +228,47 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R10G10B10A2_TYPELESS":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R10G10B10A2_UNORM":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "10_0",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R10G10B10A2_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R11G11B10_FLOAT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "10_0",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8B8A8_TYPELESS":
{
@@ -305,63 +278,57 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8B8A8_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8B8A8_UNORM_SRGB":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8B8A8_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8B8A8_SNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8B8A8_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16_TYPELESS":
{
@@ -371,8 +338,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16_FLOAT":
{
@@ -382,63 +348,57 @@
"shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16_SNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16G16_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32_TYPELESS":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_D32_FLOAT":
{
@@ -448,8 +408,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "check",
- "depthStencil": "10_0",
- "mipAutoGen": "never"
+ "depthStencil": "always"
},
"DXGI_FORMAT_R32_FLOAT":
{
@@ -459,30 +418,27 @@
"shaderSample": "10_0check10_1always",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R32_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R24G8_TYPELESS":
{
@@ -492,8 +448,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_D24_UNORM_S8_UINT":
{
@@ -513,8 +468,7 @@
"shaderSample": "10_0check10_1always",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_X24_TYPELESS_G8_UINT":
{
@@ -524,8 +478,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8_TYPELESS":
{
@@ -535,52 +488,47 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8_UNORM":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "9_3check_10_0always",
- "renderTarget": "9_3check_10_0always",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
+ "shaderSample": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8_SNORM":
{
"texture2D": "always",
- "texture3D": "10_0",
- "textureCube": "10_0",
- "shaderSample": "always",
- "renderTarget": "10_0",
+ "texture3D": "always",
+ "textureCube": "always",
+ "shaderSample": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16_TYPELESS":
{
@@ -590,19 +538,17 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16_FLOAT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "10_0",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_D16_UNORM":
{
@@ -612,52 +558,47 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "check",
- "depthStencil": "always",
- "mipAutoGen": "never"
+ "depthStencil": "always"
},
"DXGI_FORMAT_R16_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "10_0",
+ "shaderSample": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16_SNORM":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "10_0",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R16_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8_TYPELESS":
{
@@ -667,52 +608,47 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
- "renderTarget": "9_3check_10_0always",
+ "shaderSample": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8_UINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8_SNORM":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "10_0",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8_SINT":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "never",
- "renderTarget": "10_0",
+ "renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_A8_UNORM":
{
@@ -722,8 +658,7 @@
"shaderSample": "10_0",
"renderTarget": "always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "10_0"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R1_UNORM":
{
@@ -733,19 +668,17 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R9G9B9E5_SHAREDEXP":
{
- "texture2D": "10_0",
- "texture3D": "10_0",
- "textureCube": "10_0",
+ "texture2D": "always",
+ "texture3D": "always",
+ "textureCube": "always",
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R8G8_B8G8_UNORM":
{
@@ -755,8 +688,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_G8R8_G8B8_UNORM":
{
@@ -766,8 +698,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC1_TYPELESS":
{
@@ -777,19 +708,17 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC1_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC1_UNORM_SRGB":
{
@@ -799,8 +728,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC2_TYPELESS":
{
@@ -810,19 +738,17 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC2_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC2_UNORM_SRGB":
{
@@ -832,8 +758,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC3_TYPELESS":
{
@@ -843,19 +768,17 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC3_UNORM":
{
"texture2D": "always",
"texture3D": "always",
"textureCube": "always",
- "shaderSample": "always",
+ "shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC3_UNORM_SRGB":
{
@@ -865,8 +788,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC4_TYPELESS":
{
@@ -876,8 +798,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC4_UNORM":
{
@@ -887,8 +808,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC4_SNORM":
{
@@ -898,8 +818,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC5_TYPELESS":
{
@@ -909,8 +828,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC5_UNORM":
{
@@ -920,8 +838,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC5_SNORM":
{
@@ -931,8 +848,7 @@
"shaderSample": "10_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B5G6R5_UNORM":
{
@@ -942,8 +858,7 @@
"shaderSample": "dxgi1_2",
"renderTarget": "dxgi1_2",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "dxgi1_2"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B5G5R5A1_UNORM":
{
@@ -953,19 +868,17 @@
"shaderSample": "dxgi1_2",
"renderTarget": "check",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "dxgi1_2"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B8G8R8A8_UNORM":
{
"texture2D": "check",
"texture3D": "check",
"textureCube": "check",
- "shaderSample": "9_3always_10_0check11_0always",
- "renderTarget": "9_3always_10_0check11_0always",
+ "shaderSample": "10_0check11_0always",
+ "renderTarget": "10_0check11_0always",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "always"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B8G8R8X8_UNORM":
{
@@ -975,8 +888,7 @@
"shaderSample": "10_0check11_0always",
"renderTarget": "11_0",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM":
{
@@ -986,8 +898,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B8G8R8A8_TYPELESS":
{
@@ -997,8 +908,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B8G8R8A8_UNORM_SRGB":
{
@@ -1008,8 +918,7 @@
"shaderSample": "10_0check11_0always",
"renderTarget": "11_0",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B8G8R8X8_TYPELESS":
{
@@ -1019,8 +928,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B8G8R8X8_UNORM_SRGB":
{
@@ -1030,8 +938,7 @@
"shaderSample": "10_0check11_0always",
"renderTarget": "11_0",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC6H_TYPELESS":
{
@@ -1041,8 +948,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC6H_UF16":
{
@@ -1052,8 +958,7 @@
"shaderSample": "11_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC6H_SF16":
{
@@ -1063,8 +968,7 @@
"shaderSample": "11_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC7_TYPELESS":
{
@@ -1074,8 +978,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC7_UNORM":
{
@@ -1085,8 +988,7 @@
"shaderSample": "11_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_BC7_UNORM_SRGB":
{
@@ -1096,8 +998,7 @@
"shaderSample": "11_0",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_AYUV":
{
@@ -1107,8 +1008,7 @@
"shaderSample": "11_1",
"renderTarget": "11_1",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_Y410":
{
@@ -1118,8 +1018,7 @@
"shaderSample": "11_1",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_Y416":
{
@@ -1129,8 +1028,7 @@
"shaderSample": "11_1",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_NV12":
{
@@ -1140,8 +1038,7 @@
"shaderSample": "11_1",
"renderTarget": "11_1",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_P010":
{
@@ -1151,8 +1048,7 @@
"shaderSample": "11_1",
"renderTarget": "11_1",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_P016":
{
@@ -1162,8 +1058,7 @@
"shaderSample": "11_1",
"renderTarget": "11_1",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_420_OPAQUE":
{
@@ -1173,8 +1068,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_YUY2":
{
@@ -1184,8 +1078,7 @@
"shaderSample": "11_1",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_Y210":
{
@@ -1195,8 +1088,7 @@
"shaderSample": "11_1",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_Y216":
{
@@ -1206,8 +1098,7 @@
"shaderSample": "11_1",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_NV11":
{
@@ -1217,8 +1108,7 @@
"shaderSample": "11_1",
"renderTarget": "11_1",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_AI44":
{
@@ -1228,8 +1118,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_IA44":
{
@@ -1239,8 +1128,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_P8":
{
@@ -1250,8 +1138,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_A8P8":
{
@@ -1261,8 +1148,7 @@
"shaderSample": "never",
"renderTarget": "never",
"multisampleRT": "never",
- "depthStencil": "never",
- "mipAutoGen": "never"
+ "depthStencil": "never"
},
"DXGI_FORMAT_B4G4R4A4_UNORM":
{
@@ -1272,8 +1158,7 @@
"shaderSample": "dxgi1_2",
"renderTarget": "check",
"multisampleRT": "check",
- "depthStencil": "never",
- "mipAutoGen": "dxgi1_2"
+ "depthStencil": "never"
}
}
]
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp
index d202ce130..cbc36445e 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/dxgi_support_table.cpp
@@ -26,205 +26,205 @@ namespace d3d11
#define F_RT D3D11_FORMAT_SUPPORT_RENDER_TARGET
#define F_MS D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET
#define F_DS D3D11_FORMAT_SUPPORT_DEPTH_STENCIL
-#define F_MIPGEN D3D11_FORMAT_SUPPORT_MIP_AUTOGEN
namespace
{
const DXGISupport &GetDefaultSupport()
{
- static UINT AllSupportFlags =
- D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURE3D |
- D3D11_FORMAT_SUPPORT_TEXTURECUBE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE |
- D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET |
- D3D11_FORMAT_SUPPORT_DEPTH_STENCIL | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN;
+ static UINT AllSupportFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D |
+ D3D11_FORMAT_SUPPORT_TEXTURE3D |
+ D3D11_FORMAT_SUPPORT_TEXTURECUBE |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE |
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET |
+ D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET |
+ D3D11_FORMAT_SUPPORT_DEPTH_STENCIL;
static const DXGISupport defaultSupport(0, 0, AllSupportFlags);
return defaultSupport;
}
-const DXGISupport &GetDXGISupport_9_3(DXGI_FORMAT dxgiFormat)
+const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
{
- // clang-format off
switch (dxgiFormat)
{
case DXGI_FORMAT_420_OPAQUE:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_A8P8:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_A8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_AI44:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_AYUV:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_B4G4R4A4_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_B5G5R5A1_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_B5G6R5_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
return info;
}
case DXGI_FORMAT_B8G8R8A8_UNORM:
{
- static const DXGISupport info(F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_RT | F_SAMPLE);
return info;
}
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
return info;
}
case DXGI_FORMAT_B8G8R8X8_UNORM:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_BC1_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC1_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC1_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC2_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC2_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC2_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC3_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC3_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC3_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC4_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC4_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC4_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC5_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC5_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC5_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC6H_SF16:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC6H_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC6H_UF16:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC7_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC7_UNORM:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC7_UNORM_SRGB:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_D16_UNORM:
{
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_D24_UNORM_S8_UINT:
@@ -234,112 +234,112 @@ const DXGISupport &GetDXGISupport_9_3(DXGI_FORMAT dxgiFormat)
}
case DXGI_FORMAT_D32_FLOAT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_G8R8_G8B8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_IA44:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_NV11:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_NV12:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P010:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P016:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P8:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R10G10B10A2_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R10G10B10A2_UINT:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R10G10B10A2_UNORM:
{
- static const DXGISupport info(0, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
{
- static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
return info;
}
case DXGI_FORMAT_R11G11B10_FLOAT:
{
- static const DXGISupport info(0, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_SINT:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_SNORM:
{
- static const DXGISupport info(0, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16G16B16A16_UINT:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_SINT:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_SNORM:
@@ -349,875 +349,282 @@ const DXGISupport &GetDXGISupport_9_3(DXGI_FORMAT dxgiFormat)
}
case DXGI_FORMAT_R16G16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16G16_UINT:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16_FLOAT:
- {
- static const DXGISupport info(0, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16_SINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16_SNORM:
- {
- static const DXGISupport info(0, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R16_UINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R1_UNORM:
- {
- static const DXGISupport info(F_2D, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R24G8_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_R32G32B32A32_FLOAT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32G32B32A32_SINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32G32B32A32_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R32G32B32A32_UINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32G32B32_FLOAT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
- return info;
- }
- case DXGI_FORMAT_R32G32B32_SINT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
- return info;
- }
- case DXGI_FORMAT_R32G32B32_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R32G32B32_UINT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
- return info;
- }
- case DXGI_FORMAT_R32G32_FLOAT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32G32_SINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32G32_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R32G32_UINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32G8X24_TYPELESS:
- {
- static const DXGISupport info(0, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R32_FLOAT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_R32_SINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R32_TYPELESS:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R32_UINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8B8A8_SINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8B8A8_SNORM:
- {
static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
- case DXGI_FORMAT_R8G8B8A8_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R8G8B8A8_UINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8B8A8_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8_B8G8_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_R8G8_SINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8_SNORM:
- {
- static const DXGISupport info(F_2D | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R8G8_UINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8G8_UNORM:
- {
- static const DXGISupport info(0, F_DS, F_MS | F_RT | F_SAMPLE);
- return info;
- }
- case DXGI_FORMAT_R8_SINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8_SNORM:
- {
- static const DXGISupport info(0, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R8_UINT:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R8_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
- return info;
- }
- case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_UNKNOWN:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
- {
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
- {
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_Y210:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_Y216:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_Y410:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_Y416:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_YUY2:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
-
- default:
- UNREACHABLE();
- return GetDefaultSupport();
- }
- // clang-format on
-}
-
-const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
-{
- // clang-format off
- switch (dxgiFormat)
- {
- case DXGI_FORMAT_420_OPAQUE:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_A8P8:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_A8_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_AI44:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_AYUV:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_B4G4R4A4_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
- return info;
- }
- case DXGI_FORMAT_B5G5R5A1_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
- return info;
- }
- case DXGI_FORMAT_B5G6R5_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_B8G8R8A8_TYPELESS:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
- return info;
- }
- case DXGI_FORMAT_B8G8R8A8_UNORM:
- {
- static const DXGISupport info(F_MIPGEN, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_RT | F_SAMPLE);
- return info;
- }
- case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
- return info;
- }
- case DXGI_FORMAT_B8G8R8X8_TYPELESS:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
- return info;
- }
- case DXGI_FORMAT_B8G8R8X8_UNORM:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
- return info;
- }
- case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
- return info;
- }
- case DXGI_FORMAT_BC1_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_BC1_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC1_UNORM_SRGB:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC2_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_BC2_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC2_UNORM_SRGB:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC3_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_BC3_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC3_UNORM_SRGB:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC4_SNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC4_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_BC4_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC5_SNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC5_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_BC5_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC6H_SF16:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC6H_TYPELESS:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_BC6H_UF16:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC7_TYPELESS:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_BC7_UNORM:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_BC7_UNORM_SRGB:
- {
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_D16_UNORM:
- {
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_D24_UNORM_S8_UINT:
- {
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_D32_FLOAT:
- {
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
- {
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_G8R8_G8B8_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
- return info;
- }
- case DXGI_FORMAT_IA44:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_NV11:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_NV12:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_P010:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_P016:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_P8:
- {
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R10G10B10A2_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R10G10B10A2_UINT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R10G10B10A2_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
- {
- static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
- return info;
- }
- case DXGI_FORMAT_R11G11B10_FLOAT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16B16A16_FLOAT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16B16A16_SINT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16B16A16_SNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16B16A16_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R16G16B16A16_UINT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16B16A16_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16_FLOAT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16_SINT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16_SNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16_TYPELESS:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
- return info;
- }
- case DXGI_FORMAT_R16G16_UINT:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
- return info;
- }
- case DXGI_FORMAT_R16G16_UNORM:
- {
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
- return info;
- }
case DXGI_FORMAT_R16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R1_UNORM:
{
- static const DXGISupport info(F_2D, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R24G8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, F_SAMPLE);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT, F_SAMPLE);
return info;
}
case DXGI_FORMAT_R32G32B32A32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS, F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_R32G32B32A32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32B32A32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32B32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_SAMPLE, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32B32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32B32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_SAMPLE, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS, F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_R32G32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G8X24_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT, F_DS, F_MS | F_SAMPLE);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS, F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, F_SAMPLE);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT, F_SAMPLE);
return info;
}
case DXGI_FORMAT_R32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_B8G8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_R8G8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8G8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_UNKNOWN:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y210:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y216:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y410:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y416:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_YUY2:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
@@ -1225,192 +632,190 @@ const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
UNREACHABLE();
return GetDefaultSupport();
}
- // clang-format on
}
const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
{
- // clang-format off
switch (dxgiFormat)
{
case DXGI_FORMAT_420_OPAQUE:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_A8P8:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_A8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_AI44:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_AYUV:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_B4G4R4A4_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_B5G5R5A1_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_B5G6R5_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
return info;
}
case DXGI_FORMAT_B8G8R8A8_UNORM:
{
- static const DXGISupport info(F_MIPGEN, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_RT | F_SAMPLE);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_RT | F_SAMPLE);
return info;
}
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
return info;
}
case DXGI_FORMAT_B8G8R8X8_UNORM:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
+ static const DXGISupport info(0, F_DS, F_2D | F_3D | F_CUBE | F_MS | F_SAMPLE);
return info;
}
case DXGI_FORMAT_BC1_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC1_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC1_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC2_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC2_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC2_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC3_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC3_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC3_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC4_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC4_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC4_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC5_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC5_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC5_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC6H_SF16:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC6H_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC6H_UF16:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC7_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC7_UNORM:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC7_UNORM_SRGB:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_D16_UNORM:
{
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_D24_UNORM_S8_UINT:
@@ -1420,397 +825,397 @@ const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
}
case DXGI_FORMAT_D32_FLOAT:
{
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_G8R8_G8B8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_IA44:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_NV11:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_NV12:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P010:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P016:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P8:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R10G10B10A2_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R10G10B10A2_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R10G10B10A2_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
{
- static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
return info;
}
case DXGI_FORMAT_R11G11B10_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16G16B16A16_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16G16_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R1_UNORM:
{
- static const DXGISupport info(F_2D, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R24G8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_R32G32B32A32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32A32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32B32A32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32B32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_SAMPLE, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32B32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32B32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_SAMPLE, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R32G32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G8X24_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_R32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_B8G8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_R8G8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8G8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_UNKNOWN:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y210:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y216:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y410:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y416:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_YUY2:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
@@ -1818,192 +1223,190 @@ const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
UNREACHABLE();
return GetDefaultSupport();
}
- // clang-format on
}
const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
{
- // clang-format off
switch (dxgiFormat)
{
case DXGI_FORMAT_420_OPAQUE:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_A8P8:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_A8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_AI44:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_AYUV:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_B4G4R4A4_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_B5G5R5A1_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_SAMPLE, F_DS, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_B5G6R5_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
return info;
}
case DXGI_FORMAT_B8G8R8A8_UNORM:
{
- static const DXGISupport info(F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
return info;
}
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
{
- static const DXGISupport info(F_RT | F_SAMPLE, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
return info;
}
case DXGI_FORMAT_B8G8R8X8_TYPELESS:
{
- static const DXGISupport info(0, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
+ static const DXGISupport info(0, F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D | F_CUBE);
return info;
}
case DXGI_FORMAT_B8G8R8X8_UNORM:
{
- static const DXGISupport info(F_RT | F_SAMPLE, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
return info;
}
case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB:
{
- static const DXGISupport info(F_RT | F_SAMPLE, F_DS | F_MIPGEN, F_2D | F_3D | F_CUBE | F_MS);
+ static const DXGISupport info(F_RT | F_SAMPLE, F_DS, F_2D | F_3D | F_CUBE | F_MS);
return info;
}
case DXGI_FORMAT_BC1_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC1_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC1_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC2_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC2_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC2_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC3_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC3_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC3_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC4_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC4_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC4_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC5_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC5_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC5_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC6H_SF16:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC6H_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC6H_UF16:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC7_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_BC7_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_BC7_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_D16_UNORM:
{
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_D24_UNORM_S8_UINT:
@@ -2013,397 +1416,397 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
}
case DXGI_FORMAT_D32_FLOAT:
{
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_D32_FLOAT_S8X24_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_CUBE | F_DS, F_3D | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_G8R8_G8B8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_IA44:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_NV11:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_NV12:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P010:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P016:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_RT | F_SAMPLE, F_MS);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_RT | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_P8:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R10G10B10A2_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R10G10B10A2_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R10G10B10A2_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM:
{
- static const DXGISupport info(0, F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
+ static const DXGISupport info(0, F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, F_2D | F_3D);
return info;
}
case DXGI_FORMAT_R11G11B10_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16G16B16A16_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16B16A16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16G16_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16G16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R16_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R16_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R16_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R1_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R24G8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R24_UNORM_X8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_R32G32B32A32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32A32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32A32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32B32A32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32B32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32B32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_SAMPLE, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32B32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32B32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_SAMPLE, F_MS | F_RT);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_SAMPLE, F_MS | F_RT);
return info;
}
case DXGI_FORMAT_R32G32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R32G32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32G32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32G8X24_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32_FLOAT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS:
{
- static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_CUBE | F_SAMPLE, F_3D | F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_R32_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R32_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R32_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_B8G8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_R8G8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8G8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8G8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8_SINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8_SNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R8_TYPELESS:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE, F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_R8_UINT:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_MIPGEN | F_SAMPLE, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT, F_DS | F_SAMPLE, F_MS);
return info;
}
case DXGI_FORMAT_R8_UNORM:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_MIPGEN | F_RT | F_SAMPLE, F_DS, F_MS);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_RT | F_SAMPLE, F_DS, F_MS);
return info;
}
case DXGI_FORMAT_R9G9B9E5_SHAREDEXP:
{
- static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MIPGEN | F_MS | F_RT, 0);
+ static const DXGISupport info(F_2D | F_3D | F_CUBE | F_SAMPLE, F_DS | F_MS | F_RT, 0);
return info;
}
case DXGI_FORMAT_UNKNOWN:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_X24_TYPELESS_G8_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT:
{
- static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(F_2D | F_CUBE, F_3D | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y210:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y216:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y410:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_Y416:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
case DXGI_FORMAT_YUY2:
{
- static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MIPGEN | F_MS | F_RT | F_SAMPLE, 0);
+ static const DXGISupport info(0, F_2D | F_3D | F_CUBE | F_DS | F_MS | F_RT | F_SAMPLE, 0);
return info;
}
@@ -2411,7 +1814,6 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
UNREACHABLE();
return GetDefaultSupport();
}
- // clang-format on
}
}
@@ -2423,14 +1825,11 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
#undef F_RT
#undef F_MS
#undef F_DS
-#undef F_MIPGEN
const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_9_3:
- return GetDXGISupport_9_3(dxgiFormat);
case D3D_FEATURE_LEVEL_10_0:
return GetDXGISupport_10_0(dxgiFormat);
case D3D_FEATURE_LEVEL_10_1:
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
index 695ad468d..c4b3f3202 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.cpp
@@ -15,7 +15,6 @@
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/d3d/d3d11/copyvertex.h"
-#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
@@ -25,11 +24,329 @@ namespace rx
namespace d3d11
{
-bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel)
+struct DXGIColorFormatInfo
{
- const auto &support = GetDXGISupport(dxgiFormat, featureLevel);
- ASSERT((support.optionallySupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) == 0);
- return ((support.alwaysSupportedFlags & D3D11_FORMAT_SUPPORT_MIP_AUTOGEN) != 0);
+ size_t redBits;
+ size_t greenBits;
+ size_t blueBits;
+
+ size_t luminanceBits;
+
+ size_t alphaBits;
+ size_t sharedBits;
+};
+
+typedef std::map<DXGI_FORMAT, DXGIColorFormatInfo> ColorFormatInfoMap;
+typedef std::pair<DXGI_FORMAT, DXGIColorFormatInfo> ColorFormatInfoPair;
+
+static inline void InsertDXGIColorFormatInfo(ColorFormatInfoMap *map, DXGI_FORMAT format, size_t redBits, size_t greenBits,
+ size_t blueBits, size_t alphaBits, size_t sharedBits)
+{
+ DXGIColorFormatInfo info;
+ info.redBits = redBits;
+ info.greenBits = greenBits;
+ info.blueBits = blueBits;
+ info.alphaBits = alphaBits;
+ info.sharedBits = sharedBits;
+
+ map->insert(std::make_pair(format, info));
+}
+
+static ColorFormatInfoMap BuildColorFormatInfoMap()
+{
+ ColorFormatInfoMap map;
+
+ // clang-format off
+ // | DXGI format | R | G | B | A | S |
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_A8_UNORM, 0, 0, 0, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8_UNORM, 8, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8_UNORM, 8, 8, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8B8A8_UNORM, 8, 8, 8, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, 8, 8, 8, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_B8G8R8A8_UNORM, 8, 8, 8, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16_UNORM, 16, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16_UNORM, 16, 16, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16B16A16_UNORM, 16, 16, 16, 16, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8_SNORM, 8, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8_SNORM, 8, 8, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8B8A8_SNORM, 8, 8, 8, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16_SNORM, 16, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16_SNORM, 16, 16, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16B16A16_SNORM, 16, 16, 16, 16, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8_UINT, 8, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16_UINT, 16, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32_UINT, 32, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8_UINT, 8, 8, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16_UINT, 16, 16, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32_UINT, 32, 32, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32_UINT, 32, 32, 32, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8B8A8_UINT, 8, 8, 8, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16B16A16_UINT, 16, 16, 16, 16, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32A32_UINT, 32, 32, 32, 32, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8_SINT, 8, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16_SINT, 16, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32_SINT, 32, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8_SINT, 8, 8, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16_SINT, 16, 16, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32_SINT, 32, 32, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32_SINT, 32, 32, 32, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8B8A8_SINT, 8, 8, 8, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16B16A16_SINT, 16, 16, 16, 16, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32A32_SINT, 32, 32, 32, 32, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R10G10B10A2_TYPELESS, 10, 10, 10, 2, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R10G10B10A2_UNORM, 10, 10, 10, 2, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R10G10B10A2_UINT, 10, 10, 10, 2, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16_FLOAT, 16, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16_FLOAT, 16, 16, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16B16A16_FLOAT, 16, 16, 16, 16, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32_FLOAT, 32, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32_FLOAT, 32, 32, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32_FLOAT, 32, 32, 32, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32A32_FLOAT, 32, 32, 32, 32, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, 9, 9, 9, 0, 5);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R11G11B10_FLOAT, 11, 11, 10, 0, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_B5G6R5_UNORM, 5, 6, 5, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_B4G4R4A4_UNORM, 4, 4, 4, 4, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_B5G5R5A1_UNORM, 5, 5, 5, 1, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8_TYPELESS, 8, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16_TYPELESS, 16, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32_TYPELESS, 32, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8_TYPELESS, 8, 8, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16_TYPELESS, 16, 16, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32_TYPELESS, 32, 32, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32_TYPELESS, 32, 32, 32, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R8G8B8A8_TYPELESS, 8, 8, 8, 8, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R16G16B16A16_TYPELESS, 16, 16, 16, 16, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G32B32A32_TYPELESS, 32, 32, 32, 32, 0);
+
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R24G8_TYPELESS, 24, 8, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, 24, 0, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32G8X24_TYPELESS, 32, 8, 0, 0, 0);
+ InsertDXGIColorFormatInfo(&map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, 32, 0, 0, 0, 0);
+ // clang-format on
+
+ return map;
+}
+
+struct DXGIDepthStencilInfo
+{
+ unsigned int depthBits;
+ unsigned int stencilBits;
+};
+
+typedef std::map<DXGI_FORMAT, DXGIDepthStencilInfo> DepthStencilInfoMap;
+typedef std::pair<DXGI_FORMAT, DXGIDepthStencilInfo> DepthStencilInfoPair;
+
+static inline void InsertDXGIDepthStencilInfo(DepthStencilInfoMap *map,
+ DXGI_FORMAT format,
+ unsigned int depthBits,
+ unsigned int stencilBits)
+{
+ DXGIDepthStencilInfo info;
+ info.depthBits = depthBits;
+ info.stencilBits = stencilBits;
+
+ map->insert(std::make_pair(format, info));
+}
+
+static DepthStencilInfoMap BuildDepthStencilInfoMap()
+{
+ DepthStencilInfoMap map;
+
+ // clang-format off
+ InsertDXGIDepthStencilInfo(&map, DXGI_FORMAT_D16_UNORM, 16, 0);
+ InsertDXGIDepthStencilInfo(&map, DXGI_FORMAT_D24_UNORM_S8_UINT, 24, 8);
+ InsertDXGIDepthStencilInfo(&map, DXGI_FORMAT_D32_FLOAT, 32, 0);
+ InsertDXGIDepthStencilInfo(&map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, 32, 8);
+ // clang-format on
+
+ return map;
+}
+
+typedef std::map<DXGI_FORMAT, DXGIFormat> DXGIFormatInfoMap;
+
+DXGIFormat::DXGIFormat()
+ : redBits(0),
+ greenBits(0),
+ blueBits(0),
+ alphaBits(0),
+ sharedBits(0),
+ depthBits(0),
+ stencilBits(0),
+ componentType(GL_NONE),
+ nativeMipmapSupport(NULL)
+{
+}
+
+static bool NeverSupported(D3D_FEATURE_LEVEL)
+{
+ return false;
+}
+
+template <D3D_FEATURE_LEVEL requiredFeatureLevel>
+static bool RequiresFeatureLevel(D3D_FEATURE_LEVEL featureLevel)
+{
+ return featureLevel >= requiredFeatureLevel;
+}
+
+void AddDXGIFormat(DXGIFormatInfoMap *map,
+ DXGI_FORMAT dxgiFormat,
+ GLenum componentType,
+ NativeMipmapGenerationSupportFunction nativeMipmapSupport)
+{
+ DXGIFormat info;
+
+ static const ColorFormatInfoMap colorInfoMap = BuildColorFormatInfoMap();
+ ColorFormatInfoMap::const_iterator colorInfoIter = colorInfoMap.find(dxgiFormat);
+ if (colorInfoIter != colorInfoMap.end())
+ {
+ const DXGIColorFormatInfo &colorInfo = colorInfoIter->second;
+ info.redBits = static_cast<GLuint>(colorInfo.redBits);
+ info.greenBits = static_cast<GLuint>(colorInfo.greenBits);
+ info.blueBits = static_cast<GLuint>(colorInfo.blueBits);
+ info.alphaBits = static_cast<GLuint>(colorInfo.alphaBits);
+ info.sharedBits = static_cast<GLuint>(colorInfo.sharedBits);
+ }
+
+ static const DepthStencilInfoMap dsInfoMap = BuildDepthStencilInfoMap();
+ DepthStencilInfoMap::const_iterator dsInfoIter = dsInfoMap.find(dxgiFormat);
+ if (dsInfoIter != dsInfoMap.end())
+ {
+ const DXGIDepthStencilInfo &dsInfo = dsInfoIter->second;
+ info.depthBits = dsInfo.depthBits;
+ info.stencilBits = dsInfo.stencilBits;
+ }
+
+ info.componentType = componentType;
+ info.nativeMipmapSupport = nativeMipmapSupport;
+
+ map->insert(std::make_pair(dxgiFormat, info));
+}
+
+// A map to determine the color read function and mipmap generation function of a given DXGI format
+static DXGIFormatInfoMap BuildDXGIFormatInfoMap()
+{
+ DXGIFormatInfoMap map;
+
+ // clang-format off
+ // | DXGI format | Component Type | Color read function | Native mipmap function
+ AddDXGIFormat(&map, DXGI_FORMAT_UNKNOWN, GL_NONE, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_A8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
+ AddDXGIFormat(&map, DXGI_FORMAT_B8G8R8A8_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_SNORM, GL_SIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_SNORM, GL_SIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SNORM, GL_SIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SNORM, GL_SIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SNORM, GL_SIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SNORM, GL_SIGNED_NORMALIZED, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_UINT, GL_UNSIGNED_INT, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_SINT, GL_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_SINT, GL_INT, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R10G10B10A2_UINT, GL_UNSIGNED_INT, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_2>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_FLOAT, GL_FLOAT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_3>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R9G9B9E5_SHAREDEXP, GL_FLOAT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R11G11B10_FLOAT, GL_FLOAT, RequiresFeatureLevel<D3D_FEATURE_LEVEL_10_0>);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R8_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R8G8B8A8_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R16G16B16A16_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G32B32A32_TYPELESS, GL_NONE, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_R24G8_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R24_UNORM_X8_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32G8X24_TYPELESS, GL_NONE, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS, GL_NONE, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_D16_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_D24_UNORM_S8_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT_S8X24_UINT, GL_UNSIGNED_INT, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_D32_FLOAT, GL_FLOAT, NeverSupported);
+
+ AddDXGIFormat(&map, DXGI_FORMAT_BC1_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_BC2_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_BC3_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+
+ // B5G6R5 in D3D11 is treated the same as R5G6B5 in D3D9, so reuse the R5G6B5 functions used by the D3D9 renderer.
+ // The same applies to B4G4R4A4 and B5G5R5A1 with A4R4G4B4 and A1R5G5B5 respectively.
+ AddDXGIFormat(&map, DXGI_FORMAT_B5G6R5_UNORM, GL_UNSIGNED_NORMALIZED, RequiresFeatureLevel<D3D_FEATURE_LEVEL_9_1>);
+ AddDXGIFormat(&map, DXGI_FORMAT_B4G4R4A4_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+ AddDXGIFormat(&map, DXGI_FORMAT_B5G5R5A1_UNORM, GL_UNSIGNED_NORMALIZED, NeverSupported);
+ // clang-format on
+
+ return map;
+}
+
+const DXGIFormat &GetDXGIFormatInfo(DXGI_FORMAT format)
+{
+ static const DXGIFormatInfoMap infoMap = BuildDXGIFormatInfoMap();
+ DXGIFormatInfoMap::const_iterator iter = infoMap.find(format);
+ if (iter != infoMap.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ static DXGIFormat defaultInfo;
+ return defaultInfo;
+ }
}
DXGIFormatSize::DXGIFormatSize(GLuint pixelBits, GLuint blockWidth, GLuint blockHeight)
@@ -199,214 +516,117 @@ const DXGIFormatSize &GetDXGIFormatSizeInfo(DXGI_FORMAT format)
}
}
-constexpr VertexFormat::VertexFormat()
- : conversionType(VERTEX_CONVERT_NONE), nativeFormat(DXGI_FORMAT_UNKNOWN), copyFunction(NULL)
+typedef std::map<gl::VertexFormatType, VertexFormat> D3D11VertexFormatInfoMap;
+typedef std::pair<gl::VertexFormatType, VertexFormat> D3D11VertexFormatPair;
+
+VertexFormat::VertexFormat()
+ : conversionType(VERTEX_CONVERT_NONE),
+ nativeFormat(DXGI_FORMAT_UNKNOWN),
+ copyFunction(NULL)
+{
+}
+
+VertexFormat::VertexFormat(VertexConversionType conversionTypeIn,
+ DXGI_FORMAT nativeFormatIn,
+ VertexCopyFunction copyFunctionIn)
+ : conversionType(conversionTypeIn),
+ nativeFormat(nativeFormatIn),
+ copyFunction(copyFunctionIn)
{
}
-constexpr VertexFormat::VertexFormat(VertexConversionType conversionTypeIn,
- DXGI_FORMAT nativeFormatIn,
- VertexCopyFunction copyFunctionIn)
- : conversionType(conversionTypeIn), nativeFormat(nativeFormatIn), copyFunction(copyFunctionIn)
+static void AddVertexFormatInfo(D3D11VertexFormatInfoMap *map,
+ GLenum inputType,
+ GLboolean normalized,
+ GLuint componentCount,
+ VertexConversionType conversionType,
+ DXGI_FORMAT nativeFormat,
+ VertexCopyFunction copyFunction)
{
+ gl::VertexFormatType formatType = gl::GetVertexFormatType(inputType, normalized, componentCount, false);
+
+ VertexFormat info;
+ info.conversionType = conversionType;
+ info.nativeFormat = nativeFormat;
+ info.copyFunction = copyFunction;
+
+ map->insert(D3D11VertexFormatPair(formatType, info));
}
-const VertexFormat *GetVertexFormatInfo_FL_9_3(gl::VertexFormatType vertexFormatType)
+static D3D11VertexFormatInfoMap BuildD3D11_FL9_3VertexFormatInfoOverrideMap()
{
- // D3D11 Feature Level 9_3 doesn't support as many formats for vertex buffer resource as Feature
- // Level 10_0+.
+ // D3D11 Feature Level 9_3 doesn't support as many formats for vertex buffer resource as Feature Level 10_0+.
// http://msdn.microsoft.com/en-us/library/windows/desktop/ff471324(v=vs.85).aspx
- switch (vertexFormatType)
- {
- // GL_BYTE -- unnormalized
- case gl::VERTEX_FORMAT_SBYTE1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
- &Copy8SintTo16SintVertexData<1, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
- &Copy8SintTo16SintVertexData<2, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
- &Copy8SintTo16SintVertexData<3, 4>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
- &Copy8SintTo16SintVertexData<4, 4>);
- return &info;
- }
+ D3D11VertexFormatInfoMap map;
- // GL_BYTE -- normalized
- case gl::VERTEX_FORMAT_SBYTE1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
- &Copy8SnormTo16SnormVertexData<1, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
- &Copy8SnormTo16SnormVertexData<2, 2>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
- &Copy8SnormTo16SnormVertexData<3, 4>);
- return &info;
- }
- case gl::VERTEX_FORMAT_SBYTE4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
- &Copy8SnormTo16SnormVertexData<4, 4>);
- return &info;
- }
+ // GL_BYTE -- unnormalized
+ AddVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 1, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT, &Copy8SintTo16SintVertexData<1, 2>);
+ AddVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 2, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT, &Copy8SintTo16SintVertexData<2, 2>);
+ AddVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 3, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT, &Copy8SintTo16SintVertexData<3, 4>);
+ AddVertexFormatInfo(&map, GL_BYTE, GL_FALSE, 4, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT, &Copy8SintTo16SintVertexData<4, 4>);
- // GL_UNSIGNED_BYTE -- un-normalized
- // NOTE: 3 and 4 component unnormalized GL_UNSIGNED_BYTE should use the default format
- // table.
- case gl::VERTEX_FORMAT_UBYTE1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 1, 4, 1>);
- return &info;
- }
- case gl::VERTEX_FORMAT_UBYTE2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 2, 4, 1>);
- return &info;
- }
+ // GL_BYTE -- normalized
+ AddVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM, &Copy8SnormTo16SnormVertexData<1, 2>);
+ AddVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 2, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM, &Copy8SnormTo16SnormVertexData<2, 2>);
+ AddVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM, &Copy8SnormTo16SnormVertexData<3, 4>);
+ AddVertexFormatInfo(&map, GL_BYTE, GL_TRUE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM, &Copy8SnormTo16SnormVertexData<4, 4>);
- // GL_UNSIGNED_BYTE -- normalized
- // NOTE: 3 and 4 component normalized GL_UNSIGNED_BYTE should use the default format table.
+ // GL_UNSIGNED_BYTE -- unnormalized
+ AddVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_FALSE, 1, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT, &CopyNativeVertexData<GLubyte, 1, 4, 1>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_FALSE, 2, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT, &CopyNativeVertexData<GLubyte, 2, 4, 1>);
+ // NOTE: 3 and 4 component unnormalized GL_UNSIGNED_BYTE should use the default format table.
- // GL_UNSIGNED_BYTE -- normalized
- case gl::VERTEX_FORMAT_UBYTE1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
- &CopyNativeVertexData<GLubyte, 1, 4, UINT8_MAX>);
- return &info;
- }
- case gl::VERTEX_FORMAT_UBYTE2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
- &CopyNativeVertexData<GLubyte, 2, 4, UINT8_MAX>);
- return &info;
- }
+ // GL_UNSIGNED_BYTE -- normalized
+ AddVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_TRUE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM, &CopyNativeVertexData<GLubyte, 1, 4, UINT8_MAX>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_BYTE, GL_TRUE, 2, VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM, &CopyNativeVertexData<GLubyte, 2, 4, UINT8_MAX>);
+ // NOTE: 3 and 4 component normalized GL_UNSIGNED_BYTE should use the default format table.
- // GL_SHORT -- un-normalized
- // NOTE: 2, 3 and 4 component unnormalized GL_SHORT should use the default format table.
- case gl::VERTEX_FORMAT_SSHORT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT,
- &CopyNativeVertexData<GLshort, 1, 2, 0>);
- return &info;
- }
+ // GL_SHORT -- unnormalized
+ AddVertexFormatInfo(&map, GL_SHORT, GL_FALSE, 1, VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16_SINT, &CopyNativeVertexData<GLshort, 1, 2, 0>);
+ // NOTE: 2, 3 and 4 component unnormalized GL_SHORT should use the default format table.
- // GL_SHORT -- normalized
- // NOTE: 2, 3 and 4 component normalized GL_SHORT should use the default format table.
- case gl::VERTEX_FORMAT_SSHORT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM,
- &CopyNativeVertexData<GLshort, 1, 2, 0>);
- return &info;
- }
+ // GL_SHORT -- normalized
+ AddVertexFormatInfo(&map, GL_SHORT, GL_TRUE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16_SNORM, &CopyNativeVertexData<GLshort, 1, 2, 0>);
+ // NOTE: 2, 3 and 4 component normalized GL_SHORT should use the default format table.
- // GL_UNSIGNED_SHORT -- un-normalized
- case gl::VERTEX_FORMAT_USHORT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 1, 2, false>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT2:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 2, 2, false>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT3:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLushort, 3, 3, false>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT4:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyTo32FVertexData<GLushort, 4, 4, false>);
- return &info;
- }
+ // GL_UNSIGNED_SHORT -- unnormalized
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &CopyTo32FVertexData<GLushort, 1, 2, false>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 2, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &CopyTo32FVertexData<GLushort, 2, 2, false>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &CopyTo32FVertexData<GLushort, 3, 3, false>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_FALSE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &CopyTo32FVertexData<GLushort, 4, 4, false>);
- // GL_UNSIGNED_SHORT -- normalized
- case gl::VERTEX_FORMAT_USHORT1_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 1, 2, true>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT2_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLushort, 2, 2, true>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT3_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLushort, 3, 3, true>);
- return &info;
- }
- case gl::VERTEX_FORMAT_USHORT4_NORM:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyTo32FVertexData<GLushort, 4, 4, true>);
- return &info;
- }
+ // GL_UNSIGNED_SHORT -- normalized
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &CopyTo32FVertexData<GLushort, 1, 2, true>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 2, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &CopyTo32FVertexData<GLushort, 2, 2, true>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 3, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &CopyTo32FVertexData<GLushort, 3, 3, true>);
+ AddVertexFormatInfo(&map, GL_UNSIGNED_SHORT, GL_TRUE, 4, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &CopyTo32FVertexData<GLushort, 4, 4, true>);
- // GL_FIXED
- // TODO: Add test to verify that this works correctly.
- // NOTE: 2, 3 and 4 component GL_FIXED should use the default format table.
- case gl::VERTEX_FORMAT_FIXED1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &Copy32FixedTo32FVertexData<1, 2>);
- return &info;
- }
+ // GL_FIXED
+ // TODO: Add test to verify that this works correctly.
+ AddVertexFormatInfo(&map, GL_FIXED, GL_FALSE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &Copy32FixedTo32FVertexData<1, 2>);
+ // NOTE: 2, 3 and 4 component GL_FIXED should use the default format table.
- // GL_FLOAT
- // TODO: Add test to verify that this works correctly.
- // NOTE: 2, 3 and 4 component GL_FLOAT should use the default format table.
- case gl::VERTEX_FORMAT_FLOAT1:
- {
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyNativeVertexData<GLfloat, 1, 2, 0>);
- return &info;
- }
+ // GL_FLOAT
+ // TODO: Add test to verify that this works correctly.
+ AddVertexFormatInfo(&map, GL_FLOAT, GL_FALSE, 1, VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &CopyNativeVertexData<GLfloat, 1, 2, 0>);
+ // NOTE: 2, 3 and 4 component GL_FLOAT should use the default format table.
- default:
- return nullptr;
- }
+ return map;
}
const VertexFormat &GetVertexFormatInfo(gl::VertexFormatType vertexFormatType, D3D_FEATURE_LEVEL featureLevel)
{
if (featureLevel == D3D_FEATURE_LEVEL_9_3)
{
- const VertexFormat *result = GetVertexFormatInfo_FL_9_3(vertexFormatType);
- if (result)
+ static const D3D11VertexFormatInfoMap vertexFormatMapFL9_3Override =
+ BuildD3D11_FL9_3VertexFormatInfoOverrideMap();
+
+ // First see if the format has a special mapping for FL9_3
+ auto iter = vertexFormatMapFL9_3Override.find(vertexFormatType);
+ if (iter != vertexFormatMapFL9_3Override.end())
{
- return *result;
+ return iter->second;
}
}
@@ -419,418 +639,357 @@ const VertexFormat &GetVertexFormatInfo(gl::VertexFormatType vertexFormatType, D
// GL_BYTE -- un-normalized
case gl::VERTEX_FORMAT_SBYTE1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_SINT,
- &CopyNativeVertexData<GLbyte, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_SINT, &CopyNativeVertexData<GLbyte, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_SINT,
- &CopyNativeVertexData<GLbyte, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_SINT, &CopyNativeVertexData<GLbyte, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_SINT, &CopyNativeVertexData<GLbyte, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_SINT, &CopyNativeVertexData<GLbyte, 4, 4, 0>);
return info;
}
// GL_BYTE -- normalized
case gl::VERTEX_FORMAT_SBYTE1_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SNORM,
- &CopyNativeVertexData<GLbyte, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SNORM, &CopyNativeVertexData<GLbyte, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE2_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SNORM,
- &CopyNativeVertexData<GLbyte, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SNORM, &CopyNativeVertexData<GLbyte, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE3_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SNORM,
- &CopyNativeVertexData<GLbyte, 3, 4, INT8_MAX>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SNORM, &CopyNativeVertexData<GLbyte, 3, 4, INT8_MAX>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE4_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SNORM,
- &CopyNativeVertexData<GLbyte, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SNORM, &CopyNativeVertexData<GLbyte, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_BYTE -- un-normalized
case gl::VERTEX_FORMAT_UBYTE1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_UINT,
- &CopyNativeVertexData<GLubyte, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8_UINT, &CopyNativeVertexData<GLubyte, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_UINT,
- &CopyNativeVertexData<GLubyte, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8_UINT, &CopyNativeVertexData<GLubyte, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R8G8B8A8_UINT, &CopyNativeVertexData<GLubyte, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R8G8B8A8_UINT, &CopyNativeVertexData<GLubyte, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_BYTE -- normalized
case gl::VERTEX_FORMAT_UBYTE1_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UNORM,
- &CopyNativeVertexData<GLubyte, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UNORM, &CopyNativeVertexData<GLubyte, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE2_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UNORM,
- &CopyNativeVertexData<GLubyte, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UNORM, &CopyNativeVertexData<GLubyte, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE3_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM,
- &CopyNativeVertexData<GLubyte, 3, 4, UINT8_MAX>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UNORM, &CopyNativeVertexData<GLubyte, 3, 4, UINT8_MAX>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE4_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UNORM,
- &CopyNativeVertexData<GLubyte, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UNORM, &CopyNativeVertexData<GLubyte, 4, 4, 0>);
return info;
}
// GL_SHORT -- un-normalized
case gl::VERTEX_FORMAT_SSHORT1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_SINT,
- &CopyNativeVertexData<GLshort, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_SINT, &CopyNativeVertexData<GLshort, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_SINT,
- &CopyNativeVertexData<GLshort, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_SINT, &CopyNativeVertexData<GLshort, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_SINT, &CopyNativeVertexData<GLshort, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_SINT, &CopyNativeVertexData<GLshort, 4, 4, 0>);
return info;
}
// GL_SHORT -- normalized
case gl::VERTEX_FORMAT_SSHORT1_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SNORM,
- &CopyNativeVertexData<GLshort, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SNORM, &CopyNativeVertexData<GLshort, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT2_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SNORM,
- &CopyNativeVertexData<GLshort, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SNORM, &CopyNativeVertexData<GLshort, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT3_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM,
- &CopyNativeVertexData<GLshort, 3, 4, INT16_MAX>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SNORM, &CopyNativeVertexData<GLshort, 3, 4, INT16_MAX>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT4_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SNORM,
- &CopyNativeVertexData<GLshort, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SNORM, &CopyNativeVertexData<GLshort, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_SHORT -- un-normalized
case gl::VERTEX_FORMAT_USHORT1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_UINT,
- &CopyNativeVertexData<GLushort, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16_UINT, &CopyNativeVertexData<GLushort, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_USHORT2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_UINT,
- &CopyNativeVertexData<GLushort, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16_UINT, &CopyNativeVertexData<GLushort, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_USHORT3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_BOTH, DXGI_FORMAT_R16G16B16A16_UINT, &CopyNativeVertexData<GLushort, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_USHORT4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R16G16B16A16_UINT, &CopyNativeVertexData<GLushort, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_SHORT -- normalized
case gl::VERTEX_FORMAT_USHORT1_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UNORM,
- &CopyNativeVertexData<GLushort, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UNORM, &CopyNativeVertexData<GLushort, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_USHORT2_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UNORM,
- &CopyNativeVertexData<GLushort, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UNORM, &CopyNativeVertexData<GLushort, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_USHORT3_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UNORM,
- &CopyNativeVertexData<GLushort, 3, 4, UINT16_MAX>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UNORM, &CopyNativeVertexData<GLushort, 3, 4, UINT16_MAX>);
return info;
}
case gl::VERTEX_FORMAT_USHORT4_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UNORM,
- &CopyNativeVertexData<GLushort, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UNORM, &CopyNativeVertexData<GLushort, 4, 4, 0>);
return info;
}
// GL_INT -- un-normalized
case gl::VERTEX_FORMAT_SINT1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_SINT,
- &CopyNativeVertexData<GLint, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_SINT, &CopyNativeVertexData<GLint, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SINT2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_SINT,
- &CopyNativeVertexData<GLint, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_SINT, &CopyNativeVertexData<GLint, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SINT3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_SINT,
- &CopyNativeVertexData<GLint, 3, 3, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_SINT, &CopyNativeVertexData<GLint, 3, 3, 0>);
return info;
}
case gl::VERTEX_FORMAT_SINT4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_SINT,
- &CopyNativeVertexData<GLint, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_SINT, &CopyNativeVertexData<GLint, 4, 4, 0>);
return info;
}
// GL_INT -- normalized
case gl::VERTEX_FORMAT_SINT1_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
- &CopyTo32FVertexData<GLint, 1, 1, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT, &CopyTo32FVertexData<GLint, 1, 1, true>);
return info;
}
case gl::VERTEX_FORMAT_SINT2_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLint, 2, 2, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &CopyTo32FVertexData<GLint, 2, 2, true>);
return info;
}
case gl::VERTEX_FORMAT_SINT3_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLint, 3, 3, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &CopyTo32FVertexData<GLint, 3, 3, true>);
return info;
}
case gl::VERTEX_FORMAT_SINT4_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyTo32FVertexData<GLint, 4, 4, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &CopyTo32FVertexData<GLint, 4, 4, true>);
return info;
}
// GL_UNSIGNED_INT -- un-normalized
case gl::VERTEX_FORMAT_UINT1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_UINT,
- &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32_UINT, &CopyNativeVertexData<GLuint, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_UINT2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_UINT,
- &CopyNativeVertexData<GLuint, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32_UINT, &CopyNativeVertexData<GLuint, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_UINT3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_UINT,
- &CopyNativeVertexData<GLuint, 3, 3, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32_UINT, &CopyNativeVertexData<GLuint, 3, 3, 0>);
return info;
}
case gl::VERTEX_FORMAT_UINT4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_UINT,
- &CopyNativeVertexData<GLuint, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_GPU, DXGI_FORMAT_R32G32B32A32_UINT, &CopyNativeVertexData<GLuint, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_INT -- normalized
case gl::VERTEX_FORMAT_UINT1_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
- &CopyTo32FVertexData<GLuint, 1, 1, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
+ &CopyTo32FVertexData<GLuint, 1, 1, true>);
return info;
}
case gl::VERTEX_FORMAT_UINT2_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &CopyTo32FVertexData<GLuint, 2, 2, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
+ &CopyTo32FVertexData<GLuint, 2, 2, true>);
return info;
}
case gl::VERTEX_FORMAT_UINT3_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyTo32FVertexData<GLuint, 3, 3, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &CopyTo32FVertexData<GLuint, 3, 3, true>);
return info;
}
case gl::VERTEX_FORMAT_UINT4_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyTo32FVertexData<GLuint, 4, 4, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
+ &CopyTo32FVertexData<GLuint, 4, 4, true>);
return info;
}
// GL_FIXED
case gl::VERTEX_FORMAT_FIXED1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT,
- &Copy32FixedTo32FVertexData<1, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32_FLOAT, &Copy32FixedTo32FVertexData<1, 1>);
return info;
}
case gl::VERTEX_FORMAT_FIXED2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT,
- &Copy32FixedTo32FVertexData<2, 2>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32_FLOAT, &Copy32FixedTo32FVertexData<2, 2>);
return info;
}
case gl::VERTEX_FORMAT_FIXED3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT,
- &Copy32FixedTo32FVertexData<3, 3>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32_FLOAT, &Copy32FixedTo32FVertexData<3, 3>);
return info;
}
case gl::VERTEX_FORMAT_FIXED4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &Copy32FixedTo32FVertexData<4, 4>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &Copy32FixedTo32FVertexData<4, 4>);
return info;
}
// GL_HALF_FLOAT
case gl::VERTEX_FORMAT_HALF1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_FLOAT,
- &CopyNativeVertexData<GLhalf, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_FLOAT, &CopyNativeVertexData<GLhalf, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_HALF2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_FLOAT,
- &CopyNativeVertexData<GLhalf, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_FLOAT, &CopyNativeVertexData<GLhalf, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_HALF3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_FLOAT,
- &CopyNativeVertexData<GLhalf, 3, 4, gl::Float16One>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_FLOAT, &CopyNativeVertexData<GLhalf, 3, 4, gl::Float16One>);
return info;
}
case gl::VERTEX_FORMAT_HALF4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_FLOAT,
- &CopyNativeVertexData<GLhalf, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_FLOAT, &CopyNativeVertexData<GLhalf, 4, 4, 0>);
return info;
}
// GL_FLOAT
case gl::VERTEX_FORMAT_FLOAT1:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT,
- &CopyNativeVertexData<GLfloat, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_FLOAT, &CopyNativeVertexData<GLfloat, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_FLOAT2:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT,
- &CopyNativeVertexData<GLfloat, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_FLOAT, &CopyNativeVertexData<GLfloat, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_FLOAT3:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_FLOAT,
- &CopyNativeVertexData<GLfloat, 3, 3, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_FLOAT, &CopyNativeVertexData<GLfloat, 3, 3, 0>);
return info;
}
case gl::VERTEX_FORMAT_FLOAT4:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyNativeVertexData<GLfloat, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_FLOAT, &CopyNativeVertexData<GLfloat, 4, 4, 0>);
return info;
}
// GL_INT_2_10_10_10_REV
case gl::VERTEX_FORMAT_SINT210:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyXYZ10W2ToXYZW32FVertexData<true, false, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &CopyXYZ10W2ToXYZW32FVertexData<true, false, true>);
return info;
}
case gl::VERTEX_FORMAT_SINT210_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyXYZ10W2ToXYZW32FVertexData<true, true, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &CopyXYZ10W2ToXYZW32FVertexData<true, true, true>);
return info;
}
// GL_UNSIGNED_INT_2_10_10_10_REV
case gl::VERTEX_FORMAT_UINT210:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT,
- &CopyXYZ10W2ToXYZW32FVertexData<false, false, true>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R32G32B32A32_FLOAT, &CopyXYZ10W2ToXYZW32FVertexData<false, false, true>);
return info;
}
case gl::VERTEX_FORMAT_UINT210_NORM:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UNORM,
- &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UNORM, &CopyNativeVertexData<GLuint, 1, 1, 0>);
return info;
}
@@ -841,183 +1000,157 @@ const VertexFormat &GetVertexFormatInfo(gl::VertexFormatType vertexFormatType, D
// GL_BYTE
case gl::VERTEX_FORMAT_SBYTE1_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SINT,
- &CopyNativeVertexData<GLbyte, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_SINT, &CopyNativeVertexData<GLbyte, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE2_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SINT,
- &CopyNativeVertexData<GLbyte, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_SINT, &CopyNativeVertexData<GLbyte, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE3_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_SINT, &CopyNativeVertexData<GLbyte, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_SBYTE4_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SINT,
- &CopyNativeVertexData<GLbyte, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_SINT, &CopyNativeVertexData<GLbyte, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_BYTE
case gl::VERTEX_FORMAT_UBYTE1_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UINT,
- &CopyNativeVertexData<GLubyte, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8_UINT, &CopyNativeVertexData<GLubyte, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE2_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UINT,
- &CopyNativeVertexData<GLubyte, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8_UINT, &CopyNativeVertexData<GLubyte, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE3_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R8G8B8A8_UINT, &CopyNativeVertexData<GLubyte, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_UBYTE4_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UINT,
- &CopyNativeVertexData<GLubyte, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R8G8B8A8_UINT, &CopyNativeVertexData<GLubyte, 4, 4, 0>);
return info;
}
// GL_SHORT
case gl::VERTEX_FORMAT_SSHORT1_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SINT,
- &CopyNativeVertexData<GLshort, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_SINT, &CopyNativeVertexData<GLshort, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT2_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SINT,
- &CopyNativeVertexData<GLshort, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_SINT, &CopyNativeVertexData<GLshort, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT3_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT, &CopyNativeVertexData<GLshort, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_SSHORT4_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyNativeVertexData<GLshort, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_SINT, &CopyNativeVertexData<GLshort, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_SHORT
case gl::VERTEX_FORMAT_USHORT1_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UINT,
- &CopyNativeVertexData<GLushort, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16_UINT, &CopyNativeVertexData<GLushort, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_USHORT2_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UINT,
- &CopyNativeVertexData<GLushort, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16_UINT, &CopyNativeVertexData<GLushort, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_USHORT3_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 3, 4, 1>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_UINT, &CopyNativeVertexData<GLushort, 3, 4, 1>);
return info;
}
case gl::VERTEX_FORMAT_USHORT4_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UINT,
- &CopyNativeVertexData<GLushort, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R16G16B16A16_UINT, &CopyNativeVertexData<GLushort, 4, 4, 0>);
return info;
}
// GL_INT
case gl::VERTEX_FORMAT_SINT1_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT,
- &CopyNativeVertexData<GLint, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT, &CopyNativeVertexData<GLint, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_SINT2_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT,
- &CopyNativeVertexData<GLint, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT, &CopyNativeVertexData<GLint, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_SINT3_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT,
- &CopyNativeVertexData<GLint, 3, 3, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT, &CopyNativeVertexData<GLint, 3, 3, 0>);
return info;
}
case gl::VERTEX_FORMAT_SINT4_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT,
- &CopyNativeVertexData<GLint, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT, &CopyNativeVertexData<GLint, 4, 4, 0>);
return info;
}
// GL_UNSIGNED_INT
case gl::VERTEX_FORMAT_UINT1_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT,
- &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32_SINT, &CopyNativeVertexData<GLuint, 1, 1, 0>);
return info;
}
case gl::VERTEX_FORMAT_UINT2_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT,
- &CopyNativeVertexData<GLuint, 2, 2, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32_SINT, &CopyNativeVertexData<GLuint, 2, 2, 0>);
return info;
}
case gl::VERTEX_FORMAT_UINT3_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT,
- &CopyNativeVertexData<GLuint, 3, 3, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32_SINT, &CopyNativeVertexData<GLuint, 3, 3, 0>);
return info;
}
case gl::VERTEX_FORMAT_UINT4_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT,
- &CopyNativeVertexData<GLuint, 4, 4, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R32G32B32A32_SINT, &CopyNativeVertexData<GLuint, 4, 4, 0>);
return info;
}
// GL_INT_2_10_10_10_REV
case gl::VERTEX_FORMAT_SINT210_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT,
- &CopyXYZ10W2ToXYZW32FVertexData<true, true, false>);
+ static const VertexFormat info(VERTEX_CONVERT_CPU, DXGI_FORMAT_R16G16B16A16_SINT, &CopyXYZ10W2ToXYZW32FVertexData<true, true, false>);
return info;
}
// GL_UNSIGNED_INT_2_10_10_10_REV
case gl::VERTEX_FORMAT_UINT210_INT:
{
- static constexpr VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UINT,
- &CopyNativeVertexData<GLuint, 1, 1, 0>);
+ static const VertexFormat info(VERTEX_CONVERT_NONE, DXGI_FORMAT_R10G10B10A2_UINT, &CopyNativeVertexData<GLuint, 1, 1, 0>);
return info;
}
default:
{
- static constexpr VertexFormat info;
+ static const VertexFormat info;
return info;
}
}
}
-} // namespace d3d11
+}
-} // namespace rx
+}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h
index 3a9fd63df..1aa5cc294 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/formatutils11.h
@@ -25,11 +25,31 @@ struct Renderer11DeviceCaps;
namespace d3d11
{
-// A texture might be stored as DXGI_FORMAT_R16_TYPELESS but store integer components,
+typedef bool (*NativeMipmapGenerationSupportFunction)(D3D_FEATURE_LEVEL);
+
+struct DXGIFormat
+{
+ DXGIFormat();
+
+ GLuint redBits;
+ GLuint greenBits;
+ GLuint blueBits;
+ GLuint alphaBits;
+ GLuint sharedBits;
+
+ GLuint depthBits;
+ GLuint stencilBits;
+
+ GLenum componentType;
+
+ NativeMipmapGenerationSupportFunction nativeMipmapSupport;
+};
+
+// This structure is problematic because a resource is associated with multiple DXGI formats.
+// For example, a texture might be stored as DXGI_FORMAT_R16_TYPELESS but store integer components,
// which are accessed through an DXGI_FORMAT_R16_SINT view. It's easy to write code which queries
// information about the wrong format. Therefore, use of this should be avoided where possible.
-
-bool SupportsMipGen(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel);
+const DXGIFormat &GetDXGIFormatInfo(DXGI_FORMAT format);
struct DXGIFormatSize
{
@@ -41,31 +61,22 @@ struct DXGIFormatSize
};
const DXGIFormatSize &GetDXGIFormatSizeInfo(DXGI_FORMAT format);
-struct VertexFormat : angle::NonCopyable
+struct VertexFormat
{
- constexpr VertexFormat();
- constexpr VertexFormat(VertexConversionType conversionType,
- DXGI_FORMAT nativeFormat,
- VertexCopyFunction copyFunction);
+ VertexFormat();
+ VertexFormat(VertexConversionType conversionType,
+ DXGI_FORMAT nativeFormat,
+ VertexCopyFunction copyFunction);
VertexConversionType conversionType;
DXGI_FORMAT nativeFormat;
VertexCopyFunction copyFunction;
};
-
const VertexFormat &GetVertexFormatInfo(gl::VertexFormatType vertexFormatType,
D3D_FEATURE_LEVEL featureLevel);
-// Auto-generated in dxgi_format_map_autogen.cpp.
-GLenum GetComponentType(DXGI_FORMAT dxgiFormat);
-
} // namespace d3d11
-namespace d3d11_angle
-{
-const angle::Format &GetFormat(DXGI_FORMAT dxgiFormat);
-}
-
} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_D3D11_FORMATUTILS11_H_
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py
deleted file mode 100644
index 6c6d1906a..000000000
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_format_table.py
+++ /dev/null
@@ -1,134 +0,0 @@
-#!/usr/bin/python
-# Copyright 2016 The ANGLE Project Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# gen_dxgi_format_table.py:
-# Code generation for DXGI format map.
-
-from datetime import date
-import sys
-
-sys.path.append('../..')
-import angle_format
-
-template_cpp = """// GENERATED FILE - DO NOT EDIT.
-// Generated by {script_name} using data from {data_source_name}.
-//
-// Copyright {copyright_year} The ANGLE Project Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-//
-// DXGI format info:
-// Determining metadata about a DXGI format.
-
-#include "libANGLE/renderer/Format.h"
-
-using namespace angle;
-
-namespace rx
-{{
-
-namespace d3d11
-{{
-
-GLenum GetComponentType(DXGI_FORMAT dxgiFormat)
-{{
- switch (dxgiFormat)
- {{
-{component_type_cases} default:
- break;
- }}
-
- UNREACHABLE();
- return GL_NONE;
-}}
-
-}} // namespace d3d11
-
-namespace d3d11_angle
-{{
-
-const Format &GetFormat(DXGI_FORMAT dxgiFormat)
-{{
- switch (dxgiFormat)
- {{
-{format_cases} default:
- break;
- }}
-
- UNREACHABLE();
- return Format::Get(Format::ID::NONE);
-}}
-
-}} // namespace d3d11_angle
-
-}} // namespace rx
-"""
-
-template_format_case = """ case DXGI_FORMAT_{dxgi_format}:
- return {result};
-"""
-
-template_undefined_case = """ case DXGI_FORMAT_{dxgi_format}:
- break;
-"""
-
-def format_case(dxgi_format, result):
- return template_format_case.format(
- dxgi_format = dxgi_format,
- result = result)
-
-def undefined_case(dxgi_format):
- return template_undefined_case.format(dxgi_format = dxgi_format)
-
-component_cases = ""
-format_cases = ""
-
-input_data = 'dxgi_format_data.json'
-
-dxgi_map = angle_format.load_json(input_data)
-
-types = {
- 'SNORM': 'GL_SIGNED_NORMALIZED',
- 'UNORM': 'GL_UNSIGNED_NORMALIZED',
- 'SINT': 'GL_INT',
- 'UINT': 'GL_UNSIGNED_INT',
- 'FLOAT': 'GL_FLOAT',
- 'SHAREDEXP': 'GL_FLOAT'
-}
-
-angle_to_gl = angle_format.load_inverse_table('../../angle_format_map.json')
-all_angle = angle_to_gl.keys()
-
-for dxgi_format, angle_format in sorted(dxgi_map.iteritems()):
-
- found = [ctype in dxgi_format for ctype in types.keys()]
- count = reduce((lambda a, b: int(a) + int(b)), found)
-
- component_type = 'GL_NONE'
-
- if count == 1:
- gltype = next(gltype for ctype, gltype in types.iteritems() if ctype in dxgi_format)
- component_cases += format_case(dxgi_format, gltype)
- else:
- component_cases += undefined_case(dxgi_format)
-
- if angle_format == "":
- angle_format = dxgi_format
-
- if angle_format in all_angle:
- angle_format = "Format::Get(Format::ID::" + angle_format + ")"
- format_cases += format_case(dxgi_format, angle_format)
- else:
- format_cases += undefined_case(dxgi_format)
-
-with open('dxgi_format_map_autogen.cpp', 'wt') as out_file:
- output_cpp = template_cpp.format(
- script_name = sys.argv[0],
- data_source_name = input_data,
- copyright_year = date.today().year,
- component_type_cases = component_cases,
- format_cases = format_cases)
- out_file.write(output_cpp)
- out_file.close()
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_support_tables.py b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_support_tables.py
index dba583f1e..21b22803b 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_support_tables.py
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_dxgi_support_tables.py
@@ -46,38 +46,25 @@ namespace d3d11
#define {prefix}RT D3D11_FORMAT_SUPPORT_RENDER_TARGET
#define {prefix}MS D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET
#define {prefix}DS D3D11_FORMAT_SUPPORT_DEPTH_STENCIL
-#define {prefix}MIPGEN D3D11_FORMAT_SUPPORT_MIP_AUTOGEN
namespace
{{
const DXGISupport &GetDefaultSupport()
{{
- static UINT AllSupportFlags =
- D3D11_FORMAT_SUPPORT_TEXTURE2D | D3D11_FORMAT_SUPPORT_TEXTURE3D |
- D3D11_FORMAT_SUPPORT_TEXTURECUBE | D3D11_FORMAT_SUPPORT_SHADER_SAMPLE |
- D3D11_FORMAT_SUPPORT_RENDER_TARGET | D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET |
- D3D11_FORMAT_SUPPORT_DEPTH_STENCIL | D3D11_FORMAT_SUPPORT_MIP_AUTOGEN;
+ static UINT AllSupportFlags = D3D11_FORMAT_SUPPORT_TEXTURE2D |
+ D3D11_FORMAT_SUPPORT_TEXTURE3D |
+ D3D11_FORMAT_SUPPORT_TEXTURECUBE |
+ D3D11_FORMAT_SUPPORT_SHADER_SAMPLE |
+ D3D11_FORMAT_SUPPORT_RENDER_TARGET |
+ D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET |
+ D3D11_FORMAT_SUPPORT_DEPTH_STENCIL;
static const DXGISupport defaultSupport(0, 0, AllSupportFlags);
return defaultSupport;
}}
-const DXGISupport &GetDXGISupport_9_3(DXGI_FORMAT dxgiFormat)
-{{
- // clang-format off
- switch (dxgiFormat)
- {{
-{table_data_9_3}
- default:
- UNREACHABLE();
- return GetDefaultSupport();
- }}
- // clang-format on
-}}
-
const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
{{
- // clang-format off
switch (dxgiFormat)
{{
{table_data_10_0}
@@ -85,12 +72,10 @@ const DXGISupport &GetDXGISupport_10_0(DXGI_FORMAT dxgiFormat)
UNREACHABLE();
return GetDefaultSupport();
}}
- // clang-format on
}}
const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
{{
- // clang-format off
switch (dxgiFormat)
{{
{table_data_10_1}
@@ -98,12 +83,10 @@ const DXGISupport &GetDXGISupport_10_1(DXGI_FORMAT dxgiFormat)
UNREACHABLE();
return GetDefaultSupport();
}}
- // clang-format on
}}
const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
{{
- // clang-format off
switch (dxgiFormat)
{{
{table_data_11_0}
@@ -111,7 +94,6 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
UNREACHABLE();
return GetDefaultSupport();
}}
- // clang-format on
}}
}}
@@ -123,14 +105,11 @@ const DXGISupport &GetDXGISupport_11_0(DXGI_FORMAT dxgiFormat)
#undef {prefix}RT
#undef {prefix}MS
#undef {prefix}DS
-#undef {prefix}MIPGEN
const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL featureLevel)
{{
switch (featureLevel)
{{
- case D3D_FEATURE_LEVEL_9_3:
- return GetDXGISupport_9_3(dxgiFormat);
case D3D_FEATURE_LEVEL_10_0:
return GetDXGISupport_10_0(dxgiFormat);
case D3D_FEATURE_LEVEL_10_1:
@@ -150,7 +129,7 @@ const DXGISupport &GetDXGISupport(DXGI_FORMAT dxgiFormat, D3D_FEATURE_LEVEL feat
table_init = ""
def do_format(format_data):
- table_data = {'9_3': '', '10_0': '', '10_1': '', '11_0': ''}
+ table_data = {'10_0': '', '10_1': '', '11_0': ''}
json_flag_to_d3d = {
'texture2D': macro_prefix + '2D',
@@ -159,8 +138,7 @@ def do_format(format_data):
'shaderSample': macro_prefix + 'SAMPLE',
'renderTarget': macro_prefix + 'RT',
'multisampleRT': macro_prefix + 'MS',
- 'depthStencil': macro_prefix + 'DS',
- 'mipAutoGen': macro_prefix + 'MIPGEN'
+ 'depthStencil': macro_prefix + 'DS'
}
for format_name, format_support in sorted(format_data.iteritems()):
@@ -168,9 +146,6 @@ def do_format(format_data):
always_supported = set()
never_supported = set()
optionally_supported = set()
- fl_9_3_supported = set()
- fl_9_3_check = set()
- fl_10_0_supported = set()
fl_10_1_supported = set()
fl_11_0_supported = set()
fl_11_0_check = set()
@@ -188,7 +163,8 @@ def do_format(format_data):
elif support == 'never':
never_supported.update(d3d_flag)
elif support == '10_0':
- fl_10_0_supported.update(d3d_flag)
+ # TODO(jmadill): FL 9_3 handling
+ always_supported.update(d3d_flag)
elif support == '10_1':
fl_10_1_supported.update(d3d_flag)
elif support == '11_0':
@@ -205,33 +181,21 @@ def do_format(format_data):
fl_10_0_check_11_0_supported.update(d3d_flag)
elif support == '11_0check':
fl_11_0_check.update(d3d_flag)
- elif support == '9_3always_10_0check11_0always':
- fl_9_3_supported.update(d3d_flag)
- fl_10_0_check_11_0_supported.update(d3d_flag)
- elif support == '9_3check_10_0always':
- fl_9_3_check.update(d3d_flag)
- fl_10_0_supported.update(d3d_flag)
else:
print("Data specification error: " + support)
sys.exit(1)
- for feature_level in ['9_3', '10_0', '10_1', '11_0']:
+ for feature_level in ['10_0', '10_1', '11_0']:
always_for_fl = always_supported
optional_for_fl = optionally_supported
- if feature_level == '9_3':
- always_for_fl = fl_9_3_supported.union(always_for_fl)
- optional_for_fl = fl_9_3_check.union(optional_for_fl)
- elif feature_level == '10_0':
- always_for_fl = fl_10_0_supported.union(always_for_fl)
+ if feature_level == '10_0':
optional_for_fl = fl_10_0_check_10_1_supported.union(optional_for_fl)
optional_for_fl = fl_10_0_check_11_0_supported.union(optional_for_fl)
- elif feature_level == '10_1':
- always_for_fl = fl_10_0_supported.union(always_for_fl)
+ if feature_level == '10_1':
always_for_fl = fl_10_1_supported.union(always_for_fl)
always_for_fl = fl_10_0_check_10_1_supported.union(always_for_fl)
optional_for_fl = fl_10_0_check_11_0_supported.union(optional_for_fl)
elif feature_level == '11_0':
- always_for_fl = fl_10_0_supported.union(always_for_fl)
always_for_fl = fl_10_0_check_10_1_supported.union(always_for_fl)
always_for_fl = fl_10_0_check_11_0_supported.union(always_for_fl)
always_for_fl = fl_10_1_supported.union(always_for_fl)
@@ -254,8 +218,7 @@ def do_format(format_data):
return table_data
def join_table_data(table_data_1, table_data_2):
- return {'9_3': table_data_1['9_3'] + table_data_2['9_3'],
- '10_0': table_data_1['10_0'] + table_data_2['10_0'],
+ return {'10_0': table_data_1['10_0'] + table_data_2['10_0'],
'10_1': table_data_1['10_1'] + table_data_2['10_1'],
'11_0': table_data_1['11_0'] + table_data_2['11_0']}
@@ -264,13 +227,12 @@ with open('dxgi_support_data.json') as dxgi_file:
dxgi_file.close()
json_data = json.loads(file_data)
- table_data = {'9_3': '', '10_0': '', '10_1': '', '11_0': ''}
+ table_data = {'10_0': '', '10_1': '', '11_0': ''}
for format_data in json_data:
table_data = join_table_data(table_data, do_format(format_data))
out_data = template.format(prefix=macro_prefix,
- table_data_9_3=table_data['9_3'],
table_data_10_0=table_data['10_0'],
table_data_10_1=table_data['10_1'],
table_data_11_0=table_data['11_0'])
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py
index 3c4b228e4..981a77f51 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py
@@ -19,7 +19,7 @@ sys.path.append('../..')
import angle_format
template_texture_format_table_autogen_cpp = """// GENERATED FILE - DO NOT EDIT.
-// Generated by {script_name} using data from {data_source_name}
+// Generated by gen_texture_format_table.py using data from texture_format_data.json
//
// Copyright {copyright_year} The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
@@ -60,7 +60,7 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
// clang-format on
UNREACHABLE();
- static constexpr Format defaultInfo;
+ static const Format defaultInfo;
return defaultInfo;
}}
@@ -216,7 +216,23 @@ def get_blit_srv_format(angle_format):
format_entry_template = """{space}{{
-{space} static constexpr Format info({internalFormat},
+{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 Format info({internalFormat},
{space} angle::Format::ID::{formatName},
{space} {texFormat},
{space} {srvFormat},
@@ -224,22 +240,8 @@ format_entry_template = """{space}{{
{space} {dsvFormat},
{space} {blitSRVFormat},
{space} {swizzleFormat},
-{space} {initializer});
-{space} return info;
-{space}}}
-"""
-
-split_format_entry_template = """{space} {condition}
-{space} {{
-{space} static constexpr Format info({internalFormat},
-{space} angle::Format::ID::{formatName},
-{space} {texFormat},
-{space} {srvFormat},
-{space} {rtvFormat},
-{space} {dsvFormat},
-{space} {blitSRVFormat},
-{space} {swizzleFormat},
-{space} {initializer});
+{space} {initializer},
+{space} deviceCaps);
{space} return info;
{space} }}
"""
@@ -342,19 +344,16 @@ def reject_duplicate_keys(pairs):
return found_keys
json_map = angle_format.load_with_override(os.path.abspath('texture_format_map.json'))
-data_source_name = 'texture_format_data.json'
-with open(data_source_name) as texture_format_json_file:
+with open('texture_format_data.json') as texture_format_json_file:
texture_format_data = texture_format_json_file.read()
texture_format_json_file.close()
json_data = json.loads(texture_format_data, object_pairs_hook=angle_format.reject_duplicate_keys)
angle_format_cases = parse_json_into_switch_angle_format_string(json_map, json_data)
output_cpp = template_texture_format_table_autogen_cpp.format(
- script_name = sys.argv[0],
- copyright_year = date.today().year,
- angle_format_info_cases = angle_format_cases,
- data_source_name = data_source_name)
+ copyright_year=date.today().year,
+ angle_format_info_cases=angle_format_cases)
with open('texture_format_table_autogen.cpp', 'wt') as out_file:
out_file.write(output_cpp)
out_file.close()
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
index 5bb51feca..f7548c4ee 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp
@@ -22,13 +22,219 @@
#include "libANGLE/renderer/d3d/d3d11/texture_format_table.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/d3d/WorkaroundsD3D.h"
-#include "libANGLE/renderer/driver_utils.h"
namespace rx
{
+namespace gl_d3d11
+{
+
+D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha)
+{
+ D3D11_BLEND d3dBlend = D3D11_BLEND_ZERO;
+
+ switch (glBlend)
+ {
+ case GL_ZERO: d3dBlend = D3D11_BLEND_ZERO; break;
+ case GL_ONE: d3dBlend = D3D11_BLEND_ONE; break;
+ case GL_SRC_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_SRC_ALPHA : D3D11_BLEND_SRC_COLOR); break;
+ case GL_ONE_MINUS_SRC_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_INV_SRC_ALPHA : D3D11_BLEND_INV_SRC_COLOR); break;
+ case GL_DST_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_DEST_COLOR); break;
+ case GL_ONE_MINUS_DST_COLOR: d3dBlend = (isAlpha ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_INV_DEST_COLOR); break;
+ case GL_SRC_ALPHA: d3dBlend = D3D11_BLEND_SRC_ALPHA; break;
+ case GL_ONE_MINUS_SRC_ALPHA: d3dBlend = D3D11_BLEND_INV_SRC_ALPHA; break;
+ case GL_DST_ALPHA: d3dBlend = D3D11_BLEND_DEST_ALPHA; break;
+ case GL_ONE_MINUS_DST_ALPHA: d3dBlend = D3D11_BLEND_INV_DEST_ALPHA; break;
+ case GL_CONSTANT_COLOR: d3dBlend = D3D11_BLEND_BLEND_FACTOR; break;
+ case GL_ONE_MINUS_CONSTANT_COLOR: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR; break;
+ case GL_CONSTANT_ALPHA: d3dBlend = D3D11_BLEND_BLEND_FACTOR; break;
+ case GL_ONE_MINUS_CONSTANT_ALPHA: d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR; break;
+ case GL_SRC_ALPHA_SATURATE: d3dBlend = D3D11_BLEND_SRC_ALPHA_SAT; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dBlend;
+}
+
+D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp)
+{
+ D3D11_BLEND_OP d3dBlendOp = D3D11_BLEND_OP_ADD;
+
+ switch (glBlendOp)
+ {
+ case GL_FUNC_ADD: d3dBlendOp = D3D11_BLEND_OP_ADD; break;
+ case GL_FUNC_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_SUBTRACT; break;
+ case GL_FUNC_REVERSE_SUBTRACT: d3dBlendOp = D3D11_BLEND_OP_REV_SUBTRACT; break;
+ case GL_MIN: d3dBlendOp = D3D11_BLEND_OP_MIN; break;
+ case GL_MAX: d3dBlendOp = D3D11_BLEND_OP_MAX; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dBlendOp;
+}
+
+UINT8 ConvertColorMask(bool red, bool green, bool blue, bool alpha)
+{
+ UINT8 mask = 0;
+ if (red)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_RED;
+ }
+ if (green)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_GREEN;
+ }
+ if (blue)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_BLUE;
+ }
+ if (alpha)
+ {
+ mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
+ }
+ return mask;
+}
+
+D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode)
+{
+ D3D11_CULL_MODE cull = D3D11_CULL_NONE;
+
+ if (cullEnabled)
+ {
+ switch (cullMode)
+ {
+ case GL_FRONT: cull = D3D11_CULL_FRONT; break;
+ case GL_BACK: cull = D3D11_CULL_BACK; break;
+ case GL_FRONT_AND_BACK: cull = D3D11_CULL_NONE; break;
+ default: UNREACHABLE();
+ }
+ }
+ else
+ {
+ cull = D3D11_CULL_NONE;
+ }
+
+ return cull;
+}
+
+D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison)
+{
+ D3D11_COMPARISON_FUNC d3dComp = D3D11_COMPARISON_NEVER;
+ switch (comparison)
+ {
+ case GL_NEVER: d3dComp = D3D11_COMPARISON_NEVER; break;
+ case GL_ALWAYS: d3dComp = D3D11_COMPARISON_ALWAYS; break;
+ case GL_LESS: d3dComp = D3D11_COMPARISON_LESS; break;
+ case GL_LEQUAL: d3dComp = D3D11_COMPARISON_LESS_EQUAL; break;
+ case GL_EQUAL: d3dComp = D3D11_COMPARISON_EQUAL; break;
+ case GL_GREATER: d3dComp = D3D11_COMPARISON_GREATER; break;
+ case GL_GEQUAL: d3dComp = D3D11_COMPARISON_GREATER_EQUAL; break;
+ case GL_NOTEQUAL: d3dComp = D3D11_COMPARISON_NOT_EQUAL; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dComp;
+}
+
+D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled)
+{
+ return depthWriteEnabled ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
+}
+
+UINT8 ConvertStencilMask(GLuint stencilmask)
+{
+ return static_cast<UINT8>(stencilmask);
+}
+
+D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp)
+{
+ D3D11_STENCIL_OP d3dStencilOp = D3D11_STENCIL_OP_KEEP;
+
+ switch (stencilOp)
+ {
+ case GL_ZERO: d3dStencilOp = D3D11_STENCIL_OP_ZERO; break;
+ case GL_KEEP: d3dStencilOp = D3D11_STENCIL_OP_KEEP; break;
+ case GL_REPLACE: d3dStencilOp = D3D11_STENCIL_OP_REPLACE; break;
+ case GL_INCR: d3dStencilOp = D3D11_STENCIL_OP_INCR_SAT; break;
+ case GL_DECR: d3dStencilOp = D3D11_STENCIL_OP_DECR_SAT; break;
+ case GL_INVERT: d3dStencilOp = D3D11_STENCIL_OP_INVERT; break;
+ case GL_INCR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_INCR; break;
+ case GL_DECR_WRAP: d3dStencilOp = D3D11_STENCIL_OP_DECR; break;
+ default: UNREACHABLE();
+ }
+
+ return d3dStencilOp;
+}
+
+D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode)
+{
+ bool comparison = comparisonMode != GL_NONE;
+
+ if (maxAnisotropy > 1.0f)
+ {
+ return D3D11_ENCODE_ANISOTROPIC_FILTER(static_cast<D3D11_COMPARISON_FUNC>(comparison));
+ }
+ else
+ {
+ D3D11_FILTER_TYPE dxMin = D3D11_FILTER_TYPE_POINT;
+ D3D11_FILTER_TYPE dxMip = D3D11_FILTER_TYPE_POINT;
+ switch (minFilter)
+ {
+ case GL_NEAREST: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_LINEAR: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_NEAREST_MIPMAP_NEAREST: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_LINEAR_MIPMAP_NEAREST: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_POINT; break;
+ case GL_NEAREST_MIPMAP_LINEAR: dxMin = D3D11_FILTER_TYPE_POINT; dxMip = D3D11_FILTER_TYPE_LINEAR; break;
+ case GL_LINEAR_MIPMAP_LINEAR: dxMin = D3D11_FILTER_TYPE_LINEAR; dxMip = D3D11_FILTER_TYPE_LINEAR; break;
+ default: UNREACHABLE();
+ }
+
+ D3D11_FILTER_TYPE dxMag = D3D11_FILTER_TYPE_POINT;
+ switch (magFilter)
+ {
+ case GL_NEAREST: dxMag = D3D11_FILTER_TYPE_POINT; break;
+ case GL_LINEAR: dxMag = D3D11_FILTER_TYPE_LINEAR; break;
+ default: UNREACHABLE();
+ }
+
+ return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip, static_cast<D3D11_COMPARISON_FUNC>(comparison));
+ }
+}
+
+D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap)
+{
+ switch (wrap)
+ {
+ case GL_REPEAT: return D3D11_TEXTURE_ADDRESS_WRAP;
+ case GL_CLAMP_TO_EDGE: return D3D11_TEXTURE_ADDRESS_CLAMP;
+ case GL_MIRRORED_REPEAT: return D3D11_TEXTURE_ADDRESS_MIRROR;
+ default: UNREACHABLE();
+ }
+
+ return D3D11_TEXTURE_ADDRESS_WRAP;
+}
+
+D3D11_QUERY ConvertQueryType(GLenum queryType)
+{
+ switch (queryType)
+ {
+ case GL_ANY_SAMPLES_PASSED_EXT:
+ case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: return D3D11_QUERY_OCCLUSION;
+ case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: return D3D11_QUERY_SO_STATISTICS;
+ case GL_TIME_ELAPSED_EXT:
+ // Two internal queries are also created for begin/end timestamps
+ return D3D11_QUERY_TIMESTAMP_DISJOINT;
+ case GL_COMMANDS_COMPLETED_CHROMIUM:
+ return D3D11_QUERY_EVENT;
+ default: UNREACHABLE(); return D3D11_QUERY_EVENT;
+ }
+}
+
+} // namespace gl_d3d11
+
namespace d3d11_gl
{
+
namespace
{
@@ -37,7 +243,8 @@ class DXGISupportHelper : angle::NonCopyable
{
public:
DXGISupportHelper(ID3D11Device *device, D3D_FEATURE_LEVEL featureLevel)
- : mDevice(device), mFeatureLevel(featureLevel)
+ : mDevice(device),
+ mFeatureLevel(featureLevel)
{
}
@@ -72,10 +279,72 @@ class DXGISupportHelper : angle::NonCopyable
D3D_FEATURE_LEVEL mFeatureLevel;
};
-gl::TextureCaps GenerateTextureFormatCaps(GLint maxClientVersion,
- GLenum internalFormat,
- ID3D11Device *device,
- const Renderer11DeviceCaps &renderer11DeviceCaps)
+} // anonymous namespace
+
+unsigned int GetReservedVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 0;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 3; // dx_ViewAdjust, dx_ViewCoords and dx_ViewScale
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+unsigned int GetReservedFragmentUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return 0;
+
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 3;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+GLint GetMaximumClientVersion(D3D_FEATURE_LEVEL featureLevel)
+{
+ switch (featureLevel)
+ {
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ return 3;
+
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 2;
+
+ default:
+ UNREACHABLE();
+ return 0;
+ }
+}
+
+static gl::TextureCaps GenerateTextureFormatCaps(GLint maxClientVersion, GLenum internalFormat, ID3D11Device *device, const Renderer11DeviceCaps &renderer11DeviceCaps)
{
gl::TextureCaps textureCaps;
@@ -136,911 +405,661 @@ gl::TextureCaps GenerateTextureFormatCaps(GLint maxClientVersion,
return textureCaps;
}
-bool GetNPOTTextureSupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetNPOTTextureSupport(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return true;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
// From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return false;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return false;
- default:
- UNREACHABLE();
- return false;
+ default: UNREACHABLE(); return false;
}
}
-float GetMaximumAnisotropy(D3D_FEATURE_LEVEL featureLevel)
+static float GetMaximumAnisotropy(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_MAX_MAXANISOTROPY;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_MAX_MAXANISOTROPY;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_MAX_MAXANISOTROPY;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_MAX_MAXANISOTROPY;
// From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- return 16;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2: return 16;
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_DEFAULT_MAX_ANISOTROPY;
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_DEFAULT_MAX_ANISOTROPY;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-bool GetOcclusionQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetOcclusionQuerySupport(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return true;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
- // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
- // ID3D11Device::CreateQuery
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- return true;
- case D3D_FEATURE_LEVEL_9_1:
- return false;
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateQuery
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2: return true;
+ case D3D_FEATURE_LEVEL_9_1: return false;
- default:
- UNREACHABLE();
- return false;
+ default: UNREACHABLE(); return false;
}
}
-bool GetEventQuerySupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetEventQuerySupport(D3D_FEATURE_LEVEL featureLevel)
{
- // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
- // ID3D11Device::CreateQuery
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateQuery
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return true;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return true;
- default:
- UNREACHABLE();
- return false;
+ default: UNREACHABLE(); return false;
}
}
-bool GetInstancingSupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetInstancingSupport(D3D_FEATURE_LEVEL featureLevel)
{
- // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
- // ID3D11Device::CreateInputLayout
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateInputLayout
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return true;
-
- // Feature Level 9_3 supports instancing, but slot 0 in the input layout must not be
- // instanced.
- // D3D9 has a similar restriction, where stream 0 must not be instanced.
- // This restriction can be worked around by remapping any non-instanced slot to slot
- // 0.
- // This works because HLSL uses shader semantics to match the vertex inputs to the
- // elements in the input layout, rather than the slots.
- // Note that we only support instancing via ANGLE_instanced_array on 9_3, since 9_3
- // doesn't support OpenGL ES 3.0
- case D3D_FEATURE_LEVEL_9_3:
- return true;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return false;
+ // Feature Level 9_3 supports instancing, but slot 0 in the input layout must not be instanced.
+ // D3D9 has a similar restriction, where stream 0 must not be instanced.
+ // This restriction can be worked around by remapping any non-instanced slot to slot 0.
+ // This works because HLSL uses shader semantics to match the vertex inputs to the elements in the input layout, rather than the slots.
+ // Note that we only support instancing via ANGLE_instanced_array on 9_3, since 9_3 doesn't support OpenGL ES 3.0
+ case D3D_FEATURE_LEVEL_9_3: return true;
- default:
- UNREACHABLE();
- return false;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return false;
+
+ default: UNREACHABLE(); return false;
}
}
-bool GetFramebufferMultisampleSupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetFramebufferMultisampleSupport(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return true;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return false;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return false;
- default:
- UNREACHABLE();
- return false;
+ default: UNREACHABLE(); return false;
}
}
-bool GetFramebufferBlitSupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetFramebufferBlitSupport(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return true;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return false;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return false;
- default:
- UNREACHABLE();
- return false;
+ default: UNREACHABLE(); return false;
}
}
-bool GetDerivativeInstructionSupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetDerivativeInstructionSupport(D3D_FEATURE_LEVEL featureLevel)
{
- // http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588.aspx states that
- // shader model
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588.aspx states that shader model
// ps_2_x is required for the ddx (and other derivative functions).
- // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx states that
- // feature level
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx states that feature level
// 9.3 supports shader model ps_2_x.
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- case D3D_FEATURE_LEVEL_9_3:
- return true;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return false;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ case D3D_FEATURE_LEVEL_9_3: return true;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return false;
- default:
- UNREACHABLE();
- return false;
+ default: UNREACHABLE(); return false;
}
}
-bool GetShaderTextureLODSupport(D3D_FEATURE_LEVEL featureLevel)
+static bool GetShaderTextureLODSupport(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return true;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return true;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return false;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return false;
- default:
- UNREACHABLE();
- return false;
+ default: UNREACHABLE(); return false;
}
}
-size_t GetMaximumSimultaneousRenderTargets(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumSimultaneousRenderTargets(D3D_FEATURE_LEVEL featureLevel)
{
- // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx
- // ID3D11Device::CreateInputLayout
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx ID3D11Device::CreateInputLayout
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_SIMULTANEOUS_RENDER_TARGET_COUNT;
- case D3D_FEATURE_LEVEL_9_3:
- return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT;
+ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_SIMULTANEOUS_RENDER_TARGET_COUNT;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_SIMULTANEOUS_RENDER_TARGET_COUNT;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximum2DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximum2DTextureSize(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
- case D3D_FEATURE_LEVEL_9_3:
- return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumCubeMapTextureSize(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumCubeMapTextureSize(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_REQ_TEXTURECUBE_DIMENSION;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURECUBE_DIMENSION;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_REQ_TEXTURECUBE_DIMENSION;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURECUBE_DIMENSION;
- case D3D_FEATURE_LEVEL_9_3:
- return D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_REQ_TEXTURECUBE_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURECUBE_DIMENSION;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximum2DTextureArraySize(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximum2DTextureArraySize(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximum3DTextureSize(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximum3DTextureSize(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURE3D_U_V_OR_W_DIMENSION;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumViewportSize(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumViewportSize(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_VIEWPORT_BOUNDS_MAX;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_VIEWPORT_BOUNDS_MAX;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_VIEWPORT_BOUNDS_MAX;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_VIEWPORT_BOUNDS_MAX;
- // No constants for D3D11 Feature Level 9 viewport size limits, use the maximum
- // texture sizes
- case D3D_FEATURE_LEVEL_9_3:
- return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ // No constants for D3D11 Feature Level 9 viewport size limits, use the maximum texture sizes
+ case D3D_FEATURE_LEVEL_9_3: return D3D_FL9_3_REQ_TEXTURE2D_U_OR_V_DIMENSION;
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_REQ_TEXTURE2D_U_OR_V_DIMENSION;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumDrawIndexedIndexCount(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumDrawIndexedIndexCount(D3D_FEATURE_LEVEL featureLevel)
{
- // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since
- // that's what's
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since that's what's
// returned from glGetInteger
- static_assert(D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32,
- "Unexpected D3D11 constant value.");
- static_assert(D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32,
- "Unexpected D3D11 constant value.");
+ static_assert(D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32, "Unexpected D3D11 constant value.");
+ static_assert(D3D10_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP == 32, "Unexpected D3D11 constant value.");
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return std::numeric_limits<GLint>::max();
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return std::numeric_limits<GLint>::max();
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2: return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumDrawVertexCount(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumDrawVertexCount(D3D_FEATURE_LEVEL featureLevel)
{
- // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since
- // that's what's
+ // D3D11 allows up to 2^32 elements, but we report max signed int for convenience since that's what's
// returned from glGetInteger
static_assert(D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32, "Unexpected D3D11 constant value.");
static_assert(D3D10_REQ_DRAW_VERTEX_COUNT_2_TO_EXP == 32, "Unexpected D3D11 constant value.");
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return std::numeric_limits<GLint>::max();
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return std::numeric_limits<GLint>::max();
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
- case D3D_FEATURE_LEVEL_9_1:
- return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2: return D3D_FL9_2_IA_PRIMITIVE_MAX_COUNT;
+ case D3D_FEATURE_LEVEL_9_1: return D3D_FL9_1_IA_PRIMITIVE_MAX_COUNT;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumVertexInputSlots(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumVertexInputSlots(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_STANDARD_VERTEX_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_STANDARD_VERTEX_ELEMENT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- return D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT;
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_STANDARD_VERTEX_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_STANDARD_VERTEX_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_STANDARD_VERTEX_ELEMENT_COUNT;
- // From http://http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx
- // "Max Input Slots"
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 16;
+ // From http://http://msdn.microsoft.com/en-us/library/windows/desktop/ff476876.aspx "Max Input Slots"
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 16;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
- // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
- // ID3D11DeviceContext::VSSetConstantBuffers
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 255 - d3d11_gl::GetReservedVertexUniformVectors(featureLevel);
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx ID3D11DeviceContext::VSSetConstantBuffers
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 255 - d3d11_gl::GetReservedVertexUniformVectors(featureLevel);
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumVertexUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumVertexUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
- d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
- d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
- // Uniform blocks not supported on D3D11 Feature Level 9
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ // Uniform blocks not supported on D3D11 Feature Level 9
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetReservedVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetReservedVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
{
// According to The OpenGL ES Shading Language specifications
// (Language Version 1.00 section 10.16, Language Version 3.10 section 12.21)
// built-in special variables (e.g. gl_FragCoord, or gl_PointCoord)
- // which are statically used in the shader should be included in the variable packing
- // algorithm.
+ // which are statically used in the shader should be included in the variable packing algorithm.
// Therefore, we should not reserve output vectors for them.
switch (featureLevel)
{
- // We must reserve one output vector for dx_Position.
- // We also reserve one for gl_Position, which we unconditionally output on Feature
- // Levels 10_0+,
- // even if it's unused in the shader (e.g. for transform feedback). TODO: This could
- // be improved.
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return 2;
+ // We must reserve one output vector for dx_Position.
+ // We also reserve one for gl_Position, which we unconditionally output on Feature Levels 10_0+,
+ // even if it's unused in the shader (e.g. for transform feedback). TODO: This could be improved.
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return 2;
- // Just reserve dx_Position on Feature Level 9, since we don't ever need to output
- // gl_Position.
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 1;
+ // Just reserve dx_Position on Feature Level 9, since we don't ever need to output gl_Position.
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 1;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumVertexOutputVectors(D3D_FEATURE_LEVEL featureLevel)
{
- static_assert(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT,
- "Unexpected D3D11 constant value.");
+ static_assert(gl::IMPLEMENTATION_MAX_VARYING_VECTORS == D3D11_VS_OUTPUT_REGISTER_COUNT, "Unexpected D3D11 constant value.");
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
- case D3D_FEATURE_LEVEL_10_1:
- return D3D10_1_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_VS_OUTPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
- // Use Shader Model 2.X limits
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 8 - GetReservedVertexOutputVectors(featureLevel);
+ // Use Shader Model 2.X limits
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 8 - GetReservedVertexOutputVectors(featureLevel);
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumVertexTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumVertexTextureUnits(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
- // Vertex textures not supported on D3D11 Feature Level 9 according to
- // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
- // ID3D11DeviceContext::VSSetSamplers and ID3D11DeviceContext::VSSetShaderResources
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ // Vertex textures not supported on D3D11 Feature Level 9 according to
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
+ // ID3D11DeviceContext::VSSetSamplers and ID3D11DeviceContext::VSSetShaderResources
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumPixelUniformVectors(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumPixelUniformVectors(D3D_FEATURE_LEVEL featureLevel)
{
// TODO(geofflang): Remove hard-coded limit once the gl-uniform-arrays test can pass
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return 1024; // D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return 1024; // D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return 1024; // D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return 1024; // D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT;
- // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
- // ID3D11DeviceContext::PSSetConstantBuffers
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 32 - d3d11_gl::GetReservedFragmentUniformVectors(featureLevel);
+ // From http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx ID3D11DeviceContext::PSSetConstantBuffers
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1:
+ return 32 - d3d11_gl::GetReservedFragmentUniformVectors(featureLevel);
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumPixelUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumPixelUniformBlocks(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
- d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
+ return D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
- d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0:
+ return D3D10_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT -
+ d3d11::RESERVED_CONSTANT_BUFFER_SLOT_COUNT;
- // Uniform blocks not supported on D3D11 Feature Level 9
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ // Uniform blocks not supported on D3D11 Feature Level 9
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumPixelInputVectors(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumPixelInputVectors(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_PS_INPUT_REGISTER_COUNT - GetReservedVertexOutputVectors(featureLevel);
- // Use Shader Model 2.X limits
- case D3D_FEATURE_LEVEL_9_3:
- return 8 - GetReservedVertexOutputVectors(featureLevel);
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 8 - GetReservedVertexOutputVectors(featureLevel);
+ // Use Shader Model 2.X limits
+ case D3D_FEATURE_LEVEL_9_3: return 8 - GetReservedVertexOutputVectors(featureLevel);
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 8 - GetReservedVertexOutputVectors(featureLevel);
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumPixelTextureUnits(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumPixelTextureUnits(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_SAMPLER_SLOT_COUNT;
- // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx
- // ID3D11DeviceContext::PSSetShaderResources
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 16;
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/ff476149.aspx ID3D11DeviceContext::PSSetShaderResources
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 16;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-int GetMinimumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+static int GetMinimumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE;
- // Sampling functions with offsets are not available below shader model 4.0.
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ // Sampling functions with offsets are not available below shader model 4.0.
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-int GetMaximumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
+static int GetMaximumTexelOffset(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE;
- // Sampling functions with offsets are not available below shader model 4.0.
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ // Sampling functions with offsets are not available below shader model 4.0.
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumConstantBufferSize(D3D_FEATURE_LEVEL featureLevel)
{
- // Returns a size_t despite the limit being a GLuint64 because size_t is the maximum
- // size of
+ // Returns a size_t despite the limit being a GLuint64 because size_t is the maximum size of
// any buffer that could be allocated.
const size_t bytesPerComponent = 4 * sizeof(float);
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_REQ_CONSTANT_BUFFER_ELEMENT_COUNT * bytesPerComponent;
- // Limits from http://msdn.microsoft.com/en-us/library/windows/desktop/ff476501.aspx
- // remarks section
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 4096 * bytesPerComponent;
+ // Limits from http://msdn.microsoft.com/en-us/library/windows/desktop/ff476501.aspx remarks section
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 4096 * bytesPerComponent;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumStreamOutputBuffers(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumStreamOutputBuffers(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return D3D11_SO_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return D3D11_SO_BUFFER_SLOT_COUNT;
- case D3D_FEATURE_LEVEL_10_1:
- return D3D10_1_SO_BUFFER_SLOT_COUNT;
- case D3D_FEATURE_LEVEL_10_0:
- return D3D10_SO_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_1: return D3D10_1_SO_BUFFER_SLOT_COUNT;
+ case D3D_FEATURE_LEVEL_10_0: return D3D10_SO_BUFFER_SLOT_COUNT;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumStreamOutputInterleavedComponents(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumStreamOutputInterleavedComponents(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return GetMaximumVertexOutputVectors(featureLevel) * 4;
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return GetMaximumVertexOutputVectors(featureLevel) * 4;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
-size_t GetMaximumStreamOutputSeparateComponents(D3D_FEATURE_LEVEL featureLevel)
+static size_t GetMaximumStreamOutputSeparateComponents(D3D_FEATURE_LEVEL featureLevel)
{
switch (featureLevel)
{
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- return GetMaximumStreamOutputInterleavedComponents(featureLevel) /
- GetMaximumStreamOutputBuffers(featureLevel);
-
- // D3D 10 and 10.1 only allow one output per output slot if an output slot other
- // than zero is used.
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return 4;
-
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 0;
-
- default:
- UNREACHABLE();
- return 0;
- }
-}
+ case D3D_FEATURE_LEVEL_11_1:
+ case D3D_FEATURE_LEVEL_11_0: return GetMaximumStreamOutputInterleavedComponents(featureLevel) /
+ GetMaximumStreamOutputBuffers(featureLevel);
-} // anonymous namespace
-unsigned int GetReservedVertexUniformVectors(D3D_FEATURE_LEVEL featureLevel)
-{
- switch (featureLevel)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return 0;
+ // D3D 10 and 10.1 only allow one output per output slot if an output slot other than zero is used.
+ case D3D_FEATURE_LEVEL_10_1:
+ case D3D_FEATURE_LEVEL_10_0: return 4;
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 3; // dx_ViewAdjust, dx_ViewCoords and dx_ViewScale
+ case D3D_FEATURE_LEVEL_9_3:
+ case D3D_FEATURE_LEVEL_9_2:
+ case D3D_FEATURE_LEVEL_9_1: return 0;
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-unsigned int GetReservedFragmentUniformVectors(D3D_FEATURE_LEVEL featureLevel)
-{
- switch (featureLevel)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- case D3D_FEATURE_LEVEL_10_0:
- return 0;
-
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 3;
-
- default:
- UNREACHABLE();
- return 0;
- }
-}
-
-GLint GetMaximumClientVersion(D3D_FEATURE_LEVEL featureLevel)
-{
- switch (featureLevel)
- {
- case D3D_FEATURE_LEVEL_11_1:
- case D3D_FEATURE_LEVEL_11_0:
- case D3D_FEATURE_LEVEL_10_1:
- return 3;
-
- case D3D_FEATURE_LEVEL_10_0:
- case D3D_FEATURE_LEVEL_9_3:
- case D3D_FEATURE_LEVEL_9_2:
- case D3D_FEATURE_LEVEL_9_1:
- return 2;
-
- default:
- UNREACHABLE();
- return 0;
+ default: UNREACHABLE(); return 0;
}
}
@@ -1220,7 +1239,6 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons
extensions->lossyETCDecode = true;
extensions->syncQuery = GetEventQuerySupport(featureLevel);
extensions->copyTexture = true;
- extensions->copyCompressedTexture = true;
// D3D11 Feature Level 10_0+ uses SV_IsFrontFace in HLSL to emulate gl_FrontFacing.
// D3D11 Feature Level 9_3 doesn't support SV_IsFrontFace, and has no equivalent, so can't support gl_FrontFacing.
@@ -1252,336 +1270,6 @@ void GenerateCaps(ID3D11Device *device, ID3D11DeviceContext *deviceContext, cons
} // namespace d3d11_gl
-namespace gl_d3d11
-{
-
-D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha)
-{
- D3D11_BLEND d3dBlend = D3D11_BLEND_ZERO;
-
- switch (glBlend)
- {
- case GL_ZERO:
- d3dBlend = D3D11_BLEND_ZERO;
- break;
- case GL_ONE:
- d3dBlend = D3D11_BLEND_ONE;
- break;
- case GL_SRC_COLOR:
- d3dBlend = (isAlpha ? D3D11_BLEND_SRC_ALPHA : D3D11_BLEND_SRC_COLOR);
- break;
- case GL_ONE_MINUS_SRC_COLOR:
- d3dBlend = (isAlpha ? D3D11_BLEND_INV_SRC_ALPHA : D3D11_BLEND_INV_SRC_COLOR);
- break;
- case GL_DST_COLOR:
- d3dBlend = (isAlpha ? D3D11_BLEND_DEST_ALPHA : D3D11_BLEND_DEST_COLOR);
- break;
- case GL_ONE_MINUS_DST_COLOR:
- d3dBlend = (isAlpha ? D3D11_BLEND_INV_DEST_ALPHA : D3D11_BLEND_INV_DEST_COLOR);
- break;
- case GL_SRC_ALPHA:
- d3dBlend = D3D11_BLEND_SRC_ALPHA;
- break;
- case GL_ONE_MINUS_SRC_ALPHA:
- d3dBlend = D3D11_BLEND_INV_SRC_ALPHA;
- break;
- case GL_DST_ALPHA:
- d3dBlend = D3D11_BLEND_DEST_ALPHA;
- break;
- case GL_ONE_MINUS_DST_ALPHA:
- d3dBlend = D3D11_BLEND_INV_DEST_ALPHA;
- break;
- case GL_CONSTANT_COLOR:
- d3dBlend = D3D11_BLEND_BLEND_FACTOR;
- break;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR;
- break;
- case GL_CONSTANT_ALPHA:
- d3dBlend = D3D11_BLEND_BLEND_FACTOR;
- break;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- d3dBlend = D3D11_BLEND_INV_BLEND_FACTOR;
- break;
- case GL_SRC_ALPHA_SATURATE:
- d3dBlend = D3D11_BLEND_SRC_ALPHA_SAT;
- break;
- default:
- UNREACHABLE();
- }
-
- return d3dBlend;
-}
-
-D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp)
-{
- D3D11_BLEND_OP d3dBlendOp = D3D11_BLEND_OP_ADD;
-
- switch (glBlendOp)
- {
- case GL_FUNC_ADD:
- d3dBlendOp = D3D11_BLEND_OP_ADD;
- break;
- case GL_FUNC_SUBTRACT:
- d3dBlendOp = D3D11_BLEND_OP_SUBTRACT;
- break;
- case GL_FUNC_REVERSE_SUBTRACT:
- d3dBlendOp = D3D11_BLEND_OP_REV_SUBTRACT;
- break;
- case GL_MIN:
- d3dBlendOp = D3D11_BLEND_OP_MIN;
- break;
- case GL_MAX:
- d3dBlendOp = D3D11_BLEND_OP_MAX;
- break;
- default:
- UNREACHABLE();
- }
-
- return d3dBlendOp;
-}
-
-UINT8 ConvertColorMask(bool red, bool green, bool blue, bool alpha)
-{
- UINT8 mask = 0;
- if (red)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_RED;
- }
- if (green)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_GREEN;
- }
- if (blue)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_BLUE;
- }
- if (alpha)
- {
- mask |= D3D11_COLOR_WRITE_ENABLE_ALPHA;
- }
- return mask;
-}
-
-D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode)
-{
- D3D11_CULL_MODE cull = D3D11_CULL_NONE;
-
- if (cullEnabled)
- {
- switch (cullMode)
- {
- case GL_FRONT:
- cull = D3D11_CULL_FRONT;
- break;
- case GL_BACK:
- cull = D3D11_CULL_BACK;
- break;
- case GL_FRONT_AND_BACK:
- cull = D3D11_CULL_NONE;
- break;
- default:
- UNREACHABLE();
- }
- }
- else
- {
- cull = D3D11_CULL_NONE;
- }
-
- return cull;
-}
-
-D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison)
-{
- D3D11_COMPARISON_FUNC d3dComp = D3D11_COMPARISON_NEVER;
- switch (comparison)
- {
- case GL_NEVER:
- d3dComp = D3D11_COMPARISON_NEVER;
- break;
- case GL_ALWAYS:
- d3dComp = D3D11_COMPARISON_ALWAYS;
- break;
- case GL_LESS:
- d3dComp = D3D11_COMPARISON_LESS;
- break;
- case GL_LEQUAL:
- d3dComp = D3D11_COMPARISON_LESS_EQUAL;
- break;
- case GL_EQUAL:
- d3dComp = D3D11_COMPARISON_EQUAL;
- break;
- case GL_GREATER:
- d3dComp = D3D11_COMPARISON_GREATER;
- break;
- case GL_GEQUAL:
- d3dComp = D3D11_COMPARISON_GREATER_EQUAL;
- break;
- case GL_NOTEQUAL:
- d3dComp = D3D11_COMPARISON_NOT_EQUAL;
- break;
- default:
- UNREACHABLE();
- }
-
- return d3dComp;
-}
-
-D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled)
-{
- return depthWriteEnabled ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
-}
-
-UINT8 ConvertStencilMask(GLuint stencilmask)
-{
- return static_cast<UINT8>(stencilmask);
-}
-
-D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp)
-{
- D3D11_STENCIL_OP d3dStencilOp = D3D11_STENCIL_OP_KEEP;
-
- switch (stencilOp)
- {
- case GL_ZERO:
- d3dStencilOp = D3D11_STENCIL_OP_ZERO;
- break;
- case GL_KEEP:
- d3dStencilOp = D3D11_STENCIL_OP_KEEP;
- break;
- case GL_REPLACE:
- d3dStencilOp = D3D11_STENCIL_OP_REPLACE;
- break;
- case GL_INCR:
- d3dStencilOp = D3D11_STENCIL_OP_INCR_SAT;
- break;
- case GL_DECR:
- d3dStencilOp = D3D11_STENCIL_OP_DECR_SAT;
- break;
- case GL_INVERT:
- d3dStencilOp = D3D11_STENCIL_OP_INVERT;
- break;
- case GL_INCR_WRAP:
- d3dStencilOp = D3D11_STENCIL_OP_INCR;
- break;
- case GL_DECR_WRAP:
- d3dStencilOp = D3D11_STENCIL_OP_DECR;
- break;
- default:
- UNREACHABLE();
- }
-
- return d3dStencilOp;
-}
-
-D3D11_FILTER ConvertFilter(GLenum minFilter,
- GLenum magFilter,
- float maxAnisotropy,
- GLenum comparisonMode)
-{
- bool comparison = comparisonMode != GL_NONE;
-
- if (maxAnisotropy > 1.0f)
- {
- return D3D11_ENCODE_ANISOTROPIC_FILTER(static_cast<D3D11_COMPARISON_FUNC>(comparison));
- }
- else
- {
- D3D11_FILTER_TYPE dxMin = D3D11_FILTER_TYPE_POINT;
- D3D11_FILTER_TYPE dxMip = D3D11_FILTER_TYPE_POINT;
- switch (minFilter)
- {
- case GL_NEAREST:
- dxMin = D3D11_FILTER_TYPE_POINT;
- dxMip = D3D11_FILTER_TYPE_POINT;
- break;
- case GL_LINEAR:
- dxMin = D3D11_FILTER_TYPE_LINEAR;
- dxMip = D3D11_FILTER_TYPE_POINT;
- break;
- case GL_NEAREST_MIPMAP_NEAREST:
- dxMin = D3D11_FILTER_TYPE_POINT;
- dxMip = D3D11_FILTER_TYPE_POINT;
- break;
- case GL_LINEAR_MIPMAP_NEAREST:
- dxMin = D3D11_FILTER_TYPE_LINEAR;
- dxMip = D3D11_FILTER_TYPE_POINT;
- break;
- case GL_NEAREST_MIPMAP_LINEAR:
- dxMin = D3D11_FILTER_TYPE_POINT;
- dxMip = D3D11_FILTER_TYPE_LINEAR;
- break;
- case GL_LINEAR_MIPMAP_LINEAR:
- dxMin = D3D11_FILTER_TYPE_LINEAR;
- dxMip = D3D11_FILTER_TYPE_LINEAR;
- break;
- default:
- UNREACHABLE();
- }
-
- D3D11_FILTER_TYPE dxMag = D3D11_FILTER_TYPE_POINT;
- switch (magFilter)
- {
- case GL_NEAREST:
- dxMag = D3D11_FILTER_TYPE_POINT;
- break;
- case GL_LINEAR:
- dxMag = D3D11_FILTER_TYPE_LINEAR;
- break;
- default:
- UNREACHABLE();
- }
-
- return D3D11_ENCODE_BASIC_FILTER(dxMin, dxMag, dxMip,
- static_cast<D3D11_COMPARISON_FUNC>(comparison));
- }
-}
-
-D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap)
-{
- switch (wrap)
- {
- case GL_REPEAT:
- return D3D11_TEXTURE_ADDRESS_WRAP;
- case GL_CLAMP_TO_EDGE:
- return D3D11_TEXTURE_ADDRESS_CLAMP;
- case GL_MIRRORED_REPEAT:
- return D3D11_TEXTURE_ADDRESS_MIRROR;
- default:
- UNREACHABLE();
- }
-
- return D3D11_TEXTURE_ADDRESS_WRAP;
-}
-
-UINT ConvertMaxAnisotropy(float maxAnisotropy, D3D_FEATURE_LEVEL featureLevel)
-{
- return static_cast<UINT>(std::min(maxAnisotropy, d3d11_gl::GetMaximumAnisotropy(featureLevel)));
-}
-
-D3D11_QUERY ConvertQueryType(GLenum queryType)
-{
- switch (queryType)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- return D3D11_QUERY_OCCLUSION;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- return D3D11_QUERY_SO_STATISTICS;
- case GL_TIME_ELAPSED_EXT:
- // Two internal queries are also created for begin/end timestamps
- return D3D11_QUERY_TIMESTAMP_DISJOINT;
- case GL_COMMANDS_COMPLETED_CHROMIUM:
- return D3D11_QUERY_EVENT;
- default:
- UNREACHABLE();
- return D3D11_QUERY_EVENT;
- }
-}
-
-} // namespace gl_d3d11
-
namespace d3d11
{
@@ -1791,6 +1479,7 @@ ID3D11InputLayout *LazyInputLayout::resolve(ID3D11Device *device)
device->CreateInputLayout(&mInputDesc[0], static_cast<UINT>(mInputDesc.size()),
mByteCode, mByteCodeLen, &mResource);
ASSERT(SUCCEEDED(result));
+ UNUSED_ASSERTION_VARIABLE(result);
d3d11::SetDebugName(mResource, mDebugName);
}
@@ -1810,6 +1499,7 @@ ID3D11BlendState *LazyBlendState::resolve(ID3D11Device *device)
{
HRESULT result = device->CreateBlendState(&mDesc, &mResource);
ASSERT(SUCCEEDED(result));
+ UNUSED_ASSERTION_VARIABLE(result);
d3d11::SetDebugName(mResource, mDebugName);
}
@@ -1828,7 +1518,7 @@ WorkaroundsD3D GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps,
workarounds.useInstancedPointSpriteEmulation = is9_3;
// TODO(jmadill): Narrow problematic driver range.
- if (IsNvidia(adapterDesc.VendorId))
+ if (adapterDesc.VendorId == VENDOR_ID_NVIDIA)
{
if (deviceCaps.driverVersion.valid())
{
@@ -1847,32 +1537,11 @@ WorkaroundsD3D GenerateWorkarounds(const Renderer11DeviceCaps &deviceCaps,
// TODO(jmadill): Disable workaround when we have a fixed compiler DLL.
workarounds.expandIntegerPowExpressions = true;
- workarounds.flushAfterEndingTransformFeedback = IsNvidia(adapterDesc.VendorId);
- workarounds.getDimensionsIgnoresBaseLevel = IsNvidia(adapterDesc.VendorId);
-
- workarounds.preAddTexelFetchOffsets = IsIntel(adapterDesc.VendorId);
- workarounds.disableB5G6R5Support = IsIntel(adapterDesc.VendorId);
- workarounds.rewriteUnaryMinusOperator =
- IsIntel(adapterDesc.VendorId) &&
- (IsBroadwell(adapterDesc.DeviceId) || IsHaswell(adapterDesc.DeviceId));
- workarounds.emulateIsnanFloat =
- IsIntel(adapterDesc.VendorId) && IsSkylake(adapterDesc.DeviceId);
- workarounds.callClearTwice =
- IsIntel(adapterDesc.VendorId) && IsSkylake(adapterDesc.DeviceId);
-
- // TODO(jmadill): Disable when we have a fixed driver version.
- workarounds.emulateTinyStencilTextures = IsAMD(adapterDesc.VendorId);
-
- // The tiny stencil texture workaround involves using CopySubresource or UpdateSubresource on a
- // depth stencil texture. This is not allowed until feature level 10.1 but since it is not
- // possible to support ES3 on these devices, there is no need for the workaround to begin with
- // (anglebug.com/1572).
- if (deviceCaps.featureLevel < D3D_FEATURE_LEVEL_10_1)
- {
- workarounds.emulateTinyStencilTextures = false;
- }
+ workarounds.flushAfterEndingTransformFeedback = (adapterDesc.VendorId == VENDOR_ID_NVIDIA);
+ workarounds.getDimensionsIgnoresBaseLevel = (adapterDesc.VendorId == VENDOR_ID_NVIDIA);
- workarounds.useSystemMemoryForConstantBuffers = IsIntel(adapterDesc.VendorId);
+ workarounds.preAddTexelFetchOffsets = (adapterDesc.VendorId == VENDOR_ID_INTEL);
+ workarounds.disableB5G6R5Support = (adapterDesc.VendorId == VENDOR_ID_INTEL);
return workarounds;
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h
index 463571cf9..2690fc6f5 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h
@@ -52,7 +52,6 @@ D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy, GLenum comparisonMode);
D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
-UINT ConvertMaxAnisotropy(float maxAnisotropy, D3D_FEATURE_LEVEL featureLevel);
D3D11_QUERY ConvertQueryType(GLenum queryType);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp
index a9dfec56b..6697a1177 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.cpp
@@ -15,19 +15,40 @@ namespace rx
namespace d3d11
{
-const Format &Format::getSwizzleFormat(const Renderer11DeviceCaps &deviceCaps) const
+Format::Format()
+ : internalFormat(GL_NONE),
+ format(angle::Format::Get(angle::Format::ID::NONE)),
+ texFormat(DXGI_FORMAT_UNKNOWN),
+ srvFormat(DXGI_FORMAT_UNKNOWN),
+ rtvFormat(DXGI_FORMAT_UNKNOWN),
+ dsvFormat(DXGI_FORMAT_UNKNOWN),
+ blitSRVFormat(DXGI_FORMAT_UNKNOWN),
+ swizzle(*this),
+ dataInitializerFunction(nullptr)
{
- return (swizzleFormat == internalFormat ? *this : Format::Get(swizzleFormat, deviceCaps));
}
-LoadFunctionMap Format::getLoadFunctions() const
+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),
+ srvFormat(srvFormat),
+ rtvFormat(rtvFormat),
+ dsvFormat(dsvFormat),
+ blitSRVFormat(blitSRVFormat),
+ swizzle(swizzleFormat == internalFormat ? *this : Format::Get(swizzleFormat, deviceCaps)),
+ dataInitializerFunction(internalFormatInitializer),
+ loadFunctions(GetLoadFunctionsMap(internalFormat, formatID))
{
- return GetLoadFunctionsMap(internalFormat, formatID);
-}
-
-const angle::Format &Format::format() const
-{
- return angle::Format::Get(formatID);
}
} // namespace d3d11
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h
index 3be759f19..8e05a2eb8 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table.h
@@ -32,25 +32,22 @@ namespace d3d11
// DSVs given a GL internal format.
struct Format final : angle::NonCopyable
{
- constexpr Format();
- constexpr 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);
+ 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);
- const Format &getSwizzleFormat(const Renderer11DeviceCaps &deviceCaps) const;
- LoadFunctionMap getLoadFunctions() const;
- const angle::Format &format() const;
-
GLenum internalFormat;
- angle::Format::ID formatID;
+ const angle::Format &format;
DXGI_FORMAT texFormat;
DXGI_FORMAT srvFormat;
@@ -59,44 +56,12 @@ struct Format final : angle::NonCopyable
DXGI_FORMAT blitSRVFormat;
- GLenum swizzleFormat;
+ const Format &swizzle;
InitializeTextureDataFunction dataInitializerFunction;
-};
-constexpr Format::Format()
- : internalFormat(GL_NONE),
- formatID(angle::Format::ID::NONE),
- texFormat(DXGI_FORMAT_UNKNOWN),
- srvFormat(DXGI_FORMAT_UNKNOWN),
- rtvFormat(DXGI_FORMAT_UNKNOWN),
- dsvFormat(DXGI_FORMAT_UNKNOWN),
- blitSRVFormat(DXGI_FORMAT_UNKNOWN),
- swizzleFormat(GL_NONE),
- dataInitializerFunction(nullptr)
-{
-}
-
-constexpr 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)
- : internalFormat(internalFormat),
- formatID(formatID),
- texFormat(texFormat),
- srvFormat(srvFormat),
- rtvFormat(rtvFormat),
- dsvFormat(dsvFormat),
- blitSRVFormat(blitSRVFormat),
- swizzleFormat(swizzleFormat),
- dataInitializerFunction(internalFormatInitializer)
-{
-}
+ LoadFunctionMap loadFunctions;
+};
} // namespace d3d11
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp
index dd9c8757f..d5eab7bc1 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d11/texture_format_table_autogen.cpp
@@ -35,56 +35,60 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
{
case GL_ALPHA16F_EXT:
{
- static constexpr Format info(GL_ALPHA16F_EXT,
- angle::Format::ID::R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- GL_RGBA16F,
- nullptr);
+ static const Format info(GL_ALPHA16F_EXT,
+ angle::Format::ID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_ALPHA32F_EXT:
{
- static constexpr Format info(GL_ALPHA32F_EXT,
- angle::Format::ID::R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_ALPHA32F_EXT,
+ angle::Format::ID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_ALPHA8_EXT:
{
if (OnlyFL10Plus(deviceCaps))
{
- static constexpr Format info(GL_ALPHA8_EXT,
- angle::Format::ID::A8_UNORM,
- DXGI_FORMAT_A8_UNORM,
- DXGI_FORMAT_A8_UNORM,
- DXGI_FORMAT_A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_A8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_ALPHA8_EXT,
+ angle::Format::ID::A8_UNORM,
+ DXGI_FORMAT_A8_UNORM,
+ DXGI_FORMAT_A8_UNORM,
+ DXGI_FORMAT_A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_A8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_ALPHA8_EXT,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_ALPHA8_EXT,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
}
@@ -92,684 +96,736 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
{
if (SupportsFormat(DXGI_FORMAT_B5G6R5_UNORM, deviceCaps))
{
- static constexpr Format info(GL_BGR565_ANGLEX,
- angle::Format::ID::B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B5G6R5_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_BGR565_ANGLEX,
+ angle::Format::ID::B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_BGR565_ANGLEX,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_BGR565_ANGLEX,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
}
case GL_BGR5_A1_ANGLEX:
{
- static constexpr Format info(GL_BGR5_A1_ANGLEX,
- angle::Format::ID::B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- GL_BGRA8_EXT,
- nullptr);
+ static const Format info(GL_BGR5_A1_ANGLEX,
+ angle::Format::ID::B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ GL_BGRA8_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_BGRA4_ANGLEX:
{
- static constexpr Format info(GL_BGRA4_ANGLEX,
- angle::Format::ID::B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- GL_BGRA8_EXT,
- nullptr);
+ static const Format info(GL_BGRA4_ANGLEX,
+ angle::Format::ID::B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ GL_BGRA8_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_BGRA8_EXT:
{
- static constexpr Format info(GL_BGRA8_EXT,
- angle::Format::ID::B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B8G8R8A8_UNORM,
- GL_BGRA8_EXT,
- nullptr);
+ static const Format info(GL_BGRA8_EXT,
+ angle::Format::ID::B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B8G8R8A8_UNORM,
+ GL_BGRA8_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_R11_EAC:
{
- static constexpr Format info(GL_COMPRESSED_R11_EAC,
- angle::Format::ID::R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_R11_EAC,
+ angle::Format::ID::R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RG11_EAC:
{
- static constexpr Format info(GL_COMPRESSED_RG11_EAC,
- angle::Format::ID::R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_RG11_EAC,
+ angle::Format::ID::R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGB8_ETC2:
{
- static constexpr Format info(GL_COMPRESSED_RGB8_ETC2,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_COMPRESSED_RGB8_ETC2,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
{
- static constexpr Format info(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA8_ETC2_EAC:
{
- static constexpr Format info(GL_COMPRESSED_RGBA8_ETC2_EAC,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA8_ETC2_EAC,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_10x10_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_10x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_10x6_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_10x8_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_12x12_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_4x4_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_5x4_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_5x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_6x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_6x6_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_8x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_8x6_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_ASTC_8x8_KHR:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
- angle::Format::ID::BC1_RGBA_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_BC1_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
+ angle::Format::ID::BC1_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
- angle::Format::ID::BC2_RGBA_UNORM_BLOCK,
- DXGI_FORMAT_BC2_UNORM,
- DXGI_FORMAT_BC2_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_BC2_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
+ angle::Format::ID::BC2_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC2_UNORM,
+ DXGI_FORMAT_BC2_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC2_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
{
- static constexpr Format info(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
- angle::Format::ID::BC3_RGBA_UNORM_BLOCK,
- DXGI_FORMAT_BC3_UNORM,
- DXGI_FORMAT_BC3_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_BC3_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
+ angle::Format::ID::BC3_RGBA_UNORM_BLOCK,
+ DXGI_FORMAT_BC3_UNORM,
+ DXGI_FORMAT_BC3_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC3_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
{
- static constexpr Format info(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
- angle::Format::ID::BC1_RGB_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_BC1_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
+ angle::Format::ID::BC1_RGB_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SIGNED_R11_EAC:
{
- static constexpr Format info(GL_COMPRESSED_SIGNED_R11_EAC,
- angle::Format::ID::R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_SNORM,
- GL_RGBA8_SNORM,
- nullptr);
+ static const Format info(GL_COMPRESSED_SIGNED_R11_EAC,
+ angle::Format::ID::R8_SNORM,
+ DXGI_FORMAT_R8_SNORM,
+ DXGI_FORMAT_R8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SIGNED_RG11_EAC:
{
- static constexpr Format info(GL_COMPRESSED_SIGNED_RG11_EAC,
- angle::Format::ID::R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_SNORM,
- GL_RGBA8_SNORM,
- nullptr);
+ static const Format info(GL_COMPRESSED_SIGNED_RG11_EAC,
+ angle::Format::ID::R8G8_SNORM,
+ DXGI_FORMAT_R8G8_SNORM,
+ DXGI_FORMAT_R8G8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
- angle::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- GL_SRGB8_ALPHA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
+ angle::Format::ID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_ETC2:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_ETC2,
- angle::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- GL_SRGB8_ALPHA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_COMPRESSED_SRGB8_ETC2,
+ angle::Format::ID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
{
- static constexpr Format info(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- angle::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- GL_SRGB8_ALPHA8,
- nullptr);
+ static const Format info(GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
+ angle::Format::ID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_DEPTH24_STENCIL8:
{
if (OnlyFL10Plus(deviceCaps))
{
- static constexpr Format info(GL_DEPTH24_STENCIL8,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH24_STENCIL8,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_DEPTH24_STENCIL8,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH24_STENCIL8,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
}
case GL_DEPTH32F_STENCIL8:
{
- static constexpr Format info(GL_DEPTH32F_STENCIL8,
- angle::Format::ID::D32_FLOAT_S8X24_UINT,
- DXGI_FORMAT_R32G8X24_TYPELESS,
- DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
- DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH32F_STENCIL8,
+ angle::Format::ID::D32_FLOAT_S8X24_UINT,
+ DXGI_FORMAT_R32G8X24_TYPELESS,
+ DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D32_FLOAT_S8X24_UINT,
+ DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_DEPTH_COMPONENT16:
{
if (OnlyFL10Plus(deviceCaps))
{
- static constexpr Format info(GL_DEPTH_COMPONENT16,
- angle::Format::ID::D16_UNORM,
- DXGI_FORMAT_R16_TYPELESS,
- DXGI_FORMAT_R16_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D16_UNORM,
- DXGI_FORMAT_R16_UNORM,
- GL_RGBA16_EXT,
- nullptr);
+ static const Format info(GL_DEPTH_COMPONENT16,
+ angle::Format::ID::D16_UNORM,
+ DXGI_FORMAT_R16_TYPELESS,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_DEPTH_COMPONENT16,
- angle::Format::ID::D16_UNORM,
- DXGI_FORMAT_D16_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D16_UNORM,
- DXGI_FORMAT_UNKNOWN,
- GL_RGBA16_EXT,
- nullptr);
+ static const Format info(GL_DEPTH_COMPONENT16,
+ angle::Format::ID::D16_UNORM,
+ DXGI_FORMAT_D16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA16_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
}
@@ -777,684 +833,736 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
{
if (OnlyFL10Plus(deviceCaps))
{
- static constexpr Format info(GL_DEPTH_COMPONENT24,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH_COMPONENT24,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_DEPTH_COMPONENT24,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH_COMPONENT24,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
}
case GL_DEPTH_COMPONENT32F:
{
- static constexpr Format info(GL_DEPTH_COMPONENT32F,
- angle::Format::ID::D32_FLOAT,
- DXGI_FORMAT_R32_TYPELESS,
- DXGI_FORMAT_R32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D32_FLOAT,
- DXGI_FORMAT_R32_FLOAT,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH_COMPONENT32F,
+ angle::Format::ID::D32_FLOAT,
+ DXGI_FORMAT_R32_TYPELESS,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_DEPTH_COMPONENT32_OES:
{
if (OnlyFL10Plus(deviceCaps))
{
- static constexpr Format info(GL_DEPTH_COMPONENT32_OES,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH_COMPONENT32_OES,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_DEPTH_COMPONENT32_OES,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_DEPTH_COMPONENT32_OES,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
}
case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE:
{
- static constexpr Format info(GL_ETC1_RGB8_LOSSY_DECODE_ANGLE,
- angle::Format::ID::BC1_RGB_UNORM_BLOCK,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_BC1_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_BC1_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_ETC1_RGB8_LOSSY_DECODE_ANGLE,
+ angle::Format::ID::BC1_RGB_UNORM_BLOCK,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_BC1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_BC1_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_ETC1_RGB8_OES:
{
- static constexpr Format info(GL_ETC1_RGB8_OES,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_ETC1_RGB8_OES,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_LUMINANCE16F_EXT:
{
- static constexpr Format info(GL_LUMINANCE16F_EXT,
- angle::Format::ID::R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- GL_RGBA16F,
- Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>);
+ static const Format info(GL_LUMINANCE16F_EXT,
+ angle::Format::ID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>,
+ deviceCaps);
return info;
}
case GL_LUMINANCE32F_EXT:
{
- static constexpr Format info(GL_LUMINANCE32F_EXT,
- angle::Format::ID::R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- GL_RGBA32F,
- Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>);
+ static const Format info(GL_LUMINANCE32F_EXT,
+ angle::Format::ID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>,
+ deviceCaps);
return info;
}
case GL_LUMINANCE8_ALPHA8_EXT:
{
- static constexpr Format info(GL_LUMINANCE8_ALPHA8_EXT,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_LUMINANCE8_ALPHA8_EXT,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_LUMINANCE8_EXT:
{
- static constexpr Format info(GL_LUMINANCE8_EXT,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_LUMINANCE8_EXT,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_LUMINANCE_ALPHA16F_EXT:
{
- static constexpr Format info(GL_LUMINANCE_ALPHA16F_EXT,
- angle::Format::ID::R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- GL_RGBA16F,
- nullptr);
+ static const Format info(GL_LUMINANCE_ALPHA16F_EXT,
+ angle::Format::ID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_LUMINANCE_ALPHA32F_EXT:
{
- static constexpr Format info(GL_LUMINANCE_ALPHA32F_EXT,
- angle::Format::ID::R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_LUMINANCE_ALPHA32F_EXT,
+ angle::Format::ID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_NONE:
{
- static constexpr Format info(GL_NONE,
- angle::Format::ID::NONE,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- GL_NONE,
- nullptr);
+ static const Format info(GL_NONE,
+ angle::Format::ID::NONE,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ GL_NONE,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R11F_G11F_B10F:
{
- static constexpr Format info(GL_R11F_G11F_B10F,
- angle::Format::ID::R11G11B10_FLOAT,
- DXGI_FORMAT_R11G11B10_FLOAT,
- DXGI_FORMAT_R11G11B10_FLOAT,
- DXGI_FORMAT_R11G11B10_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R11G11B10_FLOAT,
- GL_RGBA16F_EXT,
- nullptr);
+ static const Format info(GL_R11F_G11F_B10F,
+ angle::Format::ID::R11G11B10_FLOAT,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R11G11B10_FLOAT,
+ GL_RGBA16F_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R16F:
{
- static constexpr Format info(GL_R16F,
- angle::Format::ID::R16_FLOAT,
- DXGI_FORMAT_R16_FLOAT,
- DXGI_FORMAT_R16_FLOAT,
- DXGI_FORMAT_R16_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16_FLOAT,
- GL_RGBA16F_EXT,
- nullptr);
+ static const Format info(GL_R16F,
+ angle::Format::ID::R16_FLOAT,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_R16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_FLOAT,
+ GL_RGBA16F_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R16I:
{
- static constexpr Format info(GL_R16I,
- angle::Format::ID::R16_SINT,
- DXGI_FORMAT_R16_SINT,
- DXGI_FORMAT_R16_SINT,
- DXGI_FORMAT_R16_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16_SINT,
- GL_RGBA16I,
- nullptr);
+ static const Format info(GL_R16I,
+ angle::Format::ID::R16_SINT,
+ DXGI_FORMAT_R16_SINT,
+ DXGI_FORMAT_R16_SINT,
+ DXGI_FORMAT_R16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_SINT,
+ GL_RGBA16I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R16UI:
{
- static constexpr Format info(GL_R16UI,
- angle::Format::ID::R16_UINT,
- DXGI_FORMAT_R16_UINT,
- DXGI_FORMAT_R16_UINT,
- DXGI_FORMAT_R16_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16_UINT,
- GL_RGBA16I,
- nullptr);
+ static const Format info(GL_R16UI,
+ angle::Format::ID::R16_UINT,
+ DXGI_FORMAT_R16_UINT,
+ DXGI_FORMAT_R16_UINT,
+ DXGI_FORMAT_R16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UINT,
+ GL_RGBA16I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R16_EXT:
{
- static constexpr Format info(GL_R16_EXT,
- angle::Format::ID::R16_UNORM,
- DXGI_FORMAT_R16_UNORM,
- DXGI_FORMAT_R16_UNORM,
- DXGI_FORMAT_R16_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16_UNORM,
- GL_RGBA16_EXT,
- nullptr);
+ static const Format info(GL_R16_EXT,
+ angle::Format::ID::R16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_R16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R16_SNORM_EXT:
{
- static constexpr Format info(GL_R16_SNORM_EXT,
- angle::Format::ID::R16_SNORM,
- DXGI_FORMAT_R16_SNORM,
- DXGI_FORMAT_R16_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16_SNORM,
- GL_RGBA16_SNORM_EXT,
- nullptr);
+ static const Format info(GL_R16_SNORM_EXT,
+ angle::Format::ID::R16_SNORM,
+ DXGI_FORMAT_R16_SNORM,
+ DXGI_FORMAT_R16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R32F:
{
- static constexpr Format info(GL_R32F,
- angle::Format::ID::R32_FLOAT,
- DXGI_FORMAT_R32_FLOAT,
- DXGI_FORMAT_R32_FLOAT,
- DXGI_FORMAT_R32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32_FLOAT,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_R32F,
+ angle::Format::ID::R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_R32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32_FLOAT,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R32I:
{
- static constexpr Format info(GL_R32I,
- angle::Format::ID::R32_SINT,
- DXGI_FORMAT_R32_SINT,
- DXGI_FORMAT_R32_SINT,
- DXGI_FORMAT_R32_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32_SINT,
- GL_RGBA32I,
- nullptr);
+ static const Format info(GL_R32I,
+ angle::Format::ID::R32_SINT,
+ DXGI_FORMAT_R32_SINT,
+ DXGI_FORMAT_R32_SINT,
+ DXGI_FORMAT_R32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32_SINT,
+ GL_RGBA32I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R32UI:
{
- static constexpr Format info(GL_R32UI,
- angle::Format::ID::R32_UINT,
- DXGI_FORMAT_R32_UINT,
- DXGI_FORMAT_R32_UINT,
- DXGI_FORMAT_R32_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32_UINT,
- GL_RGBA32I,
- nullptr);
+ static const Format info(GL_R32UI,
+ angle::Format::ID::R32_UINT,
+ DXGI_FORMAT_R32_UINT,
+ DXGI_FORMAT_R32_UINT,
+ DXGI_FORMAT_R32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32_UINT,
+ GL_RGBA32I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R8:
{
- static constexpr Format info(GL_R8,
- angle::Format::ID::R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_R8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_R8,
+ angle::Format::ID::R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_R8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R8I:
{
- static constexpr Format info(GL_R8I,
- angle::Format::ID::R8_SINT,
- DXGI_FORMAT_R8_SINT,
- DXGI_FORMAT_R8_SINT,
- DXGI_FORMAT_R8_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_SINT,
- GL_RGBA8I,
- nullptr);
+ static const Format info(GL_R8I,
+ angle::Format::ID::R8_SINT,
+ DXGI_FORMAT_R8_SINT,
+ DXGI_FORMAT_R8_SINT,
+ DXGI_FORMAT_R8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_SINT,
+ GL_RGBA8I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R8UI:
{
- static constexpr Format info(GL_R8UI,
- angle::Format::ID::R8_UINT,
- DXGI_FORMAT_R8_UINT,
- DXGI_FORMAT_R8_UINT,
- DXGI_FORMAT_R8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_UINT,
- GL_RGBA8I,
- nullptr);
+ static const Format info(GL_R8UI,
+ angle::Format::ID::R8_UINT,
+ DXGI_FORMAT_R8_UINT,
+ DXGI_FORMAT_R8_UINT,
+ DXGI_FORMAT_R8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_UINT,
+ GL_RGBA8I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_R8_SNORM:
{
- static constexpr Format info(GL_R8_SNORM,
- angle::Format::ID::R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- DXGI_FORMAT_R8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8_SNORM,
- GL_RGBA8_SNORM,
- nullptr);
+ static const Format info(GL_R8_SNORM,
+ angle::Format::ID::R8_SNORM,
+ DXGI_FORMAT_R8_SNORM,
+ DXGI_FORMAT_R8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG16F:
{
- static constexpr Format info(GL_RG16F,
- angle::Format::ID::R16G16_FLOAT,
- DXGI_FORMAT_R16G16_FLOAT,
- DXGI_FORMAT_R16G16_FLOAT,
- DXGI_FORMAT_R16G16_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16_FLOAT,
- GL_RGBA16F_EXT,
- nullptr);
+ static const Format info(GL_RG16F,
+ angle::Format::ID::R16G16_FLOAT,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_R16G16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_FLOAT,
+ GL_RGBA16F_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG16I:
{
- static constexpr Format info(GL_RG16I,
- angle::Format::ID::R16G16_SINT,
- DXGI_FORMAT_R16G16_SINT,
- DXGI_FORMAT_R16G16_SINT,
- DXGI_FORMAT_R16G16_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16_SINT,
- GL_RGBA16I,
- nullptr);
+ static const Format info(GL_RG16I,
+ angle::Format::ID::R16G16_SINT,
+ DXGI_FORMAT_R16G16_SINT,
+ DXGI_FORMAT_R16G16_SINT,
+ DXGI_FORMAT_R16G16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_SINT,
+ GL_RGBA16I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG16UI:
{
- static constexpr Format info(GL_RG16UI,
- angle::Format::ID::R16G16_UINT,
- DXGI_FORMAT_R16G16_UINT,
- DXGI_FORMAT_R16G16_UINT,
- DXGI_FORMAT_R16G16_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16_UINT,
- GL_RGBA16I,
- nullptr);
+ static const Format info(GL_RG16UI,
+ angle::Format::ID::R16G16_UINT,
+ DXGI_FORMAT_R16G16_UINT,
+ DXGI_FORMAT_R16G16_UINT,
+ DXGI_FORMAT_R16G16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UINT,
+ GL_RGBA16I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG16_EXT:
{
- static constexpr Format info(GL_RG16_EXT,
- angle::Format::ID::R16G16_UNORM,
- DXGI_FORMAT_R16G16_UNORM,
- DXGI_FORMAT_R16G16_UNORM,
- DXGI_FORMAT_R16G16_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16_UNORM,
- GL_RGBA16_EXT,
- nullptr);
+ static const Format info(GL_RG16_EXT,
+ angle::Format::ID::R16G16_UNORM,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_R16G16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG16_SNORM_EXT:
{
- static constexpr Format info(GL_RG16_SNORM_EXT,
- angle::Format::ID::R16G16_SNORM,
- DXGI_FORMAT_R16G16_SNORM,
- DXGI_FORMAT_R16G16_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16_SNORM,
- GL_RGBA16_SNORM_EXT,
- nullptr);
+ static const Format info(GL_RG16_SNORM_EXT,
+ angle::Format::ID::R16G16_SNORM,
+ DXGI_FORMAT_R16G16_SNORM,
+ DXGI_FORMAT_R16G16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG32F:
{
- static constexpr Format info(GL_RG32F,
- angle::Format::ID::R32G32_FLOAT,
- DXGI_FORMAT_R32G32_FLOAT,
- DXGI_FORMAT_R32G32_FLOAT,
- DXGI_FORMAT_R32G32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32_FLOAT,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_RG32F,
+ angle::Format::ID::R32G32_FLOAT,
+ DXGI_FORMAT_R32G32_FLOAT,
+ DXGI_FORMAT_R32G32_FLOAT,
+ DXGI_FORMAT_R32G32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_FLOAT,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG32I:
{
- static constexpr Format info(GL_RG32I,
- angle::Format::ID::R32G32_SINT,
- DXGI_FORMAT_R32G32_SINT,
- DXGI_FORMAT_R32G32_SINT,
- DXGI_FORMAT_R32G32_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32_SINT,
- GL_RGBA32I,
- nullptr);
+ static const Format info(GL_RG32I,
+ angle::Format::ID::R32G32_SINT,
+ DXGI_FORMAT_R32G32_SINT,
+ DXGI_FORMAT_R32G32_SINT,
+ DXGI_FORMAT_R32G32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_SINT,
+ GL_RGBA32I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG32UI:
{
- static constexpr Format info(GL_RG32UI,
- angle::Format::ID::R32G32_UINT,
- DXGI_FORMAT_R32G32_UINT,
- DXGI_FORMAT_R32G32_UINT,
- DXGI_FORMAT_R32G32_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32_UINT,
- GL_RGBA32I,
- nullptr);
+ static const Format info(GL_RG32UI,
+ angle::Format::ID::R32G32_UINT,
+ DXGI_FORMAT_R32G32_UINT,
+ DXGI_FORMAT_R32G32_UINT,
+ DXGI_FORMAT_R32G32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32_UINT,
+ GL_RGBA32I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG8:
{
- static constexpr Format info(GL_RG8,
- angle::Format::ID::R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_R8G8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_RG8,
+ angle::Format::ID::R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_R8G8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG8I:
{
- static constexpr Format info(GL_RG8I,
- angle::Format::ID::R8G8_SINT,
- DXGI_FORMAT_R8G8_SINT,
- DXGI_FORMAT_R8G8_SINT,
- DXGI_FORMAT_R8G8_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_SINT,
- GL_RGBA8I,
- nullptr);
+ static const Format info(GL_RG8I,
+ angle::Format::ID::R8G8_SINT,
+ DXGI_FORMAT_R8G8_SINT,
+ DXGI_FORMAT_R8G8_SINT,
+ DXGI_FORMAT_R8G8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_SINT,
+ GL_RGBA8I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG8UI:
{
- static constexpr Format info(GL_RG8UI,
- angle::Format::ID::R8G8_UINT,
- DXGI_FORMAT_R8G8_UINT,
- DXGI_FORMAT_R8G8_UINT,
- DXGI_FORMAT_R8G8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_UINT,
- GL_RGBA8I,
- nullptr);
+ static const Format info(GL_RG8UI,
+ angle::Format::ID::R8G8_UINT,
+ DXGI_FORMAT_R8G8_UINT,
+ DXGI_FORMAT_R8G8_UINT,
+ DXGI_FORMAT_R8G8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_UINT,
+ GL_RGBA8I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RG8_SNORM:
{
- static constexpr Format info(GL_RG8_SNORM,
- angle::Format::ID::R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- DXGI_FORMAT_R8G8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8_SNORM,
- GL_RGBA8_SNORM,
- nullptr);
+ static const Format info(GL_RG8_SNORM,
+ angle::Format::ID::R8G8_SNORM,
+ DXGI_FORMAT_R8G8_SNORM,
+ DXGI_FORMAT_R8G8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGB:
{
- static constexpr Format info(GL_RGB,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_RGB,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_RGB10_A2:
{
- static constexpr Format info(GL_RGB10_A2,
- angle::Format::ID::R10G10B10A2_UNORM,
- DXGI_FORMAT_R10G10B10A2_UNORM,
- DXGI_FORMAT_R10G10B10A2_UNORM,
- DXGI_FORMAT_R10G10B10A2_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R10G10B10A2_UNORM,
- GL_RGBA16_EXT,
- nullptr);
+ static const Format info(GL_RGB10_A2,
+ angle::Format::ID::R10G10B10A2_UNORM,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R10G10B10A2_UNORM,
+ GL_RGBA16_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGB10_A2UI:
{
- static constexpr Format info(GL_RGB10_A2UI,
- angle::Format::ID::R10G10B10A2_UINT,
- DXGI_FORMAT_R10G10B10A2_UINT,
- DXGI_FORMAT_R10G10B10A2_UINT,
- DXGI_FORMAT_R10G10B10A2_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R10G10B10A2_UINT,
- GL_RGBA16I,
- nullptr);
+ static const Format info(GL_RGB10_A2UI,
+ angle::Format::ID::R10G10B10A2_UINT,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R10G10B10A2_UINT,
+ GL_RGBA16I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGB16F:
{
- static constexpr Format info(GL_RGB16F,
- angle::Format::ID::R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- GL_RGBA16F,
- Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>);
+ static const Format info(GL_RGB16F,
+ angle::Format::ID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ Initialize4ComponentData<GLhalf, 0x0000, 0x0000, 0x0000, gl::Float16One>,
+ deviceCaps);
return info;
}
case GL_RGB16I:
{
- static constexpr Format info(GL_RGB16I,
- angle::Format::ID::R16G16B16A16_SINT,
- DXGI_FORMAT_R16G16B16A16_SINT,
- DXGI_FORMAT_R16G16B16A16_SINT,
- DXGI_FORMAT_R16G16B16A16_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_SINT,
- GL_RGBA16I,
- Initialize4ComponentData<GLshort, 0x0000, 0x0000, 0x0000, 0x0001>);
+ static const Format info(GL_RGB16I,
+ angle::Format::ID::R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ GL_RGBA16I,
+ Initialize4ComponentData<GLshort, 0x0000, 0x0000, 0x0000, 0x0001>,
+ deviceCaps);
return info;
}
case GL_RGB16UI:
{
- static constexpr Format info(GL_RGB16UI,
- angle::Format::ID::R16G16B16A16_UINT,
- DXGI_FORMAT_R16G16B16A16_UINT,
- DXGI_FORMAT_R16G16B16A16_UINT,
- DXGI_FORMAT_R16G16B16A16_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_UINT,
- GL_RGBA16UI,
- Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x0001>);
+ static const Format info(GL_RGB16UI,
+ angle::Format::ID::R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ GL_RGBA16UI,
+ Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x0001>,
+ deviceCaps);
return info;
}
case GL_RGB16_EXT:
{
- static constexpr Format info(GL_RGB16_EXT,
- angle::Format::ID::R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- GL_RGBA16_EXT,
- Initialize4ComponentData<GLubyte, 0x0000, 0x0000, 0x0000, 0xFFFF>);
+ static const Format info(GL_RGB16_EXT,
+ angle::Format::ID::R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ GL_RGBA16_EXT,
+ Initialize4ComponentData<GLubyte, 0x0000, 0x0000, 0x0000, 0xFFFF>,
+ deviceCaps);
return info;
}
case GL_RGB16_SNORM_EXT:
{
- static constexpr Format info(GL_RGB16_SNORM_EXT,
- angle::Format::ID::R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- GL_RGBA16_SNORM_EXT,
- Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x7FFF>);
+ static const Format info(GL_RGB16_SNORM_EXT,
+ angle::Format::ID::R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ Initialize4ComponentData<GLushort, 0x0000, 0x0000, 0x0000, 0x7FFF>,
+ deviceCaps);
return info;
}
case GL_RGB32F:
{
- static constexpr Format info(GL_RGB32F,
- angle::Format::ID::R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- GL_RGBA32F,
- Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>);
+ static const Format info(GL_RGB32F,
+ angle::Format::ID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ Initialize4ComponentData<GLfloat, 0x00000000, 0x00000000, 0x00000000, gl::Float32One>,
+ deviceCaps);
return info;
}
case GL_RGB32I:
{
- static constexpr Format info(GL_RGB32I,
- angle::Format::ID::R32G32B32A32_SINT,
- DXGI_FORMAT_R32G32B32A32_SINT,
- DXGI_FORMAT_R32G32B32A32_SINT,
- DXGI_FORMAT_R32G32B32A32_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_SINT,
- GL_RGBA32I,
- Initialize4ComponentData<GLint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>);
+ static const Format info(GL_RGB32I,
+ angle::Format::ID::R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ GL_RGBA32I,
+ Initialize4ComponentData<GLint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>,
+ deviceCaps);
return info;
}
case GL_RGB32UI:
{
- static constexpr Format info(GL_RGB32UI,
- angle::Format::ID::R32G32B32A32_UINT,
- DXGI_FORMAT_R32G32B32A32_UINT,
- DXGI_FORMAT_R32G32B32A32_UINT,
- DXGI_FORMAT_R32G32B32A32_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_UINT,
- GL_RGBA32UI,
- Initialize4ComponentData<GLuint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>);
+ static const Format info(GL_RGB32UI,
+ angle::Format::ID::R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ GL_RGBA32UI,
+ Initialize4ComponentData<GLuint, 0x00000000, 0x00000000, 0x00000000, 0x00000001>,
+ deviceCaps);
return info;
}
case GL_RGB565:
{
if (SupportsFormat(DXGI_FORMAT_B5G6R5_UNORM, deviceCaps))
{
- static constexpr Format info(GL_RGB565,
- angle::Format::ID::B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_B5G6R5_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B5G6R5_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_RGB565,
+ angle::Format::ID::B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G6R5_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_RGB565,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_RGB565,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
}
@@ -1462,34 +1570,21 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
{
if (SupportsFormat(DXGI_FORMAT_B5G5R5A1_UNORM, deviceCaps))
{
- static constexpr Format info(GL_RGB5_A1,
- angle::Format::ID::B5G5R5A1_UNORM,
- DXGI_FORMAT_B5G5R5A1_UNORM,
- DXGI_FORMAT_B5G5R5A1_UNORM,
- DXGI_FORMAT_B5G5R5A1_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B5G5R5A1_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_RGB5_A1,
+ angle::Format::ID::B5G5R5A1_UNORM,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B5G5R5A1_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_RGB5_A1,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- nullptr);
- return info;
- }
- }
- case GL_RGB8:
- {
- static constexpr Format info(GL_RGB8,
+ static const Format info(GL_RGB5_A1,
angle::Format::ID::R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM,
@@ -1497,210 +1592,226 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_R8G8B8A8_UNORM,
GL_RGBA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ nullptr,
+ deviceCaps);
+ return info;
+ }
+ }
+ case GL_RGB8:
+ {
+ static const Format info(GL_RGB8,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_RGB8I:
{
- static constexpr Format info(GL_RGB8I,
- angle::Format::ID::R8G8B8A8_SINT,
- DXGI_FORMAT_R8G8B8A8_SINT,
- DXGI_FORMAT_R8G8B8A8_SINT,
- DXGI_FORMAT_R8G8B8A8_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_SINT,
- GL_RGBA8I,
- Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x01>);
+ static const Format info(GL_RGB8I,
+ angle::Format::ID::R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ GL_RGBA8I,
+ Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x01>,
+ deviceCaps);
return info;
}
case GL_RGB8UI:
{
- static constexpr Format info(GL_RGB8UI,
- angle::Format::ID::R8G8B8A8_UINT,
- DXGI_FORMAT_R8G8B8A8_UINT,
- DXGI_FORMAT_R8G8B8A8_UINT,
- DXGI_FORMAT_R8G8B8A8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UINT,
- GL_RGBA8UI,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0x01>);
+ static const Format info(GL_RGB8UI,
+ angle::Format::ID::R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ GL_RGBA8UI,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0x01>,
+ deviceCaps);
return info;
}
case GL_RGB8_SNORM:
{
- static constexpr Format info(GL_RGB8_SNORM,
- angle::Format::ID::R8G8B8A8_SNORM,
- DXGI_FORMAT_R8G8B8A8_SNORM,
- DXGI_FORMAT_R8G8B8A8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_SNORM,
- GL_RGBA8_SNORM,
- Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x7F>);
+ static const Format info(GL_RGB8_SNORM,
+ angle::Format::ID::R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ GL_RGBA8_SNORM,
+ Initialize4ComponentData<GLbyte, 0x00, 0x00, 0x00, 0x7F>,
+ deviceCaps);
return info;
}
case GL_RGB9_E5:
{
- static constexpr Format info(GL_RGB9_E5,
- angle::Format::ID::R9G9B9E5_SHAREDEXP,
- DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
- DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
- GL_RGBA16F_EXT,
- nullptr);
+ static const Format info(GL_RGB9_E5,
+ angle::Format::ID::R9G9B9E5_SHAREDEXP,
+ DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
+ DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R9G9B9E5_SHAREDEXP,
+ GL_RGBA16F_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA:
{
- static constexpr Format info(GL_RGBA,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- nullptr);
+ static const Format info(GL_RGBA,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA16F:
{
- static constexpr Format info(GL_RGBA16F,
- angle::Format::ID::R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_FLOAT,
- GL_RGBA16F,
- nullptr);
+ static const Format info(GL_RGBA16F,
+ angle::Format::ID::R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_FLOAT,
+ GL_RGBA16F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA16I:
{
- static constexpr Format info(GL_RGBA16I,
- angle::Format::ID::R16G16B16A16_SINT,
- DXGI_FORMAT_R16G16B16A16_SINT,
- DXGI_FORMAT_R16G16B16A16_SINT,
- DXGI_FORMAT_R16G16B16A16_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_SINT,
- GL_RGBA16I,
- nullptr);
+ static const Format info(GL_RGBA16I,
+ angle::Format::ID::R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SINT,
+ GL_RGBA16I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA16UI:
{
- static constexpr Format info(GL_RGBA16UI,
- angle::Format::ID::R16G16B16A16_UINT,
- DXGI_FORMAT_R16G16B16A16_UINT,
- DXGI_FORMAT_R16G16B16A16_UINT,
- DXGI_FORMAT_R16G16B16A16_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_UINT,
- GL_RGBA16UI,
- nullptr);
+ static const Format info(GL_RGBA16UI,
+ angle::Format::ID::R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UINT,
+ GL_RGBA16UI,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA16_EXT:
{
- static constexpr Format info(GL_RGBA16_EXT,
- angle::Format::ID::R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_UNORM,
- GL_RGBA16_EXT,
- nullptr);
+ static const Format info(GL_RGBA16_EXT,
+ angle::Format::ID::R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_UNORM,
+ GL_RGBA16_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA16_SNORM_EXT:
{
- static constexpr Format info(GL_RGBA16_SNORM_EXT,
- angle::Format::ID::R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R16G16B16A16_SNORM,
- GL_RGBA16_SNORM_EXT,
- nullptr);
+ static const Format info(GL_RGBA16_SNORM_EXT,
+ angle::Format::ID::R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R16G16B16A16_SNORM,
+ GL_RGBA16_SNORM_EXT,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA32F:
{
- static constexpr Format info(GL_RGBA32F,
- angle::Format::ID::R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_FLOAT,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_RGBA32F,
+ angle::Format::ID::R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_FLOAT,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA32I:
{
- static constexpr Format info(GL_RGBA32I,
- angle::Format::ID::R32G32B32A32_SINT,
- DXGI_FORMAT_R32G32B32A32_SINT,
- DXGI_FORMAT_R32G32B32A32_SINT,
- DXGI_FORMAT_R32G32B32A32_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_SINT,
- GL_RGBA32I,
- nullptr);
+ static const Format info(GL_RGBA32I,
+ angle::Format::ID::R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_SINT,
+ GL_RGBA32I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA32UI:
{
- static constexpr Format info(GL_RGBA32UI,
- angle::Format::ID::R32G32B32A32_UINT,
- DXGI_FORMAT_R32G32B32A32_UINT,
- DXGI_FORMAT_R32G32B32A32_UINT,
- DXGI_FORMAT_R32G32B32A32_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R32G32B32A32_UINT,
- GL_RGBA32UI,
- nullptr);
+ static const Format info(GL_RGBA32UI,
+ angle::Format::ID::R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R32G32B32A32_UINT,
+ GL_RGBA32UI,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA4:
{
if (SupportsFormat(DXGI_FORMAT_B4G4R4A4_UNORM, deviceCaps))
{
- static constexpr Format info(GL_RGBA4,
- angle::Format::ID::B4G4R4A4_UNORM,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_B4G4R4A4_UNORM,
- GL_RGBA4,
- nullptr);
+ static const Format info(GL_RGBA4,
+ angle::Format::ID::B4G4R4A4_UNORM,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_B4G4R4A4_UNORM,
+ GL_RGBA4,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_RGBA4,
- angle::Format::ID::R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM,
- GL_RGBA8,
- nullptr);
- return info;
- }
- }
- case GL_RGBA8:
- {
- static constexpr Format info(GL_RGBA8,
+ static const Format info(GL_RGBA4,
angle::Format::ID::R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM,
DXGI_FORMAT_R8G8B8A8_UNORM,
@@ -1708,100 +1819,123 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
DXGI_FORMAT_UNKNOWN,
DXGI_FORMAT_R8G8B8A8_UNORM,
GL_RGBA8,
- nullptr);
+ nullptr,
+ deviceCaps);
+ return info;
+ }
+ }
+ case GL_RGBA8:
+ {
+ static const Format info(GL_RGBA8,
+ angle::Format::ID::R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM,
+ GL_RGBA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA8I:
{
- static constexpr Format info(GL_RGBA8I,
- angle::Format::ID::R8G8B8A8_SINT,
- DXGI_FORMAT_R8G8B8A8_SINT,
- DXGI_FORMAT_R8G8B8A8_SINT,
- DXGI_FORMAT_R8G8B8A8_SINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_SINT,
- GL_RGBA8I,
- nullptr);
+ static const Format info(GL_RGBA8I,
+ angle::Format::ID::R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SINT,
+ GL_RGBA8I,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA8UI:
{
- static constexpr Format info(GL_RGBA8UI,
- angle::Format::ID::R8G8B8A8_UINT,
- DXGI_FORMAT_R8G8B8A8_UINT,
- DXGI_FORMAT_R8G8B8A8_UINT,
- DXGI_FORMAT_R8G8B8A8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UINT,
- GL_RGBA8UI,
- nullptr);
+ static const Format info(GL_RGBA8UI,
+ angle::Format::ID::R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UINT,
+ GL_RGBA8UI,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_RGBA8_SNORM:
{
- static constexpr Format info(GL_RGBA8_SNORM,
- angle::Format::ID::R8G8B8A8_SNORM,
- DXGI_FORMAT_R8G8B8A8_SNORM,
- DXGI_FORMAT_R8G8B8A8_SNORM,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_SNORM,
- GL_RGBA8_SNORM,
- nullptr);
+ static const Format info(GL_RGBA8_SNORM,
+ angle::Format::ID::R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_SNORM,
+ GL_RGBA8_SNORM,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_SRGB8:
{
- static constexpr Format info(GL_SRGB8,
- angle::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- GL_SRGB8_ALPHA8,
- Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>);
+ static const Format info(GL_SRGB8,
+ angle::Format::ID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ Initialize4ComponentData<GLubyte, 0x00, 0x00, 0x00, 0xFF>,
+ deviceCaps);
return info;
}
case GL_SRGB8_ALPHA8:
{
- static constexpr Format info(GL_SRGB8_ALPHA8,
- angle::Format::ID::R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
- GL_SRGB8_ALPHA8,
- nullptr);
+ static const Format info(GL_SRGB8_ALPHA8,
+ angle::Format::ID::R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
+ GL_SRGB8_ALPHA8,
+ nullptr,
+ deviceCaps);
return info;
}
case GL_STENCIL_INDEX8:
{
if (OnlyFL10Plus(deviceCaps))
{
- static constexpr Format info(GL_STENCIL_INDEX8,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24G8_TYPELESS,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_STENCIL_INDEX8,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24G8_TYPELESS,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_R24_UNORM_X8_TYPELESS,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
else
{
- static constexpr Format info(GL_STENCIL_INDEX8,
- angle::Format::ID::D24_UNORM_S8_UINT,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_UNKNOWN,
- DXGI_FORMAT_D24_UNORM_S8_UINT,
- DXGI_FORMAT_UNKNOWN,
- GL_RGBA32F,
- nullptr);
+ static const Format info(GL_STENCIL_INDEX8,
+ angle::Format::ID::D24_UNORM_S8_UINT,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_UNKNOWN,
+ DXGI_FORMAT_D24_UNORM_S8_UINT,
+ DXGI_FORMAT_UNKNOWN,
+ GL_RGBA32F,
+ nullptr,
+ deviceCaps);
return info;
}
}
@@ -1812,7 +1946,7 @@ const Format &Format::Get(GLenum internalFormat, const Renderer11DeviceCaps &dev
// clang-format on
UNREACHABLE();
- static constexpr Format defaultInfo;
+ static const Format defaultInfo;
return defaultInfo;
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
index 95320f228..2ac8ee3a2 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp
@@ -145,7 +145,13 @@ gl::Error Blit9::setShader(ShaderId source, const char *profile,
{
const BYTE* shaderCode = g_shaderCode[source];
size_t shaderSize = g_shaderSize[source];
- ANGLE_TRY((mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize, &shader));
+
+ gl::Error error = (mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize, &shader);
+ if (error.isError())
+ {
+ return error;
+ }
+
mCompiledShaders[source] = shader;
}
@@ -184,10 +190,18 @@ RECT Blit9::getSurfaceRect(IDirect3DSurface9 *surface) const
gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
- ANGLE_TRY(initialize());
+ gl::Error error = initialize();
+ if (error.isError())
+ {
+ return error;
+ }
IDirect3DTexture9 *texture = NULL;
- ANGLE_TRY(copySurfaceToTexture(source, getSurfaceRect(source), &texture));
+ error = copySurfaceToTexture(source, getSurfaceRect(source), &texture);
+ if (error.isError())
+ {
+ return error;
+ }
IDirect3DDevice9 *device = mRenderer->getDevice();
@@ -216,13 +230,21 @@ gl::Error Blit9::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, GLint level)
{
- ANGLE_TRY(initialize());
+ gl::Error error = initialize();
+ if (error.isError())
+ {
+ return error;
+ }
const gl::FramebufferAttachment *colorbuffer = framebuffer->getColorbuffer(0);
ASSERT(colorbuffer);
RenderTarget9 *renderTarget9 = nullptr;
- ANGLE_TRY(colorbuffer->getRenderTarget(&renderTarget9));
+ error = colorbuffer->getRenderTarget(&renderTarget9);
+ if (error.isError())
+ {
+ return error;
+ }
ASSERT(renderTarget9);
IDirect3DSurface9 *source = renderTarget9->getSurface();
@@ -230,7 +252,7 @@ gl::Error Blit9::copy2D(const gl::Framebuffer *framebuffer, const RECT &sourceRe
IDirect3DSurface9 *destSurface = NULL;
TextureStorage9 *storage9 = GetAs<TextureStorage9>(storage);
- gl::Error error = storage9->getSurfaceLevel(GL_TEXTURE_2D, level, true, &destSurface);
+ error = storage9->getSurfaceLevel(GL_TEXTURE_2D, level, true, &destSurface);
if (error.isError())
{
SafeRelease(source);
@@ -492,12 +514,9 @@ gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &so
D3DSURFACE_DESC sourceDesc;
surface->GetDesc(&sourceDesc);
- const auto destWidth = sourceRect.right - sourceRect.left;
- const auto destHeight = sourceRect.bottom - sourceRect.top;
-
// Copy the render target into a texture
IDirect3DTexture9 *texture;
- HRESULT result = device->CreateTexture(destWidth, destHeight, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, NULL);
+ HRESULT result = device->CreateTexture(sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, NULL);
if (FAILED(result))
{
@@ -516,40 +535,8 @@ gl::Error Blit9::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &so
}
mRenderer->endScene();
+ result = device->StretchRect(surface, &sourceRect, textureSurface, NULL, D3DTEXF_NONE);
- if (sourceRect.left < sourceDesc.Width && sourceRect.right > 0 &&
- sourceRect.top < sourceDesc.Height && sourceRect.bottom > 0)
- {
- RECT validSourceRect = sourceRect;
- RECT validDestRect = {0, 0, destWidth, destHeight};
-
- if (sourceRect.left < 0) {
- validSourceRect.left += 0 - sourceRect.left;
- validDestRect.left += 0 - sourceRect.left;
- }
-
- if (sourceRect.right > sourceDesc.Width) {
- validSourceRect.right -= sourceRect.right - sourceDesc.Width;
- validDestRect.right -= sourceRect.right - sourceDesc.Width;
- }
-
- if (sourceRect.top < 0) {
- validSourceRect.top += 0 - sourceRect.top;
- validDestRect.top += 0 - sourceRect.top;
- }
-
- if (sourceRect.bottom > sourceDesc.Height) {
- validSourceRect.bottom -= sourceRect.bottom - sourceDesc.Height;
- validDestRect.bottom -= sourceRect.bottom - sourceDesc.Height;
- }
-
- ASSERT(validSourceRect.left < validSourceRect.right);
- ASSERT(validSourceRect.top < validSourceRect.bottom);
- ASSERT(validDestRect.left < validDestRect.right);
- ASSERT(validDestRect.top < validDestRect.bottom);
- result = device->StretchRect(surface, &validSourceRect, textureSurface,
- &validDestRect, D3DTEXF_NONE);
- }
SafeRelease(textureSurface);
if (FAILED(result))
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
index b8abf3845..0ee0d8325 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.cpp
@@ -12,8 +12,9 @@
namespace rx
{
-Buffer9::Buffer9(const gl::BufferState &state, Renderer9 *renderer)
- : BufferD3D(state, renderer), mSize(0)
+Buffer9::Buffer9(Renderer9 *renderer)
+ : BufferD3D(renderer),
+ mSize(0)
{}
Buffer9::~Buffer9()
@@ -21,7 +22,7 @@ Buffer9::~Buffer9()
mSize = 0;
}
-gl::Error Buffer9::setData(GLenum /*target*/, const void *data, size_t size, GLenum usage)
+gl::Error Buffer9::setData(const void* data, size_t size, GLenum usage)
{
if (size > mMemory.size())
{
@@ -50,7 +51,7 @@ gl::Error Buffer9::getData(const uint8_t **outData)
return gl::Error(GL_NO_ERROR);
}
-gl::Error Buffer9::setSubData(GLenum /*target*/, const void *data, size_t size, size_t offset)
+gl::Error Buffer9::setSubData(const void* data, size_t size, size_t offset)
{
if (offset + size > mMemory.size())
{
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
index dd7671827..219f8a658 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Buffer9.h
@@ -20,7 +20,7 @@ class Renderer9;
class Buffer9 : public BufferD3D
{
public:
- Buffer9(const gl::BufferState &state, Renderer9 *renderer);
+ Buffer9(Renderer9 *renderer);
virtual ~Buffer9();
// BufferD3D implementation
@@ -29,16 +29,13 @@ class Buffer9 : public BufferD3D
gl::Error getData(const uint8_t **outData) override;
// BufferImpl implementation
- gl::Error setData(GLenum target, const void *data, size_t size, GLenum usage) override;
- gl::Error setSubData(GLenum target, const void *data, size_t size, size_t offset) override;
- gl::Error copySubData(BufferImpl *source,
- GLintptr sourceOffset,
- GLintptr destOffset,
- GLsizeiptr size) override;
- gl::Error map(GLenum access, GLvoid **mapPtr) override;
- gl::Error mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr) override;
- gl::Error unmap(GLboolean *result) override;
- gl::Error markTransformFeedbackUsage() override;
+ virtual gl::Error setData(const void* data, size_t size, GLenum usage);
+ virtual gl::Error setSubData(const void* data, size_t size, size_t offset);
+ virtual gl::Error copySubData(BufferImpl* source, GLintptr sourceOffset, GLintptr destOffset, GLsizeiptr size);
+ virtual gl::Error map(GLenum access, GLvoid **mapPtr);
+ virtual gl::Error mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr);
+ virtual gl::Error unmap(GLboolean *result);
+ virtual gl::Error markTransformFeedbackUsage();
private:
MemoryBuffer mMemory;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
index c38bc1b11..9b31ab927 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.cpp
@@ -82,9 +82,9 @@ RenderbufferImpl *Context9::createRenderbuffer()
return new RenderbufferD3D(mRenderer);
}
-BufferImpl *Context9::createBuffer(const gl::BufferState &state)
+BufferImpl *Context9::createBuffer()
{
- return new Buffer9(state, mRenderer);
+ return new Buffer9(mRenderer);
}
VertexArrayImpl *Context9::createVertexArray(const gl::VertexArrayState &data)
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h
index aeb18ff5e..7e3492f9a 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Context9.h
@@ -39,7 +39,7 @@ class Context9 : public ContextImpl
RenderbufferImpl *createRenderbuffer() override;
// Buffer creation
- BufferImpl *createBuffer(const gl::BufferState &state) override;
+ BufferImpl *createBuffer() override;
// Vertex Array creation
VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) override;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
index 18e1b3da4..9286d9b0d 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp
@@ -205,7 +205,7 @@ gl::Error Framebuffer9::readPixelsImpl(const gl::Rectangle &area,
packParams.outputPitch = static_cast<GLuint>(outputPitch);
packParams.pack = pack;
- PackPixels(packParams, d3dFormatInfo.info(), inputPitch, source, pixels);
+ PackPixels(packParams, *d3dFormatInfo.info, inputPitch, source, pixels);
systemSurface->UnlockRect();
SafeRelease(systemSurface);
@@ -404,7 +404,7 @@ GLenum Framebuffer9::getRenderTargetImplementationFormat(RenderTargetD3D *render
{
RenderTarget9 *renderTarget9 = GetAs<RenderTarget9>(renderTarget);
const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(renderTarget9->getD3DFormat());
- return d3dFormatInfo.info().glInternalFormat;
+ return d3dFormatInfo.info->glInternalFormat;
}
} // namespace rx
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
index ad2c41584..24c1e9150 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Image9.cpp
@@ -61,7 +61,7 @@ gl::Error Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9
ASSERT(sourceDesc.Height == 1 || sourceDesc.Height / 2 == destDesc.Height);
const d3d9::D3DFormat &d3dFormatInfo = d3d9::GetD3DFormatInfo(sourceDesc.Format);
- ASSERT(d3dFormatInfo.info().mipGenerationFunction != NULL);
+ ASSERT(d3dFormatInfo.info->mipGenerationFunction != NULL);
D3DLOCKED_RECT sourceLocked = {0};
result = sourceSurface->LockRect(&sourceLocked, NULL, D3DLOCK_READONLY);
@@ -85,9 +85,8 @@ gl::Error Image9::generateMip(IDirect3DSurface9 *destSurface, IDirect3DSurface9
ASSERT(sourceData && destData);
- d3dFormatInfo.info().mipGenerationFunction(sourceDesc.Width, sourceDesc.Height, 1, sourceData,
- sourceLocked.Pitch, 0, destData, destLocked.Pitch,
- 0);
+ d3dFormatInfo.info->mipGenerationFunction(sourceDesc.Width, sourceDesc.Height, 1, sourceData,
+ sourceLocked.Pitch, 0, destData, destLocked.Pitch, 0);
destSurface->UnlockRect();
sourceSurface->UnlockRect();
@@ -295,6 +294,7 @@ void Image9::unlock()
if (mSurface)
{
HRESULT result = mSurface->UnlockRect();
+ UNUSED_ASSERTION_VARIABLE(result);
ASSERT(SUCCEEDED(result));
}
}
@@ -475,17 +475,17 @@ gl::Error Image9::copyToSurface(IDirect3DSurface9 *destSurface, const gl::Box &a
// into the target pixel rectangle.
gl::Error Image9::loadData(const gl::Box &area,
const gl::PixelUnpackState &unpack,
- GLenum inputType,
+ GLenum type,
const void *input,
bool applySkipImages)
{
// 3D textures are not supported by the D3D9 backend.
ASSERT(area.z == 0 && area.depth == 1);
- ASSERT(getSizedInputFormat(inputType) == mInternalFormat);
+
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLuint inputRowPitch = 0;
ANGLE_TRY_RESULT(
- formatInfo.computeRowPitch(area.width, unpack.alignment, unpack.rowLength),
+ formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength),
inputRowPitch);
ASSERT(!applySkipImages);
ASSERT(unpack.skipPixels == 0);
@@ -523,10 +523,11 @@ gl::Error Image9::loadCompressedData(const gl::Box &area, const void *input)
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(mInternalFormat);
GLsizei inputRowPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, 1, 0), inputRowPitch);
+ ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch);
GLsizei inputDepthPitch = 0;
- ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, 0, inputDepthPitch),
- inputDepthPitch);
+ ANGLE_TRY_RESULT(
+ formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0, 0),
+ inputDepthPitch);
const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(mInternalFormat);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
index d578d4075..63b33b6f2 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp
@@ -525,7 +525,6 @@ void Renderer9::generateDisplayExtensions(egl::DisplayExtensions *outExtensions)
outExtensions->d3dShareHandleClientBuffer = true;
outExtensions->surfaceD3DTexture2DShareHandle = true;
}
- outExtensions->d3dTextureClientBuffer = true;
outExtensions->querySurfacePointer = true;
outExtensions->windowFixedSize = true;
@@ -673,111 +672,12 @@ NativeWindowD3D *Renderer9::createNativeWindow(EGLNativeWindowType window,
SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation)
{
- return new SwapChain9(this, GetAs<NativeWindow9>(nativeWindow), shareHandle, d3dTexture,
- backBufferFormat, depthBufferFormat, orientation);
-}
-
-egl::Error Renderer9::getD3DTextureInfo(IUnknown *d3dTexture,
- EGLint *width,
- EGLint *height,
- GLenum *fboFormat) const
-{
- IDirect3DTexture9 *texture = nullptr;
- if (FAILED(d3dTexture->QueryInterface(&texture)))
- {
- return egl::Error(EGL_BAD_PARAMETER, "client buffer is not a IDirect3DTexture9");
- }
-
- IDirect3DDevice9 *textureDevice = nullptr;
- texture->GetDevice(&textureDevice);
- if (textureDevice != mDevice)
- {
- SafeRelease(texture);
- return egl::Error(EGL_BAD_PARAMETER, "Texture's device does not match.");
- }
- SafeRelease(textureDevice);
-
- D3DSURFACE_DESC desc;
- texture->GetLevelDesc(0, &desc);
- SafeRelease(texture);
-
- if (width)
- {
- *width = static_cast<EGLint>(desc.Width);
- }
- if (height)
- {
- *height = static_cast<EGLint>(desc.Height);
- }
-
- // From table egl.restrictions in EGL_ANGLE_d3d_texture_client_buffer.
- switch (desc.Format)
- {
- case D3DFMT_R8G8B8:
- case D3DFMT_A8R8G8B8:
- case D3DFMT_A16B16G16R16F:
- case D3DFMT_A32B32G32R32F:
- break;
-
- default:
- return egl::Error(EGL_BAD_PARAMETER, "Unknown client buffer texture format: %u.",
- desc.Format);
- }
-
- if (fboFormat)
- {
- const auto &d3dFormatInfo = d3d9::GetD3DFormatInfo(desc.Format);
- ASSERT(d3dFormatInfo.info().id != angle::Format::ID::NONE);
- *fboFormat = d3dFormatInfo.info().fboImplementationInternalFormat;
- }
-
- return egl::Error(EGL_SUCCESS);
-}
-
-egl::Error Renderer9::validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const
-{
- if (shareHandle == nullptr)
- {
- return egl::Error(EGL_BAD_PARAMETER, "NULL share handle.");
- }
-
- EGLint width = attribs.getAsInt(EGL_WIDTH, 0);
- EGLint height = attribs.getAsInt(EGL_HEIGHT, 0);
- ASSERT(width != 0 && height != 0);
-
- const d3d9::TextureFormat &backBufferd3dFormatInfo =
- d3d9::GetTextureFormatInfo(config->renderTargetFormat);
-
- IDirect3DTexture9 *texture = nullptr;
- HRESULT result = mDevice->CreateTexture(width, height, 1, D3DUSAGE_RENDERTARGET,
- backBufferd3dFormatInfo.texFormat, D3DPOOL_DEFAULT,
- &texture, &shareHandle);
- if (FAILED(result))
- {
- return egl::Error(EGL_BAD_PARAMETER, "Failed to open share handle, result: 0x%X.", result);
- }
-
- DWORD levelCount = texture->GetLevelCount();
-
- D3DSURFACE_DESC desc;
- texture->GetLevelDesc(0, &desc);
- SafeRelease(texture);
-
- if (levelCount != 1 || desc.Width != static_cast<UINT>(width) ||
- desc.Height != static_cast<UINT>(height) ||
- desc.Format != backBufferd3dFormatInfo.texFormat)
- {
- return egl::Error(EGL_BAD_PARAMETER, "Invalid texture parameters in share handle texture.");
- }
-
- return egl::Error(EGL_SUCCESS);
+ return new SwapChain9(this, GetAs<NativeWindow9>(nativeWindow), shareHandle, backBufferFormat,
+ depthBufferFormat, orientation);
}
ContextImpl *Renderer9::createContext(const gl::ContextState &state)
@@ -918,9 +818,7 @@ gl::Error Renderer9::setSamplerState(gl::SamplerType type, int index, gl::Textur
mDevice->SetSamplerState(d3dSampler, D3DSAMP_MIPMAPLODBIAS, static_cast<DWORD>(lodBias));
if (getNativeExtensions().textureFilterAnisotropic)
{
- DWORD maxAnisotropy =
- std::min(mDeviceCaps.MaxAnisotropy, static_cast<DWORD>(samplerState.maxAnisotropy));
- mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, maxAnisotropy);
+ mDevice->SetSamplerState(d3dSampler, D3DSAMP_MAXANISOTROPY, (DWORD)samplerState.maxAnisotropy);
}
}
@@ -1007,18 +905,7 @@ gl::Error Renderer9::updateState(Context9 *context, GLenum drawMode)
setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled());
// Setting blend, depth stencil, and rasterizer states
- // Since framebuffer->getSamples will return the original samples which may be different with
- // the sample counts that we set in render target view, here we use renderTarget->getSamples to
- // get the actual samples.
- GLsizei samples = 0;
- auto firstColorAttachment = framebuffer->getFirstColorbuffer();
- if (firstColorAttachment)
- {
- ASSERT(firstColorAttachment->isAttached());
- RenderTarget9 *renderTarget = nullptr;
- ANGLE_TRY(firstColorAttachment->getRenderTarget(&renderTarget));
- samples = renderTarget->getSamples();
- }
+ int samples = framebuffer->getSamples(data);
gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0);
@@ -1041,18 +928,7 @@ gl::Error Renderer9::setBlendDepthRasterStates(const gl::ContextState &glData, G
const auto &glState = glData.getState();
auto drawFramebuffer = glState.getDrawFramebuffer();
ASSERT(!drawFramebuffer->hasAnyDirtyBit());
- // Since framebuffer->getSamples will return the original samples which may be different with
- // the sample counts that we set in render target view, here we use renderTarget->getSamples to
- // get the actual samples.
- GLsizei samples = 0;
- auto firstColorAttachment = drawFramebuffer->getFirstColorbuffer();
- if (firstColorAttachment)
- {
- ASSERT(firstColorAttachment->isAttached());
- RenderTarget9 *renderTarget = nullptr;
- ANGLE_TRY(firstColorAttachment->getRenderTarget(&renderTarget));
- samples = renderTarget->getSamples();
- }
+ int samples = drawFramebuffer->getSamples(glData);
gl::RasterizerState rasterizer = glState.getRasterizerState();
rasterizer.pointDrawMode = (drawMode == GL_POINTS);
rasterizer.multiSample = (samples != 0);
@@ -2464,15 +2340,6 @@ gl::Error Renderer9::copyTexture(const gl::Texture *source,
return gl::Error(GL_INVALID_OPERATION);
}
-gl::Error Renderer9::copyCompressedTexture(const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel)
-{
- UNIMPLEMENTED();
- return gl::Error(GL_INVALID_OPERATION);
-}
-
gl::Error Renderer9::createRenderTarget(int width, int height, GLenum format, GLsizei samples, RenderTargetD3D **outRT)
{
const d3d9::TextureFormat &d3d9FormatInfo = d3d9::GetTextureFormatInfo(format);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
index 9c3ae8b04..fb8d8fa21 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h
@@ -18,7 +18,6 @@
#include "libANGLE/renderer/d3d/d3d9/ShaderCache.h"
#include "libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.h"
#include "libANGLE/renderer/d3d/d3d9/StateManager9.h"
-#include "libANGLE/renderer/driver_utils.h"
namespace gl
{
@@ -88,17 +87,9 @@ class Renderer9 : public RendererD3D
SwapChainD3D *createSwapChain(NativeWindowD3D *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation) override;
- egl::Error getD3DTextureInfo(IUnknown *d3dTexture,
- EGLint *width,
- EGLint *height,
- GLenum *fboFormat) const override;
- egl::Error validateShareHandle(const egl::Config *config,
- HANDLE shareHandle,
- const egl::AttributeMap &attribs) const override;
ContextImpl *createContext(const gl::ContextState &state) override;
@@ -220,10 +211,6 @@ class Renderer9 : public RendererD3D
bool unpackFlipY,
bool unpackPremultiplyAlpha,
bool unpackUnmultiplyAlpha) override;
- gl::Error copyCompressedTexture(const gl::Texture *source,
- GLint sourceLevel,
- TextureStorage *storage,
- GLint destLevel) override;
// RenderTarget creation
gl::Error createRenderTarget(int width,
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
index 54885bf81..5fb675ddb 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/StateManager9.cpp
@@ -70,7 +70,7 @@ StateManager9::~StateManager9()
void StateManager9::initialize()
{
- mUsingZeroColorMaskWorkaround = IsAMD(mRenderer9->getVendorId());
+ mUsingZeroColorMaskWorkaround = mRenderer9->getVendorId() == VENDOR_ID_AMD;
}
void StateManager9::forceSetBlendState()
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
index 7e6948ebb..b61809050 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.cpp
@@ -19,11 +19,10 @@ namespace rx
SwapChain9::SwapChain9(Renderer9 *renderer,
NativeWindow9 *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation)
- : SwapChainD3D(shareHandle, d3dTexture, backBufferFormat, depthBufferFormat),
+ : SwapChainD3D(shareHandle, backBufferFormat, depthBufferFormat),
mRenderer(renderer),
mWidth(-1),
mHeight(-1),
@@ -106,37 +105,28 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
SafeRelease(mOffscreenTexture);
SafeRelease(mDepthStencil);
- const d3d9::TextureFormat &backBufferd3dFormatInfo =
- d3d9::GetTextureFormatInfo(mOffscreenRenderTargetFormat);
- if (mD3DTexture != nullptr)
+ HANDLE *pShareHandle = NULL;
+ if (!mNativeWindow->getNativeWindow() && mRenderer->getShareHandleSupport())
{
- result = mD3DTexture->QueryInterface(&mOffscreenTexture);
- ASSERT(SUCCEEDED(result));
+ pShareHandle = &mShareHandle;
}
- else
+
+ const d3d9::TextureFormat &backBufferd3dFormatInfo = d3d9::GetTextureFormatInfo(mOffscreenRenderTargetFormat);
+ result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
+ backBufferd3dFormatInfo.texFormat, D3DPOOL_DEFAULT, &mOffscreenTexture,
+ pShareHandle);
+ if (FAILED(result))
{
- HANDLE *pShareHandle = NULL;
- if (!mNativeWindow->getNativeWindow() && mRenderer->getShareHandleSupport())
+ ERR("Could not create offscreen texture: %08lX", result);
+ release();
+
+ if (d3d9::isDeviceLostError(result))
{
- pShareHandle = &mShareHandle;
+ return EGL_CONTEXT_LOST;
}
-
- result = device->CreateTexture(backbufferWidth, backbufferHeight, 1, D3DUSAGE_RENDERTARGET,
- backBufferd3dFormatInfo.texFormat, D3DPOOL_DEFAULT,
- &mOffscreenTexture, pShareHandle);
- if (FAILED(result))
+ else
{
- ERR("Could not create offscreen texture: %08lX", result);
- release();
-
- if (d3d9::isDeviceLostError(result))
- {
- return EGL_CONTEXT_LOST;
- }
- else
- {
- return EGL_BAD_ALLOC;
- }
+ return EGL_BAD_ALLOC;
}
}
@@ -201,7 +191,7 @@ EGLint SwapChain9::reset(int backbufferWidth, int backbufferHeight, EGLint swapI
//
// Some non-switchable AMD GPUs / drivers do not respect the source rectangle to Present. Therefore, when the vendor ID
// is not Intel, the back buffer width must be exactly the same width as the window or horizontal scaling will occur.
- if (IsIntel(mRenderer->getVendorId()))
+ if (mRenderer->getVendorId() == VENDOR_ID_INTEL)
{
presentParameters.BackBufferWidth = (presentParameters.BackBufferWidth + 63) / 64 * 64;
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h
index 2e5cce1db..7c21b1788 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/SwapChain9.h
@@ -24,7 +24,6 @@ class SwapChain9 : public SwapChainD3D
SwapChain9(Renderer9 *renderer,
NativeWindow9 *nativeWindow,
HANDLE shareHandle,
- IUnknown *d3dTexture,
GLenum backBufferFormat,
GLenum depthBufferFormat,
EGLint orientation);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
index db8765218..fd792752a 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp
@@ -153,6 +153,7 @@ gl::Error TextureStorage9_2D::getSurfaceLevel(GLenum target,
IDirect3DSurface9 **outSurface)
{
ASSERT(target == GL_TEXTURE_2D);
+ UNUSED_ASSERTION_VARIABLE(target);
IDirect3DBaseTexture9 *baseTexture = NULL;
gl::Error error = getBaseTexture(&baseTexture);
@@ -328,6 +329,8 @@ gl::Error TextureStorage9_EGLImage::getSurfaceLevel(GLenum target,
{
ASSERT(target == GL_TEXTURE_2D);
ASSERT(level == 0);
+ UNUSED_ASSERTION_VARIABLE(target);
+ UNUSED_ASSERTION_VARIABLE(level);
RenderTargetD3D *renderTargetD3D = nullptr;
gl::Error error = mImage->getRenderTarget(&renderTargetD3D);
@@ -347,6 +350,7 @@ gl::Error TextureStorage9_EGLImage::getRenderTarget(const gl::ImageIndex &index,
{
ASSERT(!index.hasLayer());
ASSERT(index.mipIndex == 0);
+ UNUSED_ASSERTION_VARIABLE(index);
return mImage->getRenderTarget(outRT);
}
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
index c2e935e71..afae5188c 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/VertexDeclarationCache.cpp
@@ -94,7 +94,7 @@ gl::Error VertexDeclarationCache::applyDeclaration(
// The validation layer checks that there is at least one active attribute with a zero divisor as per
// the GL_ANGLE_instanced_arrays spec.
- ASSERT(indexedAttribute != invalidAttribIndex || !attributes.size());
+ ASSERT(indexedAttribute != invalidAttribIndex);
}
D3DCAPS9 caps;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp
index 7cff9a117..8e6d40e25 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.cpp
@@ -24,13 +24,13 @@ namespace rx
namespace d3d9
{
-constexpr D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I', 'N', 'T', 'Z')));
-constexpr D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N', 'U', 'L', 'L')));
+const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I', 'N', 'T', 'Z')));
+const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N', 'U', 'L', 'L')));
// A map to determine the pixel size and mip generation function of a given D3D format
typedef std::map<D3DFORMAT, D3DFormat> D3D9FormatInfoMap;
-constexpr D3DFormat::D3DFormat()
+D3DFormat::D3DFormat()
: pixelBytes(0),
blockWidth(0),
blockHeight(0),
@@ -41,188 +41,97 @@ constexpr D3DFormat::D3DFormat()
luminanceBits(0),
depthBits(0),
stencilBits(0),
- formatID(angle::Format::ID::NONE)
+ info(nullptr)
{
}
-constexpr D3DFormat::D3DFormat(GLuint bits,
- GLuint blockWidth,
- GLuint blockHeight,
- GLuint redBits,
- GLuint greenBits,
- GLuint blueBits,
- GLuint alphaBits,
- GLuint lumBits,
- GLuint depthBits,
- GLuint stencilBits,
- Format::ID formatID)
- : pixelBytes(bits / 8),
- blockWidth(blockWidth),
- blockHeight(blockHeight),
- redBits(redBits),
- greenBits(greenBits),
- blueBits(blueBits),
- alphaBits(alphaBits),
- luminanceBits(lumBits),
- depthBits(depthBits),
- stencilBits(stencilBits),
- formatID(formatID)
+static inline void InsertD3DFormatInfo(D3D9FormatInfoMap *map,
+ D3DFORMAT format,
+ GLuint bits,
+ GLuint blockWidth,
+ GLuint blockHeight,
+ GLuint redBits,
+ GLuint greenBits,
+ GLuint blueBits,
+ GLuint alphaBits,
+ GLuint lumBits,
+ GLuint depthBits,
+ GLuint stencilBits,
+ Format::ID formatID)
{
+ D3DFormat info;
+ info.pixelBytes = bits / 8;
+ info.blockWidth = blockWidth;
+ info.blockHeight = blockHeight;
+ info.redBits = redBits;
+ info.greenBits = greenBits;
+ info.blueBits = blueBits;
+ info.alphaBits = alphaBits;
+ info.luminanceBits = lumBits;
+ info.depthBits = depthBits;
+ info.stencilBits = stencilBits;
+ info.info = &Format::Get(formatID);
+
+ map->insert(std::make_pair(format, info));
+}
+
+static D3D9FormatInfoMap BuildD3D9FormatInfoMap()
+{
+ using namespace angle; // For image reading and mipmap generation functions
+
+ D3D9FormatInfoMap map;
+
+ // clang-format off
+ // | D3DFORMAT | S |W |H | R | G | B | A | L | D | S | ANGLE format |
+ InsertD3DFormatInfo(&map, D3DFMT_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Format::ID::NONE );
+ InsertD3DFormatInfo(&map, D3DFMT_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Format::ID::NONE );
+
+ InsertD3DFormatInfo(&map, D3DFMT_L8, 8, 1, 1, 0, 0, 0, 0, 8, 0, 0, Format::ID::L8_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_A8, 8, 1, 1, 0, 0, 0, 8, 0, 0, 0, Format::ID::A8_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_A8L8, 16, 1, 1, 0, 0, 0, 8, 8, 0, 0, Format::ID::L8A8_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_A4R4G4B4, 16, 1, 1, 4, 4, 4, 4, 0, 0, 0, Format::ID::B4G4R4A4_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_A1R5G5B5, 16, 1, 1, 5, 5, 5, 1, 0, 0, 0, Format::ID::B5G5R5A1_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_R5G6B5, 16, 1, 1, 5, 6, 5, 0, 0, 0, 0, Format::ID::R5G6B5_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_X8R8G8B8, 32, 1, 1, 8, 8, 8, 0, 0, 0, 0, Format::ID::B8G8R8X8_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_A8R8G8B8, 32, 1, 1, 8, 8, 8, 8, 0, 0, 0, Format::ID::B8G8R8A8_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_R16F, 16, 1, 1, 16, 0, 0, 0, 0, 0, 0, Format::ID::R16_FLOAT );
+ InsertD3DFormatInfo(&map, D3DFMT_G16R16F, 32, 1, 1, 16, 16, 0, 0, 0, 0, 0, Format::ID::R16G16_FLOAT );
+ InsertD3DFormatInfo(&map, D3DFMT_A16B16G16R16F, 64, 1, 1, 16, 16, 16, 16, 0, 0, 0, Format::ID::R16G16B16A16_FLOAT );
+ InsertD3DFormatInfo(&map, D3DFMT_R32F, 32, 1, 1, 32, 0, 0, 0, 0, 0, 0, Format::ID::R32_FLOAT );
+ InsertD3DFormatInfo(&map, D3DFMT_G32R32F, 64, 1, 1, 32, 32, 0, 0, 0, 0, 0, Format::ID::R32G32_FLOAT );
+ InsertD3DFormatInfo(&map, D3DFMT_A32B32G32R32F, 128, 1, 1, 32, 32, 32, 32, 0, 0, 0, Format::ID::R32G32B32A32_FLOAT );
+
+ InsertD3DFormatInfo(&map, D3DFMT_D16, 16, 1, 1, 0, 0, 0, 0, 0, 16, 0, Format::ID::D16_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_D24S8, 32, 1, 1, 0, 0, 0, 0, 0, 24, 8, Format::ID::D24_UNORM_S8_UINT );
+ InsertD3DFormatInfo(&map, D3DFMT_D24X8, 32, 1, 1, 0, 0, 0, 0, 0, 24, 0, Format::ID::D16_UNORM );
+ InsertD3DFormatInfo(&map, D3DFMT_D32, 32, 1, 1, 0, 0, 0, 0, 0, 32, 0, Format::ID::D32_UNORM );
+
+ InsertD3DFormatInfo(&map, D3DFMT_INTZ, 32, 1, 1, 0, 0, 0, 0, 0, 24, 8, Format::ID::D24_UNORM_S8_UINT );
+
+ InsertD3DFormatInfo(&map, D3DFMT_DXT1, 64, 4, 4, 0, 0, 0, 0, 0, 0, 0, Format::ID::BC1_RGBA_UNORM_BLOCK);
+ InsertD3DFormatInfo(&map, D3DFMT_DXT3, 128, 4, 4, 0, 0, 0, 0, 0, 0, 0, Format::ID::BC2_RGBA_UNORM_BLOCK);
+ InsertD3DFormatInfo(&map, D3DFMT_DXT5, 128, 4, 4, 0, 0, 0, 0, 0, 0, 0, Format::ID::BC3_RGBA_UNORM_BLOCK);
+ // clang-format on
+
+ return map;
}
const D3DFormat &GetD3DFormatInfo(D3DFORMAT format)
{
- if (format == D3DFMT_NULL)
+ static const D3D9FormatInfoMap infoMap = BuildD3D9FormatInfoMap();
+ D3D9FormatInfoMap::const_iterator iter = infoMap.find(format);
+ if (iter != infoMap.end())
{
- static constexpr D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Format::ID::NONE);
- return info;
+ return iter->second;
}
-
- if (format == D3DFMT_INTZ)
+ else
{
- static constexpr D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8,
- Format::ID::D24_UNORM_S8_UINT);
- return info;
+ static const D3DFormat defaultInfo;
+ return defaultInfo;
}
+}
- switch (format)
- {
- case D3DFMT_UNKNOWN:
- {
- static constexpr D3DFormat info(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Format::ID::NONE);
- return info;
- }
-
- case D3DFMT_L8:
- {
- static constexpr D3DFormat info(8, 1, 1, 0, 0, 0, 0, 8, 0, 0, Format::ID::L8_UNORM);
- return info;
- }
- case D3DFMT_A8:
- {
- static constexpr D3DFormat info(8, 1, 1, 0, 0, 0, 8, 0, 0, 0, Format::ID::A8_UNORM);
- return info;
- }
- case D3DFMT_A8L8:
- {
- static constexpr D3DFormat info(16, 1, 1, 0, 0, 0, 8, 8, 0, 0, Format::ID::L8A8_UNORM);
- return info;
- }
-
- case D3DFMT_A4R4G4B4:
- {
- static constexpr D3DFormat info(16, 1, 1, 4, 4, 4, 4, 0, 0, 0,
- Format::ID::B4G4R4A4_UNORM);
- return info;
- }
- case D3DFMT_A1R5G5B5:
- {
- static constexpr D3DFormat info(16, 1, 1, 5, 5, 5, 1, 0, 0, 0,
- Format::ID::B5G5R5A1_UNORM);
- return info;
- }
- case D3DFMT_R5G6B5:
- {
- static constexpr D3DFormat info(16, 1, 1, 5, 6, 5, 0, 0, 0, 0,
- Format::ID::R5G6B5_UNORM);
- return info;
- }
- case D3DFMT_X8R8G8B8:
- {
- static constexpr D3DFormat info(32, 1, 1, 8, 8, 8, 0, 0, 0, 0,
- Format::ID::B8G8R8X8_UNORM);
- return info;
- }
- case D3DFMT_A8R8G8B8:
- {
- static constexpr D3DFormat info(32, 1, 1, 8, 8, 8, 8, 0, 0, 0,
- Format::ID::B8G8R8A8_UNORM);
- return info;
- }
-
- case D3DFMT_R16F:
- {
- static constexpr D3DFormat info(16, 1, 1, 16, 0, 0, 0, 0, 0, 0, Format::ID::R16_FLOAT);
- return info;
- }
- case D3DFMT_G16R16F:
- {
- static constexpr D3DFormat info(32, 1, 1, 16, 16, 0, 0, 0, 0, 0,
- Format::ID::R16G16_FLOAT);
- return info;
- }
- case D3DFMT_A16B16G16R16F:
- {
- static constexpr D3DFormat info(64, 1, 1, 16, 16, 16, 16, 0, 0, 0,
- Format::ID::R16G16B16A16_FLOAT);
- return info;
- }
- case D3DFMT_R32F:
- {
- static constexpr D3DFormat info(32, 1, 1, 32, 0, 0, 0, 0, 0, 0, Format::ID::R32_FLOAT);
- return info;
- }
- case D3DFMT_G32R32F:
- {
- static constexpr D3DFormat info(64, 1, 1, 32, 32, 0, 0, 0, 0, 0,
- Format::ID::R32G32_FLOAT);
- return info;
- }
- case D3DFMT_A32B32G32R32F:
- {
- static constexpr D3DFormat info(128, 1, 1, 32, 32, 32, 32, 0, 0, 0,
- Format::ID::R32G32B32A32_FLOAT);
- return info;
- }
-
- case D3DFMT_D16:
- {
- static constexpr D3DFormat info(16, 1, 1, 0, 0, 0, 0, 0, 16, 0, Format::ID::D16_UNORM);
- return info;
- }
- case D3DFMT_D24S8:
- {
- static constexpr D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 8,
- Format::ID::D24_UNORM_S8_UINT);
- return info;
- }
- case D3DFMT_D24X8:
- {
- static constexpr D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 24, 0, Format::ID::D16_UNORM);
- return info;
- }
- case D3DFMT_D32:
- {
- static constexpr D3DFormat info(32, 1, 1, 0, 0, 0, 0, 0, 32, 0, Format::ID::D32_UNORM);
- return info;
- }
-
- case D3DFMT_DXT1:
- {
- static constexpr D3DFormat info(64, 4, 4, 0, 0, 0, 0, 0, 0, 0,
- Format::ID::BC1_RGBA_UNORM_BLOCK);
- return info;
- }
- case D3DFMT_DXT3:
- {
- static constexpr D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
- Format::ID::BC2_RGBA_UNORM_BLOCK);
- return info;
- }
- case D3DFMT_DXT5:
- {
- static constexpr D3DFormat info(128, 4, 4, 0, 0, 0, 0, 0, 0, 0,
- Format::ID::BC3_RGBA_UNORM_BLOCK);
- return info;
- }
- default:
- {
- static constexpr D3DFormat defaultInfo;
- return defaultInfo;
- }
- }
-}
typedef std::pair<GLint, InitializeTextureDataFunction> InternalFormatInitialzerPair;
typedef std::map<GLint, InitializeTextureDataFunction> InternalFormatInitialzerMap;
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h
index 828252d33..2937e14e7 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/formatutils9.h
@@ -29,20 +29,7 @@ namespace d3d9
struct D3DFormat
{
- constexpr D3DFormat();
- constexpr D3DFormat(GLuint pixelBytes,
- GLuint blockWidth,
- GLuint blockHeight,
- GLuint redBits,
- GLuint greenBits,
- GLuint blueBits,
- GLuint alphaBits,
- GLuint luminanceBits,
- GLuint depthBits,
- GLuint stencilBits,
- angle::Format::ID formatID);
-
- const angle::Format &info() const { return angle::Format::Get(formatID); }
+ D3DFormat();
GLuint pixelBytes;
GLuint blockWidth;
@@ -57,7 +44,7 @@ struct D3DFormat
GLuint depthBits;
GLuint stencilBits;
- angle::Format::ID formatID;
+ const angle::Format *info;
};
const D3DFormat &GetD3DFormatInfo(D3DFORMAT format);
diff --git a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
index a6e1f239d..1883636a3 100755
--- a/gfx/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
+++ b/gfx/angle/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp
@@ -18,7 +18,6 @@
#include "libANGLE/renderer/d3d/d3d9/RenderTarget9.h"
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/d3d/WorkaroundsD3D.h"
-#include "libANGLE/renderer/driver_utils.h"
#include "third_party/systeminfo/SystemInfo.h"
@@ -307,7 +306,7 @@ GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type)
bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format)
{
- GLenum internalFormat = d3d9::GetD3DFormatInfo(d3dformat).info().glInternalFormat;
+ GLenum internalFormat = d3d9::GetD3DFormatInfo(d3dformat).info->glInternalFormat;
GLenum convertedFormat = gl::GetInternalFormatInfo(internalFormat).format;
return convertedFormat == format;
}
@@ -541,12 +540,12 @@ void GenerateCaps(IDirect3D9 *d3d9,
{
// ATI cards on XP have problems with non-power-of-two textures.
extensions->textureNPOT = !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_POW2) &&
- !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
- !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &&
- !(!isWindowsVistaOrGreater() && IsAMD(adapterId.VendorId));
+ !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP_POW2) &&
+ !(deviceCaps.TextureCaps & D3DPTEXTURECAPS_NONPOW2CONDITIONAL) &&
+ !(!isWindowsVistaOrGreater() && adapterId.VendorId == VENDOR_ID_AMD);
// Disable depth texture support on AMD cards (See ANGLE issue 839)
- if (IsAMD(adapterId.VendorId))
+ if (adapterId.VendorId == VENDOR_ID_AMD)
{
extensions->depthTextures = false;
}