Warning, /graphics/krita/3rdparty/ext_qt/0003-Implement-openGL-surface-color-space-selection-in-An.patch is written in an unsupported language. File is not indexed.
0001 From 02bca629cc154e9bb2208b3be3fed95915010b0d Mon Sep 17 00:00:00 2001 0002 From: Dmitry Kazakov <dimula73@gmail.com> 0003 Date: Sat, 8 Dec 2018 15:35:43 +0300 0004 Subject: [PATCH 13/47] Implement openGL surface color space selection in Angle 0005 0006 WARNING: this patch actually means that the library must be build on 0007 the system with at least DXGI 1.4 (DirectX 12 API) present 0008 in SDK. Mingw64 7.3 supports that. 0009 0010 1) D3D11 implementation of angle now supports GL_RGB10_A2 format 0011 0012 2) Technically, Angle's EGL implementation now supports the following 0013 display extensions: 0014 * EGL_KHR_gl_colorspace 0015 * EGL_EXT_gl_colorspace_scrgb_linear 0016 * EGL_EXT_gl_colorspace_bt2020_pq 0017 0018 3) D3D11 implementation of angle now supports GL_COLOR_SPACE attribute, 0019 which allows selection one of four color modes: 0020 * Linear --- just pass-through data to GPU 0021 * sRGB --- p709-g22 color space. WARNING: in 8-bit mode the system 0022 becomes clever and automatically converts linear framebuffer 0023 attachments to sRGB space, as per EGL_KHR_gl_colorspace definition. 0024 It is not possible to select sRGB without this extra "feature". 0025 * scRGB --- p709-g10 color space. This mode is the only mode 0026 supported in f16-bit mode (and it is also not supported in other 0027 bit depths). 0028 * bt2020-pq --- p2020-pq color space. Supported only in 10-bit mode. 0029 0030 5) SwapChain is now created in DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL mode: 0031 * because non-flip mode is considered deprecated and HDR is not 0032 supported in it; 0033 * because in flip-discard mode partial updates from 0034 SwapChain11::present() are not supported and return an error, 0035 which is never checked :) 0036 0037 6) As a fallback, SwapChain uses old DXGI_SWAP_EFFECT_DISCARD, because 0038 flip modes are not available on Windows 7 and such old systems. 0039 0040 Notes: 0041 0042 eglCreatePixmapSurface() is not implemented in Angle, so the support is 0043 not added. 0044 0045 eglCreatePlatformWindowSurface() and eglCreatePlatformPixmapSurface() 0046 do not have support for color spaces according to the extension wording 0047 (and they are also not supported by Angle :) ) 0048 0049 Change-Id: I68204a5db6bbd7066a83a8d1d021ce76cd1cf6f6 0050 --- 0051 src/3rdparty/angle/src/common/platform.h | 14 +- 0052 src/3rdparty/angle/src/libANGLE/Caps.cpp | 8 +- 0053 src/3rdparty/angle/src/libANGLE/Caps.h | 9 + 0054 .../src/libANGLE/renderer/d3d/RendererD3D.h | 3 +- 0055 .../src/libANGLE/renderer/d3d/SurfaceD3D.cpp | 26 +- 0056 .../src/libANGLE/renderer/d3d/SurfaceD3D.h | 1 + 0057 .../renderer/d3d/d3d11/Renderer11.cpp | 16 +- 0058 .../libANGLE/renderer/d3d/d3d11/Renderer11.h | 4 +- 0059 .../renderer/d3d/d3d11/SwapChain11.cpp | 91 ++- 0060 .../libANGLE/renderer/d3d/d3d11/SwapChain11.h | 4 +- 0061 .../d3d/d3d11/win32/NativeWindow11Win32.cpp | 19 +- 0062 .../libANGLE/renderer/d3d/d3d9/Renderer9.cpp | 4 +- 0063 .../libANGLE/renderer/d3d/d3d9/Renderer9.h | 3 +- 0064 .../angle/src/libANGLE/validationEGL.cpp | 53 ++ 0065 ...-surface-color-space-selection-in-An.patch | 596 ++++++++++++++++++ 0066 15 files changed, 831 insertions(+), 20 deletions(-) 0067 create mode 100644 src/angle/patches/0013-Implement-openGL-surface-color-space-selection-in-An.patch 0068 0069 diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h 0070 index fb251da579..2e17994557 100644 0071 --- a/src/3rdparty/angle/src/common/platform.h 0072 +++ b/src/3rdparty/angle/src/common/platform.h 0073 @@ -59,12 +59,14 @@ 0074 # endif 0075 0076 # if defined(ANGLE_ENABLE_D3D11) 0077 -#include <d3d10_1.h> 0078 -#include <d3d11.h> 0079 -#include <d3d11_3.h> 0080 -#include <d3dcompiler.h> 0081 -#include <dxgi.h> 0082 -#include <dxgi1_2.h> 0083 +# include <d3d10_1.h> 0084 +# include <d3d11.h> 0085 +# include <dxgi.h> 0086 +# include <d3d11_1.h> 0087 +# include <d3d11_3.h> 0088 +# include <dxgi1_2.h> 0089 +# include <dxgi1_4.h> // WARNING: This is actually D3D12! 0090 +# include <d3dcompiler.h> 0091 # endif 0092 0093 #if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11) 0094 diff --git a/src/3rdparty/angle/src/libANGLE/Caps.cpp b/src/3rdparty/angle/src/libANGLE/Caps.cpp 0095 index 44da2bbe27..2088457458 100644 0096 --- a/src/3rdparty/angle/src/libANGLE/Caps.cpp 0097 +++ b/src/3rdparty/angle/src/libANGLE/Caps.cpp 0098 @@ -1101,7 +1101,10 @@ DisplayExtensions::DisplayExtensions() 0099 displayTextureShareGroup(false), 0100 createContextClientArrays(false), 0101 programCacheControl(false), 0102 - robustResourceInitialization(false) 0103 + robustResourceInitialization(false), 0104 + colorspaceSRGB(false), 0105 + colorspaceSCRGBLinear(false), 0106 + colorspaceBt2020PQ(false) 0107 { 0108 } 0109 0110 @@ -1146,6 +1149,9 @@ std::vector<std::string> DisplayExtensions::getStrings() const 0111 InsertExtensionString("EGL_ANGLE_create_context_client_arrays", createContextClientArrays, &extensionStrings); 0112 InsertExtensionString("EGL_ANGLE_program_cache_control", programCacheControl, &extensionStrings); 0113 InsertExtensionString("EGL_ANGLE_robust_resource_initialization", robustResourceInitialization, &extensionStrings); 0114 + InsertExtensionString("EGL_KHR_gl_colorspace", colorspaceSRGB, &extensionStrings); 0115 + InsertExtensionString("EGL_EXT_gl_colorspace_scrgb_linear", colorspaceSCRGBLinear, &extensionStrings); 0116 + InsertExtensionString("EGL_EXT_gl_colorspace_bt2020_pq", colorspaceBt2020PQ, &extensionStrings); 0117 // TODO(jmadill): Enable this when complete. 0118 //InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings); 0119 // clang-format on 0120 diff --git a/src/3rdparty/angle/src/libANGLE/Caps.h b/src/3rdparty/angle/src/libANGLE/Caps.h 0121 index 64bdf97112..8157af5800 100644 0122 --- a/src/3rdparty/angle/src/libANGLE/Caps.h 0123 +++ b/src/3rdparty/angle/src/libANGLE/Caps.h 0124 @@ -692,6 +692,15 @@ struct DisplayExtensions 0125 0126 // EGL_ANGLE_robust_resource_initialization 0127 bool robustResourceInitialization; 0128 + 0129 + // EGL_KHR_gl_colorspace 0130 + bool colorspaceSRGB; 0131 + 0132 + // EGL_EXT_gl_colorspace_scrgb_linear 0133 + bool colorspaceSCRGBLinear; 0134 + 0135 + // EGL_EXT_gl_colorspace_bt2020_pq 0136 + bool colorspaceBt2020PQ; 0137 }; 0138 0139 struct DeviceExtensions 0140 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h 0141 index dcc98f2ec6..b8ee635625 100644 0142 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h 0143 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h 0144 @@ -130,7 +130,8 @@ class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitialize 0145 GLenum backBufferFormat, 0146 GLenum depthBufferFormat, 0147 EGLint orientation, 0148 - EGLint samples) = 0; 0149 + EGLint samples, 0150 + EGLint colorSpace) = 0; 0151 virtual egl::Error getD3DTextureInfo(const egl::Config *configuration, 0152 IUnknown *d3dTexture, 0153 EGLint *width, 0154 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp 0155 index 7657aef79e..efd4dd1a24 100644 0156 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp 0157 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp 0158 @@ -22,6 +22,27 @@ 0159 namespace rx 0160 { 0161 0162 +GLenum renderTargetFormatFromColorSpace(egl::Display *display, GLenum baseFormat, EGLint colorSpace) 0163 +{ 0164 + GLenum result = baseFormat; 0165 + 0166 + /** 0167 + * If sRGB extension is supported, we should change the surface format 0168 + * to a specific one that does support automated gamma conversion. 0169 + * 0170 + * TODO: openGL doesn't support BGRA-sRGB texture format, so creation of 0171 + * textures in this format technically is not supported! 0172 + */ 0173 + if (display->getExtensions().colorspaceSRGB && 0174 + baseFormat == GL_RGBA8_OES && 0175 + colorSpace == EGL_GL_COLORSPACE_SRGB_KHR) 0176 + { 0177 + result = GL_SRGB8_ALPHA8; 0178 + } 0179 + 0180 + return result; 0181 +} 0182 + 0183 SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state, 0184 RendererD3D *renderer, 0185 egl::Display *display, 0186 @@ -34,7 +55,8 @@ SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state, 0187 mDisplay(display), 0188 mFixedSize(window == nullptr || attribs.get(EGL_FIXED_SIZE_ANGLE, EGL_FALSE) == EGL_TRUE), 0189 mOrientation(static_cast<EGLint>(attribs.get(EGL_SURFACE_ORIENTATION_ANGLE, 0))), 0190 - mRenderTargetFormat(state.config->renderTargetFormat), 0191 + mColorSpace(static_cast<EGLint>(attribs.get(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_LINEAR_KHR))), 0192 + mRenderTargetFormat(renderTargetFormatFromColorSpace(display, state.config->renderTargetFormat, mColorSpace)), 0193 mDepthStencilFormat(state.config->depthStencilFormat), 0194 mSwapChain(nullptr), 0195 mSwapIntervalDirty(true), 0196 @@ -148,7 +170,7 @@ egl::Error SurfaceD3D::resetSwapChain(const egl::Display *display) 0197 0198 mSwapChain = 0199 mRenderer->createSwapChain(mNativeWindow, mShareHandle, mD3DTexture, mRenderTargetFormat, 0200 - mDepthStencilFormat, mOrientation, mState.config->samples); 0201 + mDepthStencilFormat, mOrientation, mState.config->samples, mColorSpace); 0202 if (!mSwapChain) 0203 { 0204 return egl::EglBadAlloc(); 0205 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h 0206 index 01d2573244..ccb793d423 100644 0207 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h 0208 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h 0209 @@ -90,6 +90,7 @@ class SurfaceD3D : public SurfaceImpl 0210 0211 bool mFixedSize; 0212 GLint mOrientation; 0213 + EGLint mColorSpace; 0214 0215 GLenum mRenderTargetFormat; 0216 GLenum mDepthStencilFormat; 0217 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 0218 index b0ef9abddc..f0e497b52f 100644 0219 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 0220 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 0221 @@ -465,6 +465,7 @@ Renderer11::Renderer11(egl::Display *display) 0222 mRenderer11DeviceCaps.supportsConstantBufferOffsets = false; 0223 mRenderer11DeviceCaps.supportsVpRtIndexWriteFromVertexShader = false; 0224 mRenderer11DeviceCaps.supportsDXGI1_2 = false; 0225 + mRenderer11DeviceCaps.supportsDXGI1_4 = false; 0226 mRenderer11DeviceCaps.B5G6R5support = 0; 0227 mRenderer11DeviceCaps.B4G4R4A4support = 0; 0228 mRenderer11DeviceCaps.B5G5R5A1support = 0; 0229 @@ -918,6 +919,7 @@ egl::Error Renderer11::initializeDevice() 0230 0231 // Gather stats on DXGI and D3D feature level 0232 ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.SupportsDXGI1_2", mRenderer11DeviceCaps.supportsDXGI1_2); 0233 + ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.SupportsDXGI1_4", mRenderer11DeviceCaps.supportsDXGI1_4); 0234 0235 ANGLEFeatureLevel angleFeatureLevel = GetANGLEFeatureLevel(mRenderer11DeviceCaps.featureLevel); 0236 0237 @@ -1002,6 +1004,10 @@ void Renderer11::populateRenderer11DeviceCaps() 0238 IDXGIAdapter2 *dxgiAdapter2 = d3d11::DynamicCastComObject<IDXGIAdapter2>(mDxgiAdapter); 0239 mRenderer11DeviceCaps.supportsDXGI1_2 = (dxgiAdapter2 != nullptr); 0240 SafeRelease(dxgiAdapter2); 0241 + 0242 + IDXGIAdapter3 *dxgiAdapter3 = d3d11::DynamicCastComObject<IDXGIAdapter3>(mDxgiAdapter); 0243 + mRenderer11DeviceCaps.supportsDXGI1_4 = (dxgiAdapter3 != nullptr); 0244 + SafeRelease(dxgiAdapter3); 0245 } 0246 0247 gl::SupportedSampleSet Renderer11::generateSampleSetForEGLConfig( 0248 @@ -1241,6 +1247,11 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions 0249 0250 // All D3D feature levels support robust resource init 0251 outExtensions->robustResourceInitialization = true; 0252 + 0253 + // color space selection supported in DXGI 1.4 only 0254 + outExtensions->colorspaceSRGB = mRenderer11DeviceCaps.supportsDXGI1_4; 0255 + outExtensions->colorspaceSCRGBLinear = mRenderer11DeviceCaps.supportsDXGI1_4; 0256 + outExtensions->colorspaceBt2020PQ = mRenderer11DeviceCaps.supportsDXGI1_4; 0257 } 0258 0259 gl::Error Renderer11::flush() 0260 @@ -1436,10 +1447,11 @@ SwapChainD3D *Renderer11::createSwapChain(NativeWindowD3D *nativeWindow, 0261 GLenum backBufferFormat, 0262 GLenum depthBufferFormat, 0263 EGLint orientation, 0264 - EGLint samples) 0265 + EGLint samples, 0266 + EGLint colorSpace) 0267 { 0268 return new SwapChain11(this, GetAs<NativeWindow11>(nativeWindow), shareHandle, d3dTexture, 0269 - backBufferFormat, depthBufferFormat, orientation, samples); 0270 + backBufferFormat, depthBufferFormat, orientation, samples, colorSpace); 0271 } 0272 0273 void *Renderer11::getD3DDevice() 0274 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h 0275 index a8c24e681b..3516bf779d 100644 0276 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h 0277 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h 0278 @@ -49,6 +49,7 @@ struct Renderer11DeviceCaps 0279 0280 D3D_FEATURE_LEVEL featureLevel; 0281 bool supportsDXGI1_2; // Support for DXGI 1.2 0282 + bool supportsDXGI1_4; // Support for DXGI 1.4 0283 bool supportsClearView; // Support for ID3D11DeviceContext1::ClearView 0284 bool supportsConstantBufferOffsets; // Support for Constant buffer offset 0285 bool supportsVpRtIndexWriteFromVertexShader; // VP/RT can be selected in the Vertex Shader 0286 @@ -138,7 +139,8 @@ class Renderer11 : public RendererD3D 0287 GLenum backBufferFormat, 0288 GLenum depthBufferFormat, 0289 EGLint orientation, 0290 - EGLint samples) override; 0291 + EGLint samples, 0292 + EGLint colorSpace) override; 0293 egl::Error getD3DTextureInfo(const egl::Config *configuration, 0294 IUnknown *d3dTexture, 0295 EGLint *width, 0296 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp 0297 index e8f13b388f..a4550667bb 100644 0298 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp 0299 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp 0300 @@ -18,6 +18,11 @@ 0301 #include "libANGLE/renderer/d3d/d3d11/texture_format_table.h" 0302 #include "third_party/trace_event/trace_event.h" 0303 0304 +#if 0 0305 +// used only for HDR metadata configuration options 0306 +#include <dxgi1_5.h> 0307 +#endif 0308 + 0309 // Precompiled shaders 0310 #include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h" 0311 #include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h" 0312 @@ -56,12 +61,14 @@ SwapChain11::SwapChain11(Renderer11 *renderer, 0313 GLenum backBufferFormat, 0314 GLenum depthBufferFormat, 0315 EGLint orientation, 0316 - EGLint samples) 0317 + EGLint samples, 0318 + EGLint colorSpace) 0319 : SwapChainD3D(shareHandle, d3dTexture, backBufferFormat, depthBufferFormat), 0320 mRenderer(renderer), 0321 mWidth(-1), 0322 mHeight(-1), 0323 mOrientation(orientation), 0324 + mColorSpace(colorSpace), 0325 mAppCreatedShareHandle(mShareHandle != nullptr), 0326 mSwapInterval(0), 0327 mPassThroughResourcesInit(false), 0328 @@ -624,10 +631,92 @@ EGLint SwapChain11::reset(const gl::Context *context, 0329 mSwapChain1 = d3d11::DynamicCastComObject<IDXGISwapChain1>(mSwapChain); 0330 } 0331 0332 + if (mRenderer->getRenderer11DeviceCaps().supportsDXGI1_4) 0333 + { 0334 + IDXGISwapChain3 *swapChain3 = d3d11::DynamicCastComObject<IDXGISwapChain3>(mSwapChain); 0335 + 0336 + // printf("*** EGL colorSpace: 0x%X\n", mColorSpace); 0337 + // printf("*** EGL format: 0x%X\n", mOffscreenRenderTargetFormat); 0338 + // printf("*** Native format: 0x%X\n", getSwapChainNativeFormat()); 0339 + 0340 + if (mColorSpace != EGL_GL_COLORSPACE_LINEAR_KHR) { 0341 + DXGI_COLOR_SPACE_TYPE nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; 0342 + switch (mColorSpace) 0343 + { 0344 + case EGL_GL_COLORSPACE_SRGB_KHR: 0345 + nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; 0346 + break; 0347 + case EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT: 0348 + nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709; 0349 + break; 0350 + case EGL_GL_COLORSPACE_BT2020_PQ_EXT: 0351 + nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; 0352 + break; 0353 + default: 0354 + ASSERT(0 && "Unsupported colorspace requested"); 0355 + } 0356 + 0357 + // printf("*** Native colorSpace: 0x%X\n", nativeColorSpace); 0358 + 0359 + UINT supported = 0; 0360 + result = swapChain3->CheckColorSpaceSupport(nativeColorSpace, &supported); 0361 + ASSERT(SUCCEEDED(result)); 0362 + if (!(supported & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) { 0363 + SafeRelease(swapChain3); 0364 + return EGL_BAD_MATCH; 0365 + } 0366 + 0367 + result = swapChain3->SetColorSpace1(nativeColorSpace); 0368 + ASSERT(SUCCEEDED(result)); 0369 + } 0370 + 0371 + SafeRelease(swapChain3); 0372 + 0373 +#if 0 0374 + 0375 + IDXGISwapChain4 *swapChain4 = d3d11::DynamicCastComObject<IDXGISwapChain4>(mSwapChain); 0376 + 0377 + DXGI_HDR_METADATA_HDR10 md; 0378 + md.RedPrimary[0] = 0.680 * 50000; 0379 + md.RedPrimary[1] = 0.320 * 50000; 0380 + md.GreenPrimary[0] = 0.265 * 50000; 0381 + md.GreenPrimary[1] = 0.690 * 50000; 0382 + md.BluePrimary[0] = 0.150 * 50000; 0383 + md.BluePrimary[1] = 0.060 * 50000; 0384 + md.WhitePoint[0] = 0.3127 * 50000; 0385 + md.WhitePoint[1] = 0.3290 * 50000; 0386 + md.MaxMasteringLuminance = 1000 * 10000; 0387 + md.MinMasteringLuminance = 0.001 * 10000; 0388 + md.MaxContentLightLevel = 1000; 0389 + md.MaxFrameAverageLightLevel = 200; 0390 + result = swapChain4->SetHDRMetaData(DXGI_HDR_METADATA_TYPE_HDR10, sizeof(md), &md); 0391 + // printf("*** Result hdr 0x%X\n", result); 0392 + SafeRelease(swapChain4); 0393 +#endif 0394 + } 0395 + 0396 ID3D11Texture2D *backbufferTex = nullptr; 0397 result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), 0398 reinterpret_cast<LPVOID *>(&backbufferTex)); 0399 ASSERT(SUCCEEDED(result)); 0400 + 0401 + // TODO: recover rendering to sRGB 0402 + // 0403 + // D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc; 0404 + // offscreenRTVDesc.Format = getSwapChainNativeFormat(); 0405 + // 0406 + // if (mColorSpace == EGL_GL_COLORSPACE_SRGB_KHR) { 0407 + // if (offscreenRTVDesc.Format == DXGI_FORMAT_R8G8B8A8_UNORM) { 0408 + // offscreenRTVDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; 0409 + // } 0410 + // 0411 + // if (offscreenRTVDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM) { 0412 + // offscreenRTVDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; 0413 + // } 0414 + // } 0415 + // 0416 + // printf("*** Render target format: 0x%X\n", offscreenRTVDesc.Format); 0417 + 0418 const auto &format = 0419 d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps()); 0420 mBackBufferTexture.set(backbufferTex, format); 0421 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h 0422 index eca068210b..2a4b9ba274 100644 0423 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h 0424 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h 0425 @@ -28,7 +28,8 @@ class SwapChain11 final : public SwapChainD3D 0426 GLenum backBufferFormat, 0427 GLenum depthBufferFormat, 0428 EGLint orientation, 0429 - EGLint samples); 0430 + EGLint samples, 0431 + EGLint colorSpace); 0432 ~SwapChain11() override; 0433 0434 EGLint resize(const gl::Context *context, 0435 @@ -93,6 +94,7 @@ class SwapChain11 final : public SwapChainD3D 0436 EGLint mWidth; 0437 EGLint mHeight; 0438 const EGLint mOrientation; 0439 + EGLint mColorSpace; 0440 bool mAppCreatedShareHandle; 0441 unsigned int mSwapInterval; 0442 bool mPassThroughResourcesInit; 0443 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp 0444 index 5394e3d3e7..af52c41d00 100644 0445 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp 0446 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp 0447 @@ -146,6 +146,9 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 0448 0449 // Use IDXGIFactory2::CreateSwapChainForHwnd if DXGI 1.2 is available to create a 0450 // DXGI_SWAP_EFFECT_SEQUENTIAL swap chain. 0451 + // 0452 + // NOTE: in non-flip mode HDR rendering is not supported, so use it 0453 + // by default 0454 IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory); 0455 if (factory2 != nullptr) 0456 { 0457 @@ -158,9 +161,9 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 0458 swapChainDesc.SampleDesc.Quality = 0; 0459 swapChainDesc.BufferUsage = 0460 DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_BACK_BUFFER; 0461 - swapChainDesc.BufferCount = 1; 0462 + swapChainDesc.BufferCount = 2; 0463 swapChainDesc.Scaling = DXGI_SCALING_STRETCH; 0464 - swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; 0465 + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; 0466 swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED; 0467 swapChainDesc.Flags = 0; 0468 IDXGISwapChain1 *swapChain1 = nullptr; 0469 @@ -176,7 +179,7 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 0470 } 0471 0472 DXGI_SWAP_CHAIN_DESC swapChainDesc = {}; 0473 - swapChainDesc.BufferCount = 1; 0474 + swapChainDesc.BufferCount = 2; 0475 swapChainDesc.BufferDesc.Format = format; 0476 swapChainDesc.BufferDesc.Width = width; 0477 swapChainDesc.BufferDesc.Height = height; 0478 @@ -191,6 +194,16 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 0479 swapChainDesc.SampleDesc.Count = samples; 0480 swapChainDesc.SampleDesc.Quality = 0; 0481 swapChainDesc.Windowed = TRUE; 0482 + 0483 + /** 0484 + * NOTE1: in discard mode the swap chain doesn't support partial 0485 + * presentatiopn with Present1() call. Though it is not a big 0486 + * problem, because in case DXGI 1.2 is supported this code is 0487 + * unreachable. 0488 + * 0489 + * NOTE2: Flip modes are not supported on Windows 7 and the like, 0490 + * so use a legacy mode as a fallback 0491 + */ 0492 swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; 0493 0494 HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain); 0495 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp 0496 index 75c6298868..58596169a8 100644 0497 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp 0498 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp 0499 @@ -718,8 +718,10 @@ SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow, 0500 GLenum backBufferFormat, 0501 GLenum depthBufferFormat, 0502 EGLint orientation, 0503 - EGLint samples) 0504 + EGLint samples, 0505 + EGLint colorSpace) 0506 { 0507 + UNUSED_VARIABLE(colorSpace); 0508 return new SwapChain9(this, GetAs<NativeWindow9>(nativeWindow), shareHandle, d3dTexture, 0509 backBufferFormat, depthBufferFormat, orientation); 0510 } 0511 diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h 0512 index 9ddee45f0f..ce4bb201e5 100644 0513 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h 0514 +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h 0515 @@ -92,7 +92,8 @@ class Renderer9 : public RendererD3D 0516 GLenum backBufferFormat, 0517 GLenum depthBufferFormat, 0518 EGLint orientation, 0519 - EGLint samples) override; 0520 + EGLint samples, 0521 + EGLint colorSpace) override; 0522 egl::Error getD3DTextureInfo(const egl::Config *configuration, 0523 IUnknown *d3dTexture, 0524 EGLint *width, 0525 diff --git a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp 0526 index 13a3a9e280..858d7ee929 100644 0527 --- a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp 0528 +++ b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp 0529 @@ -885,6 +885,32 @@ Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWin 0530 "either EGL_TRUE or EGL_FALSE."; 0531 } 0532 break; 0533 + case EGL_GL_COLORSPACE: 0534 + 0535 + if (!displayExtensions.colorspaceSRGB) 0536 + { 0537 + return EglBadAttribute() << "EGL_KHR_gl_colorspace is not supported on this platform."; 0538 + } 0539 + 0540 + if (value == EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT) 0541 + { 0542 + if (!displayExtensions.colorspaceSCRGBLinear) 0543 + { 0544 + return EglBadAttribute() << "EGL_EXT_gl_colorspace_scrgb_linear is not supported on this platform."; 0545 + } 0546 + } 0547 + else if (value == EGL_GL_COLORSPACE_BT2020_PQ_EXT) 0548 + { 0549 + if (!displayExtensions.colorspaceBt2020PQ) 0550 + { 0551 + return EglBadAttribute() << "EGL_EXT_gl_colorspace_bt2020_pq is not supported on this platform."; 0552 + } 0553 + } 0554 + else if (value != EGL_GL_COLORSPACE_SRGB_KHR && value != EGL_GL_COLORSPACE_LINEAR_KHR) 0555 + { 0556 + return EglBadAttribute() << "Unknown EGL color space requested"; 0557 + } 0558 + break; 0559 0560 default: 0561 return EglBadAttribute(); 0562 @@ -977,6 +1003,33 @@ Error ValidateCreatePbufferSurface(Display *display, Config *config, const Attri 0563 } 0564 break; 0565 0566 + case EGL_GL_COLORSPACE: 0567 + 0568 + if (!displayExtensions.colorspaceSRGB) 0569 + { 0570 + return EglBadAttribute() << "EGL_KHR_gl_colorspace is not supported on this platform."; 0571 + } 0572 + 0573 + if (value == EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT) 0574 + { 0575 + if (!displayExtensions.colorspaceSCRGBLinear) 0576 + { 0577 + return EglBadAttribute() << "EGL_EXT_gl_colorspace_scrgb_linear is not supported on this platform."; 0578 + } 0579 + } 0580 + else if (value == EGL_GL_COLORSPACE_BT2020_PQ_EXT) 0581 + { 0582 + if (!displayExtensions.colorspaceBt2020PQ) 0583 + { 0584 + return EglBadAttribute() << "EGL_EXT_gl_colorspace_bt2020_pq is not supported on this platform."; 0585 + } 0586 + } 0587 + else if (value != EGL_GL_COLORSPACE_SRGB_KHR && value != EGL_GL_COLORSPACE_LINEAR_KHR) 0588 + { 0589 + return EglBadAttribute() << "Unknown EGL color space requested"; 0590 + } 0591 + break; 0592 + 0593 default: 0594 return EglBadAttribute(); 0595 } 0596 diff --git a/src/angle/patches/0013-Implement-openGL-surface-color-space-selection-in-An.patch b/src/angle/patches/0013-Implement-openGL-surface-color-space-selection-in-An.patch 0597 new file mode 100644 0598 index 0000000000..81b72914fa 0599 --- /dev/null 0600 +++ b/src/angle/patches/0013-Implement-openGL-surface-color-space-selection-in-An.patch 0601 @@ -0,0 +1,596 @@ 0602 +From 05082a2affad3428e2ba4475a5c083e81a7730ab Mon Sep 17 00:00:00 2001 0603 +From: Dmitry Kazakov <dimula73@gmail.com> 0604 +Date: Sat, 8 Dec 2018 15:35:43 +0300 0605 +Subject: [PATCH] Implement openGL surface color space selection in Angle 0606 + 0607 +WARNING: this patch actually means that the library must be build on 0608 + the system with at least DXGI 1.4 (DirectX 12 API) present 0609 + in SDK. Mingw64 7.3 supports that. 0610 + 0611 +1) D3D11 implementation of angle now supports GL_RGB10_A2 format 0612 + 0613 +2) Technically, Angle's EGL implementation now supports the following 0614 + display extensions: 0615 + * EGL_KHR_gl_colorspace 0616 + * EGL_EXT_gl_colorspace_scrgb_linear 0617 + * EGL_EXT_gl_colorspace_bt2020_pq 0618 + 0619 +3) D3D11 implementation of angle now supports GL_COLOR_SPACE attribute, 0620 + which allows selection one of four color modes: 0621 + * Linear --- just pass-through data to GPU 0622 + * sRGB --- p709-g22 color space. WARNING: in 8-bit mode the system 0623 + becomes clever and automatically converts linear framebuffer 0624 + attachments to sRGB space, as per EGL_KHR_gl_colorspace definition. 0625 + It is not possible to select sRGB without this extra "feature". 0626 + * scRGB --- p709-g10 color space. This mode is the only mode 0627 + supported in f16-bit mode (and it is also not supported in other 0628 + bit depths). 0629 + * bt2020-pq --- p2020-pq color space. Supported only in 10-bit mode. 0630 + 0631 +5) SwapChain is now created in DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL mode: 0632 + * because non-flip mode is considered deprecated and HDR is not 0633 + supported in it; 0634 + * because in flip-discard mode partial updates from 0635 + SwapChain11::present() are not supported and return an error, 0636 + which is never checked :) 0637 + 0638 +6) As a fallback, SwapChain uses old DXGI_SWAP_EFFECT_DISCARD, because 0639 + flip modes are not available on Windows 7 and such old systems. 0640 + 0641 +Notes: 0642 + 0643 +eglCreatePixmapSurface() is not implemented in Angle, so the support is 0644 +not added. 0645 + 0646 +eglCreatePlatformWindowSurface() and eglCreatePlatformPixmapSurface() 0647 +do not have support for color spaces according to the extension wording 0648 +(and they are also not supported by Angle :) ) 0649 + 0650 +Change-Id: I68204a5db6bbd7066a83a8d1d021ce76cd1cf6f6 0651 +--- 0652 + src/3rdparty/angle/src/common/platform.h | 14 +-- 0653 + src/3rdparty/angle/src/libANGLE/Caps.cpp | 8 +- 0654 + src/3rdparty/angle/src/libANGLE/Caps.h | 9 ++ 0655 + .../src/libANGLE/renderer/d3d/RendererD3D.h | 3 +- 0656 + .../src/libANGLE/renderer/d3d/SurfaceD3D.cpp | 26 +++++- 0657 + .../src/libANGLE/renderer/d3d/SurfaceD3D.h | 1 + 0658 + .../renderer/d3d/d3d11/Renderer11.cpp | 16 +++- 0659 + .../libANGLE/renderer/d3d/d3d11/Renderer11.h | 4 +- 0660 + .../renderer/d3d/d3d11/SwapChain11.cpp | 91 ++++++++++++++++++- 0661 + .../libANGLE/renderer/d3d/d3d11/SwapChain11.h | 4 +- 0662 + .../d3d/d3d11/win32/NativeWindow11Win32.cpp | 19 +++- 0663 + .../libANGLE/renderer/d3d/d3d9/Renderer9.cpp | 4 +- 0664 + .../libANGLE/renderer/d3d/d3d9/Renderer9.h | 3 +- 0665 + .../angle/src/libANGLE/validationEGL.cpp | 53 +++++++++++ 0666 + 14 files changed, 235 insertions(+), 20 deletions(-) 0667 + 0668 +diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h 0669 +index fb251da579..2e17994557 100644 0670 +--- a/src/3rdparty/angle/src/common/platform.h 0671 ++++ b/src/3rdparty/angle/src/common/platform.h 0672 +@@ -59,12 +59,14 @@ 0673 + # endif 0674 + 0675 + # if defined(ANGLE_ENABLE_D3D11) 0676 +-#include <d3d10_1.h> 0677 +-#include <d3d11.h> 0678 +-#include <d3d11_3.h> 0679 +-#include <d3dcompiler.h> 0680 +-#include <dxgi.h> 0681 +-#include <dxgi1_2.h> 0682 ++# include <d3d10_1.h> 0683 ++# include <d3d11.h> 0684 ++# include <dxgi.h> 0685 ++# include <d3d11_1.h> 0686 ++# include <d3d11_3.h> 0687 ++# include <dxgi1_2.h> 0688 ++# include <dxgi1_4.h> // WARNING: This is actually D3D12! 0689 ++# include <d3dcompiler.h> 0690 + # endif 0691 + 0692 + #if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11) 0693 +diff --git a/src/3rdparty/angle/src/libANGLE/Caps.cpp b/src/3rdparty/angle/src/libANGLE/Caps.cpp 0694 +index 44da2bbe27..2088457458 100644 0695 +--- a/src/3rdparty/angle/src/libANGLE/Caps.cpp 0696 ++++ b/src/3rdparty/angle/src/libANGLE/Caps.cpp 0697 +@@ -1101,7 +1101,10 @@ DisplayExtensions::DisplayExtensions() 0698 + displayTextureShareGroup(false), 0699 + createContextClientArrays(false), 0700 + programCacheControl(false), 0701 +- robustResourceInitialization(false) 0702 ++ robustResourceInitialization(false), 0703 ++ colorspaceSRGB(false), 0704 ++ colorspaceSCRGBLinear(false), 0705 ++ colorspaceBt2020PQ(false) 0706 + { 0707 + } 0708 + 0709 +@@ -1146,6 +1149,9 @@ std::vector<std::string> DisplayExtensions::getStrings() const 0710 + InsertExtensionString("EGL_ANGLE_create_context_client_arrays", createContextClientArrays, &extensionStrings); 0711 + InsertExtensionString("EGL_ANGLE_program_cache_control", programCacheControl, &extensionStrings); 0712 + InsertExtensionString("EGL_ANGLE_robust_resource_initialization", robustResourceInitialization, &extensionStrings); 0713 ++ InsertExtensionString("EGL_KHR_gl_colorspace", colorspaceSRGB, &extensionStrings); 0714 ++ InsertExtensionString("EGL_EXT_gl_colorspace_scrgb_linear", colorspaceSCRGBLinear, &extensionStrings); 0715 ++ InsertExtensionString("EGL_EXT_gl_colorspace_bt2020_pq", colorspaceBt2020PQ, &extensionStrings); 0716 + // TODO(jmadill): Enable this when complete. 0717 + //InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings); 0718 + // clang-format on 0719 +diff --git a/src/3rdparty/angle/src/libANGLE/Caps.h b/src/3rdparty/angle/src/libANGLE/Caps.h 0720 +index 64bdf97112..8157af5800 100644 0721 +--- a/src/3rdparty/angle/src/libANGLE/Caps.h 0722 ++++ b/src/3rdparty/angle/src/libANGLE/Caps.h 0723 +@@ -692,6 +692,15 @@ struct DisplayExtensions 0724 + 0725 + // EGL_ANGLE_robust_resource_initialization 0726 + bool robustResourceInitialization; 0727 ++ 0728 ++ // EGL_KHR_gl_colorspace 0729 ++ bool colorspaceSRGB; 0730 ++ 0731 ++ // EGL_EXT_gl_colorspace_scrgb_linear 0732 ++ bool colorspaceSCRGBLinear; 0733 ++ 0734 ++ // EGL_EXT_gl_colorspace_bt2020_pq 0735 ++ bool colorspaceBt2020PQ; 0736 + }; 0737 + 0738 + struct DeviceExtensions 0739 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h 0740 +index dcc98f2ec6..b8ee635625 100644 0741 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h 0742 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/RendererD3D.h 0743 +@@ -130,7 +130,8 @@ class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitialize 0744 + GLenum backBufferFormat, 0745 + GLenum depthBufferFormat, 0746 + EGLint orientation, 0747 +- EGLint samples) = 0; 0748 ++ EGLint samples, 0749 ++ EGLint colorSpace) = 0; 0750 + virtual egl::Error getD3DTextureInfo(const egl::Config *configuration, 0751 + IUnknown *d3dTexture, 0752 + EGLint *width, 0753 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp 0754 +index 7657aef79e..efd4dd1a24 100644 0755 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp 0756 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.cpp 0757 +@@ -22,6 +22,27 @@ 0758 + namespace rx 0759 + { 0760 + 0761 ++GLenum renderTargetFormatFromColorSpace(egl::Display *display, GLenum baseFormat, EGLint colorSpace) 0762 ++{ 0763 ++ GLenum result = baseFormat; 0764 ++ 0765 ++ /** 0766 ++ * If sRGB extension is supported, we should change the surface format 0767 ++ * to a specific one that does support automated gamma conversion. 0768 ++ * 0769 ++ * TODO: openGL doesn't support BGRA-sRGB texture format, so creation of 0770 ++ * textures in this format technically is not supported! 0771 ++ */ 0772 ++ if (display->getExtensions().colorspaceSRGB && 0773 ++ baseFormat == GL_RGBA8_OES && 0774 ++ colorSpace == EGL_GL_COLORSPACE_SRGB_KHR) 0775 ++ { 0776 ++ result = GL_SRGB8_ALPHA8; 0777 ++ } 0778 ++ 0779 ++ return result; 0780 ++} 0781 ++ 0782 + SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state, 0783 + RendererD3D *renderer, 0784 + egl::Display *display, 0785 +@@ -34,7 +55,8 @@ SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state, 0786 + mDisplay(display), 0787 + mFixedSize(window == nullptr || attribs.get(EGL_FIXED_SIZE_ANGLE, EGL_FALSE) == EGL_TRUE), 0788 + mOrientation(static_cast<EGLint>(attribs.get(EGL_SURFACE_ORIENTATION_ANGLE, 0))), 0789 +- mRenderTargetFormat(state.config->renderTargetFormat), 0790 ++ mColorSpace(static_cast<EGLint>(attribs.get(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_LINEAR_KHR))), 0791 ++ mRenderTargetFormat(renderTargetFormatFromColorSpace(display, state.config->renderTargetFormat, mColorSpace)), 0792 + mDepthStencilFormat(state.config->depthStencilFormat), 0793 + mSwapChain(nullptr), 0794 + mSwapIntervalDirty(true), 0795 +@@ -148,7 +170,7 @@ egl::Error SurfaceD3D::resetSwapChain(const egl::Display *display) 0796 + 0797 + mSwapChain = 0798 + mRenderer->createSwapChain(mNativeWindow, mShareHandle, mD3DTexture, mRenderTargetFormat, 0799 +- mDepthStencilFormat, mOrientation, mState.config->samples); 0800 ++ mDepthStencilFormat, mOrientation, mState.config->samples, mColorSpace); 0801 + if (!mSwapChain) 0802 + { 0803 + return egl::EglBadAlloc(); 0804 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h 0805 +index 01d2573244..ccb793d423 100644 0806 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h 0807 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/SurfaceD3D.h 0808 +@@ -90,6 +90,7 @@ class SurfaceD3D : public SurfaceImpl 0809 + 0810 + bool mFixedSize; 0811 + GLint mOrientation; 0812 ++ EGLint mColorSpace; 0813 + 0814 + GLenum mRenderTargetFormat; 0815 + GLenum mDepthStencilFormat; 0816 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 0817 +index b0ef9abddc..f0e497b52f 100644 0818 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 0819 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 0820 +@@ -465,6 +465,7 @@ Renderer11::Renderer11(egl::Display *display) 0821 + mRenderer11DeviceCaps.supportsConstantBufferOffsets = false; 0822 + mRenderer11DeviceCaps.supportsVpRtIndexWriteFromVertexShader = false; 0823 + mRenderer11DeviceCaps.supportsDXGI1_2 = false; 0824 ++ mRenderer11DeviceCaps.supportsDXGI1_4 = false; 0825 + mRenderer11DeviceCaps.B5G6R5support = 0; 0826 + mRenderer11DeviceCaps.B4G4R4A4support = 0; 0827 + mRenderer11DeviceCaps.B5G5R5A1support = 0; 0828 +@@ -918,6 +919,7 @@ egl::Error Renderer11::initializeDevice() 0829 + 0830 + // Gather stats on DXGI and D3D feature level 0831 + ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.SupportsDXGI1_2", mRenderer11DeviceCaps.supportsDXGI1_2); 0832 ++ ANGLE_HISTOGRAM_BOOLEAN("GPU.ANGLE.SupportsDXGI1_4", mRenderer11DeviceCaps.supportsDXGI1_4); 0833 + 0834 + ANGLEFeatureLevel angleFeatureLevel = GetANGLEFeatureLevel(mRenderer11DeviceCaps.featureLevel); 0835 + 0836 +@@ -1002,6 +1004,10 @@ void Renderer11::populateRenderer11DeviceCaps() 0837 + IDXGIAdapter2 *dxgiAdapter2 = d3d11::DynamicCastComObject<IDXGIAdapter2>(mDxgiAdapter); 0838 + mRenderer11DeviceCaps.supportsDXGI1_2 = (dxgiAdapter2 != nullptr); 0839 + SafeRelease(dxgiAdapter2); 0840 ++ 0841 ++ IDXGIAdapter3 *dxgiAdapter3 = d3d11::DynamicCastComObject<IDXGIAdapter3>(mDxgiAdapter); 0842 ++ mRenderer11DeviceCaps.supportsDXGI1_4 = (dxgiAdapter3 != nullptr); 0843 ++ SafeRelease(dxgiAdapter3); 0844 + } 0845 + 0846 + gl::SupportedSampleSet Renderer11::generateSampleSetForEGLConfig( 0847 +@@ -1241,6 +1247,11 @@ void Renderer11::generateDisplayExtensions(egl::DisplayExtensions *outExtensions 0848 + 0849 + // All D3D feature levels support robust resource init 0850 + outExtensions->robustResourceInitialization = true; 0851 ++ 0852 ++ // color space selection supported in DXGI 1.4 only 0853 ++ outExtensions->colorspaceSRGB = mRenderer11DeviceCaps.supportsDXGI1_4; 0854 ++ outExtensions->colorspaceSCRGBLinear = mRenderer11DeviceCaps.supportsDXGI1_4; 0855 ++ outExtensions->colorspaceBt2020PQ = mRenderer11DeviceCaps.supportsDXGI1_4; 0856 + } 0857 + 0858 + gl::Error Renderer11::flush() 0859 +@@ -1436,10 +1447,11 @@ SwapChainD3D *Renderer11::createSwapChain(NativeWindowD3D *nativeWindow, 0860 + GLenum backBufferFormat, 0861 + GLenum depthBufferFormat, 0862 + EGLint orientation, 0863 +- EGLint samples) 0864 ++ EGLint samples, 0865 ++ EGLint colorSpace) 0866 + { 0867 + return new SwapChain11(this, GetAs<NativeWindow11>(nativeWindow), shareHandle, d3dTexture, 0868 +- backBufferFormat, depthBufferFormat, orientation, samples); 0869 ++ backBufferFormat, depthBufferFormat, orientation, samples, colorSpace); 0870 + } 0871 + 0872 + void *Renderer11::getD3DDevice() 0873 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h 0874 +index a8c24e681b..3516bf779d 100644 0875 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h 0876 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h 0877 +@@ -49,6 +49,7 @@ struct Renderer11DeviceCaps 0878 + 0879 + D3D_FEATURE_LEVEL featureLevel; 0880 + bool supportsDXGI1_2; // Support for DXGI 1.2 0881 ++ bool supportsDXGI1_4; // Support for DXGI 1.4 0882 + bool supportsClearView; // Support for ID3D11DeviceContext1::ClearView 0883 + bool supportsConstantBufferOffsets; // Support for Constant buffer offset 0884 + bool supportsVpRtIndexWriteFromVertexShader; // VP/RT can be selected in the Vertex Shader 0885 +@@ -138,7 +139,8 @@ class Renderer11 : public RendererD3D 0886 + GLenum backBufferFormat, 0887 + GLenum depthBufferFormat, 0888 + EGLint orientation, 0889 +- EGLint samples) override; 0890 ++ EGLint samples, 0891 ++ EGLint colorSpace) override; 0892 + egl::Error getD3DTextureInfo(const egl::Config *configuration, 0893 + IUnknown *d3dTexture, 0894 + EGLint *width, 0895 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp 0896 +index dcfd06484d..fc967b90d0 100644 0897 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp 0898 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.cpp 0899 +@@ -18,6 +18,11 @@ 0900 + #include "libANGLE/renderer/d3d/d3d11/texture_format_table.h" 0901 + #include "third_party/trace_event/trace_event.h" 0902 + 0903 ++#if 0 0904 ++// used only for HDR metadata configuration options 0905 ++#include <dxgi1_5.h> 0906 ++#endif 0907 ++ 0908 + // Precompiled shaders 0909 + #include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthrough2d11vs.h" 0910 + #include "libANGLE/renderer/d3d/d3d11/shaders/compiled/passthroughrgba2d11ps.h" 0911 +@@ -56,12 +61,14 @@ SwapChain11::SwapChain11(Renderer11 *renderer, 0912 + GLenum backBufferFormat, 0913 + GLenum depthBufferFormat, 0914 + EGLint orientation, 0915 +- EGLint samples) 0916 ++ EGLint samples, 0917 ++ EGLint colorSpace) 0918 + : SwapChainD3D(shareHandle, d3dTexture, backBufferFormat, depthBufferFormat), 0919 + mRenderer(renderer), 0920 + mWidth(-1), 0921 + mHeight(-1), 0922 + mOrientation(orientation), 0923 ++ mColorSpace(colorSpace), 0924 + mAppCreatedShareHandle(mShareHandle != nullptr), 0925 + mSwapInterval(0), 0926 + mPassThroughResourcesInit(false), 0927 +@@ -620,10 +627,92 @@ EGLint SwapChain11::reset(const gl::Context *context, 0928 + mSwapChain1 = d3d11::DynamicCastComObject<IDXGISwapChain1>(mSwapChain); 0929 + } 0930 + 0931 ++ if (mRenderer->getRenderer11DeviceCaps().supportsDXGI1_4) 0932 ++ { 0933 ++ IDXGISwapChain3 *swapChain3 = d3d11::DynamicCastComObject<IDXGISwapChain3>(mSwapChain); 0934 ++ 0935 ++ // printf("*** EGL colorSpace: 0x%X\n", mColorSpace); 0936 ++ // printf("*** EGL format: 0x%X\n", mOffscreenRenderTargetFormat); 0937 ++ // printf("*** Native format: 0x%X\n", getSwapChainNativeFormat()); 0938 ++ 0939 ++ if (mColorSpace != EGL_GL_COLORSPACE_LINEAR_KHR) { 0940 ++ DXGI_COLOR_SPACE_TYPE nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; 0941 ++ switch (mColorSpace) 0942 ++ { 0943 ++ case EGL_GL_COLORSPACE_SRGB_KHR: 0944 ++ nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; 0945 ++ break; 0946 ++ case EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT: 0947 ++ nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G10_NONE_P709; 0948 ++ break; 0949 ++ case EGL_GL_COLORSPACE_BT2020_PQ_EXT: 0950 ++ nativeColorSpace = DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; 0951 ++ break; 0952 ++ default: 0953 ++ ASSERT(0 && "Unsupported colorspace requested"); 0954 ++ } 0955 ++ 0956 ++ // printf("*** Native colorSpace: 0x%X\n", nativeColorSpace); 0957 ++ 0958 ++ UINT supported = 0; 0959 ++ result = swapChain3->CheckColorSpaceSupport(nativeColorSpace, &supported); 0960 ++ ASSERT(SUCCEEDED(result)); 0961 ++ if (!(supported & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) { 0962 ++ SafeRelease(swapChain3); 0963 ++ return EGL_BAD_MATCH; 0964 ++ } 0965 ++ 0966 ++ result = swapChain3->SetColorSpace1(nativeColorSpace); 0967 ++ ASSERT(SUCCEEDED(result)); 0968 ++ } 0969 ++ 0970 ++ SafeRelease(swapChain3); 0971 ++ 0972 ++#if 0 0973 ++ 0974 ++ IDXGISwapChain4 *swapChain4 = d3d11::DynamicCastComObject<IDXGISwapChain4>(mSwapChain); 0975 ++ 0976 ++ DXGI_HDR_METADATA_HDR10 md; 0977 ++ md.RedPrimary[0] = 0.680 * 50000; 0978 ++ md.RedPrimary[1] = 0.320 * 50000; 0979 ++ md.GreenPrimary[0] = 0.265 * 50000; 0980 ++ md.GreenPrimary[1] = 0.690 * 50000; 0981 ++ md.BluePrimary[0] = 0.150 * 50000; 0982 ++ md.BluePrimary[1] = 0.060 * 50000; 0983 ++ md.WhitePoint[0] = 0.3127 * 50000; 0984 ++ md.WhitePoint[1] = 0.3290 * 50000; 0985 ++ md.MaxMasteringLuminance = 1000 * 10000; 0986 ++ md.MinMasteringLuminance = 0.001 * 10000; 0987 ++ md.MaxContentLightLevel = 1000; 0988 ++ md.MaxFrameAverageLightLevel = 200; 0989 ++ result = swapChain4->SetHDRMetaData(DXGI_HDR_METADATA_TYPE_HDR10, sizeof(md), &md); 0990 ++ // printf("*** Result hdr 0x%X\n", result); 0991 ++ SafeRelease(swapChain4); 0992 ++#endif 0993 ++ } 0994 ++ 0995 + ID3D11Texture2D *backbufferTex = nullptr; 0996 + result = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), 0997 + reinterpret_cast<LPVOID *>(&backbufferTex)); 0998 + ASSERT(SUCCEEDED(result)); 0999 ++ 1000 ++ // TODO: recover rendering to sRGB 1001 ++ // 1002 ++ // D3D11_RENDER_TARGET_VIEW_DESC offscreenRTVDesc; 1003 ++ // offscreenRTVDesc.Format = getSwapChainNativeFormat(); 1004 ++ // 1005 ++ // if (mColorSpace == EGL_GL_COLORSPACE_SRGB_KHR) { 1006 ++ // if (offscreenRTVDesc.Format == DXGI_FORMAT_R8G8B8A8_UNORM) { 1007 ++ // offscreenRTVDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; 1008 ++ // } 1009 ++ // 1010 ++ // if (offscreenRTVDesc.Format == DXGI_FORMAT_B8G8R8A8_UNORM) { 1011 ++ // offscreenRTVDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; 1012 ++ // } 1013 ++ // } 1014 ++ // 1015 ++ // printf("*** Render target format: 0x%X\n", offscreenRTVDesc.Format); 1016 ++ 1017 + const auto &format = 1018 + d3d11::Format::Get(mOffscreenRenderTargetFormat, mRenderer->getRenderer11DeviceCaps()); 1019 + mBackBufferTexture.set(backbufferTex, format); 1020 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h 1021 +index eca068210b..2a4b9ba274 100644 1022 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h 1023 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/SwapChain11.h 1024 +@@ -28,7 +28,8 @@ class SwapChain11 final : public SwapChainD3D 1025 + GLenum backBufferFormat, 1026 + GLenum depthBufferFormat, 1027 + EGLint orientation, 1028 +- EGLint samples); 1029 ++ EGLint samples, 1030 ++ EGLint colorSpace); 1031 + ~SwapChain11() override; 1032 + 1033 + EGLint resize(const gl::Context *context, 1034 +@@ -93,6 +94,7 @@ class SwapChain11 final : public SwapChainD3D 1035 + EGLint mWidth; 1036 + EGLint mHeight; 1037 + const EGLint mOrientation; 1038 ++ EGLint mColorSpace; 1039 + bool mAppCreatedShareHandle; 1040 + unsigned int mSwapInterval; 1041 + bool mPassThroughResourcesInit; 1042 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp 1043 +index 5394e3d3e7..af52c41d00 100644 1044 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp 1045 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/win32/NativeWindow11Win32.cpp 1046 +@@ -146,6 +146,9 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 1047 + 1048 + // Use IDXGIFactory2::CreateSwapChainForHwnd if DXGI 1.2 is available to create a 1049 + // DXGI_SWAP_EFFECT_SEQUENTIAL swap chain. 1050 ++ // 1051 ++ // NOTE: in non-flip mode HDR rendering is not supported, so use it 1052 ++ // by default 1053 + IDXGIFactory2 *factory2 = d3d11::DynamicCastComObject<IDXGIFactory2>(factory); 1054 + if (factory2 != nullptr) 1055 + { 1056 +@@ -158,9 +161,9 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 1057 + swapChainDesc.SampleDesc.Quality = 0; 1058 + swapChainDesc.BufferUsage = 1059 + DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_SHADER_INPUT | DXGI_USAGE_BACK_BUFFER; 1060 +- swapChainDesc.BufferCount = 1; 1061 ++ swapChainDesc.BufferCount = 2; 1062 + swapChainDesc.Scaling = DXGI_SCALING_STRETCH; 1063 +- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_SEQUENTIAL; 1064 ++ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL; 1065 + swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_UNSPECIFIED; 1066 + swapChainDesc.Flags = 0; 1067 + IDXGISwapChain1 *swapChain1 = nullptr; 1068 +@@ -176,7 +179,7 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 1069 + } 1070 + 1071 + DXGI_SWAP_CHAIN_DESC swapChainDesc = {}; 1072 +- swapChainDesc.BufferCount = 1; 1073 ++ swapChainDesc.BufferCount = 2; 1074 + swapChainDesc.BufferDesc.Format = format; 1075 + swapChainDesc.BufferDesc.Width = width; 1076 + swapChainDesc.BufferDesc.Height = height; 1077 +@@ -191,6 +194,16 @@ HRESULT NativeWindow11Win32::createSwapChain(ID3D11Device *device, 1078 + swapChainDesc.SampleDesc.Count = samples; 1079 + swapChainDesc.SampleDesc.Quality = 0; 1080 + swapChainDesc.Windowed = TRUE; 1081 ++ 1082 ++ /** 1083 ++ * NOTE1: in discard mode the swap chain doesn't support partial 1084 ++ * presentatiopn with Present1() call. Though it is not a big 1085 ++ * problem, because in case DXGI 1.2 is supported this code is 1086 ++ * unreachable. 1087 ++ * 1088 ++ * NOTE2: Flip modes are not supported on Windows 7 and the like, 1089 ++ * so use a legacy mode as a fallback 1090 ++ */ 1091 + swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; 1092 + 1093 + HRESULT result = factory->CreateSwapChain(device, &swapChainDesc, swapChain); 1094 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp 1095 +index 75c6298868..58596169a8 100644 1096 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp 1097 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp 1098 +@@ -718,8 +718,10 @@ SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow, 1099 + GLenum backBufferFormat, 1100 + GLenum depthBufferFormat, 1101 + EGLint orientation, 1102 +- EGLint samples) 1103 ++ EGLint samples, 1104 ++ EGLint colorSpace) 1105 + { 1106 ++ UNUSED_VARIABLE(colorSpace); 1107 + return new SwapChain9(this, GetAs<NativeWindow9>(nativeWindow), shareHandle, d3dTexture, 1108 + backBufferFormat, depthBufferFormat, orientation); 1109 + } 1110 +diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h 1111 +index 9ddee45f0f..ce4bb201e5 100644 1112 +--- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h 1113 ++++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d9/Renderer9.h 1114 +@@ -92,7 +92,8 @@ class Renderer9 : public RendererD3D 1115 + GLenum backBufferFormat, 1116 + GLenum depthBufferFormat, 1117 + EGLint orientation, 1118 +- EGLint samples) override; 1119 ++ EGLint samples, 1120 ++ EGLint colorSpace) override; 1121 + egl::Error getD3DTextureInfo(const egl::Config *configuration, 1122 + IUnknown *d3dTexture, 1123 + EGLint *width, 1124 +diff --git a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp 1125 +index 13a3a9e280..858d7ee929 100644 1126 +--- a/src/3rdparty/angle/src/libANGLE/validationEGL.cpp 1127 ++++ b/src/3rdparty/angle/src/libANGLE/validationEGL.cpp 1128 +@@ -885,6 +885,32 @@ Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWin 1129 + "either EGL_TRUE or EGL_FALSE."; 1130 + } 1131 + break; 1132 ++ case EGL_GL_COLORSPACE: 1133 ++ 1134 ++ if (!displayExtensions.colorspaceSRGB) 1135 ++ { 1136 ++ return EglBadAttribute() << "EGL_KHR_gl_colorspace is not supported on this platform."; 1137 ++ } 1138 ++ 1139 ++ if (value == EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT) 1140 ++ { 1141 ++ if (!displayExtensions.colorspaceSCRGBLinear) 1142 ++ { 1143 ++ return EglBadAttribute() << "EGL_EXT_gl_colorspace_scrgb_linear is not supported on this platform."; 1144 ++ } 1145 ++ } 1146 ++ else if (value == EGL_GL_COLORSPACE_BT2020_PQ_EXT) 1147 ++ { 1148 ++ if (!displayExtensions.colorspaceBt2020PQ) 1149 ++ { 1150 ++ return EglBadAttribute() << "EGL_EXT_gl_colorspace_bt2020_pq is not supported on this platform."; 1151 ++ } 1152 ++ } 1153 ++ else if (value != EGL_GL_COLORSPACE_SRGB_KHR && value != EGL_GL_COLORSPACE_LINEAR_KHR) 1154 ++ { 1155 ++ return EglBadAttribute() << "Unknown EGL color space requested"; 1156 ++ } 1157 ++ break; 1158 + 1159 + default: 1160 + return EglBadAttribute(); 1161 +@@ -977,6 +1003,33 @@ Error ValidateCreatePbufferSurface(Display *display, Config *config, const Attri 1162 + } 1163 + break; 1164 + 1165 ++ case EGL_GL_COLORSPACE: 1166 ++ 1167 ++ if (!displayExtensions.colorspaceSRGB) 1168 ++ { 1169 ++ return EglBadAttribute() << "EGL_KHR_gl_colorspace is not supported on this platform."; 1170 ++ } 1171 ++ 1172 ++ if (value == EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT) 1173 ++ { 1174 ++ if (!displayExtensions.colorspaceSCRGBLinear) 1175 ++ { 1176 ++ return EglBadAttribute() << "EGL_EXT_gl_colorspace_scrgb_linear is not supported on this platform."; 1177 ++ } 1178 ++ } 1179 ++ else if (value == EGL_GL_COLORSPACE_BT2020_PQ_EXT) 1180 ++ { 1181 ++ if (!displayExtensions.colorspaceBt2020PQ) 1182 ++ { 1183 ++ return EglBadAttribute() << "EGL_EXT_gl_colorspace_bt2020_pq is not supported on this platform."; 1184 ++ } 1185 ++ } 1186 ++ else if (value != EGL_GL_COLORSPACE_SRGB_KHR && value != EGL_GL_COLORSPACE_LINEAR_KHR) 1187 ++ { 1188 ++ return EglBadAttribute() << "Unknown EGL color space requested"; 1189 ++ } 1190 ++ break; 1191 ++ 1192 + default: 1193 + return EglBadAttribute(); 1194 + } 1195 +-- 1196 +2.20.1.windows.1 1197 + 1198 -- 1199 2.20.1.windows.1 1200