diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:29:50 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-07-11 23:31:02 +0200 |
commit | 70dd5e7c66b1fe3f82e5b4db2406050baba15f05 (patch) | |
tree | 3f012200ef3c934f33db1a4ef2b790fae3141860 /gfx/angle/src/libANGLE/renderer | |
parent | 3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff) | |
parent | 8481fa25d246f1968d0a254ee3c6cdd82c60781a (diff) | |
download | UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.gz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.lz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.xz UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.zip |
Merge branch 'ANGLE-rollback'
This resolves #624
Note: Cherry-picked some fixes on top of the ANGLE version that we want to keep.
Diffstat (limited to 'gfx/angle/src/libANGLE/renderer')
196 files changed, 7292 insertions, 12385 deletions
diff --git a/gfx/angle/src/libANGLE/renderer/BufferImpl.h b/gfx/angle/src/libANGLE/renderer/BufferImpl.h index 10d371541..cdb3cfe88 100755 --- a/gfx/angle/src/libANGLE/renderer/BufferImpl.h +++ b/gfx/angle/src/libANGLE/renderer/BufferImpl.h @@ -15,22 +15,16 @@ #include <stdint.h> -namespace gl -{ -class BufferState; -} - namespace rx { class BufferImpl : angle::NonCopyable { public: - BufferImpl(const gl::BufferState &state) : mState(state) {} virtual ~BufferImpl() { } - virtual gl::Error setData(GLenum target, const void *data, size_t size, GLenum usage) = 0; - virtual gl::Error setSubData(GLenum target, const void *data, size_t size, size_t offset) = 0; + virtual gl::Error setData(const void *data, size_t size, GLenum usage) = 0; + virtual gl::Error setSubData(const void *data, size_t size, size_t offset) = 0; virtual gl::Error copySubData(BufferImpl *source, GLintptr sourceOffset, GLintptr destOffset, @@ -44,9 +38,6 @@ class BufferImpl : angle::NonCopyable size_t count, bool primitiveRestartEnabled, gl::IndexRange *outRange) = 0; - - protected: - const gl::BufferState &mState; }; } diff --git a/gfx/angle/src/libANGLE/renderer/BufferImpl_mock.h b/gfx/angle/src/libANGLE/renderer/BufferImpl_mock.h index 7e45c01b7..a6387661c 100755 --- a/gfx/angle/src/libANGLE/renderer/BufferImpl_mock.h +++ b/gfx/angle/src/libANGLE/renderer/BufferImpl_mock.h @@ -19,11 +19,10 @@ namespace rx class MockBufferImpl : public BufferImpl { public: - MockBufferImpl() : BufferImpl(mMockState) {} ~MockBufferImpl() { destructor(); } - MOCK_METHOD4(setData, gl::Error(GLenum, const void *, size_t, GLenum)); - MOCK_METHOD4(setSubData, gl::Error(GLenum, const void *, size_t, size_t)); + MOCK_METHOD3(setData, gl::Error(const void*, size_t, GLenum)); + MOCK_METHOD3(setSubData, gl::Error(const void*, size_t, size_t)); MOCK_METHOD4(copySubData, gl::Error(BufferImpl *, GLintptr, GLintptr, GLsizeiptr)); MOCK_METHOD2(map, gl::Error(GLenum, GLvoid **)); MOCK_METHOD4(mapRange, gl::Error(size_t, size_t, GLbitfield, GLvoid **)); @@ -32,9 +31,6 @@ class MockBufferImpl : public BufferImpl MOCK_METHOD5(getIndexRange, gl::Error(GLenum, size_t, size_t, bool, gl::IndexRange *)); MOCK_METHOD0(destructor, void()); - - protected: - gl::BufferState mMockState; }; } diff --git a/gfx/angle/src/libANGLE/renderer/DisplayImpl.cpp b/gfx/angle/src/libANGLE/renderer/DisplayImpl.cpp index fc2f2c5ce..8061189f0 100755 --- a/gfx/angle/src/libANGLE/renderer/DisplayImpl.cpp +++ b/gfx/angle/src/libANGLE/renderer/DisplayImpl.cpp @@ -41,15 +41,6 @@ const egl::DisplayExtensions &DisplayImpl::getExtensions() const return mExtensions; } -egl::Error DisplayImpl::validateClientBuffer(const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, - const egl::AttributeMap &attribs) const -{ - UNREACHABLE(); - return egl::Error(EGL_BAD_DISPLAY, "DisplayImpl::validateClientBuffer unimplemented."); -} - const egl::Caps &DisplayImpl::getCaps() const { if (!mCapsInitialized) diff --git a/gfx/angle/src/libANGLE/renderer/DisplayImpl.h b/gfx/angle/src/libANGLE/renderer/DisplayImpl.h index ec603e85b..652486edb 100755 --- a/gfx/angle/src/libANGLE/renderer/DisplayImpl.h +++ b/gfx/angle/src/libANGLE/renderer/DisplayImpl.h @@ -59,10 +59,6 @@ class DisplayImpl : public EGLImplFactory virtual egl::Error restoreLostDevice() = 0; virtual bool isValidNativeWindow(EGLNativeWindowType window) const = 0; - virtual egl::Error validateClientBuffer(const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, - const egl::AttributeMap &attribs) const; virtual std::string getVendorString() const = 0; diff --git a/gfx/angle/src/libANGLE/renderer/EGLImplFactory.h b/gfx/angle/src/libANGLE/renderer/EGLImplFactory.h index 2ddbb7625..b2c8771cc 100755 --- a/gfx/angle/src/libANGLE/renderer/EGLImplFactory.h +++ b/gfx/angle/src/libANGLE/renderer/EGLImplFactory.h @@ -47,8 +47,7 @@ class EGLImplFactory : angle::NonCopyable const egl::AttributeMap &attribs) = 0; virtual SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state, const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, + EGLClientBuffer shareHandle, const egl::AttributeMap &attribs) = 0; virtual SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state, const egl::Config *configuration, diff --git a/gfx/angle/src/libANGLE/renderer/Format.cpp b/gfx/angle/src/libANGLE/renderer/Format.cpp new file mode 100644 index 000000000..e8883c6f3 --- /dev/null +++ b/gfx/angle/src/libANGLE/renderer/Format.cpp @@ -0,0 +1,60 @@ +// +// 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. +// +// Format: +// A universal description of texture storage. Across multiple +// renderer back-ends, there are common formats and some distinct +// permutations, this enum encapsulates them all. + +#include "libANGLE/renderer/Format.h" + +#include "image_util/copyimage.h" + +using namespace rx; + +namespace angle +{ + +namespace +{ + +const FastCopyFunctionMap &GetFastCopyFunctionsMap(Format::ID formatID) +{ + switch (formatID) + { + case Format::ID::B8G8R8A8_UNORM: + { + static FastCopyFunctionMap fastCopyMap; + if (fastCopyMap.empty()) + { + fastCopyMap[gl::FormatType(GL_RGBA, GL_UNSIGNED_BYTE)] = CopyBGRA8ToRGBA8; + } + return fastCopyMap; + } + default: + { + static FastCopyFunctionMap emptyMap; + return emptyMap; + } + } +} + +} // anonymous namespace + +Format::Format(ID id, + GLenum glFormat, + GLenum fboFormat, + MipGenerationFunction mipGen, + ColorReadFunction colorRead) + : id(id), + glInternalFormat(glFormat), + fboImplementationInternalFormat(fboFormat), + mipGenerationFunction(mipGen), + colorReadFunction(colorRead), + fastCopyFunctions(GetFastCopyFunctionsMap(id)) +{ +} + +} // namespace angle diff --git a/gfx/angle/src/libANGLE/renderer/Format.h b/gfx/angle/src/libANGLE/renderer/Format.h index 5c6e7e1fe..65608a7a6 100755 --- a/gfx/angle/src/libANGLE/renderer/Format.h +++ b/gfx/angle/src/libANGLE/renderer/Format.h @@ -22,19 +22,11 @@ struct Format final : angle::NonCopyable { enum class ID; - constexpr Format(ID id, - GLenum glFormat, - GLenum fboFormat, - rx::MipGenerationFunction mipGen, - const rx::FastCopyFunctionMap &fastCopyFunctions, - rx::ColorReadFunction colorRead, - GLenum componentType, - GLuint redBits, - GLuint greenBits, - GLuint blueBits, - GLuint alphaBits, - GLuint depthBits, - GLuint stencilBits); + Format(ID id, + GLenum glFormat, + GLenum fboFormat, + rx::MipGenerationFunction mipGen, + rx::ColorReadFunction colorRead); static const Format &Get(ID id); @@ -53,47 +45,9 @@ struct Format final : angle::NonCopyable rx::ColorReadFunction colorReadFunction; // A map from a gl::FormatType to a fast pixel copy function for this format. - const rx::FastCopyFunctionMap &fastCopyFunctions; - - GLenum componentType; - - GLuint redBits; - GLuint greenBits; - GLuint blueBits; - GLuint alphaBits; - GLuint depthBits; - GLuint stencilBits; + rx::FastCopyFunctionMap fastCopyFunctions; }; -constexpr Format::Format(ID id, - GLenum glFormat, - GLenum fboFormat, - rx::MipGenerationFunction mipGen, - const rx::FastCopyFunctionMap &fastCopyFunctions, - rx::ColorReadFunction colorRead, - GLenum componentType, - GLuint redBits, - GLuint greenBits, - GLuint blueBits, - GLuint alphaBits, - GLuint depthBits, - GLuint stencilBits) - : id(id), - glInternalFormat(glFormat), - fboImplementationInternalFormat(fboFormat), - mipGenerationFunction(mipGen), - colorReadFunction(colorRead), - fastCopyFunctions(fastCopyFunctions), - componentType(componentType), - redBits(redBits), - greenBits(greenBits), - blueBits(blueBits), - alphaBits(alphaBits), - depthBits(depthBits), - stencilBits(stencilBits) -{ -} - } // namespace angle #include "libANGLE/renderer/Format_ID_autogen.inl" diff --git a/gfx/angle/src/libANGLE/renderer/Format_autogen.cpp b/gfx/angle/src/libANGLE/renderer/Format_autogen.cpp new file mode 100644 index 000000000..d6b6762e7 --- /dev/null +++ b/gfx/angle/src/libANGLE/renderer/Format_autogen.cpp @@ -0,0 +1,1126 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_angle_format_table.py using data from angle_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. +// +// ANGLE Format table: +// Queries for typed format information from the ANGLE format enum. + +#include "libANGLE/renderer/Format.h" + +#include "image_util/copyimage.h" +#include "image_util/generatemip.h" +#include "image_util/loadimage.h" + +namespace angle +{ + +// static +const Format &Format::Get(ID id) +{ + // clang-format off + switch (id) + { + case ID::A16_FLOAT: + { + static const Format info(ID::A16_FLOAT, + GL_ALPHA16F_EXT, + GL_ALPHA16F_EXT, + GenerateMip<A16F>, + ReadColor<A16F, GLfloat>); + return info; + } + case ID::A32_FLOAT: + { + static const Format info(ID::A32_FLOAT, + GL_ALPHA32F_EXT, + GL_ALPHA32F_EXT, + GenerateMip<A32F>, + ReadColor<A32F, GLfloat>); + return info; + } + case ID::A8_UNORM: + { + static const Format info(ID::A8_UNORM, + GL_ALPHA8_EXT, + GL_ALPHA8_EXT, + GenerateMip<A8>, + ReadColor<A8, GLfloat>); + return info; + } + case ID::ASTC_10x10_SRGB_BLOCK: + { + static const Format info(ID::ASTC_10x10_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_10x10_UNORM_BLOCK: + { + static const Format info(ID::ASTC_10x10_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_10x10_KHR, + GL_COMPRESSED_RGBA_ASTC_10x10_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_10x5_SRGB_BLOCK: + { + static const Format info(ID::ASTC_10x5_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_10x5_UNORM_BLOCK: + { + static const Format info(ID::ASTC_10x5_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_10x5_KHR, + GL_COMPRESSED_RGBA_ASTC_10x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_10x6_SRGB_BLOCK: + { + static const Format info(ID::ASTC_10x6_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_10x6_UNORM_BLOCK: + { + static const Format info(ID::ASTC_10x6_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_10x6_KHR, + GL_COMPRESSED_RGBA_ASTC_10x6_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_10x8_SRGB_BLOCK: + { + static const Format info(ID::ASTC_10x8_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_10x8_UNORM_BLOCK: + { + static const Format info(ID::ASTC_10x8_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_10x8_KHR, + GL_COMPRESSED_RGBA_ASTC_10x8_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_12x10_SRGB_BLOCK: + { + static const Format info(ID::ASTC_12x10_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_12x10_UNORM_BLOCK: + { + static const Format info(ID::ASTC_12x10_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_12x10_KHR, + GL_COMPRESSED_RGBA_ASTC_12x10_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_12x12_SRGB_BLOCK: + { + static const Format info(ID::ASTC_12x12_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_12x12_UNORM_BLOCK: + { + static const Format info(ID::ASTC_12x12_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_12x12_KHR, + GL_COMPRESSED_RGBA_ASTC_12x12_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_4x4_SRGB_BLOCK: + { + static const Format info(ID::ASTC_4x4_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_4x4_UNORM_BLOCK: + { + static const Format info(ID::ASTC_4x4_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_4x4_KHR, + GL_COMPRESSED_RGBA_ASTC_4x4_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_5x4_SRGB_BLOCK: + { + static const Format info(ID::ASTC_5x4_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_5x4_UNORM_BLOCK: + { + static const Format info(ID::ASTC_5x4_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_5x4_KHR, + GL_COMPRESSED_RGBA_ASTC_5x4_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_5x5_SRGB_BLOCK: + { + static const Format info(ID::ASTC_5x5_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_5x5_UNORM_BLOCK: + { + static const Format info(ID::ASTC_5x5_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_5x5_KHR, + GL_COMPRESSED_RGBA_ASTC_5x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_6x5_SRGB_BLOCK: + { + static const Format info(ID::ASTC_6x5_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_6x5_UNORM_BLOCK: + { + static const Format info(ID::ASTC_6x5_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_6x5_KHR, + GL_COMPRESSED_RGBA_ASTC_6x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_6x6_SRGB_BLOCK: + { + static const Format info(ID::ASTC_6x6_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_6x6_UNORM_BLOCK: + { + static const Format info(ID::ASTC_6x6_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_6x6_KHR, + GL_COMPRESSED_RGBA_ASTC_6x6_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_8x5_SRGB_BLOCK: + { + static const Format info(ID::ASTC_8x5_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_8x5_UNORM_BLOCK: + { + static const Format info(ID::ASTC_8x5_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_8x5_KHR, + GL_COMPRESSED_RGBA_ASTC_8x5_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_8x6_SRGB_BLOCK: + { + static const Format info(ID::ASTC_8x6_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_8x6_UNORM_BLOCK: + { + static const Format info(ID::ASTC_8x6_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_8x6_KHR, + GL_COMPRESSED_RGBA_ASTC_8x6_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_8x8_SRGB_BLOCK: + { + static const Format info(ID::ASTC_8x8_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, + nullptr, + nullptr); + return info; + } + case ID::ASTC_8x8_UNORM_BLOCK: + { + static const Format info(ID::ASTC_8x8_UNORM_BLOCK, + GL_COMPRESSED_RGBA_ASTC_8x8_KHR, + GL_COMPRESSED_RGBA_ASTC_8x8_KHR, + nullptr, + nullptr); + return info; + } + case ID::B4G4R4A4_UNORM: + { + static const Format info(ID::B4G4R4A4_UNORM, + GL_BGRA4_ANGLEX, + GL_RGBA4, + GenerateMip<A4R4G4B4>, + ReadColor<A4R4G4B4, GLfloat>); + return info; + } + case ID::B5G5R5A1_UNORM: + { + static const Format info(ID::B5G5R5A1_UNORM, + GL_BGR5_A1_ANGLEX, + GL_RGB5_A1, + GenerateMip<A1R5G5B5>, + ReadColor<A1R5G5B5, GLfloat>); + return info; + } + case ID::B5G6R5_UNORM: + { + static const Format info(ID::B5G6R5_UNORM, + GL_BGR565_ANGLEX, + GL_RGB565, + GenerateMip<B5G6R5>, + ReadColor<B5G6R5, GLfloat>); + return info; + } + case ID::B8G8R8A8_UNORM: + { + static const Format info(ID::B8G8R8A8_UNORM, + GL_BGRA8_EXT, + GL_BGRA8_EXT, + GenerateMip<B8G8R8A8>, + ReadColor<B8G8R8A8, GLfloat>); + return info; + } + case ID::B8G8R8X8_UNORM: + { + static const Format info(ID::B8G8R8X8_UNORM, + GL_BGRA8_EXT, + GL_BGRA8_EXT, + GenerateMip<B8G8R8X8>, + ReadColor<B8G8R8X8, GLfloat>); + return info; + } + case ID::BC1_RGBA_UNORM_BLOCK: + { + static const Format info(ID::BC1_RGBA_UNORM_BLOCK, + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, + GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, + nullptr, + nullptr); + return info; + } + case ID::BC1_RGB_UNORM_BLOCK: + { + static const Format info(ID::BC1_RGB_UNORM_BLOCK, + GL_COMPRESSED_RGB_S3TC_DXT1_EXT, + GL_COMPRESSED_RGB_S3TC_DXT1_EXT, + nullptr, + nullptr); + return info; + } + case ID::BC2_RGBA_UNORM_BLOCK: + { + static const Format info(ID::BC2_RGBA_UNORM_BLOCK, + GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, + GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, + nullptr, + nullptr); + return info; + } + case ID::BC3_RGBA_UNORM_BLOCK: + { + static const Format info(ID::BC3_RGBA_UNORM_BLOCK, + GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, + GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, + nullptr, + nullptr); + return info; + } + case ID::D16_UNORM: + { + static const Format info(ID::D16_UNORM, + GL_DEPTH_COMPONENT16, + GL_DEPTH_COMPONENT16, + nullptr, + nullptr); + return info; + } + case ID::D24_UNORM: + { + static const Format info(ID::D24_UNORM, + GL_DEPTH_COMPONENT24, + GL_DEPTH_COMPONENT24, + nullptr, + nullptr); + return info; + } + case ID::D24_UNORM_S8_UINT: + { + static const Format info(ID::D24_UNORM_S8_UINT, + GL_DEPTH24_STENCIL8, + GL_DEPTH24_STENCIL8, + nullptr, + nullptr); + return info; + } + case ID::D32_FLOAT: + { + static const Format info(ID::D32_FLOAT, + GL_DEPTH_COMPONENT32F, + GL_DEPTH_COMPONENT32F, + nullptr, + nullptr); + return info; + } + case ID::D32_FLOAT_S8X24_UINT: + { + static const Format info(ID::D32_FLOAT_S8X24_UINT, + GL_DEPTH32F_STENCIL8, + GL_DEPTH32F_STENCIL8, + nullptr, + nullptr); + return info; + } + case ID::D32_UNORM: + { + static const Format info(ID::D32_UNORM, + GL_DEPTH_COMPONENT32_OES, + GL_DEPTH_COMPONENT32_OES, + nullptr, + nullptr); + return info; + } + case ID::EAC_R11G11_SNORM_BLOCK: + { + static const Format info(ID::EAC_R11G11_SNORM_BLOCK, + GL_COMPRESSED_SIGNED_RG11_EAC, + GL_COMPRESSED_SIGNED_RG11_EAC, + nullptr, + nullptr); + return info; + } + case ID::EAC_R11G11_UNORM_BLOCK: + { + static const Format info(ID::EAC_R11G11_UNORM_BLOCK, + GL_COMPRESSED_RG11_EAC, + GL_COMPRESSED_RG11_EAC, + nullptr, + nullptr); + return info; + } + case ID::EAC_R11_SNORM_BLOCK: + { + static const Format info(ID::EAC_R11_SNORM_BLOCK, + GL_COMPRESSED_SIGNED_R11_EAC, + GL_COMPRESSED_SIGNED_R11_EAC, + nullptr, + nullptr); + return info; + } + case ID::EAC_R11_UNORM_BLOCK: + { + static const Format info(ID::EAC_R11_UNORM_BLOCK, + GL_COMPRESSED_R11_EAC, + GL_COMPRESSED_R11_EAC, + nullptr, + nullptr); + return info; + } + case ID::ETC2_R8G8B8A1_SRGB_BLOCK: + { + static const Format info(ID::ETC2_R8G8B8A1_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, + nullptr, + nullptr); + return info; + } + case ID::ETC2_R8G8B8A1_UNORM_BLOCK: + { + static const Format info(ID::ETC2_R8G8B8A1_UNORM_BLOCK, + GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, + nullptr, + nullptr); + return info; + } + case ID::ETC2_R8G8B8A8_SRGB_BLOCK: + { + static const Format info(ID::ETC2_R8G8B8A8_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, + GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, + nullptr, + nullptr); + return info; + } + case ID::ETC2_R8G8B8A8_UNORM_BLOCK: + { + static const Format info(ID::ETC2_R8G8B8A8_UNORM_BLOCK, + GL_COMPRESSED_RGBA8_ETC2_EAC, + GL_COMPRESSED_RGBA8_ETC2_EAC, + nullptr, + nullptr); + return info; + } + case ID::ETC2_R8G8B8_SRGB_BLOCK: + { + static const Format info(ID::ETC2_R8G8B8_SRGB_BLOCK, + GL_COMPRESSED_SRGB8_ETC2, + GL_COMPRESSED_SRGB8_ETC2, + nullptr, + nullptr); + return info; + } + case ID::ETC2_R8G8B8_UNORM_BLOCK: + { + static const Format info(ID::ETC2_R8G8B8_UNORM_BLOCK, + GL_COMPRESSED_RGB8_ETC2, + GL_COMPRESSED_RGB8_ETC2, + nullptr, + nullptr); + return info; + } + case ID::L16A16_FLOAT: + { + static const Format info(ID::L16A16_FLOAT, + GL_LUMINANCE_ALPHA16F_EXT, + GL_LUMINANCE_ALPHA16F_EXT, + GenerateMip<L16A16F>, + ReadColor<L16A16F, GLfloat>); + return info; + } + case ID::L16_FLOAT: + { + static const Format info(ID::L16_FLOAT, + GL_LUMINANCE16F_EXT, + GL_LUMINANCE16F_EXT, + GenerateMip<L16F>, + ReadColor<L16F, GLfloat>); + return info; + } + case ID::L32A32_FLOAT: + { + static const Format info(ID::L32A32_FLOAT, + GL_LUMINANCE_ALPHA32F_EXT, + GL_LUMINANCE_ALPHA32F_EXT, + GenerateMip<L32A32F>, + ReadColor<L32A32F, GLfloat>); + return info; + } + case ID::L32_FLOAT: + { + static const Format info(ID::L32_FLOAT, + GL_LUMINANCE32F_EXT, + GL_LUMINANCE32F_EXT, + GenerateMip<L32F>, + ReadColor<L32F, GLfloat>); + return info; + } + case ID::L8A8_UNORM: + { + static const Format info(ID::L8A8_UNORM, + GL_LUMINANCE8_ALPHA8_EXT, + GL_LUMINANCE8_ALPHA8_EXT, + GenerateMip<L8A8>, + ReadColor<L8A8, GLfloat>); + return info; + } + case ID::L8_UNORM: + { + static const Format info(ID::L8_UNORM, + GL_LUMINANCE8_EXT, + GL_LUMINANCE8_EXT, + GenerateMip<L8>, + ReadColor<L8, GLfloat>); + return info; + } + case ID::NONE: + { + static const Format info(ID::NONE, + GL_NONE, + GL_NONE, + nullptr, + nullptr); + return info; + } + case ID::R10G10B10A2_UINT: + { + static const Format info(ID::R10G10B10A2_UINT, + GL_RGB10_A2UI, + GL_RGB10_A2UI, + GenerateMip<R10G10B10A2>, + ReadColor<R10G10B10A2, GLuint>); + return info; + } + case ID::R10G10B10A2_UNORM: + { + static const Format info(ID::R10G10B10A2_UNORM, + GL_RGB10_A2, + GL_RGB10_A2, + GenerateMip<R10G10B10A2>, + ReadColor<R10G10B10A2, GLfloat>); + return info; + } + case ID::R11G11B10_FLOAT: + { + static const Format info(ID::R11G11B10_FLOAT, + GL_R11F_G11F_B10F, + GL_R11F_G11F_B10F, + GenerateMip<R11G11B10F>, + ReadColor<R11G11B10F, GLfloat>); + return info; + } + case ID::R16G16B16A16_FLOAT: + { + static const Format info(ID::R16G16B16A16_FLOAT, + GL_RGBA16F, + GL_RGBA16F, + GenerateMip<R16G16B16A16F>, + ReadColor<R16G16B16A16F, GLfloat>); + return info; + } + case ID::R16G16B16A16_SINT: + { + static const Format info(ID::R16G16B16A16_SINT, + GL_RGBA16I, + GL_RGBA16I, + GenerateMip<R16G16B16A16S>, + ReadColor<R16G16B16A16S, GLint>); + return info; + } + case ID::R16G16B16A16_SNORM: + { + static const Format info(ID::R16G16B16A16_SNORM, + GL_RGBA16_SNORM_EXT, + GL_RGBA16_SNORM_EXT, + GenerateMip<R16G16B16A16S>, + ReadColor<R16G16B16A16S, GLfloat>); + return info; + } + case ID::R16G16B16A16_UINT: + { + static const Format info(ID::R16G16B16A16_UINT, + GL_RGBA16UI, + GL_RGBA16UI, + GenerateMip<R16G16B16A16>, + ReadColor<R16G16B16A16, GLuint>); + return info; + } + case ID::R16G16B16A16_UNORM: + { + static const Format info(ID::R16G16B16A16_UNORM, + GL_RGBA16_EXT, + GL_RGBA16_EXT, + GenerateMip<R16G16B16A16>, + ReadColor<R16G16B16A16, GLfloat>); + return info; + } + case ID::R16G16B16_FLOAT: + { + static const Format info(ID::R16G16B16_FLOAT, + GL_RGB16F, + GL_RGB16F, + GenerateMip<R16G16B16F>, + ReadColor<R16G16B16F, GLfloat>); + return info; + } + case ID::R16G16B16_SINT: + { + static const Format info(ID::R16G16B16_SINT, + GL_RGB16I, + GL_RGB16I, + GenerateMip<R16G16B16S>, + ReadColor<R16G16B16S, GLint>); + return info; + } + case ID::R16G16B16_SNORM: + { + static const Format info(ID::R16G16B16_SNORM, + GL_RGB16_SNORM_EXT, + GL_RGB16_SNORM_EXT, + GenerateMip<R16G16B16S>, + ReadColor<R16G16B16S, GLfloat>); + return info; + } + case ID::R16G16B16_UINT: + { + static const Format info(ID::R16G16B16_UINT, + GL_RGB16UI, + GL_RGB16UI, + GenerateMip<R16G16B16>, + ReadColor<R16G16B16, GLuint>); + return info; + } + case ID::R16G16B16_UNORM: + { + static const Format info(ID::R16G16B16_UNORM, + GL_RGB16_EXT, + GL_RGB16_EXT, + GenerateMip<R16G16B16>, + ReadColor<R16G16B16, GLfloat>); + return info; + } + case ID::R16G16_FLOAT: + { + static const Format info(ID::R16G16_FLOAT, + GL_RG16F, + GL_RG16F, + GenerateMip<R16G16F>, + ReadColor<R16G16F, GLfloat>); + return info; + } + case ID::R16G16_SINT: + { + static const Format info(ID::R16G16_SINT, + GL_RG16I, + GL_RG16I, + GenerateMip<R16G16S>, + ReadColor<R16G16S, GLint>); + return info; + } + case ID::R16G16_SNORM: + { + static const Format info(ID::R16G16_SNORM, + GL_RG16_SNORM_EXT, + GL_RG16_SNORM_EXT, + GenerateMip<R16G16S>, + ReadColor<R16G16S, GLfloat>); + return info; + } + case ID::R16G16_UINT: + { + static const Format info(ID::R16G16_UINT, + GL_RG16UI, + GL_RG16UI, + GenerateMip<R16G16>, + ReadColor<R16G16, GLuint>); + return info; + } + case ID::R16G16_UNORM: + { + static const Format info(ID::R16G16_UNORM, + GL_RG16_EXT, + GL_RG16_EXT, + GenerateMip<R16G16>, + ReadColor<R16G16, GLfloat>); + return info; + } + case ID::R16_FLOAT: + { + static const Format info(ID::R16_FLOAT, + GL_R16F, + GL_R16F, + GenerateMip<R16F>, + ReadColor<R16F, GLfloat>); + return info; + } + case ID::R16_SINT: + { + static const Format info(ID::R16_SINT, + GL_R16I, + GL_R16I, + GenerateMip<R16S>, + ReadColor<R16S, GLint>); + return info; + } + case ID::R16_SNORM: + { + static const Format info(ID::R16_SNORM, + GL_R16_SNORM_EXT, + GL_R16_SNORM_EXT, + GenerateMip<R16S>, + ReadColor<R16S, GLfloat>); + return info; + } + case ID::R16_UINT: + { + static const Format info(ID::R16_UINT, + GL_R16UI, + GL_R16UI, + GenerateMip<R16>, + ReadColor<R16, GLuint>); + return info; + } + case ID::R16_UNORM: + { + static const Format info(ID::R16_UNORM, + GL_R16_EXT, + GL_R16_EXT, + GenerateMip<R16>, + ReadColor<R16, GLfloat>); + return info; + } + case ID::R32G32B32A32_FLOAT: + { + static const Format info(ID::R32G32B32A32_FLOAT, + GL_RGBA32F, + GL_RGBA32F, + GenerateMip<R32G32B32A32F>, + ReadColor<R32G32B32A32F, GLfloat>); + return info; + } + case ID::R32G32B32A32_SINT: + { + static const Format info(ID::R32G32B32A32_SINT, + GL_RGBA32I, + GL_RGBA32I, + GenerateMip<R32G32B32A32S>, + ReadColor<R32G32B32A32S, GLint>); + return info; + } + case ID::R32G32B32A32_UINT: + { + static const Format info(ID::R32G32B32A32_UINT, + GL_RGBA32UI, + GL_RGBA32UI, + GenerateMip<R32G32B32A32>, + ReadColor<R32G32B32A32, GLuint>); + return info; + } + case ID::R32G32B32_FLOAT: + { + static const Format info(ID::R32G32B32_FLOAT, + GL_RGB32F, + GL_RGB32F, + GenerateMip<R32G32B32F>, + ReadColor<R32G32B32F, GLfloat>); + return info; + } + case ID::R32G32B32_SINT: + { + static const Format info(ID::R32G32B32_SINT, + GL_RGB32I, + GL_RGB32I, + GenerateMip<R32G32B32S>, + ReadColor<R32G32B32S, GLint>); + return info; + } + case ID::R32G32B32_UINT: + { + static const Format info(ID::R32G32B32_UINT, + GL_RGB32UI, + GL_RGB32UI, + GenerateMip<R32G32B32>, + ReadColor<R32G32B32, GLuint>); + return info; + } + case ID::R32G32_FLOAT: + { + static const Format info(ID::R32G32_FLOAT, + GL_RG32F, + GL_RG32F, + GenerateMip<R32G32F>, + ReadColor<R32G32F, GLfloat>); + return info; + } + case ID::R32G32_SINT: + { + static const Format info(ID::R32G32_SINT, + GL_RG32I, + GL_RG32I, + GenerateMip<R32G32S>, + ReadColor<R32G32S, GLint>); + return info; + } + case ID::R32G32_UINT: + { + static const Format info(ID::R32G32_UINT, + GL_RG32UI, + GL_RG32UI, + GenerateMip<R32G32>, + ReadColor<R32G32, GLuint>); + return info; + } + case ID::R32_FLOAT: + { + static const Format info(ID::R32_FLOAT, + GL_R32F, + GL_R32F, + GenerateMip<R32F>, + ReadColor<R32F, GLfloat>); + return info; + } + case ID::R32_SINT: + { + static const Format info(ID::R32_SINT, + GL_R32I, + GL_R32I, + GenerateMip<R32S>, + ReadColor<R32S, GLint>); + return info; + } + case ID::R32_UINT: + { + static const Format info(ID::R32_UINT, + GL_R32UI, + GL_R32UI, + GenerateMip<R32>, + ReadColor<R32, GLuint>); + return info; + } + case ID::R4G4B4A4_UNORM: + { + static const Format info(ID::R4G4B4A4_UNORM, + GL_RGBA4, + GL_RGBA4, + GenerateMip<R4G4B4A4>, + ReadColor<R4G4B4A4, GLfloat>); + return info; + } + case ID::R5G5B5A1_UNORM: + { + static const Format info(ID::R5G5B5A1_UNORM, + GL_RGB5_A1, + GL_RGB5_A1, + GenerateMip<R5G5B5A1>, + ReadColor<R5G5B5A1, GLfloat>); + return info; + } + case ID::R5G6B5_UNORM: + { + static const Format info(ID::R5G6B5_UNORM, + GL_RGB565, + GL_RGB565, + GenerateMip<R5G6B5>, + ReadColor<R5G6B5, GLfloat>); + return info; + } + case ID::R8G8B8A8_SINT: + { + static const Format info(ID::R8G8B8A8_SINT, + GL_RGBA8I, + GL_RGBA8I, + GenerateMip<R8G8B8A8S>, + ReadColor<R8G8B8A8S, GLint>); + return info; + } + case ID::R8G8B8A8_SNORM: + { + static const Format info(ID::R8G8B8A8_SNORM, + GL_RGBA8_SNORM, + GL_RGBA8_SNORM, + GenerateMip<R8G8B8A8S>, + ReadColor<R8G8B8A8S, GLfloat>); + return info; + } + case ID::R8G8B8A8_UINT: + { + static const Format info(ID::R8G8B8A8_UINT, + GL_RGBA8UI, + GL_RGBA8UI, + GenerateMip<R8G8B8A8>, + ReadColor<R8G8B8A8, GLuint>); + return info; + } + case ID::R8G8B8A8_UNORM: + { + static const Format info(ID::R8G8B8A8_UNORM, + GL_RGBA8, + GL_RGBA8, + GenerateMip<R8G8B8A8>, + ReadColor<R8G8B8A8, GLfloat>); + return info; + } + case ID::R8G8B8A8_UNORM_SRGB: + { + static const Format info(ID::R8G8B8A8_UNORM_SRGB, + GL_SRGB8_ALPHA8, + GL_SRGB8_ALPHA8, + GenerateMip<R8G8B8A8>, + ReadColor<R8G8B8A8, GLfloat>); + return info; + } + case ID::R8G8B8_SINT: + { + static const Format info(ID::R8G8B8_SINT, + GL_RGB8I, + GL_RGB8I, + GenerateMip<R8G8B8S>, + ReadColor<R8G8B8S, GLint>); + return info; + } + case ID::R8G8B8_SNORM: + { + static const Format info(ID::R8G8B8_SNORM, + GL_RGB8_SNORM, + GL_RGB8_SNORM, + GenerateMip<R8G8B8S>, + ReadColor<R8G8B8S, GLfloat>); + return info; + } + case ID::R8G8B8_UINT: + { + static const Format info(ID::R8G8B8_UINT, + GL_RGB8UI, + GL_RGB8UI, + GenerateMip<R8G8B8>, + ReadColor<R8G8B8, GLuint>); + return info; + } + case ID::R8G8B8_UNORM: + { + static const Format info(ID::R8G8B8_UNORM, + GL_RGB8, + GL_RGB8, + GenerateMip<R8G8B8>, + ReadColor<R8G8B8, GLfloat>); + return info; + } + case ID::R8G8B8_UNORM_SRGB: + { + static const Format info(ID::R8G8B8_UNORM_SRGB, + GL_SRGB8, + GL_SRGB8, + GenerateMip<R8G8B8>, + ReadColor<R8G8B8, GLfloat>); + return info; + } + case ID::R8G8_SINT: + { + static const Format info(ID::R8G8_SINT, + GL_RG8I, + GL_RG8I, + GenerateMip<R8G8S>, + ReadColor<R8G8S, GLint>); + return info; + } + case ID::R8G8_SNORM: + { + static const Format info(ID::R8G8_SNORM, + GL_RG8_SNORM, + GL_RG8_SNORM, + GenerateMip<R8G8S>, + ReadColor<R8G8S, GLfloat>); + return info; + } + case ID::R8G8_UINT: + { + static const Format info(ID::R8G8_UINT, + GL_RG8UI, + GL_RG8UI, + GenerateMip<R8G8>, + ReadColor<R8G8, GLuint>); + return info; + } + case ID::R8G8_UNORM: + { + static const Format info(ID::R8G8_UNORM, + GL_RG8, + GL_RG8, + GenerateMip<R8G8>, + ReadColor<R8G8, GLfloat>); + return info; + } + case ID::R8_SINT: + { + static const Format info(ID::R8_SINT, + GL_R8I, + GL_R8I, + GenerateMip<R8S>, + ReadColor<R8S, GLint>); + return info; + } + case ID::R8_SNORM: + { + static const Format info(ID::R8_SNORM, + GL_R8_SNORM, + GL_R8_SNORM, + GenerateMip<R8S>, + ReadColor<R8S, GLfloat>); + return info; + } + case ID::R8_UINT: + { + static const Format info(ID::R8_UINT, + GL_R8UI, + GL_R8UI, + GenerateMip<R8>, + ReadColor<R8, GLuint>); + return info; + } + case ID::R8_UNORM: + { + static const Format info(ID::R8_UNORM, + GL_R8, + GL_R8, + GenerateMip<R8>, + ReadColor<R8, GLfloat>); + return info; + } + case ID::R9G9B9E5_SHAREDEXP: + { + static const Format info(ID::R9G9B9E5_SHAREDEXP, + GL_RGB9_E5, + GL_RGB9_E5, + GenerateMip<R9G9B9E5>, + ReadColor<R9G9B9E5, GLfloat>); + return info; + } + case ID::S8_UINT: + { + static const Format info(ID::S8_UINT, + GL_STENCIL_INDEX8, + GL_STENCIL_INDEX8, + nullptr, + nullptr); + return info; + } + + default: + UNREACHABLE(); + break; + } + // clang-format on + + static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr); + return noneInfo; +} + +} // namespace angle diff --git a/gfx/angle/src/libANGLE/renderer/Format_table_autogen.cpp b/gfx/angle/src/libANGLE/renderer/Format_table_autogen.cpp deleted file mode 100644 index 507827ff1..000000000 --- a/gfx/angle/src/libANGLE/renderer/Format_table_autogen.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// GENERATED FILE - DO NOT EDIT. -// Generated by gen_angle_format_table.py using data from angle_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. -// -// ANGLE Format table: -// Queries for typed format information from the ANGLE format enum. - -#include "libANGLE/renderer/Format.h" - -#include "image_util/copyimage.h" -#include "image_util/generatemip.h" -#include "image_util/loadimage.h" - -namespace angle -{ - -static constexpr rx::FastCopyFunctionMap::Entry BGRAEntry = {GL_RGBA, GL_UNSIGNED_BYTE, - CopyBGRA8ToRGBA8}; -static constexpr rx::FastCopyFunctionMap BGRACopyFunctions = {&BGRAEntry, 1}; -static constexpr rx::FastCopyFunctionMap NoCopyFunctions; - -constexpr Format g_formatInfoTable[] = { - // clang-format off - { Format::ID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0 }, - { Format::ID::A16_FLOAT, GL_ALPHA16F_EXT, GL_ALPHA16F_EXT, GenerateMip<A16F>, NoCopyFunctions, ReadColor<A16F, GLfloat>, GL_FLOAT, 0, 0, 0, 16, 0, 0 }, - { Format::ID::A32_FLOAT, GL_ALPHA32F_EXT, GL_ALPHA32F_EXT, GenerateMip<A32F>, NoCopyFunctions, ReadColor<A32F, GLfloat>, GL_FLOAT, 0, 0, 0, 32, 0, 0 }, - { Format::ID::A8_UNORM, GL_ALPHA8_EXT, GL_ALPHA8_EXT, GenerateMip<A8>, NoCopyFunctions, ReadColor<A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 0, 0 }, - { Format::ID::ASTC_10x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x12_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x12_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_4x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_4x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::B4G4R4A4_UNORM, GL_BGRA4_ANGLEX, GL_RGBA4, GenerateMip<A4R4G4B4>, NoCopyFunctions, ReadColor<A4R4G4B4, GLfloat>, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0 }, - { Format::ID::B5G5R5A1_UNORM, GL_BGR5_A1_ANGLEX, GL_RGB5_A1, GenerateMip<A1R5G5B5>, NoCopyFunctions, ReadColor<A1R5G5B5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0 }, - { Format::ID::B5G6R5_UNORM, GL_BGR565_ANGLEX, GL_RGB565, GenerateMip<B5G6R5>, NoCopyFunctions, ReadColor<B5G6R5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0 }, - { Format::ID::B8G8R8A8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, BGRACopyFunctions, ReadColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::B8G8R8X8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip<B8G8R8X8>, NoCopyFunctions, ReadColor<B8G8R8X8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::BC1_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC1_RGB_UNORM_BLOCK, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC2_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC3_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::D16_UNORM, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 16, 0 }, - { Format::ID::D24_UNORM, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT24, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 0 }, - { Format::ID::D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 8 }, - { Format::ID::D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, nullptr, NoCopyFunctions, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 0 }, - { Format::ID::D32_FLOAT_S8X24_UINT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, nullptr, NoCopyFunctions, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 8 }, - { Format::ID::D32_UNORM, GL_DEPTH_COMPONENT32_OES, GL_DEPTH_COMPONENT32_OES, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 32, 0 }, - { Format::ID::EAC_R11G11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_RG11_EAC, GL_COMPRESSED_SIGNED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, GL_SIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0 }, - { Format::ID::EAC_R11G11_UNORM_BLOCK, GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0 }, - { Format::ID::EAC_R11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, nullptr, NoCopyFunctions, nullptr, GL_SIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 }, - { Format::ID::EAC_R11_UNORM_BLOCK, GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 }, - { Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 }, - { Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 }, - { Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_COMPRESSED_RGBA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::ETC2_R8G8B8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ETC2, GL_COMPRESSED_SRGB8_ETC2, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::ETC2_R8G8B8_UNORM_BLOCK, GL_COMPRESSED_RGB8_ETC2, GL_COMPRESSED_RGB8_ETC2, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::L16A16_FLOAT, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA16F_EXT, GenerateMip<L16A16F>, NoCopyFunctions, ReadColor<L16A16F, GLfloat>, GL_FLOAT, 0, 0, 0, 16, 0, 0 }, - { Format::ID::L16_FLOAT, GL_LUMINANCE16F_EXT, GL_LUMINANCE16F_EXT, GenerateMip<L16F>, NoCopyFunctions, ReadColor<L16F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 0, 0 }, - { Format::ID::L32A32_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA32F_EXT, GenerateMip<L32A32F>, NoCopyFunctions, ReadColor<L32A32F, GLfloat>, GL_FLOAT, 0, 0, 0, 32, 0, 0 }, - { Format::ID::L32_FLOAT, GL_LUMINANCE32F_EXT, GL_LUMINANCE32F_EXT, GenerateMip<L32F>, NoCopyFunctions, ReadColor<L32F, GLfloat>, GL_FLOAT, 0, 0, 0, 0, 0, 0 }, - { Format::ID::L8A8_UNORM, GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE8_ALPHA8_EXT, GenerateMip<L8A8>, NoCopyFunctions, ReadColor<L8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 0, 0 }, - { Format::ID::L8_UNORM, GL_LUMINANCE8_EXT, GL_LUMINANCE8_EXT, GenerateMip<L8>, NoCopyFunctions, ReadColor<L8, GLfloat>, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::R10G10B10A2_UINT, GL_RGB10_A2UI, GL_RGB10_A2UI, GenerateMip<R10G10B10A2>, NoCopyFunctions, ReadColor<R10G10B10A2, GLuint>, GL_UNSIGNED_INT, 10, 10, 10, 2, 0, 0 }, - { Format::ID::R10G10B10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, GenerateMip<R10G10B10A2>, NoCopyFunctions, ReadColor<R10G10B10A2, GLfloat>, GL_UNSIGNED_NORMALIZED, 10, 10, 10, 2, 0, 0 }, - { Format::ID::R11G11B10_FLOAT, GL_R11F_G11F_B10F, GL_R11F_G11F_B10F, GenerateMip<R11G11B10F>, NoCopyFunctions, ReadColor<R11G11B10F, GLfloat>, GL_FLOAT, 11, 11, 10, 0, 0, 0 }, - { Format::ID::R16G16B16A16_FLOAT, GL_RGBA16F, GL_RGBA16F, GenerateMip<R16G16B16A16F>, NoCopyFunctions, ReadColor<R16G16B16A16F, GLfloat>, GL_FLOAT, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_SINT, GL_RGBA16I, GL_RGBA16I, GenerateMip<R16G16B16A16S>, NoCopyFunctions, ReadColor<R16G16B16A16S, GLint>, GL_INT, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_SNORM, GL_RGBA16_SNORM_EXT, GL_RGBA16_SNORM_EXT, GenerateMip<R16G16B16A16S>, NoCopyFunctions, ReadColor<R16G16B16A16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_UINT, GL_RGBA16UI, GL_RGBA16UI, GenerateMip<R16G16B16A16>, NoCopyFunctions, ReadColor<R16G16B16A16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_UNORM, GL_RGBA16_EXT, GL_RGBA16_EXT, GenerateMip<R16G16B16A16>, NoCopyFunctions, ReadColor<R16G16B16A16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16_FLOAT, GL_RGB16F, GL_RGB16F, GenerateMip<R16G16B16F>, NoCopyFunctions, ReadColor<R16G16B16F, GLfloat>, GL_FLOAT, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_SINT, GL_RGB16I, GL_RGB16I, GenerateMip<R16G16B16S>, NoCopyFunctions, ReadColor<R16G16B16S, GLint>, GL_INT, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_SNORM, GL_RGB16_SNORM_EXT, GL_RGB16_SNORM_EXT, GenerateMip<R16G16B16S>, NoCopyFunctions, ReadColor<R16G16B16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_UINT, GL_RGB16UI, GL_RGB16UI, GenerateMip<R16G16B16>, NoCopyFunctions, ReadColor<R16G16B16, GLuint>, GL_UNSIGNED_INT, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_UNORM, GL_RGB16_EXT, GL_RGB16_EXT, GenerateMip<R16G16B16>, NoCopyFunctions, ReadColor<R16G16B16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16_FLOAT, GL_RG16F, GL_RG16F, GenerateMip<R16G16F>, NoCopyFunctions, ReadColor<R16G16F, GLfloat>, GL_FLOAT, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_SINT, GL_RG16I, GL_RG16I, GenerateMip<R16G16S>, NoCopyFunctions, ReadColor<R16G16S, GLint>, GL_INT, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_SNORM, GL_RG16_SNORM_EXT, GL_RG16_SNORM_EXT, GenerateMip<R16G16S>, NoCopyFunctions, ReadColor<R16G16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_UINT, GL_RG16UI, GL_RG16UI, GenerateMip<R16G16>, NoCopyFunctions, ReadColor<R16G16, GLuint>, GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_UNORM, GL_RG16_EXT, GL_RG16_EXT, GenerateMip<R16G16>, NoCopyFunctions, ReadColor<R16G16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16_FLOAT, GL_R16F, GL_R16F, GenerateMip<R16F>, NoCopyFunctions, ReadColor<R16F, GLfloat>, GL_FLOAT, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_SINT, GL_R16I, GL_R16I, GenerateMip<R16S>, NoCopyFunctions, ReadColor<R16S, GLint>, GL_INT, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_SNORM, GL_R16_SNORM_EXT, GL_R16_SNORM_EXT, GenerateMip<R16S>, NoCopyFunctions, ReadColor<R16S, GLfloat>, GL_SIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_UINT, GL_R16UI, GL_R16UI, GenerateMip<R16>, NoCopyFunctions, ReadColor<R16, GLuint>, GL_UNSIGNED_INT, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_UNORM, GL_R16_EXT, GL_R16_EXT, GenerateMip<R16>, NoCopyFunctions, ReadColor<R16, GLfloat>, GL_UNSIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R32G32B32A32_FLOAT, GL_RGBA32F, GL_RGBA32F, GenerateMip<R32G32B32A32F>, NoCopyFunctions, ReadColor<R32G32B32A32F, GLfloat>, GL_FLOAT, 32, 32, 32, 32, 0, 0 }, - { Format::ID::R32G32B32A32_SINT, GL_RGBA32I, GL_RGBA32I, GenerateMip<R32G32B32A32S>, NoCopyFunctions, ReadColor<R32G32B32A32S, GLint>, GL_INT, 32, 32, 32, 32, 0, 0 }, - { Format::ID::R32G32B32A32_UINT, GL_RGBA32UI, GL_RGBA32UI, GenerateMip<R32G32B32A32>, NoCopyFunctions, ReadColor<R32G32B32A32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 32, 0, 0 }, - { Format::ID::R32G32B32_FLOAT, GL_RGB32F, GL_RGB32F, GenerateMip<R32G32B32F>, NoCopyFunctions, ReadColor<R32G32B32F, GLfloat>, GL_FLOAT, 32, 32, 32, 0, 0, 0 }, - { Format::ID::R32G32B32_SINT, GL_RGB32I, GL_RGB32I, GenerateMip<R32G32B32S>, NoCopyFunctions, ReadColor<R32G32B32S, GLint>, GL_INT, 32, 32, 32, 0, 0, 0 }, - { Format::ID::R32G32B32_UINT, GL_RGB32UI, GL_RGB32UI, GenerateMip<R32G32B32>, NoCopyFunctions, ReadColor<R32G32B32, GLuint>, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0 }, - { Format::ID::R32G32_FLOAT, GL_RG32F, GL_RG32F, GenerateMip<R32G32F>, NoCopyFunctions, ReadColor<R32G32F, GLfloat>, GL_FLOAT, 32, 32, 0, 0, 0, 0 }, - { Format::ID::R32G32_SINT, GL_RG32I, GL_RG32I, GenerateMip<R32G32S>, NoCopyFunctions, ReadColor<R32G32S, GLint>, GL_INT, 32, 32, 0, 0, 0, 0 }, - { Format::ID::R32G32_UINT, GL_RG32UI, GL_RG32UI, GenerateMip<R32G32>, NoCopyFunctions, ReadColor<R32G32, GLuint>, GL_UNSIGNED_INT, 32, 32, 0, 0, 0, 0 }, - { Format::ID::R32_FLOAT, GL_R32F, GL_R32F, GenerateMip<R32F>, NoCopyFunctions, ReadColor<R32F, GLfloat>, GL_FLOAT, 32, 0, 0, 0, 0, 0 }, - { Format::ID::R32_SINT, GL_R32I, GL_R32I, GenerateMip<R32S>, NoCopyFunctions, ReadColor<R32S, GLint>, GL_INT, 32, 0, 0, 0, 0, 0 }, - { Format::ID::R32_UINT, GL_R32UI, GL_R32UI, GenerateMip<R32>, NoCopyFunctions, ReadColor<R32, GLuint>, GL_UNSIGNED_INT, 32, 0, 0, 0, 0, 0 }, - { Format::ID::R4G4B4A4_UNORM, GL_RGBA4, GL_RGBA4, GenerateMip<R4G4B4A4>, NoCopyFunctions, ReadColor<R4G4B4A4, GLfloat>, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0 }, - { Format::ID::R5G5B5A1_UNORM, GL_RGB5_A1, GL_RGB5_A1, GenerateMip<R5G5B5A1>, NoCopyFunctions, ReadColor<R5G5B5A1, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0 }, - { Format::ID::R5G6B5_UNORM, GL_RGB565, GL_RGB565, GenerateMip<R5G6B5>, NoCopyFunctions, ReadColor<R5G6B5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0 }, - { Format::ID::R8G8B8A8_SINT, GL_RGBA8I, GL_RGBA8I, GenerateMip<R8G8B8A8S>, NoCopyFunctions, ReadColor<R8G8B8A8S, GLint>, GL_INT, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_SNORM, GL_RGBA8_SNORM, GL_RGBA8_SNORM, GenerateMip<R8G8B8A8S>, NoCopyFunctions, ReadColor<R8G8B8A8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_UINT, GL_RGBA8UI, GL_RGBA8UI, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_UNORM_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8_SINT, GL_RGB8I, GL_RGB8I, GenerateMip<R8G8B8S>, NoCopyFunctions, ReadColor<R8G8B8S, GLint>, GL_INT, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_SNORM, GL_RGB8_SNORM, GL_RGB8_SNORM, GenerateMip<R8G8B8S>, NoCopyFunctions, ReadColor<R8G8B8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_UINT, GL_RGB8UI, GL_RGB8UI, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLuint>, GL_UNSIGNED_INT, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_UNORM, GL_RGB8, GL_RGB8, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_UNORM_SRGB, GL_SRGB8, GL_SRGB8, GenerateMip<R8G8B8>, NoCopyFunctions, ReadColor<R8G8B8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8_SINT, GL_RG8I, GL_RG8I, GenerateMip<R8G8S>, NoCopyFunctions, ReadColor<R8G8S, GLint>, GL_INT, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8G8_SNORM, GL_RG8_SNORM, GL_RG8_SNORM, GenerateMip<R8G8S>, NoCopyFunctions, ReadColor<R8G8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8G8_UINT, GL_RG8UI, GL_RG8UI, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLuint>, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8G8_UNORM, GL_RG8, GL_RG8, GenerateMip<R8G8>, NoCopyFunctions, ReadColor<R8G8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8_SINT, GL_R8I, GL_R8I, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLint>, GL_INT, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R8_SNORM, GL_R8_SNORM, GL_R8_SNORM, GenerateMip<R8S>, NoCopyFunctions, ReadColor<R8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R8_UINT, GL_R8UI, GL_R8UI, GenerateMip<R8>, NoCopyFunctions, ReadColor<R8, GLuint>, GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R8_UNORM, GL_R8, GL_R8, GenerateMip<R8>, NoCopyFunctions, ReadColor<R8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R9G9B9E5_SHAREDEXP, GL_RGB9_E5, GL_RGB9_E5, GenerateMip<R9G9B9E5>, NoCopyFunctions, ReadColor<R9G9B9E5, GLfloat>, GL_FLOAT, 9, 9, 9, 0, 0, 0 }, - { Format::ID::S8_UINT, GL_STENCIL_INDEX8, GL_STENCIL_INDEX8, nullptr, NoCopyFunctions, nullptr, GL_UNSIGNED_INT, 0, 0, 0, 0, 0, 8 }, - // clang-format on -}; - -// static -const Format &Format::Get(ID id) -{ - return g_formatInfoTable[static_cast<size_t>(id)]; -} - -} // namespace angle diff --git a/gfx/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h b/gfx/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h index 5139ee5fd..a5aa65e55 100755 --- a/gfx/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h +++ b/gfx/angle/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h @@ -23,11 +23,7 @@ class FramebufferAttachmentObjectImpl : angle::NonCopyable virtual ~FramebufferAttachmentObjectImpl() {} virtual gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, - FramebufferAttachmentRenderTarget **rtOut) - { - UNIMPLEMENTED(); - return gl::Error(GL_OUT_OF_MEMORY, "getAttachmentRenderTarget not supported."); - } + FramebufferAttachmentRenderTarget **rtOut) = 0; }; } // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/GLImplFactory.h b/gfx/angle/src/libANGLE/renderer/GLImplFactory.h index 20a48fc72..09f14d727 100755 --- a/gfx/angle/src/libANGLE/renderer/GLImplFactory.h +++ b/gfx/angle/src/libANGLE/renderer/GLImplFactory.h @@ -63,7 +63,7 @@ class GLImplFactory : angle::NonCopyable virtual RenderbufferImpl *createRenderbuffer() = 0; // Buffer creation - virtual BufferImpl *createBuffer(const gl::BufferState &state) = 0; + virtual BufferImpl *createBuffer() = 0; // Vertex Array creation virtual VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) = 0; diff --git a/gfx/angle/src/libANGLE/renderer/ProgramImpl.h b/gfx/angle/src/libANGLE/renderer/ProgramImpl.h index 065f6a338..45ff0a05a 100755 --- a/gfx/angle/src/libANGLE/renderer/ProgramImpl.h +++ b/gfx/angle/src/libANGLE/renderer/ProgramImpl.h @@ -24,7 +24,14 @@ struct BlockMemberInfo; namespace rx { -using LinkResult = gl::ErrorOrResult<bool>; + +struct LinkResult +{ + LinkResult(bool linkSuccess, const gl::Error &error) : linkSuccess(linkSuccess), error(error) {} + + bool linkSuccess; + gl::Error error; +}; class ProgramImpl : angle::NonCopyable { diff --git a/gfx/angle/src/libANGLE/renderer/ShaderImpl.h b/gfx/angle/src/libANGLE/renderer/ShaderImpl.h index 77e02d023..2ade19a06 100755 --- a/gfx/angle/src/libANGLE/renderer/ShaderImpl.h +++ b/gfx/angle/src/libANGLE/renderer/ShaderImpl.h @@ -21,9 +21,9 @@ class ShaderImpl : angle::NonCopyable ShaderImpl(const gl::ShaderState &data) : mData(data) {} virtual ~ShaderImpl() { } - // Returns additional sh::Compile options. - virtual ShCompileOptions prepareSourceAndReturnOptions(std::stringstream *sourceStream, - std::string *sourcePath) = 0; + // Returns additional ShCompile options. + virtual int prepareSourceAndReturnOptions(std::stringstream *sourceStream, + std::string *sourcePath) = 0; // Returns success for compiling on the driver. Returns success. virtual bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) = 0; diff --git a/gfx/angle/src/libANGLE/renderer/SurfaceImpl.cpp b/gfx/angle/src/libANGLE/renderer/SurfaceImpl.cpp index e4b3d7c8b..517214b36 100755 --- a/gfx/angle/src/libANGLE/renderer/SurfaceImpl.cpp +++ b/gfx/angle/src/libANGLE/renderer/SurfaceImpl.cpp @@ -19,10 +19,4 @@ SurfaceImpl::~SurfaceImpl() { } -egl::Error SurfaceImpl::swapWithDamage(EGLint *rects, EGLint n_rects) -{ - UNREACHABLE(); - return egl::Error(EGL_BAD_SURFACE, "swapWithDamage implementation missing."); -} - } // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/SurfaceImpl.h b/gfx/angle/src/libANGLE/renderer/SurfaceImpl.h index 177e788d8..5efe2fc87 100755 --- a/gfx/angle/src/libANGLE/renderer/SurfaceImpl.h +++ b/gfx/angle/src/libANGLE/renderer/SurfaceImpl.h @@ -39,7 +39,6 @@ class SurfaceImpl : public FramebufferAttachmentObjectImpl virtual egl::Error initialize() = 0; virtual FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) = 0; virtual egl::Error swap() = 0; - virtual egl::Error swapWithDamage(EGLint *rects, EGLint n_rects); virtual egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) = 0; virtual egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) = 0; virtual egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) = 0; diff --git a/gfx/angle/src/libANGLE/renderer/TextureImpl.cpp b/gfx/angle/src/libANGLE/renderer/TextureImpl.cpp index af4796371..465d4e3e7 100755 --- a/gfx/angle/src/libANGLE/renderer/TextureImpl.cpp +++ b/gfx/angle/src/libANGLE/renderer/TextureImpl.cpp @@ -40,11 +40,4 @@ gl::Error TextureImpl::copySubTexture(const gl::Offset &destOffset, UNREACHABLE(); return gl::Error(GL_INVALID_OPERATION, "CHROMIUM_copy_texture exposed but not implemented."); } - -gl::Error TextureImpl::copyCompressedTexture(const gl::Texture *source) -{ - UNREACHABLE(); - return gl::Error(GL_INVALID_OPERATION, - "CHROMIUM_copy_compressed_texture exposed but not implemented."); -} } diff --git a/gfx/angle/src/libANGLE/renderer/TextureImpl.h b/gfx/angle/src/libANGLE/renderer/TextureImpl.h index 7d0ebe2f1..45c230729 100755 --- a/gfx/angle/src/libANGLE/renderer/TextureImpl.h +++ b/gfx/angle/src/libANGLE/renderer/TextureImpl.h @@ -16,7 +16,6 @@ #include "libANGLE/Error.h" #include "libANGLE/ImageIndex.h" #include "libANGLE/Stream.h" -#include "libANGLE/Texture.h" #include "libANGLE/renderer/FramebufferAttachmentObjectImpl.h" namespace egl @@ -73,8 +72,6 @@ class TextureImpl : public FramebufferAttachmentObjectImpl bool unpackUnmultiplyAlpha, const gl::Texture *source); - virtual gl::Error copyCompressedTexture(const gl::Texture *source); - virtual gl::Error setStorage(GLenum target, size_t levels, GLenum internalFormat, const gl::Extents &size) = 0; virtual gl::Error setEGLImageTarget(GLenum target, egl::Image *image) = 0; @@ -90,8 +87,6 @@ class TextureImpl : public FramebufferAttachmentObjectImpl virtual void bindTexImage(egl::Surface *surface) = 0; virtual void releaseTexImage() = 0; - virtual void syncState(const gl::Texture::DirtyBits &dirtyBits) = 0; - protected: const gl::TextureState &mState; }; diff --git a/gfx/angle/src/libANGLE/renderer/TextureImpl_mock.h b/gfx/angle/src/libANGLE/renderer/TextureImpl_mock.h index c8d05d202..8b8f397ac 100755 --- a/gfx/angle/src/libANGLE/renderer/TextureImpl_mock.h +++ b/gfx/angle/src/libANGLE/renderer/TextureImpl_mock.h @@ -19,7 +19,7 @@ namespace rx class MockTextureImpl : public TextureImpl { public: - MockTextureImpl() : TextureImpl(mMockState), mMockState(GL_TEXTURE_2D) {} + MockTextureImpl() : TextureImpl(gl::TextureState(GL_TEXTURE_2D)) {} virtual ~MockTextureImpl() { destructor(); } MOCK_METHOD8(setImage, gl::Error(GLenum, size_t, GLenum, const gl::Extents &, GLenum, GLenum, const gl::PixelUnpackState &, const uint8_t *)); MOCK_METHOD7(setSubImage, gl::Error(GLenum, size_t, const gl::Box &, GLenum, GLenum, const gl::PixelUnpackState &, const uint8_t *)); @@ -35,7 +35,6 @@ class MockTextureImpl : public TextureImpl bool, bool, const gl::Texture *)); - MOCK_METHOD1(copyCompressedTexture, gl::Error(const gl::Texture *source)); MOCK_METHOD4(setStorage, gl::Error(GLenum, size_t, GLenum, const gl::Extents &)); MOCK_METHOD3(setImageExternal, gl::Error(GLenum, egl::Stream *, const egl::Stream::GLTextureDescription &)); @@ -48,12 +47,7 @@ class MockTextureImpl : public TextureImpl MOCK_METHOD1(setBaseLevel, void(GLuint)); - MOCK_METHOD1(syncState, void(const gl::Texture::DirtyBits &)); - MOCK_METHOD0(destructor, void()); - - protected: - gl::TextureState mMockState; }; } 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(¤tCounter); + BOOL success = QueryPerformanceCounter(¤tCounter); + 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(¤tCounter); + 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 ®ion) +gl::Error Image11::copyToStorage(TextureStorage *storage, const gl::ImageIndex &index, const gl::Box ®ion) { 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 ¤tSRVs = (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 ©Area); @@ -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; } diff --git a/gfx/angle/src/libANGLE/renderer/driver_utils.cpp b/gfx/angle/src/libANGLE/renderer/driver_utils.cpp deleted file mode 100644 index 7e7b2d8a2..000000000 --- a/gfx/angle/src/libANGLE/renderer/driver_utils.cpp +++ /dev/null @@ -1,81 +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. -// - -// driver_utils.h : provides more information about current driver. - -#include <algorithm> - -#include "libANGLE/renderer/driver_utils.h" - -namespace rx -{ -// Intel -// Referenced from https://cgit.freedesktop.org/vaapi/intel-driver/tree/src/i965_pciids.h -namespace -{ -// gen7 -const uint32_t Haswell[] = { - 0x0402, 0x0406, 0x040A, 0x040B, 0x040E, 0x0C02, 0x0C06, 0x0C0A, 0x0C0B, 0x0C0E, - 0x0A02, 0x0A06, 0x0A0A, 0x0A0B, 0x0A0E, 0x0D02, 0x0D06, 0x0D0A, 0x0D0B, 0x0D0E, // hsw_gt1 - 0x0412, 0x0416, 0x041A, 0x041B, 0x041E, 0x0C12, 0x0C16, 0x0C1A, 0x0C1B, 0x0C1E, - 0x0A12, 0x0A16, 0x0A1A, 0x0A1B, 0x0A1E, 0x0D12, 0x0D16, 0x0D1A, 0x0D1B, 0x0D1E, // hsw_gt2 - 0x0422, 0x0426, 0x042A, 0x042B, 0x042E, 0x0C22, 0x0C26, 0x0C2A, 0x0C2B, 0x0C2E, - 0x0A22, 0x0A26, 0x0A2A, 0x0A2B, 0x0A2E, 0x0D22, 0x0D26, 0x0D2A, 0x0D2B, 0x0D2E // hsw_gt3 -}; - -// gen8 -const uint32_t Broadwell[] = {0x1602, 0x1606, 0x160A, 0x160B, 0x160D, 0x160E, - 0x1612, 0x1616, 0x161A, 0x161B, 0x161D, 0x161E, - 0x1622, 0x1626, 0x162A, 0x162B, 0x162D, 0x162E}; - -const uint32_t CherryView[] = {0x22B0, 0x22B1, 0x22B2, 0x22B3}; - -// gen9 -const uint32_t Skylake[] = {0x1902, 0x1906, 0x190A, 0x190B, 0x190E, 0x1912, 0x1913, 0x1915, 0x1916, - 0x1917, 0x191A, 0x191B, 0x191D, 0x191E, 0x1921, 0x1923, 0x1926, 0x1927, - 0x192A, 0x192B, 0x192D, 0x1932, 0x193A, 0x193B, 0x193D}; - -const uint32_t Broxton[] = {0x0A84, 0x1A84, 0x1A85, 0x5A84, 0x5A85}; - -// gen9p5 -const uint32_t Kabylake[] = {0x5916, 0x5913, 0x5906, 0x5926, 0x5921, 0x5915, 0x590E, - 0x591E, 0x5912, 0x5917, 0x5902, 0x591B, 0x593B, 0x590B, - 0x591A, 0x590A, 0x591D, 0x5908, 0x5923, 0x5927}; - -} // anonymous namespace - -bool IsHaswell(uint32_t DeviceId) -{ - return std::find(std::begin(Haswell), std::end(Haswell), DeviceId) != std::end(Haswell); -} - -bool IsBroadwell(uint32_t DeviceId) -{ - return std::find(std::begin(Broadwell), std::end(Broadwell), DeviceId) != std::end(Broadwell); -} - -bool IsCherryView(uint32_t DeviceId) -{ - return std::find(std::begin(CherryView), std::end(CherryView), DeviceId) != - std::end(CherryView); -} - -bool IsSkylake(uint32_t DeviceId) -{ - return std::find(std::begin(Skylake), std::end(Skylake), DeviceId) != std::end(Skylake); -} - -bool IsBroxton(uint32_t DeviceId) -{ - return std::find(std::begin(Broxton), std::end(Broxton), DeviceId) != std::end(Broxton); -} - -bool IsKabylake(uint32_t DeviceId) -{ - return std::find(std::begin(Kabylake), std::end(Kabylake), DeviceId) != std::end(Kabylake); -} - -} // namespace rx
\ No newline at end of file diff --git a/gfx/angle/src/libANGLE/renderer/driver_utils.h b/gfx/angle/src/libANGLE/renderer/driver_utils.h deleted file mode 100644 index 865de73e1..000000000 --- a/gfx/angle/src/libANGLE/renderer/driver_utils.h +++ /dev/null @@ -1,57 +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. -// - -// driver_utils.h : provides more information about current driver. - -#ifndef LIBANGLE_RENDERER_DRIVER_UTILS_H_ -#define LIBANGLE_RENDERER_DRIVER_UTILS_H_ - -#include "libANGLE/angletypes.h" - -namespace rx -{ - -enum VendorID : uint32_t -{ - VENDOR_ID_UNKNOWN = 0x0, - VENDOR_ID_AMD = 0x1002, - VENDOR_ID_INTEL = 0x8086, - VENDOR_ID_NVIDIA = 0x10DE, - // This is Qualcomm PCI Vendor ID. - // Android doesn't have a PCI bus, but all we need is a unique id. - VENDOR_ID_QUALCOMM = 0x5143, -}; - -inline bool IsAMD(uint32_t vendor_id) -{ - return vendor_id == VENDOR_ID_AMD; -} - -inline bool IsIntel(uint32_t vendor_id) -{ - return vendor_id == VENDOR_ID_INTEL; -} - -inline bool IsNvidia(uint32_t vendor_id) -{ - return vendor_id == VENDOR_ID_NVIDIA; -} - -inline bool IsQualcomm(uint32_t vendor_id) -{ - return vendor_id == VENDOR_ID_QUALCOMM; -} - -// Intel -bool IsHaswell(uint32_t DeviceId); -bool IsBroadwell(uint32_t DeviceId); -bool IsCherryView(uint32_t DeviceId); -bool IsSkylake(uint32_t DeviceId); -bool IsBroxton(uint32_t DeviceId); -bool IsKabylake(uint32_t DeviceId); - -} // namespace rx -#endif // LIBANGLE_RENDERER_DRIVER_UTILS_H_
\ No newline at end of file diff --git a/gfx/angle/src/libANGLE/renderer/gen_angle_format_table.py b/gfx/angle/src/libANGLE/renderer/gen_angle_format_table.py index 6b56bb40c..7356fc414 100755 --- a/gfx/angle/src/libANGLE/renderer/gen_angle_format_table.py +++ b/gfx/angle/src/libANGLE/renderer/gen_angle_format_table.py @@ -16,7 +16,7 @@ import re import sys template_autogen_h = """// GENERATED FILE - DO NOT EDIT. -// Generated by {script_name} using data from {data_source_name} +// Generated by gen_angle_format_table.py using data from angle_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 @@ -35,8 +35,8 @@ enum class Format::ID }} // namespace angle """ -template_autogen_inl = """// GENERATED FILE - DO NOT EDIT. -// Generated by {script_name} using data from {data_source_name} +template_autogen_cpp = """// GENERATED FILE - DO NOT EDIT. +// Generated by gen_angle_format_table.py using data from angle_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 @@ -54,21 +54,21 @@ template_autogen_inl = """// GENERATED FILE - DO NOT EDIT. namespace angle {{ -static constexpr rx::FastCopyFunctionMap::Entry BGRAEntry = {{GL_RGBA, GL_UNSIGNED_BYTE, - CopyBGRA8ToRGBA8}}; -static constexpr rx::FastCopyFunctionMap BGRACopyFunctions = {{&BGRAEntry, 1}}; -static constexpr rx::FastCopyFunctionMap NoCopyFunctions; - -constexpr Format g_formatInfoTable[] = {{ - // clang-format off - {{ Format::ID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0 }}, -{angle_format_info_cases} // clang-format on -}}; - // static const Format &Format::Get(ID id) {{ - return g_formatInfoTable[static_cast<size_t>(id)]; + // clang-format off + switch (id) + {{ +{angle_format_info_cases} + default: + UNREACHABLE(); + break; + }} + // clang-format on + + static const Format noneInfo(ID::NONE, GL_NONE, GL_NONE, nullptr, nullptr); + return noneInfo; }} }} // namespace angle @@ -123,7 +123,14 @@ def get_color_read_function(angle_format): } return 'ReadColor<' + channel_struct + ', '+ component_type_map[angle_format['componentType']] + '>' -format_entry_template = """ {{ Format::ID::{id}, {glInternalFormat}, {fboImplementationInternalFormat}, {mipGenerationFunction}, {fastCopyFunctions}, {colorReadFunction}, {namedComponentType}, {R}, {G}, {B}, {A}, {D}, {S} }}, +format_entry_template = """{space}{{ +{space} static const Format info(ID::{id}, +{space} {glInternalFormat}, +{space} {fboImplementationInternalFormat}, +{space} {mipGenerationFunction}, +{space} {colorReadFunction}); +{space} return info; +{space}}} """ def get_component_type(format_id): @@ -167,29 +174,13 @@ def get_bits(format_id): bits[token[0]] = int(token[1:]) return bits -def get_named_component_type(component_type): - if component_type == "snorm": - return "GL_SIGNED_NORMALIZED" - elif component_type == "unorm": - return "GL_UNSIGNED_NORMALIZED" - elif component_type == "float": - return "GL_FLOAT" - elif component_type == "uint": - return "GL_UNSIGNED_INT" - elif component_type == "int": - return "GL_INT" - elif component_type == "none": - return "GL_NONE" - else: - raise ValueError("Unknown component type for " + component_type) - def json_to_table_data(format_id, json, angle_to_gl): table_data = "" parsed = { + "space": " ", "id": format_id, - "fastCopyFunctions": "NoCopyFunctions", } for k, v in json.iteritems(): @@ -214,25 +205,14 @@ def json_to_table_data(format_id, json, angle_to_gl): parsed["mipGenerationFunction"] = get_mip_generation_function(parsed) parsed["colorReadFunction"] = get_color_read_function(parsed) - for channel in "ABDGLRS": - if parsed["bits"] != None and channel in parsed["bits"]: - parsed[channel] = parsed["bits"][channel] - else: - parsed[channel] = "0" - - parsed["namedComponentType"] = get_named_component_type(parsed["componentType"]) - - if format_id == "B8G8R8A8_UNORM": - parsed["fastCopyFunctions"] = "BGRACopyFunctions" - return format_entry_template.format(**parsed) -def parse_angle_format_table(all_angle, json_data, angle_to_gl): +def parse_json_into_angle_format_switch_string(all_angle, json_data, angle_to_gl): table_data = '' for format_id in sorted(all_angle): - if format_id != "NONE": - format_info = json_data[format_id] if format_id in json_data else {} - table_data += json_to_table_data(format_id, format_info, angle_to_gl) + format_info = json_data[format_id] if format_id in json_data else {} + table_data += ' case ID::' + format_id + ':\n' + table_data += json_to_table_data(format_id, format_info, angle_to_gl) return table_data @@ -246,27 +226,22 @@ def gen_enum_string(all_angle): gl_to_angle = angle_format.load_forward_table('angle_format_map.json') angle_to_gl = angle_format.load_inverse_table('angle_format_map.json') -data_source_name = 'angle_format_data.json' -json_data = angle_format.load_json(data_source_name) +json_data = angle_format.load_json('angle_format_data.json') all_angle = angle_to_gl.keys() -angle_format_cases = parse_angle_format_table( +angle_format_cases = parse_json_into_angle_format_switch_string( all_angle, json_data, angle_to_gl) -output_cpp = template_autogen_inl.format( - script_name = sys.argv[0], - copyright_year = date.today().year, - angle_format_info_cases = angle_format_cases, - data_source_name = data_source_name) -with open('Format_table_autogen.cpp', 'wt') as out_file: +output_cpp = template_autogen_cpp.format( + copyright_year=date.today().year, + angle_format_info_cases=angle_format_cases) +with open('Format_autogen.cpp', 'wt') as out_file: out_file.write(output_cpp) out_file.close() enum_data = gen_enum_string(all_angle) output_h = template_autogen_h.format( - script_name = sys.argv[0], - copyright_year = date.today().year, - angle_format_enum = enum_data, - data_source_name = data_source_name) + copyright_year=date.today().year, + angle_format_enum=enum_data) with open('Format_ID_autogen.inl', 'wt') as out_file: out_file.write(output_h) out_file.close() diff --git a/gfx/angle/src/libANGLE/renderer/gl/BlitGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/BlitGL.cpp index b181822ff..0a624dcb1 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/BlitGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/BlitGL.cpp @@ -30,7 +30,7 @@ gl::Error CheckCompileStatus(const rx::FunctionsGL *functions, GLuint shader) return gl::Error(GL_OUT_OF_MEMORY, "Failed to compile internal blit shader."); } - return gl::NoError(); + return gl::Error(GL_NO_ERROR); } gl::Error CheckLinkStatus(const rx::FunctionsGL *functions, GLuint program) @@ -43,7 +43,7 @@ gl::Error CheckLinkStatus(const rx::FunctionsGL *functions, GLuint program) return gl::Error(GL_OUT_OF_MEMORY, "Failed to link internal blit program."); } - return gl::NoError(); + return gl::Error(GL_NO_ERROR); } } // anonymous namespace @@ -58,9 +58,6 @@ BlitGL::BlitGL(const FunctionsGL *functions, mWorkarounds(workarounds), mStateManager(stateManager), mBlitProgram(0), - mSourceTextureLocation(-1), - mScaleLocation(-1), - mOffsetLocation(-1), mScratchFBO(0), mVAO(0) { @@ -133,7 +130,11 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(GLuint texture, const gl::Rectangle &sourceArea, const gl::Framebuffer *source) { - ANGLE_TRY(initializeResources()); + gl::Error error = initializeResources(); + if (error.isError()) + { + return error; + } // Blit the framebuffer to the first scratch texture const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(source); @@ -145,6 +146,7 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(GLuint texture, const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(copyTexImageFormat.internalFormat); + mStateManager->activeTexture(0); mStateManager->bindTexture(GL_TEXTURE_2D, mScratchTextures[0]); mFunctions->copyTexImage2D(GL_TEXTURE_2D, 0, copyTexImageFormat.internalFormat, sourceArea.x, sourceArea.y, sourceArea.width, sourceArea.height, 0); @@ -169,6 +171,7 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(GLuint texture, mScratchTextures[1], 0); // Render to the destination texture, sampling from the scratch texture + mStateManager->useProgram(mBlitProgram); mStateManager->setViewport(gl::Rectangle(0, 0, sourceArea.width, sourceArea.height)); mStateManager->setScissorTestEnabled(false); mStateManager->setDepthRange(0.0f, 1.0f); @@ -183,192 +186,16 @@ gl::Error BlitGL::copySubImageToLUMAWorkaroundTexture(GLuint texture, mStateManager->setRasterizerDiscardEnabled(false); mStateManager->bindTexture(GL_TEXTURE_2D, mScratchTextures[0]); - setScratchTextureParameter(GL_TEXTURE_MIN_FILTER, GL_NEAREST); - setScratchTextureParameter(GL_TEXTURE_MAG_FILTER, GL_NEAREST); - mStateManager->activeTexture(0); - mStateManager->bindTexture(GL_TEXTURE_2D, mScratchTextures[0]); - - mStateManager->useProgram(mBlitProgram); - mFunctions->uniform1i(mSourceTextureLocation, 0); - mFunctions->uniform2f(mScaleLocation, 1.0, 1.0); - mFunctions->uniform2f(mOffsetLocation, 0.0, 0.0); - mStateManager->bindVertexArray(mVAO, 0); - mFunctions->drawArrays(GL_TRIANGLES, 0, 3); + mFunctions->drawArrays(GL_TRIANGLES, 0, 6); - // Copy the swizzled texture to the destination texture + // Finally, copy the swizzled texture to the destination texture mStateManager->bindTexture(textureType, texture); mFunctions->copyTexSubImage2D(target, static_cast<GLint>(level), destOffset.x, destOffset.y, 0, 0, sourceArea.width, sourceArea.height); - // Finally orphan the scratch textures so they can be GCed by the driver. - orphanScratchTextures(); - - return gl::NoError(); -} - -gl::Error BlitGL::blitColorBufferWithShader(const gl::Framebuffer *source, - const gl::Framebuffer *dest, - const gl::Rectangle &sourceAreaIn, - const gl::Rectangle &destAreaIn, - GLenum filter) -{ - ANGLE_TRY(initializeResources()); - - // Normalize the destination area to have positive width and height because we will use - // glViewport to set it, which doesn't allow negative width or height. - gl::Rectangle sourceArea = sourceAreaIn; - gl::Rectangle destArea = destAreaIn; - if (destArea.width < 0) - { - destArea.x += destArea.width; - destArea.width = -destArea.width; - sourceArea.x += sourceArea.width; - sourceArea.width = -sourceArea.width; - } - if (destArea.height < 0) - { - destArea.y += destArea.height; - destArea.height = -destArea.height; - sourceArea.y += sourceArea.height; - sourceArea.height = -sourceArea.height; - } - - const gl::FramebufferAttachment *readAttachment = source->getReadColorbuffer(); - ASSERT(readAttachment->getSamples() <= 1); - - // Compute the part of the source that will be sampled. - gl::Rectangle inBoundsSource; - { - gl::Extents sourceSize = readAttachment->getSize(); - gl::Rectangle sourceBounds(0, 0, sourceSize.width, sourceSize.height); - gl::ClipRectangle(sourceArea, sourceBounds, &inBoundsSource); - - // Note that inBoundsSource will have lost the orientation information. - ASSERT(inBoundsSource.width >= 0 && inBoundsSource.height >= 0); - - // Early out when the sampled part is empty as the blit will be a noop, - // and it prevents a division by zero in later computations. - if (inBoundsSource.width == 0 || inBoundsSource.height == 0) - { - return gl::NoError(); - } - } - - // The blit will be emulated by getting the source of the blit in a texture and sampling it - // with CLAMP_TO_EDGE. The quad used to draw can trivially compute texture coordinates going - // from (0, 0) to (1, 1). These texture coordinates will need to be transformed to make two - // regions match: - // - The region of the texture representing the source framebuffer region that will be sampled - // - The region of the drawn quad that corresponds to non-clamped blit, this is the same as the - // region of the source rectangle that is inside the source attachment. - // - // These two regions, T (texture) and D (dest) are defined by their offset in texcoord space - // in (0, 1)^2 and their size in texcoord space in (-1, 1)^2. The size can be negative to - // represent the orientation of the blit. - // - // Then if P is the quad texcoord, Q the texcoord inside T, and R the texture texcoord: - // - Q = (P - D.offset) / D.size - // - Q = (R - T.offset) / T.size - // Hence R = (P - D.offset) / D.size * T.size - T.offset - // = P * (T.size / D.size) + (T.offset - D.offset * T.size / D.size) - - GLuint textureId; - gl::Vector2 TOffset; - gl::Vector2 TSize; - - // TODO(cwallez) once texture dirty bits are landed, reuse attached texture instead of using - // CopyTexImage2D - { - textureId = mScratchTextures[0]; - TOffset = gl::Vector2(0.0, 0.0); - TSize = gl::Vector2(1.0, 1.0); - if (sourceArea.width < 0) - { - TOffset.x = 1.0; - TSize.x = -1.0; - } - if (sourceArea.height < 0) - { - TOffset.y = 1.0; - TSize.y = -1.0; - } - - GLenum format = readAttachment->getFormat().info->internalFormat; - const FramebufferGL *sourceGL = GetImplAs<FramebufferGL>(source); - mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, sourceGL->getFramebufferID()); - mStateManager->bindTexture(GL_TEXTURE_2D, textureId); - - mFunctions->copyTexImage2D(GL_TEXTURE_2D, 0, format, inBoundsSource.x, inBoundsSource.y, - inBoundsSource.width, inBoundsSource.height, 0); - } - - // Compute normalized sampled draw quad region - // It is the same as the region of the source rectangle that is in bounds. - gl::Vector2 DOffset; - gl::Vector2 DSize; - { - ASSERT(sourceArea.width != 0 && sourceArea.height != 0); - gl::Rectangle orientedInBounds = inBoundsSource; - if (sourceArea.width < 0) - { - orientedInBounds.x += orientedInBounds.width; - orientedInBounds.width = -orientedInBounds.width; - } - if (sourceArea.height < 0) - { - orientedInBounds.y += orientedInBounds.height; - orientedInBounds.height = -orientedInBounds.height; - } - - DOffset = - gl::Vector2(static_cast<float>(orientedInBounds.x - sourceArea.x) / sourceArea.width, - static_cast<float>(orientedInBounds.y - sourceArea.y) / sourceArea.height); - DSize = gl::Vector2(static_cast<float>(orientedInBounds.width) / sourceArea.width, - static_cast<float>(orientedInBounds.height) / sourceArea.height); - } - - ASSERT(DSize.x != 0.0 && DSize.y != 0.0); - gl::Vector2 texCoordScale = gl::Vector2(TSize.x / DSize.x, TSize.y / DSize.y); - gl::Vector2 texCoordOffset = gl::Vector2(TOffset.x - DOffset.x * texCoordScale.x, - TOffset.y - DOffset.y * texCoordScale.y); - - // Reset all the state except scissor and viewport - mStateManager->setDepthRange(0.0f, 1.0f); - mStateManager->setBlendEnabled(false); - mStateManager->setColorMask(true, true, true, true); - mStateManager->setSampleAlphaToCoverageEnabled(false); - mStateManager->setSampleCoverageEnabled(false); - mStateManager->setDepthTestEnabled(false); - mStateManager->setStencilTestEnabled(false); - mStateManager->setCullFaceEnabled(false); - mStateManager->setPolygonOffsetFillEnabled(false); - mStateManager->setRasterizerDiscardEnabled(false); - - // Use the viewport to draw exactly to the destination rectangle - mStateManager->setViewport(destArea); - - // Set uniforms - setScratchTextureParameter(GL_TEXTURE_MIN_FILTER, filter); - setScratchTextureParameter(GL_TEXTURE_MAG_FILTER, filter); - setScratchTextureParameter(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - setScratchTextureParameter(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - mStateManager->activeTexture(0); - mStateManager->bindTexture(GL_TEXTURE_2D, mScratchTextures[0]); - - mStateManager->useProgram(mBlitProgram); - mFunctions->uniform1i(mSourceTextureLocation, 0); - mFunctions->uniform2f(mScaleLocation, texCoordScale.x, texCoordScale.y); - mFunctions->uniform2f(mOffsetLocation, texCoordOffset.x, texCoordOffset.y); - - const FramebufferGL *destGL = GetImplAs<FramebufferGL>(dest); - mStateManager->bindFramebuffer(GL_DRAW_FRAMEBUFFER, destGL->getFramebufferID()); - - mStateManager->bindVertexArray(mVAO, 0); - mFunctions->drawArrays(GL_TRIANGLES, 0, 3); - - return gl::NoError(); + return gl::Error(GL_NO_ERROR); } gl::Error BlitGL::initializeResources() @@ -378,38 +205,41 @@ gl::Error BlitGL::initializeResources() mBlitProgram = mFunctions->createProgram(); // Compile the fragment shader - // It uses a single, large triangle, to avoid arithmetic precision issues where fragments - // with the same Y coordinate don't get exactly the same interpolated texcoord Y. const char *vsSource = "#version 150\n" "out vec2 v_texcoord;\n" - "uniform vec2 u_scale;\n" - "uniform vec2 u_offset;\n" "\n" "void main()\n" "{\n" - " const vec2 quad_positions[3] = vec2[3]\n" + " const vec2 quad_positions[6] = vec2[6]\n" " (\n" - " vec2(-0.5f, 0.0f),\n" - " vec2( 1.5f, 0.0f),\n" - " vec2( 0.5f, 2.0f)\n" + " vec2(0.0f, 0.0f),\n" + " vec2(0.0f, 1.0f),\n" + " vec2(1.0f, 0.0f),\n" + "\n" + " vec2(0.0f, 1.0f),\n" + " vec2(1.0f, 0.0f),\n" + " vec2(1.0f, 1.0f)\n" " );\n" "\n" " gl_Position = vec4((quad_positions[gl_VertexID] * 2.0) - 1.0, 0.0, 1.0);\n" - " v_texcoord = quad_positions[gl_VertexID] * u_scale + u_offset;\n" + " v_texcoord = quad_positions[gl_VertexID];\n" "}\n"; GLuint vs = mFunctions->createShader(GL_VERTEX_SHADER); mFunctions->shaderSource(vs, 1, &vsSource, nullptr); mFunctions->compileShader(vs); - ANGLE_TRY(CheckCompileStatus(mFunctions, vs)); + gl::Error error = CheckCompileStatus(mFunctions, vs); mFunctions->attachShader(mBlitProgram, vs); mFunctions->deleteShader(vs); + if (error.isError()) + { + return error; + } + // Compile the vertex shader - // It discards if the texcoord is outside (0, 1)^2 so the blitframebuffer workaround - // doesn't write when the point sampled is outside of the source framebuffer. const char *fsSource = "#version 150\n" "uniform sampler2D u_source_texture;\n" @@ -418,28 +248,32 @@ gl::Error BlitGL::initializeResources() "\n" "void main()\n" "{\n" - " if (clamp(v_texcoord, vec2(0.0), vec2(1.0)) != v_texcoord)\n" - " {\n" - " discard;\n" - " }\n" " output_color = texture(u_source_texture, v_texcoord);\n" "}\n"; GLuint fs = mFunctions->createShader(GL_FRAGMENT_SHADER); mFunctions->shaderSource(fs, 1, &fsSource, nullptr); mFunctions->compileShader(fs); - ANGLE_TRY(CheckCompileStatus(mFunctions, fs)); + error = CheckCompileStatus(mFunctions, fs); mFunctions->attachShader(mBlitProgram, fs); mFunctions->deleteShader(fs); + if (error.isError()) + { + return error; + } + mFunctions->linkProgram(mBlitProgram); - ANGLE_TRY(CheckLinkStatus(mFunctions, mBlitProgram)); + error = CheckLinkStatus(mFunctions, mBlitProgram); + if (error.isError()) + { + return error; + } - mSourceTextureLocation = mFunctions->getUniformLocation(mBlitProgram, "u_source_texture"); - mScaleLocation = mFunctions->getUniformLocation(mBlitProgram, "u_scale"); - mOffsetLocation = mFunctions->getUniformLocation(mBlitProgram, "u_offset"); + GLuint textureUniform = mFunctions->getUniformLocation(mBlitProgram, "u_source_texture"); mStateManager->useProgram(mBlitProgram); + mFunctions->uniform1i(textureUniform, 0); } for (size_t i = 0; i < ArraySize(mScratchTextures); i++) @@ -447,6 +281,11 @@ gl::Error BlitGL::initializeResources() if (mScratchTextures[i] == 0) { mFunctions->genTextures(1, &mScratchTextures[i]); + mStateManager->bindTexture(GL_TEXTURE_2D, mScratchTextures[i]); + + // Use nearest, non-mipmapped sampling with the scratch texture + mFunctions->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + mFunctions->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); } } @@ -460,27 +299,6 @@ gl::Error BlitGL::initializeResources() mFunctions->genVertexArrays(1, &mVAO); } - return gl::NoError(); + return gl::Error(GL_NO_ERROR); } - -void BlitGL::orphanScratchTextures() -{ - for (auto texture : mScratchTextures) - { - mStateManager->bindTexture(GL_TEXTURE_2D, texture); - mFunctions->texImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 0, GL_RGBA, GL_UNSIGNED_BYTE, - nullptr); - } -} - -void BlitGL::setScratchTextureParameter(GLenum param, GLenum value) -{ - for (auto texture : mScratchTextures) - { - mStateManager->bindTexture(GL_TEXTURE_2D, texture); - mFunctions->texParameteri(GL_TEXTURE_2D, param, value); - mFunctions->texParameteri(GL_TEXTURE_2D, param, value); - } } - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/gl/BlitGL.h b/gfx/angle/src/libANGLE/renderer/gl/BlitGL.h index b306ede29..3ab8319bb 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/BlitGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/BlitGL.h @@ -52,26 +52,14 @@ class BlitGL : public angle::NonCopyable const gl::Rectangle &sourceArea, const gl::Framebuffer *source); - gl::Error blitColorBufferWithShader(const gl::Framebuffer *source, - const gl::Framebuffer *dest, - const gl::Rectangle &sourceArea, - const gl::Rectangle &destArea, - GLenum filter); - gl::Error initializeResources(); private: - void orphanScratchTextures(); - void setScratchTextureParameter(GLenum param, GLenum value); - const FunctionsGL *mFunctions; const WorkaroundsGL &mWorkarounds; StateManagerGL *mStateManager; GLuint mBlitProgram; - GLint mSourceTextureLocation; - GLint mScaleLocation; - GLint mOffsetLocation; GLuint mScratchTextures[2]; GLuint mScratchFBO; diff --git a/gfx/angle/src/libANGLE/renderer/gl/BufferGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/BufferGL.cpp index a5eda6b30..cd82733d7 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/BufferGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/BufferGL.cpp @@ -29,10 +29,8 @@ static const GLenum SourceBufferOperationTarget = GL_COPY_READ_BUFFER; // supported GL versions and doesn't affect any current state when it changes. static const GLenum DestBufferOperationTarget = GL_ARRAY_BUFFER; -BufferGL::BufferGL(const gl::BufferState &state, - const FunctionsGL *functions, - StateManagerGL *stateManager) - : BufferImpl(state), +BufferGL::BufferGL(const FunctionsGL *functions, StateManagerGL *stateManager) + : BufferImpl(), mIsMapped(false), mMapOffset(0), mMapSize(0), @@ -55,7 +53,7 @@ BufferGL::~BufferGL() mBufferID = 0; } -gl::Error BufferGL::setData(GLenum /*target*/, const void *data, size_t size, GLenum usage) +gl::Error BufferGL::setData(const void* data, size_t size, GLenum usage) { mStateManager->bindBuffer(DestBufferOperationTarget, mBufferID); mFunctions->bufferData(DestBufferOperationTarget, size, data, usage); @@ -78,7 +76,7 @@ gl::Error BufferGL::setData(GLenum /*target*/, const void *data, size_t size, GL return gl::Error(GL_NO_ERROR); } -gl::Error BufferGL::setSubData(GLenum /*target*/, const void *data, size_t size, size_t offset) +gl::Error BufferGL::setSubData(const void* data, size_t size, size_t offset) { mStateManager->bindBuffer(DestBufferOperationTarget, mBufferID); mFunctions->bufferSubData(DestBufferOperationTarget, offset, size, data); diff --git a/gfx/angle/src/libANGLE/renderer/gl/BufferGL.h b/gfx/angle/src/libANGLE/renderer/gl/BufferGL.h index d886873fe..e787ec86e 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/BufferGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/BufferGL.h @@ -21,13 +21,11 @@ class StateManagerGL; class BufferGL : public BufferImpl { public: - BufferGL(const gl::BufferState &state, - const FunctionsGL *functions, - StateManagerGL *stateManager); + BufferGL(const FunctionsGL *functions, StateManagerGL *stateManager); ~BufferGL() override; - 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, 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; diff --git a/gfx/angle/src/libANGLE/renderer/gl/ContextGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/ContextGL.cpp index 8e378a4be..57dc222b9 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/ContextGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/ContextGL.cpp @@ -62,8 +62,7 @@ ProgramImpl *ContextGL::createProgram(const gl::ProgramState &data) FramebufferImpl *ContextGL::createFramebuffer(const gl::FramebufferState &data) { - return new FramebufferGL(data, getFunctions(), getStateManager(), getWorkaroundsGL(), - mRenderer->getBlitter(), false); + return new FramebufferGL(data, getFunctions(), getStateManager(), getWorkaroundsGL(), false); } TextureImpl *ContextGL::createTexture(const gl::TextureState &state) @@ -78,9 +77,9 @@ RenderbufferImpl *ContextGL::createRenderbuffer() getNativeTextureCaps()); } -BufferImpl *ContextGL::createBuffer(const gl::BufferState &state) +BufferImpl *ContextGL::createBuffer() { - return new BufferGL(state, getFunctions(), getStateManager()); + return new BufferGL(getFunctions(), getStateManager()); } VertexArrayImpl *ContextGL::createVertexArray(const gl::VertexArrayState &data) diff --git a/gfx/angle/src/libANGLE/renderer/gl/ContextGL.h b/gfx/angle/src/libANGLE/renderer/gl/ContextGL.h index b3d5e0ee8..798a90436 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/ContextGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/ContextGL.h @@ -47,7 +47,7 @@ class ContextGL : 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/gl/DisplayGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp index 30c5c7b4e..e57513326 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.cpp @@ -22,7 +22,8 @@ namespace rx { -DisplayGL::DisplayGL() : mRenderer(nullptr), mCurrentDrawSurface(nullptr) +DisplayGL::DisplayGL() + : mRenderer(nullptr) { } @@ -72,13 +73,6 @@ StreamProducerImpl *DisplayGL::createStreamProducerD3DTextureNV12( egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) { - // Notify the previous surface (if it still exists) that it is no longer current - if (mCurrentDrawSurface && mSurfaceSet.find(mCurrentDrawSurface) != mSurfaceSet.end()) - { - ANGLE_TRY(GetImplAs<SurfaceGL>(mCurrentDrawSurface)->unMakeCurrent()); - } - mCurrentDrawSurface = nullptr; - if (!drawSurface) { return egl::Error(EGL_SUCCESS); @@ -89,10 +83,7 @@ egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readS glContext->getStateManager()->pauseTransformFeedback(context->getContextState()); SurfaceGL *glDrawSurface = GetImplAs<SurfaceGL>(drawSurface); - ANGLE_TRY(glDrawSurface->makeCurrent()); - mCurrentDrawSurface = drawSurface; - - return egl::Error(EGL_SUCCESS); + return glDrawSurface->makeCurrent(); } gl::Version DisplayGL::getMaxSupportedESVersion() const diff --git a/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.h b/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.h index a63da6bbc..9f6515886 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/DisplayGL.h @@ -12,11 +12,6 @@ #include "libANGLE/renderer/DisplayImpl.h" #include "libANGLE/renderer/gl/FunctionsGL.h" -namespace egl -{ -class Surface; -} - namespace rx { @@ -53,8 +48,6 @@ class DisplayGL : public DisplayImpl virtual const FunctionsGL *getFunctionsGL() const = 0; RendererGL *mRenderer; - - egl::Surface *mCurrentDrawSurface; }; } diff --git a/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.cpp index 0a058f8ba..4606114ca 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.cpp @@ -16,18 +16,14 @@ #include "libANGLE/angletypes.h" #include "libANGLE/formatutils.h" #include "libANGLE/renderer/ContextImpl.h" -#include "libANGLE/renderer/gl/BlitGL.h" #include "libANGLE/renderer/gl/FunctionsGL.h" #include "libANGLE/renderer/gl/RenderbufferGL.h" #include "libANGLE/renderer/gl/StateManagerGL.h" #include "libANGLE/renderer/gl/TextureGL.h" #include "libANGLE/renderer/gl/WorkaroundsGL.h" -#include "libANGLE/renderer/gl/formatutilsgl.h" -#include "libANGLE/renderer/gl/renderergl_utils.h" #include "platform/Platform.h" using namespace gl; -using angle::CheckedNumeric; namespace rx { @@ -36,13 +32,11 @@ FramebufferGL::FramebufferGL(const FramebufferState &state, const FunctionsGL *functions, StateManagerGL *stateManager, const WorkaroundsGL &workarounds, - BlitGL *blitter, bool isDefault) : FramebufferImpl(state), mFunctions(functions), mStateManager(stateManager), mWorkarounds(workarounds), - mBlitter(blitter), mFramebufferID(0), mIsDefault(isDefault) { @@ -56,13 +50,11 @@ FramebufferGL::FramebufferGL(GLuint id, const FramebufferState &state, const FunctionsGL *functions, const WorkaroundsGL &workarounds, - BlitGL *blitter, StateManagerGL *stateManager) : FramebufferImpl(state), mFunctions(functions), mStateManager(stateManager), mWorkarounds(workarounds), - mBlitter(blitter), mFramebufferID(id), mIsDefault(true) { @@ -220,14 +212,14 @@ GLenum FramebufferGL::getImplementationColorReadFormat() const { const auto *readAttachment = mState.getReadAttachment(); const Format &format = readAttachment->getFormat(); - return format.info->getReadPixelsFormat(); + return format.info->format; } GLenum FramebufferGL::getImplementationColorReadType() const { const auto *readAttachment = mState.getReadAttachment(); const Format &format = readAttachment->getFormat(); - return format.info->getReadPixelsType(); + return format.info->type; } Error FramebufferGL::readPixels(ContextImpl *context, @@ -241,37 +233,10 @@ Error FramebufferGL::readPixels(ContextImpl *context, const PixelPackState &packState = context->getGLState().getPackState(); mStateManager->setPixelPackState(packState); - nativegl::ReadPixelsFormat readPixelsFormat = - nativegl::GetReadPixelsFormat(mFunctions, mWorkarounds, format, type); - GLenum readFormat = readPixelsFormat.format; - GLenum readType = readPixelsFormat.type; - mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, mFramebufferID); + mFunctions->readPixels(area.x, area.y, area.width, area.height, format, type, pixels); - if (mWorkarounds.packOverlappingRowsSeparatelyPackBuffer && packState.pixelBuffer.get() && - packState.rowLength != 0 && packState.rowLength < area.width) - { - return readPixelsRowByRowWorkaround(area, readFormat, readType, packState, pixels); - } - - if (mWorkarounds.packLastRowSeparatelyForPaddingInclusion) - { - gl::Extents size(area.width, area.height, 1); - - bool apply; - ANGLE_TRY_RESULT(ShouldApplyLastRowPaddingWorkaround(size, packState, readFormat, readType, - false, pixels), - apply); - - if (apply) - { - return readPixelsPaddingWorkaround(area, readFormat, readType, packState, pixels); - } - } - - mFunctions->readPixels(area.x, area.y, area.width, area.height, readFormat, readType, pixels); - - return gl::NoError(); + return Error(GL_NO_ERROR); } Error FramebufferGL::blit(ContextImpl *context, @@ -281,80 +246,15 @@ Error FramebufferGL::blit(ContextImpl *context, GLenum filter) { const Framebuffer *sourceFramebuffer = context->getGLState().getReadFramebuffer(); - const Framebuffer *destFramebuffer = context->getGLState().getDrawFramebuffer(); - - const FramebufferAttachment *colorReadAttachment = sourceFramebuffer->getReadColorbuffer(); - GLsizei readAttachmentSamples = colorReadAttachment->getSamples(); - - bool needManualColorBlit = false; - - // TODO(cwallez) when the filter is LINEAR and both source and destination are SRGB, we - // could avoid doing a manual blit. - - // Prior to OpenGL 4.4 BlitFramebuffer (section 18.3.1 of GL 4.3 core profile) reads: - // When values are taken from the read buffer, no linearization is performed, even - // if the format of the buffer is SRGB. - // Starting from OpenGL 4.4 (section 18.3.1) it reads: - // When values are taken from the read buffer, if FRAMEBUFFER_SRGB is enabled and the - // value of FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING for the framebuffer attachment - // corresponding to the read buffer is SRGB, the red, green, and blue components are - // converted from the non-linear sRGB color space according [...]. - { - bool sourceSRGB = colorReadAttachment != nullptr && - colorReadAttachment->getColorEncoding() == GL_SRGB; - needManualColorBlit = - needManualColorBlit || (sourceSRGB && mFunctions->isAtMostGL(gl::Version(4, 3))); - } - - // Prior to OpenGL 4.2 BlitFramebuffer (section 4.3.2 of GL 4.1 core profile) reads: - // Blit operations bypass the fragment pipeline. The only fragment operations which - // affect a blit are the pixel ownership test and scissor test. - // Starting from OpenGL 4.2 (section 4.3.2) it reads: - // When values are written to the draw buffers, blit operations bypass the fragment - // pipeline. The only fragment operations which affect a blit are the pixel ownership - // test, the scissor test and sRGB conversion. - if (!needManualColorBlit) - { - bool destSRGB = false; - for (size_t i = 0; i < destFramebuffer->getDrawbufferStateCount(); ++i) - { - const FramebufferAttachment *attachment = destFramebuffer->getDrawBuffer(i); - if (attachment && attachment->getColorEncoding() == GL_SRGB) - { - destSRGB = true; - break; - } - } - - needManualColorBlit = - needManualColorBlit || (destSRGB && mFunctions->isAtMostGL(gl::Version(4, 1))); - } - - // Enable FRAMEBUFFER_SRGB if needed - mStateManager->setFramebufferSRGBEnabledForFramebuffer(true, this); - - GLenum blitMask = mask; - if (needManualColorBlit && (mask & GL_COLOR_BUFFER_BIT) && readAttachmentSamples <= 1) - { - ANGLE_TRY(mBlitter->blitColorBufferWithShader(sourceFramebuffer, destFramebuffer, - sourceArea, destArea, filter)); - blitMask &= ~GL_COLOR_BUFFER_BIT; - } - - if (blitMask == 0) - { - return gl::NoError(); - } - const FramebufferGL *sourceFramebufferGL = GetImplAs<FramebufferGL>(sourceFramebuffer); + mStateManager->bindFramebuffer(GL_READ_FRAMEBUFFER, sourceFramebufferGL->getFramebufferID()); mStateManager->bindFramebuffer(GL_DRAW_FRAMEBUFFER, mFramebufferID); mFunctions->blitFramebuffer(sourceArea.x, sourceArea.y, sourceArea.x1(), sourceArea.y1(), - destArea.x, destArea.y, destArea.x1(), destArea.y1(), blitMask, - filter); + destArea.x, destArea.y, destArea.x1(), destArea.y1(), mask, filter); - return gl::NoError(); + return Error(GL_NO_ERROR); } bool FramebufferGL::checkStatus() const @@ -420,9 +320,17 @@ GLuint FramebufferGL::getFramebufferID() const return mFramebufferID; } -bool FramebufferGL::isDefault() const +void FramebufferGL::syncDrawState() const { - return mIsDefault; + if (mFunctions->standard == STANDARD_GL_DESKTOP) + { + // Enable SRGB blending for all framebuffers except the default framebuffer on Desktop + // OpenGL. + // When SRGB blending is enabled, only SRGB capable formats will use it but the default + // framebuffer will always use it if it is enabled. + // TODO(geofflang): Update this when the framebuffer binding dirty changes, when it exists. + mStateManager->setFramebufferSRGBEnabled(!mIsDefault); + } } void FramebufferGL::syncClearState(GLbitfield mask) @@ -432,17 +340,17 @@ void FramebufferGL::syncClearState(GLbitfield mask) if (mWorkarounds.doesSRGBClearsOnLinearFramebufferAttachments && (mask & GL_COLOR_BUFFER_BIT) != 0 && !mIsDefault) { - bool hasSRGBAttachment = false; + bool hasSRBAttachment = false; for (const auto &attachment : mState.getColorAttachments()) { if (attachment.isAttached() && attachment.getColorEncoding() == GL_SRGB) { - hasSRGBAttachment = true; + hasSRBAttachment = true; break; } } - mStateManager->setFramebufferSRGBEnabled(hasSRGBAttachment); + mStateManager->setFramebufferSRGBEnabled(hasSRBAttachment); } else { @@ -483,71 +391,4 @@ void FramebufferGL::syncClearBufferState(GLenum buffer, GLint drawBuffer) } } } -gl::Error FramebufferGL::readPixelsRowByRowWorkaround(const gl::Rectangle &area, - GLenum format, - GLenum type, - const gl::PixelPackState &pack, - GLvoid *pixels) const -{ - intptr_t offset = reinterpret_cast<intptr_t>(pixels); - - const gl::InternalFormat &glFormat = - gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type)); - GLuint rowBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, pack.alignment, pack.rowLength), - rowBytes); - GLuint skipBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeSkipBytes(rowBytes, 0, pack, false), skipBytes); - - gl::PixelPackState directPack; - directPack.pixelBuffer = pack.pixelBuffer; - directPack.alignment = 1; - mStateManager->setPixelPackState(directPack); - directPack.pixelBuffer.set(nullptr); - - offset += skipBytes; - for (GLint row = 0; row < area.height; ++row) - { - mFunctions->readPixels(area.x, row + area.y, area.width, 1, format, type, - reinterpret_cast<GLvoid *>(offset)); - offset += row * rowBytes; - } - - return gl::NoError(); -} - -gl::Error FramebufferGL::readPixelsPaddingWorkaround(const gl::Rectangle &area, - GLenum format, - GLenum type, - const gl::PixelPackState &pack, - GLvoid *pixels) const -{ - const gl::InternalFormat &glFormat = - gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type)); - GLuint rowBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, pack.alignment, pack.rowLength), - rowBytes); - GLuint skipBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeSkipBytes(rowBytes, 0, pack, false), skipBytes); - - // Get all by the last row - if (area.height > 1) - { - mFunctions->readPixels(area.x, area.y, area.width, area.height - 1, format, type, pixels); - } - - // Get the last row manually - gl::PixelPackState directPack; - directPack.pixelBuffer = pack.pixelBuffer; - directPack.alignment = 1; - mStateManager->setPixelPackState(directPack); - directPack.pixelBuffer.set(nullptr); - - intptr_t lastRowOffset = - reinterpret_cast<intptr_t>(pixels) + skipBytes + (area.height - 1) * rowBytes; - mFunctions->readPixels(area.x, area.y + area.height - 1, area.width, 1, format, type, - reinterpret_cast<GLvoid *>(lastRowOffset)); - - return gl::NoError(); -} } // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.h b/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.h index a8bcb894c..69d4aef35 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/FramebufferGL.h @@ -14,7 +14,6 @@ namespace rx { -class BlitGL; class FunctionsGL; class StateManagerGL; struct WorkaroundsGL; @@ -26,7 +25,6 @@ class FramebufferGL : public FramebufferImpl const FunctionsGL *functions, StateManagerGL *stateManager, const WorkaroundsGL &workarounds, - BlitGL *blitter, bool isDefault); // Constructor called when we need to create a FramebufferGL from an // existing framebuffer name, for example for the default framebuffer @@ -35,7 +33,6 @@ class FramebufferGL : public FramebufferImpl const gl::FramebufferState &data, const FunctionsGL *functions, const WorkaroundsGL &workarounds, - BlitGL *blitter, StateManagerGL *stateManager); ~FramebufferGL() override; @@ -80,29 +77,17 @@ class FramebufferGL : public FramebufferImpl void syncState(const gl::Framebuffer::DirtyBits &dirtyBits) override; + void syncDrawState() const; + GLuint getFramebufferID() const; - bool isDefault() const; private: void syncClearState(GLbitfield mask); void syncClearBufferState(GLenum buffer, GLint drawBuffer); - gl::Error readPixelsRowByRowWorkaround(const gl::Rectangle &area, - GLenum format, - GLenum type, - const gl::PixelPackState &pack, - GLvoid *pixels) const; - - gl::Error readPixelsPaddingWorkaround(const gl::Rectangle &area, - GLenum format, - GLenum type, - const gl::PixelPackState &pack, - GLvoid *pixels) const; - const FunctionsGL *mFunctions; StateManagerGL *mStateManager; const WorkaroundsGL &mWorkarounds; - BlitGL *mBlitter; GLuint mFramebufferID; bool mIsDefault; diff --git a/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.cpp index fcbf211bc..9c3964e47 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.cpp @@ -2283,21 +2283,11 @@ bool FunctionsGL::isAtLeastGL(const gl::Version &glVersion) const return standard == STANDARD_GL_DESKTOP && version >= glVersion; } -bool FunctionsGL::isAtMostGL(const gl::Version &glVersion) const -{ - return standard == STANDARD_GL_DESKTOP && glVersion >= version; -} - bool FunctionsGL::isAtLeastGLES(const gl::Version &glesVersion) const { return standard == STANDARD_GL_ES && version >= glesVersion; } -bool FunctionsGL::isAtMostGLES(const gl::Version &glesVersion) const -{ - return standard == STANDARD_GL_ES && glesVersion >= version; -} - bool FunctionsGL::hasExtension(const std::string &ext) const { return std::find(extensions.begin(), extensions.end(), ext) != extensions.end(); diff --git a/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.h b/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.h index fa8634e57..e790d96fe 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/FunctionsGL.h @@ -36,9 +36,7 @@ class FunctionsGL StandardGL standard; GLint profile; bool isAtLeastGL(const gl::Version &glVersion) const; - bool isAtMostGL(const gl::Version &glVersion) const; bool isAtLeastGLES(const gl::Version &glesVersion) const; - bool isAtMostGLES(const gl::Version &glesVersion) const; // Extensions std::vector<std::string> extensions; diff --git a/gfx/angle/src/libANGLE/renderer/gl/ProgramGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/ProgramGL.cpp index 88c7df720..2c2c4e7ad 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/ProgramGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/ProgramGL.cpp @@ -62,12 +62,12 @@ LinkResult ProgramGL::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) // Verify that the program linked if (!checkLinkStatus(infoLog)) { - return false; + return LinkResult(false, gl::Error(GL_NO_ERROR)); } postLink(); - return true; + return LinkResult(true, gl::Error(GL_NO_ERROR)); } gl::Error ProgramGL::save(gl::BinaryOutputStream *stream) @@ -167,7 +167,7 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog) // Verify the link if (!checkLinkStatus(infoLog)) { - return false; + return LinkResult(false, gl::Error(GL_NO_ERROR)); } if (mWorkarounds.alwaysCallUseProgramAfterLink) @@ -177,7 +177,7 @@ LinkResult ProgramGL::link(const gl::ContextState &data, gl::InfoLog &infoLog) postLink(); - return true; + return LinkResult(true, gl::Error(GL_NO_ERROR)); } GLboolean ProgramGL::validate(const gl::Caps & /*caps*/, gl::InfoLog * /*infoLog*/) @@ -223,7 +223,7 @@ void ProgramGL::setUniform1iv(GLint location, GLsizei count, const GLint *v) std::vector<GLuint> &boundTextureUnits = mSamplerBindings[samplerIndex].boundTextureUnits; size_t copyCount = - std::min<size_t>(count, boundTextureUnits.size() - locationEntry.element); + std::max<size_t>(count, boundTextureUnits.size() - locationEntry.element); std::copy(v, v + copyCount, boundTextureUnits.begin() + locationEntry.element); } } @@ -577,7 +577,7 @@ void ProgramGL::postLink() for (GLint arrayIndex = 1; arrayIndex < arraySize; ++arrayIndex) { PathRenderingFragmentInput arrayElementInput; - arrayElementInput.name = name + "[" + ToString(arrayIndex) + "]"; + arrayElementInput.name = name + "[" + std::to_string(arrayIndex) + "]"; arrayElementInput.location = baseLocation + arrayIndex; mPathRenderingFragmentInputs.push_back(std::move(arrayElementInput)); } diff --git a/gfx/angle/src/libANGLE/renderer/gl/RenderbufferGL.h b/gfx/angle/src/libANGLE/renderer/gl/RenderbufferGL.h index 0ff0faeae..eeb164378 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/RenderbufferGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/RenderbufferGL.h @@ -38,6 +38,12 @@ class RenderbufferGL : public RenderbufferImpl GLuint getRenderbufferID() const; + gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, + FramebufferAttachmentRenderTarget **rtOut) override + { + return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL"); + } + private: const FunctionsGL *mFunctions; const WorkaroundsGL &mWorkarounds; diff --git a/gfx/angle/src/libANGLE/renderer/gl/RendererGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/RendererGL.cpp index da1a65687..10c408d93 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/RendererGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/RendererGL.cpp @@ -122,7 +122,6 @@ RendererGL::RendererGL(const FunctionsGL *functions, const egl::AttributeMap &at #ifndef NDEBUG if (mHasDebugOutput) { - mFunctions->enable(GL_DEBUG_OUTPUT); mFunctions->enable(GL_DEBUG_OUTPUT_SYNCHRONOUS); mFunctions->debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_HIGH, 0, nullptr, GL_TRUE); mFunctions->debugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM, 0, nullptr, GL_TRUE); @@ -138,17 +137,6 @@ RendererGL::RendererGL(const FunctionsGL *functions, const egl::AttributeMap &at { mSkipDrawCalls = true; } - - if (mWorkarounds.initializeCurrentVertexAttributes) - { - GLint maxVertexAttribs = 0; - mFunctions->getIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); - - for (GLint i = 0; i < maxVertexAttribs; ++i) - { - mFunctions->vertexAttrib4f(i, 0.0f, 0.0f, 0.0f, 1.0f); - } - } } RendererGL::~RendererGL() diff --git a/gfx/angle/src/libANGLE/renderer/gl/SamplerGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/SamplerGL.cpp index 2a6d81583..bffc89ec9 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/SamplerGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/SamplerGL.cpp @@ -62,7 +62,6 @@ void SamplerGL::syncState(const gl::SamplerState &samplerState) const SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_MAX_LOD, &gl::SamplerState::maxLod); SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_COMPARE_MODE, &gl::SamplerState::compareMode); SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_COMPARE_FUNC, &gl::SamplerState::compareFunc); - SyncSamplerStateMember(mFunctions, mSamplerID, samplerState, mAppliedSamplerState, GL_TEXTURE_SRGB_DECODE_EXT, &gl::SamplerState::sRGBDecode); // clang-format on } diff --git a/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.cpp index c9145b00a..400917b35 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.cpp @@ -36,8 +36,8 @@ ShaderGL::~ShaderGL() } } -ShCompileOptions ShaderGL::prepareSourceAndReturnOptions(std::stringstream *sourceStream, - std::string * /*sourcePath*/) +int ShaderGL::prepareSourceAndReturnOptions(std::stringstream *sourceStream, + std::string * /*sourcePath*/) { // Reset the previous state if (mShaderID != 0) @@ -48,43 +48,13 @@ ShCompileOptions ShaderGL::prepareSourceAndReturnOptions(std::stringstream *sour *sourceStream << mData.getSource(); - ShCompileOptions options = SH_INIT_GL_POSITION; + int options = SH_INIT_GL_POSITION; if (mWorkarounds.doWhileGLSLCausesGPUHang) { options |= SH_REWRITE_DO_WHILE_LOOPS; } - if (mWorkarounds.emulateAbsIntFunction) - { - options |= SH_EMULATE_ABS_INT_FUNCTION; - } - - if (mWorkarounds.addAndTrueToLoopCondition) - { - options |= SH_ADD_AND_TRUE_TO_LOOP_CONDITION; - } - - if (mWorkarounds.emulateIsnanFloat) - { - options |= SH_EMULATE_ISNAN_FLOAT_FUNCTION; - } - - if (mWorkarounds.useUnusedBlocksWithStandardOrSharedLayout) - { - options |= SH_USE_UNUSED_STANDARD_SHARED_BLOCKS; - } - - if (mWorkarounds.dontRemoveInvariantForFragmentInput) - { - options |= SH_DONT_REMOVE_INVARIANT_FOR_FRAGMENT_INPUT; - } - - if (mWorkarounds.removeInvariantAndCentroidForESSL3) - { - options |= SH_REMOVE_INVARIANT_AND_CENTROID_FOR_ESSL3; - } - return options; } diff --git a/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.h b/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.h index 0ecd89ce6..f35d2f711 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/ShaderGL.h @@ -25,8 +25,8 @@ class ShaderGL : public ShaderImpl ~ShaderGL() override; // 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; diff --git a/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp index 3a227906f..1cf08b242 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.cpp @@ -119,7 +119,6 @@ StateManagerGL::StateManagerGL(const FunctionsGL *functions, const gl::Caps &ren mClearDepth(1.0f), mClearStencil(0), mFramebufferSRGBEnabled(false), - mDitherEnabled(true), mTextureCubemapSeamlessEnabled(false), mMultisamplingEnabled(true), mSampleAlphaToOneEnabled(false), @@ -743,21 +742,18 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::ContextState &data) GLenum textureType = samplerUniform.textureType; for (GLuint textureUnitIndex : samplerUniform.boundTextureUnits) { - gl::Texture *texture = state.getSamplerTexture(textureUnitIndex, textureType); + const gl::Texture *texture = state.getSamplerTexture(textureUnitIndex, textureType); if (texture != nullptr) { const TextureGL *textureGL = GetImplAs<TextureGL>(texture); - if (mTextures[textureType][textureUnitIndex] != textureGL->getTextureID() || - texture->hasAnyDirtyBit() || textureGL->hasAnyDirtyBit()) + if (mTextures[textureType][textureUnitIndex] != textureGL->getTextureID()) { activeTexture(textureUnitIndex); bindTexture(textureType, textureGL->getTextureID()); - - // TODO: Call this from the gl:: layer once other backends use dirty bits for - // texture state. - texture->syncImplState(); } + + textureGL->syncState(textureUnitIndex); } else { @@ -785,6 +781,7 @@ gl::Error StateManagerGL::setGenericDrawState(const gl::ContextState &data) const gl::Framebuffer *framebuffer = state.getDrawFramebuffer(); const FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(framebuffer); bindFramebuffer(GL_DRAW_FRAMEBUFFER, framebufferGL->getFramebufferID()); + framebufferGL->syncDrawState(); // Seamless cubemaps are required for ES3 and higher contexts. setTextureCubemapSeamlessEnabled(data.getClientMajorVersion() >= 3); @@ -1319,13 +1316,6 @@ void StateManagerGL::setClearStencil(GLint clearStencil) void StateManagerGL::syncState(const gl::State &state, const gl::State::DirtyBits &glDirtyBits) { - // The the current framebuffer binding sometimes requires resetting the srgb blending - if (glDirtyBits[gl::State::DIRTY_BIT_DRAW_FRAMEBUFFER_BINDING] && - mFunctions->standard == STANDARD_GL_DESKTOP) - { - mLocalDirtyBits.set(gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB); - } - const auto &glAndLocalDirtyBits = (glDirtyBits | mLocalDirtyBits); if (!glAndLocalDirtyBits.any()) @@ -1523,7 +1513,7 @@ void StateManagerGL::syncState(const gl::State &state, const gl::State::DirtyBit setPixelPackState(state.getPackState()); break; case gl::State::DIRTY_BIT_DITHER_ENABLED: - setDitherEnabled(state.isDitherEnabled()); + // TODO(jmadill): implement this break; case gl::State::DIRTY_BIT_GENERATE_MIPMAP_HINT: // TODO(jmadill): implement this @@ -1566,11 +1556,6 @@ void StateManagerGL::syncState(const gl::State &state, const gl::State::DirtyBit setPathRenderingStencilState(state.getPathStencilFunc(), state.getPathStencilRef(), state.getPathStencilMask()); break; - case gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB: - setFramebufferSRGBEnabledForFramebuffer( - state.getFramebufferSRGB(), - GetImplAs<FramebufferGL>(state.getDrawFramebuffer())); - break; default: { ASSERT(dirtyBit >= gl::State::DIRTY_BIT_CURRENT_VALUE_0 && @@ -1600,41 +1585,6 @@ void StateManagerGL::setFramebufferSRGBEnabled(bool enabled) { mFunctions->disable(GL_FRAMEBUFFER_SRGB); } - mLocalDirtyBits.set(gl::State::DIRTY_BIT_FRAMEBUFFER_SRGB); - } -} - -void StateManagerGL::setFramebufferSRGBEnabledForFramebuffer(bool enabled, - const FramebufferGL *framebuffer) -{ - if (mFunctions->standard == STANDARD_GL_DESKTOP && framebuffer->isDefault()) - { - // Obey the framebuffer sRGB state for blending on all framebuffers except the default - // framebuffer on Desktop OpenGL. - // When SRGB blending is enabled, only SRGB capable formats will use it but the default - // framebuffer will always use it if it is enabled. - // TODO(geofflang): Update this when the framebuffer binding dirty changes, when it exists. - setFramebufferSRGBEnabled(false); - } - else - { - setFramebufferSRGBEnabled(enabled); - } -} - -void StateManagerGL::setDitherEnabled(bool enabled) -{ - if (mDitherEnabled != enabled) - { - mDitherEnabled = enabled; - if (mDitherEnabled) - { - mFunctions->enable(GL_DITHER); - } - else - { - mFunctions->disable(GL_DITHER); - } } } diff --git a/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.h b/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.h index 3c8c5389f..f7ec64772 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/StateManagerGL.h @@ -27,7 +27,6 @@ class State; namespace rx { -class FramebufferGL; class FunctionsGL; class TransformFeedbackGL; class QueryGL; @@ -124,9 +123,6 @@ class StateManagerGL final : angle::NonCopyable GLuint packBuffer); void setFramebufferSRGBEnabled(bool enabled); - void setFramebufferSRGBEnabledForFramebuffer(bool enabled, const FramebufferGL *framebuffer); - - void setDitherEnabled(bool enabled); void setMultisamplingStateEnabled(bool enabled); void setSampleAlphaToOneStateEnabled(bool enabled); @@ -268,7 +264,6 @@ class StateManagerGL final : angle::NonCopyable GLint mClearStencil; bool mFramebufferSRGBEnabled; - bool mDitherEnabled; bool mTextureCubemapSeamlessEnabled; bool mMultisamplingEnabled; diff --git a/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.cpp index a1f0abba7..fcdddebe0 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.cpp @@ -26,11 +26,6 @@ SurfaceGL::~SurfaceGL() FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::FramebufferState &data) { return new FramebufferGL(data, mRenderer->getFunctions(), mRenderer->getStateManager(), - mRenderer->getWorkarounds(), mRenderer->getBlitter(), true); -} - -egl::Error SurfaceGL::unMakeCurrent() -{ - return egl::Error(EGL_SUCCESS); + mRenderer->getWorkarounds(), true); } } diff --git a/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.h b/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.h index 681c365d2..329b562b9 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/SurfaceGL.h @@ -22,10 +22,15 @@ class SurfaceGL : public SurfaceImpl SurfaceGL(const egl::SurfaceState &state, RendererGL *renderer); ~SurfaceGL() override; + gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, + FramebufferAttachmentRenderTarget **rtOut) override + { + return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL"); + } + FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &data) override; virtual egl::Error makeCurrent() = 0; - virtual egl::Error unMakeCurrent(); private: RendererGL *mRenderer; diff --git a/gfx/angle/src/libANGLE/renderer/gl/TextureGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/TextureGL.cpp index 589580505..8b78bdc01 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/TextureGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/TextureGL.cpp @@ -8,7 +8,6 @@ #include "libANGLE/renderer/gl/TextureGL.h" -#include "common/BitSetIterator.h" #include "common/debug.h" #include "common/utilities.h" #include "libANGLE/State.h" @@ -21,27 +20,21 @@ #include "libANGLE/renderer/gl/StateManagerGL.h" #include "libANGLE/renderer/gl/WorkaroundsGL.h" #include "libANGLE/renderer/gl/formatutilsgl.h" -#include "libANGLE/renderer/gl/renderergl_utils.h" - -using angle::CheckedNumeric; namespace rx { -namespace -{ - -bool UseTexImage2D(GLenum textureType) +static bool UseTexImage2D(GLenum textureType) { return textureType == GL_TEXTURE_2D || textureType == GL_TEXTURE_CUBE_MAP; } -bool UseTexImage3D(GLenum textureType) +static bool UseTexImage3D(GLenum textureType) { return textureType == GL_TEXTURE_2D_ARRAY || textureType == GL_TEXTURE_3D; } -bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget) +static bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget) { if (textureType != GL_TEXTURE_CUBE_MAP) { @@ -53,13 +46,13 @@ bool CompatibleTextureTarget(GLenum textureType, GLenum textureTarget) } } -bool IsLUMAFormat(GLenum format) +static bool IsLUMAFormat(GLenum format) { return format == GL_LUMINANCE || format == GL_ALPHA || format == GL_LUMINANCE_ALPHA; } -LUMAWorkaroundGL GetLUMAWorkaroundInfo(const gl::InternalFormat &originalFormatInfo, - GLenum destinationFormat) +static LUMAWorkaroundGL GetLUMAWorkaroundInfo(const gl::InternalFormat &originalFormatInfo, + GLenum destinationFormat) { if (IsLUMAFormat(originalFormatInfo.format)) { @@ -74,35 +67,23 @@ LUMAWorkaroundGL GetLUMAWorkaroundInfo(const gl::InternalFormat &originalFormatI } } -bool IsDepthStencilFormat(GLenum format) +static bool IsDepthStencilFormat(GLenum format) { return format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL; } -bool GetDepthStencilWorkaround(const gl::InternalFormat &originalFormatInfo) +static bool GetDepthStencilWorkaround(const gl::InternalFormat &originalFormatInfo) { return IsDepthStencilFormat(originalFormatInfo.format); } -LevelInfoGL GetLevelInfo(GLenum originalFormat, GLenum destinationFormat) +static LevelInfoGL GetLevelInfo(GLenum originalFormat, GLenum destinationFormat) { const gl::InternalFormat &originalFormatInfo = gl::GetInternalFormatInfo(originalFormat); return LevelInfoGL(originalFormat, GetDepthStencilWorkaround(originalFormatInfo), GetLUMAWorkaroundInfo(originalFormatInfo, destinationFormat)); } -gl::Texture::DirtyBits GetLevelWorkaroundDirtyBits() -{ - gl::Texture::DirtyBits bits; - bits.set(gl::Texture::DIRTY_BIT_SWIZZLE_RED); - bits.set(gl::Texture::DIRTY_BIT_SWIZZLE_GREEN); - bits.set(gl::Texture::DIRTY_BIT_SWIZZLE_BLUE); - bits.set(gl::Texture::DIRTY_BIT_SWIZZLE_ALPHA); - return bits; -} - -} // anonymous namespace - LUMAWorkaroundGL::LUMAWorkaroundGL() : LUMAWorkaroundGL(false, GL_NONE) { } @@ -153,14 +134,8 @@ TextureGL::~TextureGL() mTextureID = 0; } -gl::Error TextureGL::setImage(GLenum target, - size_t level, - GLenum internalFormat, - const gl::Extents &size, - GLenum format, - GLenum type, - const gl::PixelUnpackState &unpack, - const uint8_t *pixels) +gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type, + const gl::PixelUnpackState &unpack, const uint8_t *pixels) { if (mWorkarounds.unpackOverlappingRowsSeparatelyUnpackBuffer && unpack.pixelBuffer.get() && unpack.rowLength != 0 && unpack.rowLength < size.width) @@ -168,41 +143,13 @@ gl::Error TextureGL::setImage(GLenum target, // The rows overlap in unpack memory. Upload the texture row by row to work around // driver bug. reserveTexImageToBeFilled(target, level, internalFormat, size, format, type); - - if (size.width == 0 || size.height == 0 || size.depth == 0) - { - return gl::NoError(); - } - gl::Box area(0, 0, 0, size.width, size.height, size.depth); - return setSubImageRowByRowWorkaround(target, level, area, format, type, unpack, pixels); + ANGLE_TRY(setSubImageRowByRowWorkaround(target, level, area, format, type, unpack, pixels)); } - - if (mWorkarounds.unpackLastRowSeparatelyForPaddingInclusion) + else { - bool apply; - ANGLE_TRY_RESULT(ShouldApplyLastRowPaddingWorkaround(size, unpack, format, type, - UseTexImage3D(mState.mTarget), pixels), - apply); - - // The driver will think the pixel buffer doesn't have enough data, work around this bug - // by uploading the last row (and last level if 3D) separately. - if (apply) - { - reserveTexImageToBeFilled(target, level, internalFormat, size, format, type); - - if (size.width == 0 || size.height == 0 || size.depth == 0) - { - return gl::NoError(); - } - - gl::Box area(0, 0, 0, size.width, size.height, size.depth); - return setSubImagePaddingWorkaround(target, level, area, format, type, unpack, pixels); - } + setImageHelper(target, level, internalFormat, size, format, type, pixels); } - - setImageHelper(target, level, internalFormat, size, format, type, pixels); - return gl::NoError(); } @@ -214,6 +161,7 @@ void TextureGL::setImageHelper(GLenum target, GLenum type, const uint8_t *pixels) { + UNUSED_ASSERTION_VARIABLE(&CompatibleTextureTarget); // Reference this function to avoid warnings. ASSERT(CompatibleTextureTarget(mState.mTarget, target)); nativegl::TexImageFormat texImageFormat = @@ -239,7 +187,7 @@ void TextureGL::setImageHelper(GLenum target, UNREACHABLE(); } - setLevelInfo(level, 1, GetLevelInfo(internalFormat, texImageFormat.internalFormat)); + mLevelInfo[level] = GetLevelInfo(internalFormat, texImageFormat.internalFormat); } void TextureGL::reserveTexImageToBeFilled(GLenum target, @@ -264,47 +212,32 @@ gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &are nativegl::TexSubImageFormat texSubImageFormat = nativegl::GetTexSubImageFormat(mFunctions, mWorkarounds, format, type); - ASSERT(mLevelInfo[level].lumaWorkaround.enabled == - GetLevelInfo(format, texSubImageFormat.format).lumaWorkaround.enabled); - mStateManager->bindTexture(mState.mTarget, mTextureID); if (mWorkarounds.unpackOverlappingRowsSeparatelyUnpackBuffer && unpack.pixelBuffer.get() && unpack.rowLength != 0 && unpack.rowLength < area.width) { - return setSubImageRowByRowWorkaround(target, level, area, format, type, unpack, pixels); - } - - if (mWorkarounds.unpackLastRowSeparatelyForPaddingInclusion) - { - gl::Extents size(area.width, area.height, area.depth); - - bool apply; - ANGLE_TRY_RESULT(ShouldApplyLastRowPaddingWorkaround(size, unpack, format, type, - UseTexImage3D(mState.mTarget), pixels), - apply); - - // The driver will think the pixel buffer doesn't have enough data, work around this bug - // by uploading the last row (and last level if 3D) separately. - if (apply) - { - return setSubImagePaddingWorkaround(target, level, area, format, type, unpack, pixels); - } + ANGLE_TRY(setSubImageRowByRowWorkaround(target, level, area, format, type, unpack, pixels)); } - - if (UseTexImage2D(mState.mTarget)) + else if (UseTexImage2D(mState.mTarget)) { ASSERT(area.z == 0 && area.depth == 1); mFunctions->texSubImage2D(target, static_cast<GLint>(level), area.x, area.y, area.width, area.height, texSubImageFormat.format, texSubImageFormat.type, pixels); } - else + else if (UseTexImage3D(mState.mTarget)) { - ASSERT(UseTexImage3D(mState.mTarget)); mFunctions->texSubImage3D(target, static_cast<GLint>(level), area.x, area.y, area.z, area.width, area.height, area.depth, texSubImageFormat.format, texSubImageFormat.type, pixels); } + else + { + UNREACHABLE(); + } + + ASSERT(mLevelInfo[level].lumaWorkaround.enabled == + GetLevelInfo(format, texSubImageFormat.format).lumaWorkaround.enabled); return gl::Error(GL_NO_ERROR); } @@ -317,24 +250,26 @@ gl::Error TextureGL::setSubImageRowByRowWorkaround(GLenum target, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - gl::PixelUnpackState directUnpack; - directUnpack.pixelBuffer = unpack.pixelBuffer; - directUnpack.alignment = 1; - mStateManager->setPixelUnpackState(directUnpack); - directUnpack.pixelBuffer.set(nullptr); - - const gl::InternalFormat &glFormat = - gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type)); - GLuint rowBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength), - rowBytes); + gl::PixelUnpackState unpackToUse; + unpackToUse.pixelBuffer = unpack.pixelBuffer; + mStateManager->setPixelUnpackState(unpackToUse); + unpackToUse.pixelBuffer.set(nullptr); + const gl::Format &glFormat = mState.getImageDesc(mState.mTarget, level).format; + GLuint rowBytes = 0; + ANGLE_TRY_RESULT( + glFormat.info->computeRowPitch(GL_NONE, area.width, unpack.alignment, unpack.rowLength), + rowBytes); GLuint imageBytes = 0; - ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, unpack.imageHeight, rowBytes), - imageBytes); + ANGLE_TRY_RESULT( + glFormat.info->computeDepthPitch(GL_NONE, area.width, area.height, unpack.alignment, + unpack.rowLength, unpack.imageHeight), + imageBytes); bool useTexImage3D = UseTexImage3D(mState.mTarget); GLuint skipBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeSkipBytes(rowBytes, imageBytes, unpack, useTexImage3D), - skipBytes); + ANGLE_TRY_RESULT( + glFormat.info->computeSkipBytes(rowBytes, imageBytes, unpack.skipImages, unpack.skipRows, + unpack.skipPixels, useTexImage3D), + skipBytes); const uint8_t *pixelsWithSkip = pixels + skipBytes; if (useTexImage3D) @@ -352,9 +287,8 @@ gl::Error TextureGL::setSubImageRowByRowWorkaround(GLenum target, } } } - else + else if (UseTexImage2D(mState.mTarget)) { - ASSERT(UseTexImage2D(mState.mTarget)); for (GLint row = 0; row < area.height; ++row) { GLint byteOffset = row * rowBytes; @@ -363,89 +297,10 @@ gl::Error TextureGL::setSubImageRowByRowWorkaround(GLenum target, area.width, 1, format, type, rowPixels); } } - return gl::NoError(); -} - -gl::Error TextureGL::setSubImagePaddingWorkaround(GLenum target, - size_t level, - const gl::Box &area, - GLenum format, - GLenum type, - const gl::PixelUnpackState &unpack, - const uint8_t *pixels) -{ - const gl::InternalFormat &glFormat = - gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type)); - GLuint rowBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength), - rowBytes); - GLuint imageBytes = 0; - ANGLE_TRY_RESULT(gl::InternalFormat::computeDepthPitch(area.height, unpack.imageHeight, rowBytes), - imageBytes); - bool useTexImage3D = UseTexImage3D(mState.mTarget); - GLuint skipBytes = 0; - ANGLE_TRY_RESULT(glFormat.computeSkipBytes(rowBytes, imageBytes, unpack, useTexImage3D), - skipBytes); - - gl::PixelUnpackState directUnpack; - directUnpack.pixelBuffer = unpack.pixelBuffer; - directUnpack.alignment = 1; - - if (useTexImage3D) - { - // Upload all but the last slice - if (area.depth > 1) - { - mFunctions->texSubImage3D(target, static_cast<GLint>(level), area.x, area.y, area.z, - area.width, area.height, area.depth - 1, format, type, - pixels); - } - - // Upload the last slice but its last row - if (area.height > 1) - { - // Do not include skipBytes in the last image pixel start offset as it will be done by - // the driver - GLint lastImageOffset = (area.depth - 1) * imageBytes; - const GLubyte *lastImagePixels = pixels + lastImageOffset; - mFunctions->texSubImage3D(target, static_cast<GLint>(level), area.x, area.y, - area.z + area.depth - 1, area.width, area.height - 1, 1, - format, type, lastImagePixels); - } - - // Upload the last row of the last slice "manually" - mStateManager->setPixelUnpackState(directUnpack); - - GLint lastRowOffset = - skipBytes + (area.depth - 1) * imageBytes + (area.height - 1) * rowBytes; - const GLubyte *lastRowPixels = pixels + lastRowOffset; - mFunctions->texSubImage3D(target, static_cast<GLint>(level), area.x, - area.y + area.height - 1, area.z + area.depth - 1, area.width, 1, - 1, format, type, lastRowPixels); - } else { - ASSERT(UseTexImage2D(mState.mTarget)); - - // Upload all but the last row - if (area.height > 1) - { - mFunctions->texSubImage2D(target, static_cast<GLint>(level), area.x, area.y, area.width, - area.height - 1, format, type, pixels); - } - - // Upload the last row "manually" - mStateManager->setPixelUnpackState(directUnpack); - - GLint lastRowOffset = skipBytes + (area.height - 1) * rowBytes; - const GLubyte *lastRowPixels = pixels + lastRowOffset; - mFunctions->texSubImage2D(target, static_cast<GLint>(level), area.x, - area.y + area.height - 1, area.width, 1, format, type, - lastRowPixels); + UNREACHABLE(); } - - directUnpack.pixelBuffer.set(nullptr); - return gl::NoError(); } @@ -476,7 +331,7 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte UNREACHABLE(); } - setLevelInfo(level, 1, GetLevelInfo(internalFormat, compressedTexImageFormat.internalFormat)); + mLevelInfo[level] = GetLevelInfo(internalFormat, compressedTexImageFormat.internalFormat); ASSERT(!mLevelInfo[level].lumaWorkaround.enabled); return gl::Error(GL_NO_ERROR); @@ -553,7 +408,7 @@ gl::Error TextureGL::copyImage(GLenum target, size_t level, const gl::Rectangle } } - setLevelInfo(level, 1, levelInfo); + mLevelInfo[level] = levelInfo; return gl::Error(GL_NO_ERROR); } @@ -639,7 +494,8 @@ gl::Error TextureGL::setStorage(GLenum target, size_t levels, GLenum internalFor if (internalFormatInfo.compressed) { GLuint dataSize = 0; - ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize(levelSize), + ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize( + GL_UNSIGNED_BYTE, levelSize), dataSize); mFunctions->compressedTexImage2D(target, static_cast<GLint>(level), texStorageFormat.internalFormat, @@ -662,7 +518,7 @@ gl::Error TextureGL::setStorage(GLenum target, size_t levels, GLenum internalFor { GLuint dataSize = 0; ANGLE_TRY_RESULT(internalFormatInfo.computeCompressedImageSize( - levelSize), + GL_UNSIGNED_BYTE, levelSize), dataSize); mFunctions->compressedTexImage2D( face, static_cast<GLint>(level), texStorageFormat.internalFormat, @@ -713,7 +569,7 @@ gl::Error TextureGL::setStorage(GLenum target, size_t levels, GLenum internalFor { GLuint dataSize = 0; ANGLE_TRY_RESULT( - internalFormatInfo.computeCompressedImageSize(levelSize), + internalFormatInfo.computeCompressedImageSize(GL_UNSIGNED_BYTE, levelSize), dataSize); mFunctions->compressedTexImage3D(target, i, texStorageFormat.internalFormat, levelSize.width, levelSize.height, @@ -735,7 +591,11 @@ gl::Error TextureGL::setStorage(GLenum target, size_t levels, GLenum internalFor UNREACHABLE(); } - setLevelInfo(0, levels, GetLevelInfo(internalFormat, texStorageFormat.internalFormat)); + LevelInfoGL levelInfo = GetLevelInfo(internalFormat, texStorageFormat.internalFormat); + for (size_t level = 0; level < mLevelInfo.size(); level++) + { + mLevelInfo[level] = levelInfo; + } return gl::Error(GL_NO_ERROR); } @@ -750,6 +610,8 @@ gl::Error TextureGL::setImageExternal(GLenum target, gl::Error TextureGL::generateMipmap() { + // Need to sync base level and max level to driver before calling GenerateMipmap. + syncState(0); mStateManager->bindTexture(mState.mTarget, mTextureID); mFunctions->generateMipmap(mState.mTarget); @@ -758,7 +620,10 @@ gl::Error TextureGL::generateMipmap() ASSERT(maxLevel < mLevelInfo.size()); - setLevelInfo(effectiveBaseLevel, maxLevel - effectiveBaseLevel, mLevelInfo[effectiveBaseLevel]); + for (GLuint level = effectiveBaseLevel; level <= maxLevel; level++) + { + mLevelInfo[level] = mLevelInfo[effectiveBaseLevel]; + } return gl::Error(GL_NO_ERROR); } @@ -770,7 +635,7 @@ void TextureGL::bindTexImage(egl::Surface *surface) // Make sure this texture is bound mStateManager->bindTexture(mState.mTarget, mTextureID); - setLevelInfo(0, 1, LevelInfoGL()); + mLevelInfo[0] = LevelInfoGL(); } void TextureGL::releaseTexImage() @@ -796,121 +661,58 @@ gl::Error TextureGL::setEGLImageTarget(GLenum target, egl::Image *image) return gl::Error(GL_INVALID_OPERATION); } -void TextureGL::syncState(const gl::Texture::DirtyBits &dirtyBits) +template <typename T, typename ApplyTextureFuncType> +static inline void SyncSamplerStateMember(const FunctionsGL *functions, + ApplyTextureFuncType applyTextureFunc, + const gl::SamplerState &newState, + gl::SamplerState &curState, + GLenum textureType, + GLenum name, + T(gl::SamplerState::*samplerMember)) { - if (dirtyBits.none() && mLocalDirtyBits.none()) - { - return; - } - - mStateManager->bindTexture(mState.mTarget, mTextureID); - - if (dirtyBits[gl::Texture::DIRTY_BIT_BASE_LEVEL] || dirtyBits[gl::Texture::DIRTY_BIT_MAX_LEVEL]) + if (curState.*samplerMember != newState.*samplerMember) { - // Don't know if the previous base level was using any workarounds, always re-sync the - // workaround dirty bits - mLocalDirtyBits |= GetLevelWorkaroundDirtyBits(); + applyTextureFunc(); + curState.*samplerMember = newState.*samplerMember; + functions->texParameterf(textureType, name, static_cast<GLfloat>(curState.*samplerMember)); } - - for (auto dirtyBit : angle::IterateBitSet(dirtyBits | mLocalDirtyBits)) - { - switch (dirtyBit) - { - case gl::Texture::DIRTY_BIT_MIN_FILTER: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_MIN_FILTER, - mState.getSamplerState().minFilter); - break; - case gl::Texture::DIRTY_BIT_MAG_FILTER: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_MAG_FILTER, - mState.getSamplerState().magFilter); - break; - case gl::Texture::DIRTY_BIT_WRAP_S: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_WRAP_S, - mState.getSamplerState().wrapS); - break; - case gl::Texture::DIRTY_BIT_WRAP_T: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_WRAP_T, - mState.getSamplerState().wrapT); - break; - case gl::Texture::DIRTY_BIT_WRAP_R: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_WRAP_R, - mState.getSamplerState().wrapR); - break; - case gl::Texture::DIRTY_BIT_MAX_ANISOTROPY: - mFunctions->texParameterf(mState.mTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, - mState.getSamplerState().maxAnisotropy); - break; - case gl::Texture::DIRTY_BIT_MIN_LOD: - mFunctions->texParameterf(mState.mTarget, GL_TEXTURE_MIN_LOD, - mState.getSamplerState().minLod); - break; - case gl::Texture::DIRTY_BIT_MAX_LOD: - mFunctions->texParameterf(mState.mTarget, GL_TEXTURE_MAX_LOD, - mState.getSamplerState().maxLod); - break; - case gl::Texture::DIRTY_BIT_COMPARE_MODE: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_COMPARE_MODE, - mState.getSamplerState().compareMode); - break; - case gl::Texture::DIRTY_BIT_COMPARE_FUNC: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_COMPARE_FUNC, - mState.getSamplerState().compareFunc); - break; - case gl::Texture::DIRTY_BIT_SRGB_DECODE: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_SRGB_DECODE_EXT, - mState.getSamplerState().sRGBDecode); - break; - - // Texture state - case gl::Texture::DIRTY_BIT_SWIZZLE_RED: - syncTextureStateSwizzle(mFunctions, GL_TEXTURE_SWIZZLE_R, - mState.getSwizzleState().swizzleRed); - break; - case gl::Texture::DIRTY_BIT_SWIZZLE_GREEN: - syncTextureStateSwizzle(mFunctions, GL_TEXTURE_SWIZZLE_G, - mState.getSwizzleState().swizzleGreen); - break; - case gl::Texture::DIRTY_BIT_SWIZZLE_BLUE: - syncTextureStateSwizzle(mFunctions, GL_TEXTURE_SWIZZLE_B, - mState.getSwizzleState().swizzleBlue); - break; - case gl::Texture::DIRTY_BIT_SWIZZLE_ALPHA: - syncTextureStateSwizzle(mFunctions, GL_TEXTURE_SWIZZLE_A, - mState.getSwizzleState().swizzleAlpha); - break; - case gl::Texture::DIRTY_BIT_BASE_LEVEL: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_BASE_LEVEL, - mState.getEffectiveBaseLevel()); - break; - case gl::Texture::DIRTY_BIT_MAX_LEVEL: - mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_MAX_LEVEL, - mState.getEffectiveMaxLevel()); - break; - case gl::Texture::DIRTY_BIT_USAGE: - break; - - default: - UNREACHABLE(); - } - } - - mLocalDirtyBits.reset(); } -bool TextureGL::hasAnyDirtyBit() const +template <typename T, typename ApplyTextureFuncType> +static inline void SyncTextureStateMember(const FunctionsGL *functions, + ApplyTextureFuncType applyTextureFunc, + const gl::TextureState &newState, + gl::TextureState &curState, + GLenum textureType, + GLenum name, + T(gl::TextureState::*stateMember)) { - return mLocalDirtyBits.any(); + if (curState.*stateMember != newState.*stateMember) + { + applyTextureFunc(); + curState.*stateMember = newState.*stateMember; + functions->texParameterf(textureType, name, static_cast<GLfloat>(curState.*stateMember)); + } } -void TextureGL::syncTextureStateSwizzle(const FunctionsGL *functions, GLenum name, GLenum value) +template <typename T, typename ApplyTextureFuncType> +static inline void SyncTextureStateSwizzle(const FunctionsGL *functions, + ApplyTextureFuncType applyTextureFunc, + const LevelInfoGL &levelInfo, + const gl::SwizzleState &newState, + gl::SwizzleState &curState, + GLenum textureType, + GLenum name, + T(gl::SwizzleState::*stateMember)) { - const LevelInfoGL &levelInfo = mLevelInfo[mState.getEffectiveBaseLevel()]; - GLenum resultSwizzle = value; + GLenum resultSwizzle = newState.*stateMember; if (levelInfo.lumaWorkaround.enabled || levelInfo.depthStencilWorkaround) { if (levelInfo.lumaWorkaround.enabled) { - switch (value) + UNUSED_ASSERTION_VARIABLE(levelInfo.lumaWorkaround.workaroundFormat); + + switch (newState.*stateMember) { case GL_RED: case GL_GREEN: @@ -964,7 +766,7 @@ void TextureGL::syncTextureStateSwizzle(const FunctionsGL *functions, GLenum nam case GL_ZERO: case GL_ONE: // Don't modify the swizzle state when requesting ZERO or ONE. - resultSwizzle = value; + resultSwizzle = newState.*stateMember; break; default: @@ -974,11 +776,11 @@ void TextureGL::syncTextureStateSwizzle(const FunctionsGL *functions, GLenum nam } else if (levelInfo.depthStencilWorkaround) { - switch (value) + switch (newState.*stateMember) { case GL_RED: // Don't modify the swizzle state when requesting the red channel. - resultSwizzle = value; + resultSwizzle = newState.*stateMember; break; case GL_GREEN: @@ -995,7 +797,7 @@ void TextureGL::syncTextureStateSwizzle(const FunctionsGL *functions, GLenum nam case GL_ZERO: case GL_ONE: // Don't modify the swizzle state when requesting ZERO or ONE. - resultSwizzle = value; + resultSwizzle = newState.*stateMember; break; default: @@ -1010,25 +812,65 @@ void TextureGL::syncTextureStateSwizzle(const FunctionsGL *functions, GLenum nam } - functions->texParameteri(mState.mTarget, name, resultSwizzle); + if (curState.*stateMember != resultSwizzle) + { + applyTextureFunc(); + curState.*stateMember = resultSwizzle; + functions->texParameterf(textureType, name, static_cast<GLfloat>(resultSwizzle)); + } } -void TextureGL::setLevelInfo(size_t level, size_t levelCount, const LevelInfoGL &levelInfo) +void TextureGL::syncState(size_t textureUnit) const { - ASSERT(levelCount > 0 && level + levelCount < mLevelInfo.size()); + // Callback lamdba to bind this texture only if needed. + bool textureApplied = false; + auto applyTextureFunc = [&]() + { + if (!textureApplied) + { + mStateManager->activeTexture(textureUnit); + mStateManager->bindTexture(mState.mTarget, mTextureID); + textureApplied = true; + } + }; - GLuint baseLevel = mState.getEffectiveBaseLevel(); - bool needsResync = level <= baseLevel && level + levelCount >= baseLevel && - (levelInfo.depthStencilWorkaround || levelInfo.lumaWorkaround.enabled); - if (needsResync) + // Sync texture state + // Apply the effective base level and max level instead of the base level and max level set from + // the API. This can help with buggy drivers. + if (mAppliedTextureState.getEffectiveBaseLevel() != mState.getEffectiveBaseLevel()) { - mLocalDirtyBits |= GetLevelWorkaroundDirtyBits(); + applyTextureFunc(); + mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_BASE_LEVEL, + mState.getEffectiveBaseLevel()); } - - for (size_t i = level; i < level + levelCount; i++) + mAppliedTextureState.mBaseLevel = mState.mBaseLevel; + if (mAppliedTextureState.getEffectiveMaxLevel() != mState.getEffectiveMaxLevel()) { - mLevelInfo[i] = levelInfo; + applyTextureFunc(); + mFunctions->texParameteri(mState.mTarget, GL_TEXTURE_MAX_LEVEL, + mState.getEffectiveMaxLevel()); } + mAppliedTextureState.mMaxLevel = mState.mMaxLevel; + + // clang-format off + const LevelInfoGL &levelInfo = mLevelInfo[mState.getEffectiveBaseLevel()]; + SyncTextureStateSwizzle(mFunctions, applyTextureFunc, levelInfo, mState.mSwizzleState, mAppliedTextureState.mSwizzleState, mState.mTarget, GL_TEXTURE_SWIZZLE_R, &gl::SwizzleState::swizzleRed); + SyncTextureStateSwizzle(mFunctions, applyTextureFunc, levelInfo, mState.mSwizzleState, mAppliedTextureState.mSwizzleState, mState.mTarget, GL_TEXTURE_SWIZZLE_G, &gl::SwizzleState::swizzleGreen); + SyncTextureStateSwizzle(mFunctions, applyTextureFunc, levelInfo, mState.mSwizzleState, mAppliedTextureState.mSwizzleState, mState.mTarget, GL_TEXTURE_SWIZZLE_B, &gl::SwizzleState::swizzleBlue); + SyncTextureStateSwizzle(mFunctions, applyTextureFunc, levelInfo, mState.mSwizzleState, mAppliedTextureState.mSwizzleState, mState.mTarget, GL_TEXTURE_SWIZZLE_A, &gl::SwizzleState::swizzleAlpha); + + // Sync sampler state + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_MIN_FILTER, &gl::SamplerState::minFilter); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_MAG_FILTER, &gl::SamplerState::magFilter); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_WRAP_S, &gl::SamplerState::wrapS); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_WRAP_T, &gl::SamplerState::wrapT); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_WRAP_R, &gl::SamplerState::wrapR); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_MAX_ANISOTROPY_EXT, &gl::SamplerState::maxAnisotropy); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_MIN_LOD, &gl::SamplerState::minLod); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_MAX_LOD, &gl::SamplerState::maxLod); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_COMPARE_MODE, &gl::SamplerState::compareMode); + SyncSamplerStateMember(mFunctions, applyTextureFunc, mState.mSamplerState, mAppliedTextureState.mSamplerState, mState.mTarget, GL_TEXTURE_COMPARE_FUNC, &gl::SamplerState::compareFunc); + // clang-format on } GLuint TextureGL::getTextureID() const diff --git a/gfx/angle/src/libANGLE/renderer/gl/TextureGL.h b/gfx/angle/src/libANGLE/renderer/gl/TextureGL.h index 068284c5b..540e6c3c6 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/TextureGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/TextureGL.h @@ -87,12 +87,16 @@ class TextureGL : public TextureImpl gl::Error setEGLImageTarget(GLenum target, egl::Image *image) override; + void syncState(size_t textureUnit) const; GLuint getTextureID() const; - void setBaseLevel(GLuint) override {} + gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, + FramebufferAttachmentRenderTarget **rtOut) override + { + return gl::Error(GL_OUT_OF_MEMORY, "Not supported on OpenGL"); + } - void syncState(const gl::Texture::DirtyBits &dirtyBits) override; - bool hasAnyDirtyBit() const; + void setBaseLevel(GLuint) override {} private: void setImageHelper(GLenum target, @@ -116,25 +120,12 @@ class TextureGL : public TextureImpl const gl::PixelUnpackState &unpack, const uint8_t *pixels); - gl::Error setSubImagePaddingWorkaround(GLenum target, - size_t level, - const gl::Box &area, - GLenum format, - GLenum type, - const gl::PixelUnpackState &unpack, - const uint8_t *pixels); - - void syncTextureStateSwizzle(const FunctionsGL *functions, GLenum name, GLenum value); - - void setLevelInfo(size_t level, size_t levelCount, const LevelInfoGL &levelInfo); - const FunctionsGL *mFunctions; const WorkaroundsGL &mWorkarounds; StateManagerGL *mStateManager; BlitGL *mBlitter; std::vector<LevelInfoGL> mLevelInfo; - gl::Texture::DirtyBits mLocalDirtyBits; mutable gl::TextureState mAppliedTextureState; GLuint mTextureID; diff --git a/gfx/angle/src/libANGLE/renderer/gl/WorkaroundsGL.h b/gfx/angle/src/libANGLE/renderer/gl/WorkaroundsGL.h index 105f94089..2549a2c47 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/WorkaroundsGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/WorkaroundsGL.h @@ -21,13 +21,7 @@ struct WorkaroundsGL doWhileGLSLCausesGPUHang(false), finishDoesNotCauseQueriesToBeAvailable(false), alwaysCallUseProgramAfterLink(false), - unpackOverlappingRowsSeparatelyUnpackBuffer(false), - emulateAbsIntFunction(false), - addAndTrueToLoopCondition(false), - emulateIsnanFloat(false), - useUnusedBlocksWithStandardOrSharedLayout(false), - dontRemoveInvariantForFragmentInput(false), - removeInvariantAndCentroidForESSL3(false) + unpackOverlappingRowsSeparatelyUnpackBuffer(false) { } @@ -73,53 +67,6 @@ struct WorkaroundsGL // In the case of unpacking from a pixel unpack buffer, unpack overlapping rows row by row. bool unpackOverlappingRowsSeparatelyUnpackBuffer; - // In the case of packing to a pixel pack buffer, pack overlapping rows row by row. - bool packOverlappingRowsSeparatelyPackBuffer; - - // During initialization, assign the current vertex attributes to the spec-mandated defaults. - bool initializeCurrentVertexAttributes; - - // abs(i) where i is an integer returns unexpected result on Intel Mac. - // Emulate abs(i) with i * sign(i). - bool emulateAbsIntFunction; - - // On Intel Mac, calculation of loop conditions in for and while loop has bug. - // Add "&& true" to the end of the condition expression to work around the bug. - bool addAndTrueToLoopCondition; - - // When uploading textures from an unpack buffer, some drivers count an extra row padding when - // checking if the pixel unpack buffer is big enough. Tracking bug: http://anglebug.com/1512 - // For example considering the pixel buffer below where in memory, each row data (D) of the - // texture is followed by some unused data (the dots): - // +-------+--+ - // |DDDDDDD|..| - // |DDDDDDD|..| - // |DDDDDDD|..| - // |DDDDDDD|..| - // +-------A--B - // The last pixel read will be A, but the driver will think it is B, causing it to generate an - // error when the pixel buffer is just big enough. - bool unpackLastRowSeparatelyForPaddingInclusion; - - // Equivalent workaround when uploading data from a pixel pack buffer. - bool packLastRowSeparatelyForPaddingInclusion; - - // 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: http://crbug.com/650547 - bool emulateIsnanFloat; - - // On Mac with OpenGL version 4.1, unused std140 or shared uniform blocks will be - // treated as inactive which is not consistent with WebGL2.0 spec. Reference all members in a - // unused std140 or shared uniform block at the beginning of main to work around it. - bool useUnusedBlocksWithStandardOrSharedLayout; - - // This flag will keep invariant declaration for input in fragment shader for GLSL >=4.20 - // on AMD. - bool dontRemoveInvariantForFragmentInput; - - // This flag is used to fix spec difference between GLSL 4.1 or lower and ESSL3. - bool removeInvariantAndCentroidForESSL3; }; } diff --git a/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.h b/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.h index cc1b17bb7..0ba57b62b 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.h @@ -35,8 +35,7 @@ class DisplayCGL : public DisplayGL 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, diff --git a/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm b/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm index f87134c82..b9d5f39b0 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm +++ b/gfx/angle/src/libANGLE/renderer/gl/cgl/DisplayCGL.mm @@ -128,8 +128,7 @@ SurfaceImpl *DisplayCGL::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayCGL::createPbufferFromClientBuffer(const egl::SurfaceState &state, const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, + EGLClientBuffer shareHandle, const egl::AttributeMap &attribs) { UNIMPLEMENTED(); diff --git a/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h b/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h index 7cbb74da4..1e198bf5a 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.h @@ -53,7 +53,7 @@ class PbufferSurfaceCGL : public SurfaceGL const FunctionsGL *mFunctions; StateManagerGL *mStateManager; - RendererGL *mRenderer; + const WorkaroundsGL &mWorkarounds; GLuint mFramebuffer; GLuint mColorRenderbuffer; diff --git a/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm b/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm index c03d3836f..b9689177e 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm +++ b/gfx/angle/src/libANGLE/renderer/gl/cgl/PbufferSurfaceCGL.mm @@ -28,7 +28,7 @@ PbufferSurfaceCGL::PbufferSurfaceCGL(const egl::SurfaceState &state, mHeight(height), mFunctions(functions), mStateManager(renderer->getStateManager()), - mRenderer(renderer), + mWorkarounds(renderer->getWorkarounds()), mFramebuffer(0), mColorRenderbuffer(0), mDSRenderbuffer(0) @@ -136,8 +136,7 @@ EGLint PbufferSurfaceCGL::getSwapBehavior() const FramebufferImpl *PbufferSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state) { // TODO(cwallez) assert it happens only once? - return new FramebufferGL(mFramebuffer, state, mFunctions, mRenderer->getWorkarounds(), - mRenderer->getBlitter(), mStateManager); + return new FramebufferGL(mFramebuffer, state, mFunctions, mWorkarounds, mStateManager); } } diff --git a/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h b/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h index 165ab0486..d8f1a14d7 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.h @@ -88,7 +88,6 @@ class WindowSurfaceCGL : public SurfaceGL CGLContextObj mContext; const FunctionsGL *mFunctions; StateManagerGL *mStateManager; - RendererGL *mRenderer; const WorkaroundsGL &mWorkarounds; GLuint mFramebuffer; diff --git a/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm b/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm index c2ac4dca4..b5375b1f9 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm +++ b/gfx/angle/src/libANGLE/renderer/gl/cgl/WindowSurfaceCGL.mm @@ -154,12 +154,11 @@ mContext(context), mFunctions(functions), mStateManager(renderer->getStateManager()), - mRenderer(renderer), mWorkarounds(renderer->getWorkarounds()), mFramebuffer(0), mDSRenderbuffer(0) - { - pthread_mutex_init(&mSwapState.mutex, nullptr); +{ + pthread_mutex_init(&mSwapState.mutex, nullptr); } WindowSurfaceCGL::~WindowSurfaceCGL() @@ -325,8 +324,7 @@ EGLint WindowSurfaceCGL::getSwapBehavior() const FramebufferImpl *WindowSurfaceCGL::createDefaultFramebuffer(const gl::FramebufferState &state) { // TODO(cwallez) assert it happens only once? - return new FramebufferGL(mFramebuffer, state, mFunctions, mWorkarounds, mRenderer->getBlitter(), - mStateManager); + return new FramebufferGL(mFramebuffer, state, mFunctions, mWorkarounds, mStateManager); } } diff --git a/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp index 693b61c9c..388832b2a 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/egl/SurfaceEGL.cpp @@ -33,6 +33,7 @@ SurfaceEGL::~SurfaceEGL() if (mSurface != EGL_NO_SURFACE) { EGLBoolean success = mEGL->destroySurface(mSurface); + UNUSED_ASSERTION_VARIABLE(success); ASSERT(success == EGL_TRUE); } } @@ -103,6 +104,7 @@ EGLint SurfaceEGL::getWidth() const { EGLint value; EGLBoolean success = mEGL->querySurface(mSurface, EGL_WIDTH, &value); + UNUSED_ASSERTION_VARIABLE(success); ASSERT(success == EGL_TRUE); return value; } @@ -111,6 +113,7 @@ EGLint SurfaceEGL::getHeight() const { EGLint value; EGLBoolean success = mEGL->querySurface(mSurface, EGL_HEIGHT, &value); + UNUSED_ASSERTION_VARIABLE(success); ASSERT(success == EGL_TRUE); return value; } @@ -125,6 +128,7 @@ EGLint SurfaceEGL::getSwapBehavior() const { EGLint value; EGLBoolean success = mEGL->querySurface(mSurface, EGL_SWAP_BEHAVIOR, &value); + UNUSED_ASSERTION_VARIABLE(success); ASSERT(success == EGL_TRUE); return value; } diff --git a/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp b/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp index b689578c9..4956c5b3f 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.cpp @@ -159,6 +159,7 @@ SurfaceImpl *DisplayAndroid::createWindowSurface(const egl::SurfaceState &state, EGL_NONE}; success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig); ASSERT(success && numConfig == 1); + UNUSED_ASSERTION_VARIABLE(success); return new WindowSurfaceEGL(state, mEGL, config, window, attribs.toIntVector(), mContext, getRenderer()); @@ -176,6 +177,7 @@ SurfaceImpl *DisplayAndroid::createPbufferSurface(const egl::SurfaceState &state EGL_NONE}; success = mEGL->chooseConfig(configAttribList, &config, 1, &numConfig); ASSERT(success && numConfig == 1); + UNUSED_ASSERTION_VARIABLE(success); return new PbufferSurfaceEGL(state, mEGL, config, attribs.toIntVector(), mContext, getRenderer()); @@ -183,8 +185,7 @@ SurfaceImpl *DisplayAndroid::createPbufferSurface(const egl::SurfaceState &state SurfaceImpl *DisplayAndroid::createPbufferFromClientBuffer(const egl::SurfaceState &state, const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, + EGLClientBuffer shareHandle, const egl::AttributeMap &attribs) { UNIMPLEMENTED(); @@ -214,6 +215,7 @@ void DisplayAndroid::getConfigAttrib(EGLConfig config, EGLint attribute, T *valu EGLint tmp; EGLBoolean success = mEGL->getConfigAttrib(config, attribute, &tmp); ASSERT(success == EGL_TRUE); + UNUSED_ASSERTION_VARIABLE(success); *value = tmp; } @@ -231,6 +233,7 @@ egl::ConfigSet DisplayAndroid::generateConfigs() success = mEGL->chooseConfig(mConfigAttribList.data(), configs.data(), numConfigs, &numConfigs2); ASSERT(success == EGL_TRUE && numConfigs2 == numConfigs); + UNUSED_ASSERTION_VARIABLE(success); for (int i = 0; i < numConfigs; i++) { diff --git a/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h b/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h index 0be9bb465..693532fb4 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h +++ b/gfx/angle/src/libANGLE/renderer/gl/egl/android/DisplayAndroid.h @@ -36,8 +36,7 @@ class DisplayAndroid : public DisplayEGL 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, diff --git a/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp b/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp index 01549fcfa..6f5321632 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.cpp @@ -308,9 +308,9 @@ uint32_t DisplayOzone::Buffer::getDRMFB() FramebufferGL *DisplayOzone::Buffer::framebufferGL(const gl::FramebufferState &state) { - return new FramebufferGL( - mGLFB, state, mDisplay->mFunctionsGL, mDisplay->getRenderer()->getWorkarounds(), - mDisplay->getRenderer()->getBlitter(), mDisplay->getRenderer()->getStateManager()); + return new FramebufferGL(mGLFB, state, mDisplay->mFunctionsGL, + mDisplay->getRenderer()->getWorkarounds(), + mDisplay->getRenderer()->getStateManager()); } void DisplayOzone::Buffer::present() @@ -859,8 +859,7 @@ SurfaceImpl *DisplayOzone::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayOzone::createPbufferFromClientBuffer(const egl::SurfaceState &state, const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, + EGLClientBuffer shareHandle, const egl::AttributeMap &attribs) { UNIMPLEMENTED(); diff --git a/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h b/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h index 77c669314..55a188c3e 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h +++ b/gfx/angle/src/libANGLE/renderer/gl/egl/ozone/DisplayOzone.h @@ -122,8 +122,7 @@ class DisplayOzone final : public DisplayEGL 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, diff --git a/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.cpp b/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.cpp index c5219b4b8..1688be116 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.cpp @@ -438,32 +438,6 @@ static GLenum GetNativeType(const FunctionsGL *functions, return result; } -static GLenum GetNativeReadType(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, - GLenum type) -{ - GLenum result = type; - - if (functions->standard == STANDARD_GL_DESKTOP) - { - if (type == GL_HALF_FLOAT_OES) - { - // The enums differ for the OES half float extensions and desktop GL spec. Update it. - result = GL_HALF_FLOAT; - } - } - - return result; -} - -static GLenum GetNativeReadFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, - GLenum format) -{ - GLenum result = format; - return result; -} - TexImageFormat GetTexImageFormat(const FunctionsGL *functions, const WorkaroundsGL &workarounds, GLenum internalFormat, @@ -538,16 +512,6 @@ RenderbufferFormat GetRenderbufferFormat(const FunctionsGL *functions, GetNativeInternalFormat(functions, workarounds, internalFormat, internalFormat); return result; } -ReadPixelsFormat GetReadPixelsFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, - GLenum format, - GLenum type) -{ - ReadPixelsFormat result; - result.format = GetNativeReadFormat(functions, workarounds, format); - result.type = GetNativeReadType(functions, workarounds, type); - return result; -} } } diff --git a/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.h b/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.h index 616f37af2..547d4783e 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.h +++ b/gfx/angle/src/libANGLE/renderer/gl/formatutilsgl.h @@ -112,16 +112,6 @@ struct RenderbufferFormat RenderbufferFormat GetRenderbufferFormat(const FunctionsGL *functions, const WorkaroundsGL &workarounds, GLenum internalFormat); - -struct ReadPixelsFormat -{ - GLenum format; - GLenum type; -}; -ReadPixelsFormat GetReadPixelsFormat(const FunctionsGL *functions, - const WorkaroundsGL &workarounds, - GLenum format, - GLenum type); } } diff --git a/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp b/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp index e98401d0a..0358a428e 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.cpp @@ -350,7 +350,7 @@ egl::Error DisplayGLX::initialize(egl::Display *display) bool isOpenGLES = eglAttributes.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE) == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE; - if (isOpenGLES && (IsIntel(vendor) || IsNvidia(vendor))) + if (isOpenGLES && (vendor == VENDOR_ID_INTEL || vendor == VENDOR_ID_NVIDIA)) { return egl::Error(EGL_NOT_INITIALIZED, "Intel or NVIDIA OpenGL ES drivers are not supported."); } @@ -410,8 +410,7 @@ SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayGLX::createPbufferFromClientBuffer(const egl::SurfaceState &state, const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, + EGLClientBuffer shareHandle, const egl::AttributeMap &attribs) { UNIMPLEMENTED(); diff --git a/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.h b/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.h index 7e870c2f3..79198395d 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.h +++ b/gfx/angle/src/libANGLE/renderer/gl/glx/DisplayGLX.h @@ -53,8 +53,7 @@ class DisplayGLX : public DisplayGL 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, diff --git a/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp b/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp index 504a787f8..87fd24a61 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.cpp @@ -11,8 +11,6 @@ #include <limits> -#include "common/mathutil.h" -#include "libANGLE/Buffer.h" #include "libANGLE/Caps.h" #include "libANGLE/formatutils.h" #include "libANGLE/renderer/gl/FunctionsGL.h" @@ -22,8 +20,6 @@ #include <algorithm> #include <sstream> -using angle::CheckedNumeric; - namespace rx { VendorID GetVendorID(const FunctionsGL *functions) @@ -871,81 +867,35 @@ void GenerateCaps(const FunctionsGL *functions, gl::Caps *caps, gl::TextureCapsM functions->isAtLeastGLES(gl::Version(3, 1)); extensions->pathRendering = canEnableGLPathRendering || canEnableESPathRendering; - - extensions->textureSRGBDecode = functions->hasGLExtension("GL_EXT_texture_sRGB_decode") || - functions->hasGLESExtension("GL_EXT_texture_sRGB_decode"); - -#if defined(ANGLE_PLATFORM_APPLE) - VendorID vendor = GetVendorID(functions); - if ((IsAMD(vendor) || IsIntel(vendor)) && *maxSupportedESVersion >= gl::Version(3, 0)) - { - // Apple Intel/AMD drivers do not correctly use the TEXTURE_SRGB_DECODE property of sampler - // states. Disable this extension when we would advertise any ES version that has samplers. - extensions->textureSRGBDecode = false; - } -#endif - - extensions->sRGBWriteControl = functions->isAtLeastGL(gl::Version(3, 0)) || - functions->hasGLExtension("GL_EXT_framebuffer_sRGB") || - functions->hasGLExtension("GL_ARB_framebuffer_sRGB") || - functions->hasGLESExtension("GL_EXT_sRGB_write_control"); - -#if defined(ANGLE_PLATFORM_ANDROID) - // SRGB blending does not appear to work correctly on the Nexus 5. Writing to an SRGB - // framebuffer with GL_FRAMEBUFFER_SRGB enabled and then reading back returns the same value. - // Disabling GL_FRAMEBUFFER_SRGB will then convert in the wrong direction. - extensions->sRGBWriteControl = false; -#endif } void GenerateWorkarounds(const FunctionsGL *functions, WorkaroundsGL *workarounds) { VendorID vendor = GetVendorID(functions); - workarounds->dontRemoveInvariantForFragmentInput = - functions->standard == STANDARD_GL_DESKTOP && IsAMD(vendor); - // Don't use 1-bit alpha formats on desktop GL with AMD or Intel drivers. workarounds->avoid1BitAlphaTextureFormats = - functions->standard == STANDARD_GL_DESKTOP && (IsAMD(vendor) || IsIntel(vendor)); + functions->standard == STANDARD_GL_DESKTOP && + (vendor == VENDOR_ID_AMD || vendor == VENDOR_ID_INTEL); workarounds->rgba4IsNotSupportedForColorRendering = - functions->standard == STANDARD_GL_DESKTOP && IsIntel(vendor); - - workarounds->emulateAbsIntFunction = IsIntel(vendor); - - workarounds->addAndTrueToLoopCondition = IsIntel(vendor); - - workarounds->emulateIsnanFloat = IsIntel(vendor); + functions->standard == STANDARD_GL_DESKTOP && vendor == VENDOR_ID_INTEL; workarounds->doesSRGBClearsOnLinearFramebufferAttachments = - functions->standard == STANDARD_GL_DESKTOP && (IsIntel(vendor) || IsAMD(vendor)); + functions->standard == STANDARD_GL_DESKTOP && + (vendor == VENDOR_ID_INTEL || vendor == VENDOR_ID_AMD); #if defined(ANGLE_PLATFORM_APPLE) workarounds->doWhileGLSLCausesGPUHang = true; - workarounds->useUnusedBlocksWithStandardOrSharedLayout = true; #endif workarounds->finishDoesNotCauseQueriesToBeAvailable = - functions->standard == STANDARD_GL_DESKTOP && IsNvidia(vendor); + functions->standard == STANDARD_GL_DESKTOP && vendor == VENDOR_ID_NVIDIA; // TODO(cwallez): Disable this workaround for MacOSX versions 10.9 or later. workarounds->alwaysCallUseProgramAfterLink = true; - workarounds->unpackOverlappingRowsSeparatelyUnpackBuffer = IsNvidia(vendor); - workarounds->packOverlappingRowsSeparatelyPackBuffer = IsNvidia(vendor); - - workarounds->initializeCurrentVertexAttributes = IsNvidia(vendor); - -#if defined(ANGLE_PLATFORM_APPLE) - workarounds->unpackLastRowSeparatelyForPaddingInclusion = true; - workarounds->packLastRowSeparatelyForPaddingInclusion = true; -#else - workarounds->unpackLastRowSeparatelyForPaddingInclusion = IsNvidia(vendor); - workarounds->packLastRowSeparatelyForPaddingInclusion = IsNvidia(vendor); -#endif - - workarounds->removeInvariantAndCentroidForESSL3 = functions->isAtMostGL(gl::Version(4, 1)); + workarounds->unpackOverlappingRowsSeparatelyUnpackBuffer = vendor == VENDOR_ID_NVIDIA; } } @@ -1001,45 +951,4 @@ uint8_t *MapBufferRangeWithFallback(const FunctionsGL *functions, return nullptr; } } - -gl::ErrorOrResult<bool> ShouldApplyLastRowPaddingWorkaround(const gl::Extents &size, - const gl::PixelStoreStateBase &state, - GLenum format, - GLenum type, - bool is3D, - const void *pixels) -{ - if (state.pixelBuffer.get() == nullptr) - { - return false; - } - - // We are using an pack or unpack buffer, compute what the driver thinks is going to be the - // last byte read or written. If it is past the end of the buffer, we will need to use the - // workaround otherwise the driver will generate INVALID_OPERATION and not do the operation. - CheckedNumeric<size_t> checkedEndByte; - CheckedNumeric<size_t> pixelBytes; - size_t rowPitch; - - const gl::InternalFormat &glFormat = - gl::GetInternalFormatInfo(gl::GetSizedInternalFormat(format, type)); - ANGLE_TRY_RESULT(glFormat.computePackUnpackEndByte(size, state, is3D), checkedEndByte); - ANGLE_TRY_RESULT(glFormat.computeRowPitch(size.width, state.alignment, state.rowLength), - rowPitch); - pixelBytes = glFormat.pixelBytes; - - checkedEndByte += reinterpret_cast<intptr_t>(pixels); - - // At this point checkedEndByte is the actual last byte read. - // The driver adds an extra row padding (if any), mimic it. - ANGLE_TRY_CHECKED_MATH(pixelBytes); - if (pixelBytes.ValueOrDie() * size.width < rowPitch) - { - checkedEndByte += rowPitch - pixelBytes * size.width; - } - - ANGLE_TRY_CHECKED_MATH(checkedEndByte); - - return checkedEndByte.ValueOrDie() > static_cast<size_t>(state.pixelBuffer->getSize()); -} } diff --git a/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.h b/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.h index 1e9338fb5..3b0cab27e 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.h +++ b/gfx/angle/src/libANGLE/renderer/gl/renderergl_utils.h @@ -11,8 +11,6 @@ #define LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_ #include "libANGLE/angletypes.h" -#include "libANGLE/Error.h" -#include "libANGLE/renderer/driver_utils.h" #include "libANGLE/renderer/gl/functionsgl_typedefs.h" #include <string> @@ -49,13 +47,6 @@ uint8_t *MapBufferRangeWithFallback(const FunctionsGL *functions, size_t offset, size_t length, GLbitfield access); - -gl::ErrorOrResult<bool> ShouldApplyLastRowPaddingWorkaround(const gl::Extents &size, - const gl::PixelStoreStateBase &state, - GLenum format, - GLenum type, - bool is3D, - const void *pixels); } #endif // LIBANGLE_RENDERER_GL_RENDERERGLUTILS_H_ diff --git a/gfx/angle/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.cpp deleted file mode 100644 index f19e8fdf3..000000000 --- a/gfx/angle/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.cpp +++ /dev/null @@ -1,384 +0,0 @@ -// -// Copyright (c) 2015 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. -// - -// D3DTextureSurfaceWGL.cpp: WGL implementation of egl::Surface for D3D texture interop. - -#include "libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h" - -#include "libANGLE/renderer/gl/FramebufferGL.h" -#include "libANGLE/renderer/gl/TextureGL.h" -#include "libANGLE/renderer/gl/RendererGL.h" -#include "libANGLE/renderer/gl/StateManagerGL.h" -#include "libANGLE/renderer/gl/wgl/DisplayWGL.h" -#include "libANGLE/renderer/gl/wgl/FunctionsWGL.h" - -namespace rx -{ - -namespace -{ - -egl::Error GetD3DTextureInfo(EGLClientBuffer clientBuffer, - size_t *width, - size_t *height, - IUnknown **object, - IUnknown **device) -{ - IUnknown *buffer = static_cast<IUnknown *>(clientBuffer); - - IDirect3DTexture9 *texture9 = nullptr; - ID3D11Texture2D *texture11 = nullptr; - if (SUCCEEDED(buffer->QueryInterface<ID3D11Texture2D>(&texture11))) - { - D3D11_TEXTURE2D_DESC textureDesc; - texture11->GetDesc(&textureDesc); - - // From table egl.restrictions in EGL_ANGLE_d3d_texture_client_buffer. - switch (textureDesc.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: - SafeRelease(texture11); - return egl::Error(EGL_BAD_PARAMETER, "Unknown client buffer texture format: %u.", - textureDesc.Format); - } - - ID3D11Device *d3d11Device = nullptr; - texture11->GetDevice(&d3d11Device); - if (d3d11Device == nullptr) - { - SafeRelease(texture11); - return egl::Error(EGL_BAD_PARAMETER, - "Could not query the D3D11 device from the client buffer."); - } - - if (width) - { - *width = textureDesc.Width; - } - if (height) - { - *height = textureDesc.Height; - } - - if (device) - { - *device = d3d11Device; - } - else - { - SafeRelease(d3d11Device); - } - - if (object) - { - *object = texture11; - } - else - { - SafeRelease(texture11); - } - - return egl::Error(EGL_SUCCESS); - } - else if (SUCCEEDED(buffer->QueryInterface<IDirect3DTexture9>(&texture9))) - { - D3DSURFACE_DESC surfaceDesc; - if (FAILED(texture9->GetLevelDesc(0, &surfaceDesc))) - { - SafeRelease(texture9); - return egl::Error(EGL_BAD_PARAMETER, - "Could not query description of the D3D9 surface."); - } - - // From table egl.restrictions in EGL_ANGLE_d3d_texture_client_buffer. - switch (surfaceDesc.Format) - { - case D3DFMT_R8G8B8: - case D3DFMT_A8R8G8B8: - case D3DFMT_A16B16G16R16F: - case D3DFMT_A32B32G32R32F: - break; - - default: - SafeRelease(texture9); - return egl::Error(EGL_BAD_PARAMETER, "Unknown client buffer texture format: %u.", - surfaceDesc.Format); - } - - if (width) - { - *width = surfaceDesc.Width; - } - if (height) - { - *height = surfaceDesc.Height; - } - - IDirect3DDevice9 *d3d9Device = nullptr; - HRESULT result = texture9->GetDevice(&d3d9Device); - if (FAILED(result)) - { - SafeRelease(texture9); - return egl::Error(EGL_BAD_PARAMETER, - "Could not query the D3D9 device from the client buffer."); - } - - if (device) - { - *device = d3d9Device; - } - else - { - SafeRelease(d3d9Device); - } - - if (object) - { - *object = texture9; - } - else - { - SafeRelease(texture9); - } - - return egl::Error(EGL_SUCCESS); - } - else - { - return egl::Error(EGL_BAD_PARAMETER, - "Provided buffer is not a IDirect3DTexture9 or ID3D11Texture2D."); - } -} - -} // anonymous namespace - -D3DTextureSurfaceWGL::D3DTextureSurfaceWGL(const egl::SurfaceState &state, - RendererGL *renderer, - EGLClientBuffer clientBuffer, - DisplayWGL *display, - HGLRC wglContext, - HDC deviceContext, - const FunctionsGL *functionsGL, - const FunctionsWGL *functionsWGL) - : SurfaceGL(state, renderer), - mClientBuffer(clientBuffer), - mRenderer(renderer), - mDisplay(display), - mStateManager(renderer->getStateManager()), - mWorkarounds(renderer->getWorkarounds()), - mFunctionsGL(functionsGL), - mFunctionsWGL(functionsWGL), - mWGLContext(wglContext), - mDeviceContext(deviceContext), - mWidth(0), - mHeight(0), - mDeviceHandle(nullptr), - mObject(nullptr), - mBoundObjectTextureHandle(nullptr), - mBoundObjectRenderbufferHandle(nullptr), - mRenderbufferID(0), - mFramebufferID(0) -{ -} - -D3DTextureSurfaceWGL::~D3DTextureSurfaceWGL() -{ - ASSERT(mBoundObjectTextureHandle == nullptr); - - SafeRelease(mObject); - - if (mDeviceHandle) - { - if (mBoundObjectRenderbufferHandle) - { - mFunctionsWGL->dxUnregisterObjectNV(mDeviceHandle, mBoundObjectRenderbufferHandle); - mBoundObjectRenderbufferHandle = nullptr; - } - mStateManager->deleteRenderbuffer(mRenderbufferID); - - if (mBoundObjectTextureHandle) - { - mFunctionsWGL->dxUnregisterObjectNV(mDeviceHandle, mBoundObjectTextureHandle); - mBoundObjectTextureHandle = nullptr; - } - - // GL framebuffer is deleted by the default framebuffer object - mFramebufferID = 0; - - mDisplay->releaseD3DDevice(mDeviceHandle); - mDeviceHandle = nullptr; - } -} - -egl::Error D3DTextureSurfaceWGL::ValidateD3DTextureClientBuffer(EGLClientBuffer clientBuffer) -{ - return GetD3DTextureInfo(clientBuffer, nullptr, nullptr, nullptr, nullptr); -} - -egl::Error D3DTextureSurfaceWGL::initialize() -{ - IUnknown *device = nullptr; - ANGLE_TRY(GetD3DTextureInfo(mClientBuffer, &mWidth, &mHeight, &mObject, &device)); - - ASSERT(device != nullptr); - egl::Error error = mDisplay->registerD3DDevice(device, &mDeviceHandle); - SafeRelease(device); - if (error.isError()) - { - return error; - } - - mFunctionsGL->genRenderbuffers(1, &mRenderbufferID); - mStateManager->bindRenderbuffer(GL_RENDERBUFFER, mRenderbufferID); - mBoundObjectRenderbufferHandle = mFunctionsWGL->dxRegisterObjectNV( - mDeviceHandle, mObject, mRenderbufferID, GL_RENDERBUFFER, WGL_ACCESS_READ_WRITE_NV); - if (mBoundObjectRenderbufferHandle == nullptr) - { - return egl::Error(EGL_BAD_ALLOC, "Failed to register D3D object, error: 0x%08x.", - HRESULT_CODE(GetLastError())); - } - - mFunctionsGL->genFramebuffers(1, &mFramebufferID); - mStateManager->bindFramebuffer(GL_FRAMEBUFFER, mFramebufferID); - mFunctionsGL->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, - mRenderbufferID); - - return egl::Error(EGL_SUCCESS); -} - -egl::Error D3DTextureSurfaceWGL::makeCurrent() -{ - if (!mFunctionsWGL->makeCurrent(mDeviceContext, mWGLContext)) - { - // TODO(geofflang): What error type here? - return egl::Error(EGL_CONTEXT_LOST, "Failed to make the WGL context current."); - } - - if (!mFunctionsWGL->dxLockObjectsNV(mDeviceHandle, 1, &mBoundObjectRenderbufferHandle)) - { - DWORD error = GetLastError(); - return egl::Error(EGL_BAD_ALLOC, "Failed to lock object, error: 0x%08x.", - HRESULT_CODE(error)); - } - - return egl::Error(EGL_SUCCESS); -} - -egl::Error D3DTextureSurfaceWGL::unMakeCurrent() -{ - if (!mFunctionsWGL->dxUnlockObjectsNV(mDeviceHandle, 1, &mBoundObjectRenderbufferHandle)) - { - DWORD error = GetLastError(); - return egl::Error(EGL_BAD_ALLOC, "Failed to unlock object, error: 0x%08x.", - HRESULT_CODE(error)); - } - - return egl::Error(EGL_SUCCESS); -} - -egl::Error D3DTextureSurfaceWGL::swap() -{ - return egl::Error(EGL_SUCCESS); -} - -egl::Error D3DTextureSurfaceWGL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_SUCCESS); -} - -egl::Error D3DTextureSurfaceWGL::querySurfacePointerANGLE(EGLint attribute, void **value) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_SUCCESS); -} - -egl::Error D3DTextureSurfaceWGL::bindTexImage(gl::Texture *texture, EGLint buffer) -{ - ASSERT(mBoundObjectTextureHandle == nullptr); - - const TextureGL *textureGL = GetImplAs<TextureGL>(texture); - GLuint textureID = textureGL->getTextureID(); - - mBoundObjectTextureHandle = mFunctionsWGL->dxRegisterObjectNV( - mDeviceHandle, mObject, textureID, GL_TEXTURE_2D, WGL_ACCESS_READ_WRITE_NV); - if (mBoundObjectTextureHandle == nullptr) - { - DWORD error = GetLastError(); - return egl::Error(EGL_BAD_ALLOC, "Failed to register D3D object, error: 0x%08x.", - HRESULT_CODE(error)); - } - - if (!mFunctionsWGL->dxLockObjectsNV(mDeviceHandle, 1, &mBoundObjectTextureHandle)) - { - DWORD error = GetLastError(); - return egl::Error(EGL_BAD_ALLOC, "Failed to lock object, error: 0x%08x.", - HRESULT_CODE(error)); - } - - return egl::Error(EGL_SUCCESS); -} - -egl::Error D3DTextureSurfaceWGL::releaseTexImage(EGLint buffer) -{ - ASSERT(mBoundObjectTextureHandle != nullptr); - if (!mFunctionsWGL->dxUnlockObjectsNV(mDeviceHandle, 1, &mBoundObjectTextureHandle)) - { - DWORD error = GetLastError(); - return egl::Error(EGL_BAD_ALLOC, "Failed to unlock object, error: 0x%08x.", - HRESULT_CODE(error)); - } - - if (!mFunctionsWGL->dxUnregisterObjectNV(mDeviceHandle, mBoundObjectTextureHandle)) - { - DWORD error = GetLastError(); - return egl::Error(EGL_BAD_ALLOC, "Failed to unregister D3D object, error: 0x%08x.", - HRESULT_CODE(error)); - } - mBoundObjectTextureHandle = nullptr; - - return egl::Error(EGL_SUCCESS); -} - -void D3DTextureSurfaceWGL::setSwapInterval(EGLint interval) -{ - UNIMPLEMENTED(); -} - -EGLint D3DTextureSurfaceWGL::getWidth() const -{ - return static_cast<EGLint>(mWidth); -} - -EGLint D3DTextureSurfaceWGL::getHeight() const -{ - return static_cast<EGLint>(mHeight); -} - -EGLint D3DTextureSurfaceWGL::isPostSubBufferSupported() const -{ - return EGL_FALSE; -} - -EGLint D3DTextureSurfaceWGL::getSwapBehavior() const -{ - return EGL_BUFFER_PRESERVED; -} - -FramebufferImpl *D3DTextureSurfaceWGL::createDefaultFramebuffer(const gl::FramebufferState &data) -{ - return new FramebufferGL(mFramebufferID, data, mFunctionsGL, mWorkarounds, - mRenderer->getBlitter(), mStateManager); -} -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h b/gfx/angle/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h deleted file mode 100644 index 8fb1d4003..000000000 --- a/gfx/angle/src/libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h +++ /dev/null @@ -1,86 +0,0 @@ - -// Copyright (c) 2015 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. -// - -// D3DTextureSurfaceWGL.h: WGL implementation of egl::Surface for D3D texture interop. - -#ifndef LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_ -#define LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_ - -#include "libANGLE/renderer/gl/SurfaceGL.h" - -#include <GL/wglext.h> - -namespace rx -{ - -class FunctionsGL; -class FunctionsWGL; -class DisplayWGL; -class StateManagerGL; -struct WorkaroundsGL; - -class D3DTextureSurfaceWGL : public SurfaceGL -{ - public: - D3DTextureSurfaceWGL(const egl::SurfaceState &state, - RendererGL *renderer, - EGLClientBuffer clientBuffer, - DisplayWGL *display, - HGLRC wglContext, - HDC deviceContext, - const FunctionsGL *functionsGL, - const FunctionsWGL *functionsWGL); - ~D3DTextureSurfaceWGL() override; - - static egl::Error ValidateD3DTextureClientBuffer(EGLClientBuffer clientBuffer); - - egl::Error initialize() override; - egl::Error makeCurrent() override; - egl::Error unMakeCurrent() override; - - egl::Error swap() override; - egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override; - egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override; - egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) override; - egl::Error releaseTexImage(EGLint buffer) override; - void setSwapInterval(EGLint interval) override; - - EGLint getWidth() const override; - EGLint getHeight() const override; - - EGLint isPostSubBufferSupported() const override; - EGLint getSwapBehavior() const override; - - FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &data) override; - - private: - EGLClientBuffer mClientBuffer; - - RendererGL *mRenderer; - - DisplayWGL *mDisplay; - StateManagerGL *mStateManager; - const WorkaroundsGL &mWorkarounds; - const FunctionsGL *mFunctionsGL; - const FunctionsWGL *mFunctionsWGL; - - HGLRC mWGLContext; - HDC mDeviceContext; - - size_t mWidth; - size_t mHeight; - - HANDLE mDeviceHandle; - IUnknown *mObject; - HANDLE mBoundObjectTextureHandle; - HANDLE mBoundObjectRenderbufferHandle; - - GLuint mRenderbufferID; - GLuint mFramebufferID; -}; -} // namespace rx - -#endif // LIBANGLE_RENDERER_GL_WGL_D3DTEXTIRESURFACEWGL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.cpp index 7c5214e82..e07457d10 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.cpp @@ -36,7 +36,6 @@ DXGISwapChainWindowSurfaceWGL::DXGISwapChainWindowSurfaceWGL(const egl::SurfaceS mWindow(window), mStateManager(renderer->getStateManager()), mWorkarounds(renderer->getWorkarounds()), - mRenderer(renderer), mFunctionsGL(functionsGL), mFunctionsWGL(functionsWGL), mDevice(device), @@ -293,8 +292,7 @@ EGLint DXGISwapChainWindowSurfaceWGL::getSwapBehavior() const FramebufferImpl *DXGISwapChainWindowSurfaceWGL::createDefaultFramebuffer( const gl::FramebufferState &data) { - return new FramebufferGL(mFramebufferID, data, mFunctionsGL, mWorkarounds, - mRenderer->getBlitter(), mStateManager); + return new FramebufferGL(mFramebufferID, data, mFunctionsGL, mWorkarounds, mStateManager); } egl::Error DXGISwapChainWindowSurfaceWGL::setObjectsLocked(bool locked) diff --git a/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h b/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h index f516239c9..66444da9b 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h @@ -66,7 +66,6 @@ class DXGISwapChainWindowSurfaceWGL : public SurfaceGL StateManagerGL *mStateManager; const WorkaroundsGL &mWorkarounds; - RendererGL *mRenderer; const FunctionsGL *mFunctionsGL; const FunctionsWGL *mFunctionsWGL; diff --git a/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp b/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp index 188321115..4647fe589 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp +++ b/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.cpp @@ -14,15 +14,12 @@ #include "libANGLE/Surface.h" #include "libANGLE/renderer/gl/RendererGL.h" #include "libANGLE/renderer/gl/renderergl_utils.h" -#include "libANGLE/renderer/gl/wgl/D3DTextureSurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/DXGISwapChainWindowSurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/FunctionsWGL.h" #include "libANGLE/renderer/gl/wgl/PbufferSurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/WindowSurfaceWGL.h" #include "libANGLE/renderer/gl/wgl/wgl_utils.h" -#include "platform/Platform.h" - #include <EGL/eglext.h> #include <string> #include <sstream> @@ -63,7 +60,7 @@ DisplayWGL::DisplayWGL() mOpenGLModule(nullptr), mFunctionsWGL(nullptr), mFunctionsGL(nullptr), - mHasRobustness(false), + mHasARBCreateContextRobustness(false), mWindowClass(0), mWindow(nullptr), mDeviceContext(nullptr), @@ -178,7 +175,7 @@ egl::Error DisplayWGL::initialize(egl::Display *display) // Reinitialize the wgl functions to grab the extensions mFunctionsWGL->initialize(mOpenGLModule, dummyDeviceContext); - bool hasWGLCreateContextRobustness = + mHasARBCreateContextRobustness = mFunctionsWGL->hasExtension("WGL_ARB_create_context_robustness"); // Destroy the dummy window and context @@ -267,7 +264,7 @@ egl::Error DisplayWGL::initialize(egl::Display *display) std::vector<int> contextCreationAttributes; - if (hasWGLCreateContextRobustness) + if (mHasARBCreateContextRobustness) { contextCreationAttributes.push_back(WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB); contextCreationAttributes.push_back(WGL_LOSE_CONTEXT_ON_RESET_ARB); @@ -343,17 +340,9 @@ egl::Error DisplayWGL::initialize(egl::Display *display) mFunctionsGL = new FunctionsGLWindows(mOpenGLModule, mFunctionsWGL->getProcAddress); mFunctionsGL->initialize(); - mHasRobustness = mFunctionsGL->getGraphicsResetStatus != nullptr; - if (hasWGLCreateContextRobustness != mHasRobustness) - { - ANGLEPlatformCurrent()->logWarning( - "WGL_ARB_create_context_robustness exists but unable to OpenGL context with " - "robustness."); - } - // Intel OpenGL ES drivers are not currently supported due to bugs in the driver and ANGLE VendorID vendor = GetVendorID(mFunctionsGL); - if (requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE && IsIntel(vendor)) + if (requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE && vendor == VENDOR_ID_INTEL) { return egl::Error(EGL_NOT_INITIALIZED, "Intel OpenGL ES drivers are not supported."); } @@ -369,7 +358,7 @@ egl::Error DisplayWGL::initialize(egl::Display *display) GetWindowThreadProcessId(nativeWindow, &windowProcessId); // AMD drivers advertise the WGL_NV_DX_interop and WGL_NV_DX_interop2 extensions but fail - mUseDXGISwapChains = !IsAMD(vendor) && (currentProcessId != windowProcessId); + mUseDXGISwapChains = vendor != VENDOR_ID_AMD && (currentProcessId != windowProcessId); } else { @@ -465,13 +454,11 @@ SurfaceImpl *DisplayWGL::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayWGL::createPbufferFromClientBuffer(const egl::SurfaceState &state, const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, + EGLClientBuffer shareHandle, const egl::AttributeMap &attribs) { - ASSERT(buftype == EGL_D3D_TEXTURE_ANGLE); - return new D3DTextureSurfaceWGL(state, getRenderer(), clientBuffer, this, mWGLContext, - mDeviceContext, mFunctionsGL, mFunctionsWGL); + UNIMPLEMENTED(); + return nullptr; } SurfaceImpl *DisplayWGL::createPixmapSurface(const egl::SurfaceState &state, @@ -566,7 +553,7 @@ egl::ConfigSet DisplayWGL::generateConfigs() bool DisplayWGL::testDeviceLost() { - if (mHasRobustness) + if (mHasARBCreateContextRobustness) { return getRenderer()->getResetStatus() != GL_NO_ERROR; } @@ -584,21 +571,6 @@ bool DisplayWGL::isValidNativeWindow(EGLNativeWindowType window) const return (IsWindow(window) == TRUE); } -egl::Error DisplayWGL::validateClientBuffer(const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, - const egl::AttributeMap &attribs) const -{ - switch (buftype) - { - case EGL_D3D_TEXTURE_ANGLE: - return D3DTextureSurfaceWGL::ValidateD3DTextureClientBuffer(clientBuffer); - - default: - return DisplayGL::validateClientBuffer(configuration, buftype, clientBuffer, attribs); - } -} - std::string DisplayWGL::getVendorString() const { //UNIMPLEMENTED(); @@ -661,9 +633,7 @@ void DisplayWGL::generateExtensions(egl::DisplayExtensions *outExtensions) const outExtensions->postSubBuffer = mUseDXGISwapChains; outExtensions->surfaceOrientation = mUseDXGISwapChains; - outExtensions->createContextRobustness = mHasRobustness; - - outExtensions->d3dTextureClientBuffer = mFunctionsWGL->hasExtension("WGL_NV_DX_interop2"); + outExtensions->createContextRobustness = mHasARBCreateContextRobustness; } void DisplayWGL::generateCaps(egl::Caps *outCaps) const diff --git a/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.h b/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.h index 509ea9b39..3f56ecf4f 100755 --- a/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.h +++ b/gfx/angle/src/libANGLE/renderer/gl/wgl/DisplayWGL.h @@ -37,8 +37,7 @@ class DisplayWGL : public DisplayGL 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, @@ -51,10 +50,6 @@ class DisplayWGL : public DisplayGL 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; @@ -83,7 +78,7 @@ class DisplayWGL : public DisplayGL FunctionsWGL *mFunctionsWGL; FunctionsGL *mFunctionsGL; - bool mHasRobustness; + bool mHasARBCreateContextRobustness; ATOM mWindowClass; HWND mWindow; diff --git a/gfx/angle/src/libANGLE/renderer/null/BufferNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/BufferNULL.cpp deleted file mode 100644 index 95463c3f4..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/BufferNULL.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// 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. -// -// BufferNULL.cpp: -// Implements the class methods for BufferNULL. -// - -#include "libANGLE/renderer/null/BufferNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -BufferNULL::BufferNULL(const gl::BufferState &state) : BufferImpl(state) -{ -} - -BufferNULL::~BufferNULL() -{ -} - -gl::Error BufferNULL::setData(GLenum target, const void *data, size_t size, GLenum usage) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error BufferNULL::setSubData(GLenum target, const void *data, size_t size, size_t offset) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error BufferNULL::copySubData(BufferImpl *source, - GLintptr sourceOffset, - GLintptr destOffset, - GLsizeiptr size) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error BufferNULL::map(GLenum access, GLvoid **mapPtr) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error BufferNULL::mapRange(size_t offset, size_t length, GLbitfield access, GLvoid **mapPtr) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error BufferNULL::unmap(GLboolean *result) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error BufferNULL::getIndexRange(GLenum type, - size_t offset, - size_t count, - bool primitiveRestartEnabled, - gl::IndexRange *outRange) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/BufferNULL.h b/gfx/angle/src/libANGLE/renderer/null/BufferNULL.h deleted file mode 100644 index 1578dacbb..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/BufferNULL.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// 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. -// -// BufferNULL.h: -// Defines the class interface for BufferNULL, implementing BufferImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_BUFFERNULL_H_ -#define LIBANGLE_RENDERER_NULL_BUFFERNULL_H_ - -#include "libANGLE/renderer/BufferImpl.h" - -namespace rx -{ - -class BufferNULL : public BufferImpl -{ - public: - BufferNULL(const gl::BufferState &state); - ~BufferNULL() override; - - 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 getIndexRange(GLenum type, - size_t offset, - size_t count, - bool primitiveRestartEnabled, - gl::IndexRange *outRange) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_BUFFERNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/CompilerNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/CompilerNULL.cpp deleted file mode 100644 index 547f4c4e1..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/CompilerNULL.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// 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. -// -// CompilerNULL.cpp: -// Implements the class methods for CompilerNULL. -// - -#include "libANGLE/renderer/null/CompilerNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -CompilerNULL::CompilerNULL() : CompilerImpl() -{ -} - -CompilerNULL::~CompilerNULL() -{ -} - -gl::Error CompilerNULL::release() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -ShShaderOutput CompilerNULL::getTranslatorOutputType() const -{ - UNIMPLEMENTED(); - return ShShaderOutput(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/CompilerNULL.h b/gfx/angle/src/libANGLE/renderer/null/CompilerNULL.h deleted file mode 100644 index 5cd85e8bf..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/CompilerNULL.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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. -// -// CompilerNULL.h: -// Defines the class interface for CompilerNULL, implementing CompilerImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_COMPILERNULL_H_ -#define LIBANGLE_RENDERER_NULL_COMPILERNULL_H_ - -#include "libANGLE/renderer/CompilerImpl.h" - -namespace rx -{ - -class CompilerNULL : public CompilerImpl -{ - public: - CompilerNULL(); - ~CompilerNULL() override; - - gl::Error release() override; - - // TODO(jmadill): Expose translator built-in resources init method. - ShShaderOutput getTranslatorOutputType() const override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_COMPILERNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/ContextNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/ContextNULL.cpp deleted file mode 100644 index 95d4c046a..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ContextNULL.cpp +++ /dev/null @@ -1,175 +0,0 @@ -// -// 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. -// -// ContextNULL.cpp: -// Implements the class methods for ContextNULL. -// - -#include "libANGLE/renderer/null/ContextNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -ContextNULL::ContextNULL(const gl::ContextState &state) : ContextImpl(state) -{ -} - -ContextNULL::~ContextNULL() -{ -} - -gl::Error ContextNULL::initialize() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ContextNULL::flush() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ContextNULL::finish() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ContextNULL::drawArrays(GLenum mode, GLint first, GLsizei count) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ContextNULL::drawArraysInstanced(GLenum mode, - GLint first, - GLsizei count, - GLsizei instanceCount) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ContextNULL::drawElements(GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices, - const gl::IndexRange &indexRange) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ContextNULL::drawElementsInstanced(GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices, - GLsizei instances, - const gl::IndexRange &indexRange) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ContextNULL::drawRangeElements(GLenum mode, - GLuint start, - GLuint end, - GLsizei count, - GLenum type, - const GLvoid *indices, - const gl::IndexRange &indexRange) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -CompilerImpl *ContextNULL::createCompiler() -{ - UNIMPLEMENTED(); - return static_cast<CompilerImpl *>(0); -} - -ShaderImpl *ContextNULL::createShader(const gl::ShaderState &data) -{ - UNIMPLEMENTED(); - return static_cast<ShaderImpl *>(0); -} - -ProgramImpl *ContextNULL::createProgram(const gl::ProgramState &data) -{ - UNIMPLEMENTED(); - return static_cast<ProgramImpl *>(0); -} - -FramebufferImpl *ContextNULL::createFramebuffer(const gl::FramebufferState &data) -{ - UNIMPLEMENTED(); - return static_cast<FramebufferImpl *>(0); -} - -TextureImpl *ContextNULL::createTexture(const gl::TextureState &state) -{ - UNIMPLEMENTED(); - return static_cast<TextureImpl *>(0); -} - -RenderbufferImpl *ContextNULL::createRenderbuffer() -{ - UNIMPLEMENTED(); - return static_cast<RenderbufferImpl *>(0); -} - -BufferImpl *ContextNULL::createBuffer(const gl::BufferState &state) -{ - UNIMPLEMENTED(); - return static_cast<BufferImpl *>(0); -} - -VertexArrayImpl *ContextNULL::createVertexArray(const gl::VertexArrayState &data) -{ - UNIMPLEMENTED(); - return static_cast<VertexArrayImpl *>(0); -} - -QueryImpl *ContextNULL::createQuery(GLenum type) -{ - UNIMPLEMENTED(); - return static_cast<QueryImpl *>(0); -} - -FenceNVImpl *ContextNULL::createFenceNV() -{ - UNIMPLEMENTED(); - return static_cast<FenceNVImpl *>(0); -} - -FenceSyncImpl *ContextNULL::createFenceSync() -{ - UNIMPLEMENTED(); - return static_cast<FenceSyncImpl *>(0); -} - -TransformFeedbackImpl *ContextNULL::createTransformFeedback(const gl::TransformFeedbackState &state) -{ - UNIMPLEMENTED(); - return static_cast<TransformFeedbackImpl *>(0); -} - -SamplerImpl *ContextNULL::createSampler() -{ - UNIMPLEMENTED(); - return static_cast<SamplerImpl *>(0); -} - -std::vector<PathImpl *> ContextNULL::createPaths(GLsizei range) -{ - UNIMPLEMENTED(); - return std::vector<PathImpl *>(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/ContextNULL.h b/gfx/angle/src/libANGLE/renderer/null/ContextNULL.h deleted file mode 100644 index 9a7987b67..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ContextNULL.h +++ /dev/null @@ -1,95 +0,0 @@ -// -// 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. -// -// ContextNULL.h: -// Defines the class interface for ContextNULL, implementing ContextImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_CONTEXTNULL_H_ -#define LIBANGLE_RENDERER_NULL_CONTEXTNULL_H_ - -#include "libANGLE/renderer/ContextImpl.h" - -namespace rx -{ - -class ContextNULL : public ContextImpl -{ - public: - ContextNULL(const gl::ContextState &state); - ~ContextNULL() override; - - gl::Error initialize() override; - - // Flush and finish. - gl::Error flush() override; - gl::Error finish() override; - - // Drawing methods. - gl::Error drawArrays(GLenum mode, GLint first, GLsizei count) override; - gl::Error drawArraysInstanced(GLenum mode, - GLint first, - GLsizei count, - GLsizei instanceCount) override; - - gl::Error drawElements(GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices, - const gl::IndexRange &indexRange) override; - gl::Error drawElementsInstanced(GLenum mode, - GLsizei count, - GLenum type, - const GLvoid *indices, - GLsizei instances, - const gl::IndexRange &indexRange) override; - gl::Error drawRangeElements(GLenum mode, - GLuint start, - GLuint end, - GLsizei count, - GLenum type, - const GLvoid *indices, - const gl::IndexRange &indexRange) override; - - // CHROMIUM_path_rendering path drawing methods. - - // Shader creation - CompilerImpl *createCompiler() override; - ShaderImpl *createShader(const gl::ShaderState &data) override; - ProgramImpl *createProgram(const gl::ProgramState &data) override; - - // Framebuffer creation - FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) override; - - // Texture creation - TextureImpl *createTexture(const gl::TextureState &state) override; - - // Renderbuffer creation - RenderbufferImpl *createRenderbuffer() override; - - // Buffer creation - BufferImpl *createBuffer(const gl::BufferState &state) override; - - // Vertex Array creation - VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) override; - - // Query and Fence creation - QueryImpl *createQuery(GLenum type) override; - FenceNVImpl *createFenceNV() override; - FenceSyncImpl *createFenceSync() override; - - // Transform Feedback creation - TransformFeedbackImpl *createTransformFeedback( - const gl::TransformFeedbackState &state) override; - - // Sampler object creation - SamplerImpl *createSampler() override; - - std::vector<PathImpl *> createPaths(GLsizei range) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_CONTEXTNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/DeviceNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/DeviceNULL.cpp deleted file mode 100644 index 4893f9466..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/DeviceNULL.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -// 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. -// -// DeviceNULL.cpp: -// Implements the class methods for DeviceNULL. -// - -#include "libANGLE/renderer/null/DeviceNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -DeviceNULL::DeviceNULL() : DeviceImpl() -{ -} - -DeviceNULL::~DeviceNULL() -{ -} - -egl::Error DeviceNULL::getDevice(void **outValue) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -EGLint DeviceNULL::getType() -{ - UNIMPLEMENTED(); - return EGLint(); -} - -void DeviceNULL::generateExtensions(egl::DeviceExtensions *outExtensions) const -{ - UNIMPLEMENTED(); -} - -bool DeviceNULL::deviceExternallySourced() -{ - UNIMPLEMENTED(); - return bool(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/DeviceNULL.h b/gfx/angle/src/libANGLE/renderer/null/DeviceNULL.h deleted file mode 100644 index ed921039e..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/DeviceNULL.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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. -// -// DeviceNULL.h: -// Defines the class interface for DeviceNULL, implementing DeviceImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_DEVICENULL_H_ -#define LIBANGLE_RENDERER_NULL_DEVICENULL_H_ - -#include "libANGLE/renderer/DeviceImpl.h" - -namespace rx -{ - -class DeviceNULL : public DeviceImpl -{ - public: - DeviceNULL(); - ~DeviceNULL() override; - - egl::Error getDevice(void **outValue) override; - EGLint getType() override; - void generateExtensions(egl::DeviceExtensions *outExtensions) const override; - bool deviceExternallySourced() override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_DEVICENULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/DisplayNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/DisplayNULL.cpp deleted file mode 100644 index fc04e0465..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/DisplayNULL.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// -// 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. -// -// DisplayNULL.cpp: -// Implements the class methods for DisplayNULL. -// - -#include "libANGLE/renderer/null/DisplayNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -DisplayNULL::DisplayNULL() : DisplayImpl() -{ -} - -DisplayNULL::~DisplayNULL() -{ -} - -egl::Error DisplayNULL::initialize(egl::Display *display) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -void DisplayNULL::terminate() -{ - UNIMPLEMENTED(); -} - -egl::Error DisplayNULL::makeCurrent(egl::Surface *drawSurface, - egl::Surface *readSurface, - gl::Context *context) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -egl::ConfigSet DisplayNULL::generateConfigs() -{ - UNIMPLEMENTED(); - return egl::ConfigSet(); -} - -bool DisplayNULL::testDeviceLost() -{ - UNIMPLEMENTED(); - return bool(); -} - -egl::Error DisplayNULL::restoreLostDevice() -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -bool DisplayNULL::isValidNativeWindow(EGLNativeWindowType window) const -{ - UNIMPLEMENTED(); - return bool(); -} - -std::string DisplayNULL::getVendorString() const -{ - UNIMPLEMENTED(); - return std::string(); -} - -egl::Error DisplayNULL::getDevice(DeviceImpl **device) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -egl::Error DisplayNULL::waitClient() const -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -egl::Error DisplayNULL::waitNative(EGLint engine, - egl::Surface *drawSurface, - egl::Surface *readSurface) const -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -gl::Version DisplayNULL::getMaxSupportedESVersion() const -{ - UNIMPLEMENTED(); - return gl::Version(); -} - -SurfaceImpl *DisplayNULL::createWindowSurface(const egl::SurfaceState &state, - const egl::Config *configuration, - EGLNativeWindowType window, - const egl::AttributeMap &attribs) -{ - UNIMPLEMENTED(); - return static_cast<SurfaceImpl *>(0); -} - -SurfaceImpl *DisplayNULL::createPbufferSurface(const egl::SurfaceState &state, - const egl::Config *configuration, - const egl::AttributeMap &attribs) -{ - UNIMPLEMENTED(); - return static_cast<SurfaceImpl *>(0); -} - -SurfaceImpl *DisplayNULL::createPbufferFromClientBuffer(const egl::SurfaceState &state, - const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer buffer, - const egl::AttributeMap &attribs) -{ - UNIMPLEMENTED(); - return static_cast<SurfaceImpl *>(0); -} - -SurfaceImpl *DisplayNULL::createPixmapSurface(const egl::SurfaceState &state, - const egl::Config *configuration, - NativePixmapType nativePixmap, - const egl::AttributeMap &attribs) -{ - UNIMPLEMENTED(); - return static_cast<SurfaceImpl *>(0); -} - -ImageImpl *DisplayNULL::createImage(EGLenum target, - egl::ImageSibling *buffer, - const egl::AttributeMap &attribs) -{ - UNIMPLEMENTED(); - return static_cast<ImageImpl *>(0); -} - -ContextImpl *DisplayNULL::createContext(const gl::ContextState &state) -{ - UNIMPLEMENTED(); - return static_cast<ContextImpl *>(0); -} - -StreamProducerImpl *DisplayNULL::createStreamProducerD3DTextureNV12( - egl::Stream::ConsumerType consumerType, - const egl::AttributeMap &attribs) -{ - UNIMPLEMENTED(); - return static_cast<StreamProducerImpl *>(0); -} - -void DisplayNULL::generateExtensions(egl::DisplayExtensions *outExtensions) const -{ - UNIMPLEMENTED(); -} - -void DisplayNULL::generateCaps(egl::Caps *outCaps) const -{ - UNIMPLEMENTED(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/DisplayNULL.h b/gfx/angle/src/libANGLE/renderer/null/DisplayNULL.h deleted file mode 100644 index 5a453810a..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/DisplayNULL.h +++ /dev/null @@ -1,82 +0,0 @@ -// -// 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. -// -// DisplayNULL.h: -// Defines the class interface for DisplayNULL, implementing DisplayImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_DISPLAYNULL_H_ -#define LIBANGLE_RENDERER_NULL_DISPLAYNULL_H_ - -#include "libANGLE/renderer/DisplayImpl.h" - -namespace rx -{ - -class DisplayNULL : public DisplayImpl -{ - public: - DisplayNULL(); - ~DisplayNULL() override; - - egl::Error initialize(egl::Display *display) override; - void terminate() override; - - egl::Error makeCurrent(egl::Surface *drawSurface, - egl::Surface *readSurface, - gl::Context *context) override; - - egl::ConfigSet generateConfigs() override; - - bool testDeviceLost() override; - egl::Error restoreLostDevice() override; - - bool isValidNativeWindow(EGLNativeWindowType window) const override; - - std::string getVendorString() const override; - - egl::Error getDevice(DeviceImpl **device) override; - - egl::Error waitClient() const override; - egl::Error waitNative(EGLint engine, - egl::Surface *drawSurface, - egl::Surface *readSurface) const override; - gl::Version getMaxSupportedESVersion() const override; - - SurfaceImpl *createWindowSurface(const egl::SurfaceState &state, - const egl::Config *configuration, - EGLNativeWindowType window, - const egl::AttributeMap &attribs) override; - SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state, - const egl::Config *configuration, - const egl::AttributeMap &attribs) override; - SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state, - const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer buffer, - const egl::AttributeMap &attribs) override; - SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state, - const egl::Config *configuration, - NativePixmapType nativePixmap, - const egl::AttributeMap &attribs) override; - - ImageImpl *createImage(EGLenum target, - egl::ImageSibling *buffer, - const egl::AttributeMap &attribs) override; - - ContextImpl *createContext(const gl::ContextState &state) override; - - StreamProducerImpl *createStreamProducerD3DTextureNV12( - egl::Stream::ConsumerType consumerType, - const egl::AttributeMap &attribs) override; - - private: - void generateExtensions(egl::DisplayExtensions *outExtensions) const override; - void generateCaps(egl::Caps *outCaps) const override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_DISPLAYNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/FenceNVNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/FenceNVNULL.cpp deleted file mode 100644 index 9d7f26043..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/FenceNVNULL.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -// 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. -// -// FenceNVNULL.cpp: -// Implements the class methods for FenceNVNULL. -// - -#include "libANGLE/renderer/null/FenceNVNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -FenceNVNULL::FenceNVNULL() : FenceNVImpl() -{ -} - -FenceNVNULL::~FenceNVNULL() -{ -} - -gl::Error FenceNVNULL::set(GLenum condition) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FenceNVNULL::test(GLboolean *outFinished) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FenceNVNULL::finish() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/FenceNVNULL.h b/gfx/angle/src/libANGLE/renderer/null/FenceNVNULL.h deleted file mode 100644 index 10cf5c2cb..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/FenceNVNULL.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// 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. -// -// FenceNVNULL.h: -// Defines the class interface for FenceNVNULL, implementing FenceNVImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_FENCENVNULL_H_ -#define LIBANGLE_RENDERER_NULL_FENCENVNULL_H_ - -#include "libANGLE/renderer/FenceNVImpl.h" - -namespace rx -{ - -class FenceNVNULL : public FenceNVImpl -{ - public: - FenceNVNULL(); - ~FenceNVNULL() override; - - gl::Error set(GLenum condition) override; - gl::Error test(GLboolean *outFinished) override; - gl::Error finish() override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_FENCENVNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/FenceSyncNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/FenceSyncNULL.cpp deleted file mode 100644 index 37bfdfedb..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/FenceSyncNULL.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// 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. -// -// FenceSyncNULL.cpp: -// Implements the class methods for FenceSyncNULL. -// - -#include "libANGLE/renderer/null/FenceSyncNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -FenceSyncNULL::FenceSyncNULL() : FenceSyncImpl() -{ -} - -FenceSyncNULL::~FenceSyncNULL() -{ -} - -gl::Error FenceSyncNULL::set(GLenum condition, GLbitfield flags) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FenceSyncNULL::clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FenceSyncNULL::serverWait(GLbitfield flags, GLuint64 timeout) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FenceSyncNULL::getStatus(GLint *outResult) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/FenceSyncNULL.h b/gfx/angle/src/libANGLE/renderer/null/FenceSyncNULL.h deleted file mode 100644 index 28a12f703..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/FenceSyncNULL.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// 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. -// -// FenceSyncNULL.h: -// Defines the class interface for FenceSyncNULL, implementing FenceSyncImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_FENCESYNCNULL_H_ -#define LIBANGLE_RENDERER_NULL_FENCESYNCNULL_H_ - -#include "libANGLE/renderer/FenceSyncImpl.h" - -namespace rx -{ - -class FenceSyncNULL : public FenceSyncImpl -{ - public: - FenceSyncNULL(); - ~FenceSyncNULL() override; - - gl::Error set(GLenum condition, GLbitfield flags) override; - gl::Error clientWait(GLbitfield flags, GLuint64 timeout, GLenum *outResult) override; - gl::Error serverWait(GLbitfield flags, GLuint64 timeout) override; - gl::Error getStatus(GLint *outResult) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_FENCESYNCNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/FramebufferNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/FramebufferNULL.cpp deleted file mode 100644 index 14ebe1eba..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/FramebufferNULL.cpp +++ /dev/null @@ -1,131 +0,0 @@ -// -// 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. -// -// FramebufferNULL.cpp: -// Implements the class methods for FramebufferNULL. -// - -#include "libANGLE/renderer/null/FramebufferNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -FramebufferNULL::FramebufferNULL(const gl::FramebufferState &state) : FramebufferImpl(state) -{ -} - -FramebufferNULL::~FramebufferNULL() -{ -} - -gl::Error FramebufferNULL::discard(size_t count, const GLenum *attachments) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::invalidate(size_t count, const GLenum *attachments) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::invalidateSub(size_t count, - const GLenum *attachments, - const gl::Rectangle &area) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::clear(ContextImpl *context, GLbitfield mask) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::clearBufferfv(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - const GLfloat *values) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::clearBufferuiv(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - const GLuint *values) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::clearBufferiv(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - const GLint *values) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::clearBufferfi(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - GLfloat depth, - GLint stencil) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -GLenum FramebufferNULL::getImplementationColorReadFormat() const -{ - UNIMPLEMENTED(); - return GLenum(); -} - -GLenum FramebufferNULL::getImplementationColorReadType() const -{ - UNIMPLEMENTED(); - return GLenum(); -} - -gl::Error FramebufferNULL::readPixels(ContextImpl *context, - const gl::Rectangle &area, - GLenum format, - GLenum type, - GLvoid *pixels) const -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error FramebufferNULL::blit(ContextImpl *context, - const gl::Rectangle &sourceArea, - const gl::Rectangle &destArea, - GLbitfield mask, - GLenum filter) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -bool FramebufferNULL::checkStatus() const -{ - UNIMPLEMENTED(); - return bool(); -} - -void FramebufferNULL::syncState(const gl::Framebuffer::DirtyBits &dirtyBits) -{ - UNIMPLEMENTED(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/FramebufferNULL.h b/gfx/angle/src/libANGLE/renderer/null/FramebufferNULL.h deleted file mode 100644 index c53132c18..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/FramebufferNULL.h +++ /dev/null @@ -1,70 +0,0 @@ -// -// 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. -// -// FramebufferNULL.h: -// Defines the class interface for FramebufferNULL, implementing FramebufferImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_FRAMEBUFFERNULL_H_ -#define LIBANGLE_RENDERER_NULL_FRAMEBUFFERNULL_H_ - -#include "libANGLE/renderer/FramebufferImpl.h" - -namespace rx -{ - -class FramebufferNULL : public FramebufferImpl -{ - public: - FramebufferNULL(const gl::FramebufferState &state); - ~FramebufferNULL() override; - - gl::Error discard(size_t count, const GLenum *attachments) override; - gl::Error invalidate(size_t count, const GLenum *attachments) override; - gl::Error invalidateSub(size_t count, - const GLenum *attachments, - const gl::Rectangle &area) override; - - gl::Error clear(ContextImpl *context, GLbitfield mask) override; - gl::Error clearBufferfv(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - const GLfloat *values) override; - gl::Error clearBufferuiv(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - const GLuint *values) override; - gl::Error clearBufferiv(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - const GLint *values) override; - gl::Error clearBufferfi(ContextImpl *context, - GLenum buffer, - GLint drawbuffer, - GLfloat depth, - GLint stencil) override; - - GLenum getImplementationColorReadFormat() const override; - GLenum getImplementationColorReadType() const override; - gl::Error readPixels(ContextImpl *context, - const gl::Rectangle &area, - GLenum format, - GLenum type, - GLvoid *pixels) const override; - - gl::Error blit(ContextImpl *context, - const gl::Rectangle &sourceArea, - const gl::Rectangle &destArea, - GLbitfield mask, - GLenum filter) override; - - bool checkStatus() const override; - - void syncState(const gl::Framebuffer::DirtyBits &dirtyBits) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_FRAMEBUFFERNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/ImageNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/ImageNULL.cpp deleted file mode 100644 index 23f3ca099..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ImageNULL.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// 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. -// -// ImageNULL.cpp: -// Implements the class methods for ImageNULL. -// - -#include "libANGLE/renderer/null/ImageNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -ImageNULL::ImageNULL() : ImageImpl() -{ -} - -ImageNULL::~ImageNULL() -{ -} - -egl::Error ImageNULL::initialize() -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -gl::Error ImageNULL::orphan(egl::ImageSibling *sibling) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/ImageNULL.h b/gfx/angle/src/libANGLE/renderer/null/ImageNULL.h deleted file mode 100644 index b88b346dd..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ImageNULL.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// 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. -// -// ImageNULL.h: -// Defines the class interface for ImageNULL, implementing ImageImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_IMAGENULL_H_ -#define LIBANGLE_RENDERER_NULL_IMAGENULL_H_ - -#include "libANGLE/renderer/ImageImpl.h" - -namespace rx -{ - -class ImageNULL : public ImageImpl -{ - public: - ImageNULL(); - ~ImageNULL() override; - egl::Error initialize() override; - - gl::Error orphan(egl::ImageSibling *sibling) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_IMAGENULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/PathNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/PathNULL.cpp deleted file mode 100644 index bb52ea2c2..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/PathNULL.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// 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. -// -// PathNULL.cpp: -// Implements the class methods for PathNULL. -// - -#include "libANGLE/renderer/null/PathNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -PathNULL::PathNULL() : PathImpl() -{ -} - -PathNULL::~PathNULL() -{ -} - -gl::Error PathNULL::setCommands(GLsizei numCommands, - const GLubyte *commands, - GLsizei numCoords, - GLenum coordType, - const void *coords) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -void PathNULL::setPathParameter(GLenum pname, GLfloat value) -{ - UNIMPLEMENTED(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/PathNULL.h b/gfx/angle/src/libANGLE/renderer/null/PathNULL.h deleted file mode 100644 index 4c80c1c91..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/PathNULL.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// 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. -// -// PathNULL.h: -// Defines the class interface for PathNULL, implementing PathImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_PATHNULL_H_ -#define LIBANGLE_RENDERER_NULL_PATHNULL_H_ - -#include "libANGLE/renderer/PathImpl.h" - -namespace rx -{ - -class PathNULL : public PathImpl -{ - public: - PathNULL(); - ~PathNULL() override; - - gl::Error setCommands(GLsizei numCommands, - const GLubyte *commands, - GLsizei numCoords, - GLenum coordType, - const void *coords) override; - - void setPathParameter(GLenum pname, GLfloat value) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_PATHNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/ProgramNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/ProgramNULL.cpp deleted file mode 100644 index fb44b6ee4..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ProgramNULL.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// -// 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. -// -// ProgramNULL.cpp: -// Implements the class methods for ProgramNULL. -// - -#include "libANGLE/renderer/null/ProgramNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -ProgramNULL::ProgramNULL(const gl::ProgramState &state) : ProgramImpl(state) -{ -} - -ProgramNULL::~ProgramNULL() -{ -} - -LinkResult ProgramNULL::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error ProgramNULL::save(gl::BinaryOutputStream *stream) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -void ProgramNULL::setBinaryRetrievableHint(bool retrievable) -{ - UNIMPLEMENTED(); -} - -LinkResult ProgramNULL::link(const gl::ContextState &data, gl::InfoLog &infoLog) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -GLboolean ProgramNULL::validate(const gl::Caps &caps, gl::InfoLog *infoLog) -{ - UNIMPLEMENTED(); - return GLboolean(); -} - -void ProgramNULL::setUniform1fv(GLint location, GLsizei count, const GLfloat *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform2fv(GLint location, GLsizei count, const GLfloat *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform3fv(GLint location, GLsizei count, const GLfloat *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform4fv(GLint location, GLsizei count, const GLfloat *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform1iv(GLint location, GLsizei count, const GLint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform2iv(GLint location, GLsizei count, const GLint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform3iv(GLint location, GLsizei count, const GLint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform4iv(GLint location, GLsizei count, const GLint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform1uiv(GLint location, GLsizei count, const GLuint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform2uiv(GLint location, GLsizei count, const GLuint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform3uiv(GLint location, GLsizei count, const GLuint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniform4uiv(GLint location, GLsizei count, const GLuint *v) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix2fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix3fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix4fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix2x3fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix3x2fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix2x4fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix4x2fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix3x4fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformMatrix4x3fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) -{ - UNIMPLEMENTED(); -} - -void ProgramNULL::setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) -{ - UNIMPLEMENTED(); -} - -bool ProgramNULL::getUniformBlockSize(const std::string &blockName, size_t *sizeOut) const -{ - UNIMPLEMENTED(); - return bool(); -} - -bool ProgramNULL::getUniformBlockMemberInfo(const std::string &memberUniformName, - sh::BlockMemberInfo *memberInfoOut) const -{ - UNIMPLEMENTED(); - return bool(); -} - -void ProgramNULL::setPathFragmentInputGen(const std::string &inputName, - GLenum genMode, - GLint components, - const GLfloat *coeffs) -{ - UNIMPLEMENTED(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/ProgramNULL.h b/gfx/angle/src/libANGLE/renderer/null/ProgramNULL.h deleted file mode 100644 index 576a52c18..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ProgramNULL.h +++ /dev/null @@ -1,101 +0,0 @@ -// -// 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. -// -// ProgramNULL.h: -// Defines the class interface for ProgramNULL, implementing ProgramImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_PROGRAMNULL_H_ -#define LIBANGLE_RENDERER_NULL_PROGRAMNULL_H_ - -#include "libANGLE/renderer/ProgramImpl.h" - -namespace rx -{ - -class ProgramNULL : public ProgramImpl -{ - public: - ProgramNULL(const gl::ProgramState &state); - ~ProgramNULL() override; - - LinkResult load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) override; - gl::Error save(gl::BinaryOutputStream *stream) override; - void setBinaryRetrievableHint(bool retrievable) override; - - LinkResult link(const gl::ContextState &data, gl::InfoLog &infoLog) override; - GLboolean validate(const gl::Caps &caps, gl::InfoLog *infoLog) override; - - void setUniform1fv(GLint location, GLsizei count, const GLfloat *v) override; - void setUniform2fv(GLint location, GLsizei count, const GLfloat *v) override; - void setUniform3fv(GLint location, GLsizei count, const GLfloat *v) override; - void setUniform4fv(GLint location, GLsizei count, const GLfloat *v) override; - void setUniform1iv(GLint location, GLsizei count, const GLint *v) override; - void setUniform2iv(GLint location, GLsizei count, const GLint *v) override; - void setUniform3iv(GLint location, GLsizei count, const GLint *v) override; - void setUniform4iv(GLint location, GLsizei count, const GLint *v) override; - void setUniform1uiv(GLint location, GLsizei count, const GLuint *v) override; - void setUniform2uiv(GLint location, GLsizei count, const GLuint *v) override; - void setUniform3uiv(GLint location, GLsizei count, const GLuint *v) override; - void setUniform4uiv(GLint location, GLsizei count, const GLuint *v) override; - void setUniformMatrix2fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix3fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix4fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix2x3fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix3x2fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix2x4fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix4x2fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix3x4fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - void setUniformMatrix4x3fv(GLint location, - GLsizei count, - GLboolean transpose, - const GLfloat *value) override; - - // TODO: synchronize in syncState when dirty bits exist. - void setUniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) override; - - // May only be called after a successful link operation. - // Return false for inactive blocks. - bool getUniformBlockSize(const std::string &blockName, size_t *sizeOut) const override; - - // May only be called after a successful link operation. - // Returns false for inactive members. - bool getUniformBlockMemberInfo(const std::string &memberUniformName, - sh::BlockMemberInfo *memberInfoOut) const override; - // CHROMIUM_path_rendering - // Set parameters to control fragment shader input variable interpolation - void setPathFragmentInputGen(const std::string &inputName, - GLenum genMode, - GLint components, - const GLfloat *coeffs) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_PROGRAMNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/QueryNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/QueryNULL.cpp deleted file mode 100644 index 6276a0ff1..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/QueryNULL.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// 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. -// -// QueryNULL.cpp: -// Implements the class methods for QueryNULL. -// - -#include "libANGLE/renderer/null/QueryNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -QueryNULL::QueryNULL(GLenum type) : QueryImpl(type) -{ -} - -QueryNULL::~QueryNULL() -{ -} - -gl::Error QueryNULL::begin() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error QueryNULL::end() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error QueryNULL::queryCounter() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error QueryNULL::getResult(GLint *params) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error QueryNULL::getResult(GLuint *params) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error QueryNULL::getResult(GLint64 *params) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error QueryNULL::getResult(GLuint64 *params) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error QueryNULL::isResultAvailable(bool *available) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/QueryNULL.h b/gfx/angle/src/libANGLE/renderer/null/QueryNULL.h deleted file mode 100644 index 40082a9b8..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/QueryNULL.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// 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. -// -// QueryNULL.h: -// Defines the class interface for QueryNULL, implementing QueryImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_QUERYNULL_H_ -#define LIBANGLE_RENDERER_NULL_QUERYNULL_H_ - -#include "libANGLE/renderer/QueryImpl.h" - -namespace rx -{ - -class QueryNULL : public QueryImpl -{ - public: - QueryNULL(GLenum type); - ~QueryNULL() override; - - gl::Error begin() override; - gl::Error end() override; - gl::Error queryCounter() override; - gl::Error getResult(GLint *params) override; - gl::Error getResult(GLuint *params) override; - gl::Error getResult(GLint64 *params) override; - gl::Error getResult(GLuint64 *params) override; - gl::Error isResultAvailable(bool *available) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_QUERYNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/RenderbufferNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/RenderbufferNULL.cpp deleted file mode 100644 index 50f54a620..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/RenderbufferNULL.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// 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. -// -// RenderbufferNULL.cpp: -// Implements the class methods for RenderbufferNULL. -// - -#include "libANGLE/renderer/null/RenderbufferNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -RenderbufferNULL::RenderbufferNULL() : RenderbufferImpl() -{ -} - -RenderbufferNULL::~RenderbufferNULL() -{ -} - -gl::Error RenderbufferNULL::setStorage(GLenum internalformat, size_t width, size_t height) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error RenderbufferNULL::setStorageMultisample(size_t samples, - GLenum internalformat, - size_t width, - size_t height) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error RenderbufferNULL::setStorageEGLImageTarget(egl::Image *image) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/RenderbufferNULL.h b/gfx/angle/src/libANGLE/renderer/null/RenderbufferNULL.h deleted file mode 100644 index 79e529c4c..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/RenderbufferNULL.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// 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. -// -// RenderbufferNULL.h: -// Defines the class interface for RenderbufferNULL, implementing RenderbufferImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_RENDERBUFFERNULL_H_ -#define LIBANGLE_RENDERER_NULL_RENDERBUFFERNULL_H_ - -#include "libANGLE/renderer/RenderbufferImpl.h" - -namespace rx -{ - -class RenderbufferNULL : public RenderbufferImpl -{ - public: - RenderbufferNULL(); - ~RenderbufferNULL() override; - - gl::Error setStorage(GLenum internalformat, size_t width, size_t height) override; - gl::Error setStorageMultisample(size_t samples, - GLenum internalformat, - size_t width, - size_t height) override; - gl::Error setStorageEGLImageTarget(egl::Image *image) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_RENDERBUFFERNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/SamplerNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/SamplerNULL.cpp deleted file mode 100644 index e1e8c7c62..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/SamplerNULL.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -// 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. -// -// SamplerNULL.cpp: -// Implements the class methods for SamplerNULL. -// - -#include "libANGLE/renderer/null/SamplerNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -SamplerNULL::SamplerNULL() : SamplerImpl() -{ -} - -SamplerNULL::~SamplerNULL() -{ -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/SamplerNULL.h b/gfx/angle/src/libANGLE/renderer/null/SamplerNULL.h deleted file mode 100644 index 031fafa39..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/SamplerNULL.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// 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. -// -// SamplerNULL.h: -// Defines the class interface for SamplerNULL, implementing SamplerImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_SAMPLERNULL_H_ -#define LIBANGLE_RENDERER_NULL_SAMPLERNULL_H_ - -#include "libANGLE/renderer/SamplerImpl.h" - -namespace rx -{ - -class SamplerNULL : public SamplerImpl -{ - public: - SamplerNULL(); - ~SamplerNULL() override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_SAMPLERNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/ShaderNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/ShaderNULL.cpp deleted file mode 100644 index 168f4bdca..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ShaderNULL.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// 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. -// -// ShaderNULL.cpp: -// Implements the class methods for ShaderNULL. -// - -#include "libANGLE/renderer/null/ShaderNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -ShaderNULL::ShaderNULL(const gl::ShaderState &data) : ShaderImpl(data) -{ -} - -ShaderNULL::~ShaderNULL() -{ -} - -ShCompileOptions ShaderNULL::prepareSourceAndReturnOptions(std::stringstream *sourceStream, - std::string *sourcePath) -{ - UNIMPLEMENTED(); - return ShCompileOptions(); -} - -bool ShaderNULL::postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) -{ - UNIMPLEMENTED(); - return bool(); -} - -std::string ShaderNULL::getDebugInfo() const -{ - UNIMPLEMENTED(); - return std::string(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/ShaderNULL.h b/gfx/angle/src/libANGLE/renderer/null/ShaderNULL.h deleted file mode 100644 index d29b4cfb7..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/ShaderNULL.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// 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. -// -// ShaderNULL.h: -// Defines the class interface for ShaderNULL, implementing ShaderImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_SHADERNULL_H_ -#define LIBANGLE_RENDERER_NULL_SHADERNULL_H_ - -#include "libANGLE/renderer/ShaderImpl.h" - -namespace rx -{ - -class ShaderNULL : public ShaderImpl -{ - public: - ShaderNULL(const gl::ShaderState &data); - ~ShaderNULL() override; - - // Returns additional sh::Compile options. - ShCompileOptions prepareSourceAndReturnOptions(std::stringstream *sourceStream, - std::string *sourcePath) override; - // Returns success for compiling on the driver. Returns success. - bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override; - - std::string getDebugInfo() const override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_SHADERNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/SurfaceNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/SurfaceNULL.cpp deleted file mode 100644 index 81d763783..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/SurfaceNULL.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -// 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. -// -// SurfaceNULL.cpp: -// Implements the class methods for SurfaceNULL. -// - -#include "libANGLE/renderer/null/SurfaceNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -SurfaceNULL::SurfaceNULL(const egl::SurfaceState &surfaceState) : SurfaceImpl(surfaceState) -{ -} - -SurfaceNULL::~SurfaceNULL() -{ -} - -egl::Error SurfaceNULL::initialize() -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -FramebufferImpl *SurfaceNULL::createDefaultFramebuffer(const gl::FramebufferState &state) -{ - UNIMPLEMENTED(); - return static_cast<FramebufferImpl *>(0); -} - -egl::Error SurfaceNULL::swap() -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -egl::Error SurfaceNULL::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -egl::Error SurfaceNULL::querySurfacePointerANGLE(EGLint attribute, void **value) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -egl::Error SurfaceNULL::bindTexImage(gl::Texture *texture, EGLint buffer) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -egl::Error SurfaceNULL::releaseTexImage(EGLint buffer) -{ - UNIMPLEMENTED(); - return egl::Error(EGL_BAD_ACCESS); -} - -void SurfaceNULL::setSwapInterval(EGLint interval) -{ - UNIMPLEMENTED(); -} - -EGLint SurfaceNULL::getWidth() const -{ - UNIMPLEMENTED(); - return EGLint(); -} - -EGLint SurfaceNULL::getHeight() const -{ - UNIMPLEMENTED(); - return EGLint(); -} - -EGLint SurfaceNULL::isPostSubBufferSupported() const -{ - UNIMPLEMENTED(); - return EGLint(); -} - -EGLint SurfaceNULL::getSwapBehavior() const -{ - UNIMPLEMENTED(); - return EGLint(); -} - -gl::Error SurfaceNULL::getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, - FramebufferAttachmentRenderTarget **rtOut) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/SurfaceNULL.h b/gfx/angle/src/libANGLE/renderer/null/SurfaceNULL.h deleted file mode 100644 index 597f1c21c..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/SurfaceNULL.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// 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. -// -// SurfaceNULL.h: -// Defines the class interface for SurfaceNULL, implementing SurfaceImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_SURFACENULL_H_ -#define LIBANGLE_RENDERER_NULL_SURFACENULL_H_ - -#include "libANGLE/renderer/SurfaceImpl.h" - -namespace rx -{ - -class SurfaceNULL : public SurfaceImpl -{ - public: - SurfaceNULL(const egl::SurfaceState &surfaceState); - ~SurfaceNULL() override; - - egl::Error initialize() override; - FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override; - egl::Error swap() override; - egl::Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) override; - egl::Error querySurfacePointerANGLE(EGLint attribute, void **value) override; - egl::Error bindTexImage(gl::Texture *texture, EGLint buffer) override; - egl::Error releaseTexImage(EGLint buffer) override; - void setSwapInterval(EGLint interval) override; - - // width and height can change with client window resizing - EGLint getWidth() const override; - EGLint getHeight() const override; - - EGLint isPostSubBufferSupported() const override; - EGLint getSwapBehavior() const override; - - gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, - FramebufferAttachmentRenderTarget **rtOut) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_SURFACENULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/TextureNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/TextureNULL.cpp deleted file mode 100644 index 2c952e528..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/TextureNULL.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// -// 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. -// -// TextureNULL.cpp: -// Implements the class methods for TextureNULL. -// - -#include "libANGLE/renderer/null/TextureNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -TextureNULL::TextureNULL(const gl::TextureState &state) : TextureImpl(state) -{ -} - -TextureNULL::~TextureNULL() -{ -} - -gl::Error TextureNULL::setImage(GLenum target, - size_t level, - GLenum internalFormat, - const gl::Extents &size, - GLenum format, - GLenum type, - const gl::PixelUnpackState &unpack, - const uint8_t *pixels) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::setSubImage(GLenum target, - size_t level, - const gl::Box &area, - GLenum format, - GLenum type, - const gl::PixelUnpackState &unpack, - const uint8_t *pixels) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::setCompressedImage(GLenum target, - size_t level, - GLenum internalFormat, - const gl::Extents &size, - const gl::PixelUnpackState &unpack, - size_t imageSize, - const uint8_t *pixels) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::setCompressedSubImage(GLenum target, - size_t level, - const gl::Box &area, - GLenum format, - const gl::PixelUnpackState &unpack, - size_t imageSize, - const uint8_t *pixels) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::copyImage(GLenum target, - size_t level, - const gl::Rectangle &sourceArea, - GLenum internalFormat, - const gl::Framebuffer *source) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::copySubImage(GLenum target, - size_t level, - const gl::Offset &destOffset, - const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::setStorage(GLenum target, - size_t levels, - GLenum internalFormat, - const gl::Extents &size) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::setEGLImageTarget(GLenum target, egl::Image *image) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::setImageExternal(GLenum target, - egl::Stream *stream, - const egl::Stream::GLTextureDescription &desc) -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -gl::Error TextureNULL::generateMipmap() -{ - UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); -} - -void TextureNULL::setBaseLevel(GLuint baseLevel) -{ - UNIMPLEMENTED(); -} - -void TextureNULL::bindTexImage(egl::Surface *surface) -{ - UNIMPLEMENTED(); -} - -void TextureNULL::releaseTexImage() -{ - UNIMPLEMENTED(); -} - -void TextureNULL::syncState(const gl::Texture::DirtyBits &dirtyBits) -{ - UNIMPLEMENTED(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/TextureNULL.h b/gfx/angle/src/libANGLE/renderer/null/TextureNULL.h deleted file mode 100644 index 10c2d3503..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/TextureNULL.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// 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. -// -// TextureNULL.h: -// Defines the class interface for TextureNULL, implementing TextureImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_TEXTURENULL_H_ -#define LIBANGLE_RENDERER_NULL_TEXTURENULL_H_ - -#include "libANGLE/renderer/TextureImpl.h" - -namespace rx -{ - -class TextureNULL : public TextureImpl -{ - public: - TextureNULL(const gl::TextureState &state); - ~TextureNULL() override; - - gl::Error setImage(GLenum target, - size_t level, - GLenum internalFormat, - const gl::Extents &size, - GLenum format, - GLenum type, - const gl::PixelUnpackState &unpack, - const uint8_t *pixels) override; - gl::Error setSubImage(GLenum target, - size_t level, - const gl::Box &area, - GLenum format, - GLenum type, - const gl::PixelUnpackState &unpack, - const uint8_t *pixels) override; - - gl::Error setCompressedImage(GLenum target, - size_t level, - GLenum internalFormat, - const gl::Extents &size, - const gl::PixelUnpackState &unpack, - size_t imageSize, - const uint8_t *pixels) override; - gl::Error setCompressedSubImage(GLenum target, - size_t level, - const gl::Box &area, - GLenum format, - const gl::PixelUnpackState &unpack, - size_t imageSize, - const uint8_t *pixels) override; - - gl::Error copyImage(GLenum target, - size_t level, - const gl::Rectangle &sourceArea, - GLenum internalFormat, - const gl::Framebuffer *source) override; - gl::Error copySubImage(GLenum target, - size_t level, - const gl::Offset &destOffset, - const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) override; - - gl::Error setStorage(GLenum target, - size_t levels, - GLenum internalFormat, - const gl::Extents &size) override; - - gl::Error setEGLImageTarget(GLenum target, egl::Image *image) override; - - gl::Error setImageExternal(GLenum target, - egl::Stream *stream, - const egl::Stream::GLTextureDescription &desc) override; - - gl::Error generateMipmap() override; - - void setBaseLevel(GLuint baseLevel) override; - - void bindTexImage(egl::Surface *surface) override; - void releaseTexImage() override; - - void syncState(const gl::Texture::DirtyBits &dirtyBits) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_TEXTURENULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/TransformFeedbackNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/TransformFeedbackNULL.cpp deleted file mode 100644 index e1433fb2d..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/TransformFeedbackNULL.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// -// 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. -// -// TransformFeedbackNULL.cpp: -// Implements the class methods for TransformFeedbackNULL. -// - -#include "libANGLE/renderer/null/TransformFeedbackNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -TransformFeedbackNULL::TransformFeedbackNULL(const gl::TransformFeedbackState &state) - : TransformFeedbackImpl(state) -{ -} - -TransformFeedbackNULL::~TransformFeedbackNULL() -{ -} - -void TransformFeedbackNULL::begin(GLenum primitiveMode) -{ - UNIMPLEMENTED(); -} - -void TransformFeedbackNULL::end() -{ - UNIMPLEMENTED(); -} - -void TransformFeedbackNULL::pause() -{ - UNIMPLEMENTED(); -} - -void TransformFeedbackNULL::resume() -{ - UNIMPLEMENTED(); -} - -void TransformFeedbackNULL::bindGenericBuffer(const BindingPointer<gl::Buffer> &binding) -{ - UNIMPLEMENTED(); -} - -void TransformFeedbackNULL::bindIndexedBuffer(size_t index, - const OffsetBindingPointer<gl::Buffer> &binding) -{ - UNIMPLEMENTED(); -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/TransformFeedbackNULL.h b/gfx/angle/src/libANGLE/renderer/null/TransformFeedbackNULL.h deleted file mode 100644 index 477e81d85..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/TransformFeedbackNULL.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// 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. -// -// TransformFeedbackNULL.h: -// Defines the class interface for TransformFeedbackNULL, implementing TransformFeedbackImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_TRANSFORMFEEDBACKNULL_H_ -#define LIBANGLE_RENDERER_NULL_TRANSFORMFEEDBACKNULL_H_ - -#include "libANGLE/renderer/TransformFeedbackImpl.h" - -namespace rx -{ - -class TransformFeedbackNULL : public TransformFeedbackImpl -{ - public: - TransformFeedbackNULL(const gl::TransformFeedbackState &state); - ~TransformFeedbackNULL() override; - - void begin(GLenum primitiveMode) override; - void end() override; - void pause() override; - void resume() override; - - void bindGenericBuffer(const BindingPointer<gl::Buffer> &binding) override; - void bindIndexedBuffer(size_t index, const OffsetBindingPointer<gl::Buffer> &binding) override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_TRANSFORMFEEDBACKNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/null/VertexArrayNULL.cpp b/gfx/angle/src/libANGLE/renderer/null/VertexArrayNULL.cpp deleted file mode 100644 index 95a835df1..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/VertexArrayNULL.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -// 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. -// -// VertexArrayNULL.cpp: -// Implements the class methods for VertexArrayNULL. -// - -#include "libANGLE/renderer/null/VertexArrayNULL.h" - -#include "common/debug.h" - -namespace rx -{ - -VertexArrayNULL::VertexArrayNULL(const gl::VertexArrayState &data) : VertexArrayImpl(data) -{ -} - -VertexArrayNULL::~VertexArrayNULL() -{ -} - -} // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/null/VertexArrayNULL.h b/gfx/angle/src/libANGLE/renderer/null/VertexArrayNULL.h deleted file mode 100644 index f8b2b0490..000000000 --- a/gfx/angle/src/libANGLE/renderer/null/VertexArrayNULL.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// 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. -// -// VertexArrayNULL.h: -// Defines the class interface for VertexArrayNULL, implementing VertexArrayImpl. -// - -#ifndef LIBANGLE_RENDERER_NULL_VERTEXARRAYNULL_H_ -#define LIBANGLE_RENDERER_NULL_VERTEXARRAYNULL_H_ - -#include "libANGLE/renderer/VertexArrayImpl.h" - -namespace rx -{ - -class VertexArrayNULL : public VertexArrayImpl -{ - public: - VertexArrayNULL(const gl::VertexArrayState &data); - ~VertexArrayNULL() override; -}; - -} // namespace rx - -#endif // LIBANGLE_RENDERER_NULL_VERTEXARRAYNULL_H_ diff --git a/gfx/angle/src/libANGLE/renderer/renderer_utils.cpp b/gfx/angle/src/libANGLE/renderer/renderer_utils.cpp index cc04dbb14..b93a1ff93 100755 --- a/gfx/angle/src/libANGLE/renderer/renderer_utils.cpp +++ b/gfx/angle/src/libANGLE/renderer/renderer_utils.cpp @@ -268,25 +268,8 @@ ColorWriteFunction GetColorWriteFunction(const gl::FormatType &formatType) ColorCopyFunction GetFastCopyFunction(const FastCopyFunctionMap &fastCopyFunctions, const gl::FormatType &formatType) { - return fastCopyFunctions.get(formatType); -} - -bool FastCopyFunctionMap::has(const gl::FormatType &formatType) const -{ - return (get(formatType) != nullptr); -} - -ColorCopyFunction FastCopyFunctionMap::get(const gl::FormatType &formatType) const -{ - for (size_t index = 0; index < mSize; ++index) - { - if (mData[index].format == formatType.format && mData[index].type == formatType.type) - { - return mData[index].func; - } - } - - return nullptr; + auto iter = fastCopyFunctions.find(formatType); + return (iter != fastCopyFunctions.end()) ? iter->second : nullptr; } } // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/renderer_utils.h b/gfx/angle/src/libANGLE/renderer/renderer_utils.h index 440548e9c..e08703000 100755 --- a/gfx/angle/src/libANGLE/renderer/renderer_utils.h +++ b/gfx/angle/src/libANGLE/renderer/renderer_utils.h @@ -44,27 +44,7 @@ typedef void (*ColorReadFunction)(const uint8_t *source, uint8_t *dest); typedef void (*ColorWriteFunction)(const uint8_t *source, uint8_t *dest); typedef void (*ColorCopyFunction)(const uint8_t *source, uint8_t *dest); -class FastCopyFunctionMap -{ - public: - struct Entry - { - GLenum format; - GLenum type; - ColorCopyFunction func; - }; - - constexpr FastCopyFunctionMap() : FastCopyFunctionMap(nullptr, 0) {} - - constexpr FastCopyFunctionMap(const Entry *data, size_t size) : mSize(size), mData(data) {} - - bool has(const gl::FormatType &formatType) const; - ColorCopyFunction get(const gl::FormatType &formatType) const; - - private: - size_t mSize; - const Entry *mData; -}; +typedef std::map<gl::FormatType, ColorCopyFunction> FastCopyFunctionMap; struct PackPixelsParams { diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.cpp b/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.cpp index 0b1babd5a..b0e01e86c 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.cpp +++ b/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.cpp @@ -14,7 +14,7 @@ namespace rx { -BufferVk::BufferVk(const gl::BufferState &state) : BufferImpl(state) +BufferVk::BufferVk() : BufferImpl() { } @@ -22,13 +22,13 @@ BufferVk::~BufferVk() { } -gl::Error BufferVk::setData(GLenum target, const void *data, size_t size, GLenum usage) +gl::Error BufferVk::setData(const void *data, size_t size, GLenum usage) { UNIMPLEMENTED(); return gl::Error(GL_INVALID_OPERATION); } -gl::Error BufferVk::setSubData(GLenum target, const void *data, size_t size, size_t offset) +gl::Error BufferVk::setSubData(const void *data, size_t size, size_t offset) { UNIMPLEMENTED(); return gl::Error(GL_INVALID_OPERATION); diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.h b/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.h index 27792962f..19bd61ea3 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.h +++ b/gfx/angle/src/libANGLE/renderer/vulkan/BufferVk.h @@ -18,11 +18,11 @@ namespace rx class BufferVk : public BufferImpl { public: - BufferVk(const gl::BufferState &state); + BufferVk(); ~BufferVk() override; - 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, diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.cpp b/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.cpp index d0660bfdc..8bd063300 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.cpp +++ b/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.cpp @@ -211,9 +211,9 @@ RenderbufferImpl *ContextVk::createRenderbuffer() return new RenderbufferVk(); } -BufferImpl *ContextVk::createBuffer(const gl::BufferState &state) +BufferImpl *ContextVk::createBuffer() { - return new BufferVk(state); + return new BufferVk(); } VertexArrayImpl *ContextVk::createVertexArray(const gl::VertexArrayState &state) diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.h b/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.h index 64e85c984..61b4f5b30 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.h +++ b/gfx/angle/src/libANGLE/renderer/vulkan/ContextVk.h @@ -97,7 +97,7 @@ class ContextVk : 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 &state) override; diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.cpp b/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.cpp index 2c652ce3c..95e8ea653 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.cpp +++ b/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.cpp @@ -111,8 +111,7 @@ SurfaceImpl *DisplayVk::createPbufferSurface(const egl::SurfaceState &state, SurfaceImpl *DisplayVk::createPbufferFromClientBuffer(const egl::SurfaceState &state, const egl::Config *configuration, - EGLenum buftype, - EGLClientBuffer clientBuffer, + EGLClientBuffer shareHandle, const egl::AttributeMap &attribs) { UNIMPLEMENTED(); diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.h b/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.h index 26eab5139..91838980d 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.h +++ b/gfx/angle/src/libANGLE/renderer/vulkan/DisplayVk.h @@ -54,8 +54,7 @@ class DisplayVk : 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, diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/ProgramVk.cpp b/gfx/angle/src/libANGLE/renderer/vulkan/ProgramVk.cpp index a83f826e7..591cf062c 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/ProgramVk.cpp +++ b/gfx/angle/src/libANGLE/renderer/vulkan/ProgramVk.cpp @@ -25,7 +25,7 @@ ProgramVk::~ProgramVk() LinkResult ProgramVk::load(gl::InfoLog &infoLog, gl::BinaryInputStream *stream) { UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); + return LinkResult(false, gl::Error(GL_INVALID_OPERATION)); } gl::Error ProgramVk::save(gl::BinaryOutputStream *stream) @@ -42,7 +42,7 @@ void ProgramVk::setBinaryRetrievableHint(bool retrievable) LinkResult ProgramVk::link(const gl::ContextState &data, gl::InfoLog &infoLog) { UNIMPLEMENTED(); - return gl::Error(GL_INVALID_OPERATION); + return LinkResult(false, gl::Error(GL_INVALID_OPERATION)); } GLboolean ProgramVk::validate(const gl::Caps &caps, gl::InfoLog *infoLog) diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.cpp b/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.cpp index 8bece9b45..06355c3c8 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.cpp +++ b/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.cpp @@ -22,8 +22,8 @@ ShaderVk::~ShaderVk() { } -ShCompileOptions ShaderVk::prepareSourceAndReturnOptions(std::stringstream *sourceStream, - std::string *sourcePath) +int ShaderVk::prepareSourceAndReturnOptions(std::stringstream *sourceStream, + std::string *sourcePath) { UNIMPLEMENTED(); return int(); diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.h b/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.h index 10f8fe423..f847070c4 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.h +++ b/gfx/angle/src/libANGLE/renderer/vulkan/ShaderVk.h @@ -21,9 +21,9 @@ class ShaderVk : public ShaderImpl ShaderVk(const gl::ShaderState &data); ~ShaderVk() override; - // Returns additional sh::Compile options. - ShCompileOptions prepareSourceAndReturnOptions(std::stringstream *sourceStream, - std::string *sourcePath) override; + // Returns additional ShCompile options. + int prepareSourceAndReturnOptions(std::stringstream *sourceStream, + std::string *sourcePath) override; // Returns success for compiling on the driver. Returns success. bool postTranslateCompile(gl::Compiler *compiler, std::string *infoLog) override; diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.cpp b/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.cpp index a2220fcad..440f98754 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.cpp +++ b/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.cpp @@ -142,9 +142,4 @@ gl::Error TextureVk::getAttachmentRenderTarget(const gl::FramebufferAttachment:: return gl::Error(GL_INVALID_OPERATION); } -void TextureVk::syncState(const gl::Texture::DirtyBits &dirtyBits) -{ - UNIMPLEMENTED(); -} - } // namespace rx diff --git a/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.h b/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.h index d5b9106c7..de45b93b7 100755 --- a/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.h +++ b/gfx/angle/src/libANGLE/renderer/vulkan/TextureVk.h @@ -83,8 +83,6 @@ class TextureVk : public TextureImpl gl::Error getAttachmentRenderTarget(const gl::FramebufferAttachment::Target &target, FramebufferAttachmentRenderTarget **rtOut) override; - - void syncState(const gl::Texture::DirtyBits &dirtyBits) override; }; } // namespace rx |