Commit d66e1939 by Olli Etuaho Committed by Commit Bot

Allow creating EGL pbuffers from typeless D3D textures

A new extension EGL_ANGLE_d3d_typeless_texture_client_buffer is added that allows creating EGL pbuffers from typeless D3D textures. The extension increases the flexibility of the API compared to plain EGL_ANGLE_D3D_texture_client_buffer. The colorspace for the created EGL pbuffer can be set by using the EGL_GL_COLORSPACE attribute. Internally this sets the ANGLE format of the buffer. There are new ANGLE formats that are used specifically for typeless textures, separate ones for SRGB and linear views into the D3D textures. The extension is only supported on the D3D11 backend of ANGLE. BUG=angleproject:2300 TEST=angle_white_box_tests Change-Id: I6a6cb873d2cc0dca0b7f18a0f2cd35e7bafcb7d8 Reviewed-on: https://chromium-review.googlesource.com/873917Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent dd21ecf8
......@@ -21,7 +21,7 @@ Status
Version
Version 1, Oct 5, 2016
Version 3, Jan 23, 2018
Number
......@@ -29,7 +29,7 @@ Number
Dependencies
This extension is written against the wording of the EGL 1.4
This extension is written against the wording of the EGL 1.5
Specification.
References the EGL_ANGLE_device_d3d extension.
......@@ -52,7 +52,7 @@ New Tokens
EGL_D3D_TEXTURE_ANGLE 0x33A3
Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
Additions to Chapter 3 of the EGL 1.5 Specification (EGL Functions and Errors)
Replace the last sentence of paragraph 1 of Section 3.5.3 with the
following text.
......@@ -88,6 +88,8 @@ Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
DXGI_FORMAT_B8G8R8A8_UNORM,
DXGI_FORMAT_B8G8R8A8_UNORM_SRGB (support is optional),
DXGI_FORMAT_R8G8B8A8_TYPELESS (support is optional),
DXGI_FORMAT_B8G8R8A8_TYPELESS (support is optional),
DXGI_FORMAT_R16G16B16A16_FLOAT or
DXGI_FORMAT_R32G32B32A32_FLOAT.
--------------------------------------------------------------------------
......@@ -95,17 +97,24 @@ Additions to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors)
as a <buffer>.
--------------------------------------------------------------------------
Append to the fifth paragraph of Section 3.5.3.
"In addition, in case buftype is EGL_D3D_TEXTURE_ANGLE and the D3D resource
has a typeless DXGI format, attrib_list may contain the attribute
EGL_GL_COLORSPACE."
Append to the end of Section 3.5.3.
"When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, the contents
of the associcated D3D texture object are undefined while the pbuffer is
the current read surface, draw surface or bound to a client texture."
Append to the end of Section 3.5.3.
"When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, the
"When a pbuffer is created with type EGL_D3D_TEXTURE_ANGLE, and the
EGL_GL_COLORSPACE attribute is not specified in attrib_list, the
EGL_GL_COLORSPACE attribute of the surface is determined by the DXGI format
of the Direct3D texture. For *_SRGB DXGI formats, the value of
EGL_GL_COLORSPACE is EGL_GL_COLORSPACE_SRGB. For other formats, the value of
EGL_GL_COLORSPACE is EGL_GL_COLORSPACE_LINEAR."
EGL_GL_COLORSPACE is EGL_GL_COLORSPACE_SRGB. For other formats including
*_TYPELESS DXGI formats, the value of EGL_GL_COLORSPACE defaults to
EGL_GL_COLORSPACE_LINEAR."
Issues
......@@ -120,8 +129,14 @@ Issues
texture with an *_SRGB format is being rendered to, it is undefined whether
SRGB conversion will be performed.
3. What renderers allow the use of typeless textures?
PROPOSED: Support for typeless textures is currently limited to D3D11.
Revision History
Version 3, 2018/01/23 - added support for typeless textures.
Version 2, 2018/01/15 - clarified SRGB conversion handling.
Version 1, 2016/10/05 - first draft.
\ No newline at end of file
......@@ -199,6 +199,13 @@ std::string ToString(const T &value)
#define GL_UINT_64_ANGLEX 0x6ABF
#define GL_BGRA8_SRGB_ANGLEX 0x6AC0
// These are dummy formats used to fit typeless D3D textures that can be bound to EGL pbuffers into
// the format system (for extension EGL_ANGLE_d3d_texture_client_buffer):
#define GL_RGBA8_TYPELESS_ANGLEX 0x6AC1
#define GL_RGBA8_TYPELESS_SRGB_ANGLEX 0x6AC2
#define GL_BGRA8_TYPELESS_ANGLEX 0x6AC3
#define GL_BGRA8_TYPELESS_SRGB_ANGLEX 0x6AC4
// TODO(jmadill): Clean this up at some point.
#define EGL_PLATFORM_ANGLE_PLATFORM_METHODS_ANGLEX 0x9999
......
......@@ -47,6 +47,8 @@ enum class Format::ID
B4G4R4A4_UNORM,
B5G5R5A1_UNORM,
B5G6R5_UNORM,
B8G8R8A8_TYPELESS,
B8G8R8A8_TYPELESS_SRGB,
B8G8R8A8_UNORM,
B8G8R8A8_UNORM_SRGB,
B8G8R8X8_UNORM,
......@@ -122,6 +124,8 @@ enum class Format::ID
R5G6B5_UNORM,
R8G8B8A8_SINT,
R8G8B8A8_SNORM,
R8G8B8A8_TYPELESS,
R8G8B8A8_TYPELESS_SRGB,
R8G8B8A8_UINT,
R8G8B8A8_UNORM,
R8G8B8A8_UNORM_SRGB,
......@@ -142,6 +146,6 @@ enum class Format::ID
S8_UINT
};
constexpr uint32_t kNumANGLEFormats = 128;
constexpr uint32_t kNumANGLEFormats = 132;
} // namespace angle
......@@ -59,6 +59,8 @@ constexpr Format g_formatInfoTable[] = {
{ Format::ID::B4G4R4A4_UNORM, GL_BGRA4_ANGLEX, GL_RGBA4, GenerateMip<A4R4G4B4>, NoCopyFunctions, ReadColor<A4R4G4B4, GLfloat>, WriteColor<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>, WriteColor<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>, WriteColor<B5G6R5, GLfloat>, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0 },
{ Format::ID::B8G8R8A8_TYPELESS, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, NoCopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
{ Format::ID::B8G8R8A8_TYPELESS_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip<B8G8R8A8>, NoCopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
{ Format::ID::B8G8R8A8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip<B8G8R8A8>, BGRACopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<B8G8R8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
{ Format::ID::B8G8R8A8_UNORM_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip<B8G8R8A8>, NoCopyFunctions, ReadColor<B8G8R8A8, GLfloat>, WriteColor<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>, WriteColor<B8G8R8X8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 },
......@@ -134,6 +136,8 @@ constexpr Format g_formatInfoTable[] = {
{ Format::ID::R5G6B5_UNORM, GL_RGB565, GL_RGB565, GenerateMip<R5G6B5>, NoCopyFunctions, ReadColor<R5G6B5, GLfloat>, WriteColor<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>, WriteColor<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>, WriteColor<R8G8B8A8S, GLfloat>, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
{ Format::ID::R8G8B8A8_TYPELESS, GL_RGBA8, GL_RGBA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, WriteColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
{ Format::ID::R8G8B8A8_TYPELESS_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLfloat>, WriteColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
{ Format::ID::R8G8B8A8_UINT, GL_RGBA8UI, GL_RGBA8UI, GenerateMip<R8G8B8A8>, NoCopyFunctions, ReadColor<R8G8B8A8, GLuint>, WriteColor<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>, WriteColor<R8G8B8A8, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
{ Format::ID::R8G8B8A8_UNORM_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip<R8G8B8A8SRGB>, NoCopyFunctions, ReadColor<R8G8B8A8SRGB, GLfloat>, WriteColor<R8G8B8A8SRGB, GLfloat>, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 },
......@@ -224,6 +228,8 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat)
return Format::ID::B8G8R8X8_UNORM;
case GL_RGB16_SNORM_EXT:
return Format::ID::R16G16B16_SNORM;
case GL_BGRA8_TYPELESS_SRGB_ANGLEX:
return Format::ID::B8G8R8A8_TYPELESS_SRGB;
case GL_RGBA8UI:
return Format::ID::R8G8B8A8_UINT;
case GL_BGRA4_ANGLEX:
......@@ -236,6 +242,8 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat)
return Format::ID::BC3_RGBA_UNORM_BLOCK;
case GL_R16I:
return Format::ID::R16_SINT;
case GL_BGRA8_TYPELESS_ANGLEX:
return Format::ID::B8G8R8A8_TYPELESS;
case GL_RGB5_A1:
return Format::ID::R5G5B5A1_UNORM;
case GL_RGB16UI:
......@@ -278,6 +286,8 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat)
return Format::ID::R8_UNORM;
case GL_RGB32F:
return Format::ID::R32G32B32_FLOAT;
case GL_RGBA8_TYPELESS_SRGB_ANGLEX:
return Format::ID::R8G8B8A8_TYPELESS_SRGB;
case GL_R16_EXT:
return Format::ID::R16_UNORM;
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
......@@ -374,6 +384,8 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat)
return Format::ID::R8G8B8_UINT;
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
return Format::ID::ASTC_10x8_SRGB_BLOCK;
case GL_RGBA8_TYPELESS_ANGLEX:
return Format::ID::R8G8B8A8_TYPELESS;
case GL_COMPRESSED_RGBA_ASTC_12x10_KHR:
return Format::ID::ASTC_12x10_UNORM_BLOCK;
case GL_RGB9_E5:
......
......@@ -10,6 +10,9 @@ import json
import os
import re
def get_angle_format_map_abs_path():
return os.path.join(os.path.dirname(os.path.realpath(__file__)), 'angle_format_map.json')
def reject_duplicate_keys(pairs):
found_keys = {}
for key, value in pairs:
......@@ -34,7 +37,7 @@ def load_inverse_table(path):
return { angle: gl for gl, angle in pairs }
def load_without_override():
map_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'angle_format_map.json')
map_path = get_angle_format_map_abs_path()
return load_forward_table(map_path)
def load_with_override(override_path):
......@@ -46,6 +49,10 @@ def load_with_override(override_path):
return results
def get_all_angle_formats():
map_path = get_angle_format_map_abs_path()
return load_inverse_table(map_path).keys()
def get_component_type(format_id):
if "SNORM" in format_id:
return "snorm"
......@@ -61,6 +68,8 @@ def get_component_type(format_id):
return "none"
elif "SRGB" in format_id:
return "unorm"
elif "TYPELESS" in format_id:
return "unorm"
elif format_id == "R9G9B9E5_SHAREDEXP":
return "float"
else:
......
......@@ -20,5 +20,17 @@
},
"R8G8B8A8_UNORM_SRGB": {
"channelStruct": "R8G8B8A8SRGB"
},
"R8G8B8A8_TYPELESS": {
"glInternalFormat": "GL_RGBA8"
},
"R8G8B8A8_TYPELESS_SRGB": {
"glInternalFormat": "GL_SRGB8_ALPHA8"
},
"B8G8R8A8_TYPELESS": {
"glInternalFormat": "GL_BGRA8_EXT"
},
"B8G8R8A8_TYPELESS_SRGB": {
"glInternalFormat": "GL_BGRA8_SRGB_ANGLEX"
}
}
......@@ -128,5 +128,9 @@
[ "GL_R16_SNORM_EXT", "R16_SNORM" ],
[ "GL_RG16_SNORM_EXT", "R16G16_SNORM" ],
[ "GL_RGB16_SNORM_EXT", "R16G16B16_SNORM" ],
[ "GL_RGBA16_SNORM_EXT", "R16G16B16A16_SNORM" ]
[ "GL_RGBA16_SNORM_EXT", "R16G16B16A16_SNORM" ],
[ "GL_RGBA8_TYPELESS_ANGLEX", "R8G8B8A8_TYPELESS" ],
[ "GL_RGBA8_TYPELESS_SRGB_ANGLEX", "R8G8B8A8_TYPELESS_SRGB" ],
[ "GL_BGRA8_TYPELESS_ANGLEX", "B8G8R8A8_TYPELESS" ],
[ "GL_BGRA8_TYPELESS_SRGB_ANGLEX", "B8G8R8A8_TYPELESS_SRGB" ]
]
......@@ -15,6 +15,7 @@
#include "libANGLE/renderer/d3d/RenderTargetD3D.h"
#include "libANGLE/renderer/d3d/RendererD3D.h"
#include "libANGLE/renderer/d3d/SwapChainD3D.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
#include <tchar.h>
#include <EGL/eglext.h>
......@@ -45,7 +46,8 @@ SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state,
mHeight(static_cast<EGLint>(attribs.get(EGL_HEIGHT, 0))),
mSwapInterval(1),
mShareHandle(0),
mD3DTexture(nullptr)
mD3DTexture(nullptr),
mBuftype(buftype)
{
if (window != nullptr && !mFixedSize)
{
......@@ -63,9 +65,6 @@ SurfaceD3D::SurfaceD3D(const egl::SurfaceState &state,
mD3DTexture = static_cast<IUnknown *>(clientBuffer);
ASSERT(mD3DTexture != nullptr);
mD3DTexture->AddRef();
ANGLE_SWALLOW_ERR(mRenderer->getD3DTextureInfo(state.config, mD3DTexture, &mWidth,
&mHeight, &mColorFormat));
mRenderTargetFormat = mColorFormat->fboImplementationInternalFormat;
break;
default:
......@@ -95,6 +94,40 @@ egl::Error SurfaceD3D::initialize(const egl::Display *display)
}
}
if (mBuftype == EGL_D3D_TEXTURE_ANGLE)
{
ANGLE_TRY(mRenderer->getD3DTextureInfo(mState.config, mD3DTexture, &mWidth, &mHeight,
&mColorFormat));
if (mState.attributes.contains(EGL_GL_COLORSPACE))
{
if (mColorFormat->id != angle::Format::ID::R8G8B8A8_TYPELESS &&
mColorFormat->id != angle::Format::ID::B8G8R8A8_TYPELESS)
{
return egl::EglBadMatch()
<< "EGL_GL_COLORSPACE may only be specified for TYPELESS textures";
}
}
if (mColorFormat->id == angle::Format::ID::R8G8B8A8_TYPELESS)
{
EGLAttrib colorspace =
mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
if (colorspace == EGL_GL_COLORSPACE_SRGB)
{
mColorFormat = &angle::Format::Get(angle::Format::ID::R8G8B8A8_TYPELESS_SRGB);
}
}
if (mColorFormat->id == angle::Format::ID::B8G8R8A8_TYPELESS)
{
EGLAttrib colorspace =
mState.attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
if (colorspace == EGL_GL_COLORSPACE_SRGB)
{
mColorFormat = &angle::Format::Get(angle::Format::ID::B8G8R8A8_TYPELESS_SRGB);
}
}
mRenderTargetFormat = mColorFormat->fboImplementationInternalFormat;
}
ANGLE_TRY(resetSwapChain(display));
return egl::NoError();
}
......
......@@ -105,6 +105,8 @@ class SurfaceD3D : public SurfaceImpl
HANDLE mShareHandle;
IUnknown *mD3DTexture;
EGLenum mBuftype;
};
class WindowSurfaceD3D : public SurfaceD3D
......
......@@ -1344,8 +1344,10 @@ egl::Error Renderer11::getD3DTextureInfo(const egl::Config *configuration,
{
case DXGI_FORMAT_R8G8B8A8_UNORM:
case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
case DXGI_FORMAT_B8G8R8A8_UNORM:
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
case DXGI_FORMAT_R16G16B16A16_FLOAT:
case DXGI_FORMAT_R32G32B32A32_FLOAT:
break;
......
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_dxgi_format_table.py using data from dxgi_format_data.json.
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Copyright 2018 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.
//
......@@ -288,7 +288,7 @@ const Format &GetFormat(DXGI_FORMAT dxgiFormat)
case DXGI_FORMAT_B5G6R5_UNORM:
return Format::Get(Format::ID::B5G6R5_UNORM);
case DXGI_FORMAT_B8G8R8A8_TYPELESS:
break;
return Format::Get(Format::ID::B8G8R8A8_TYPELESS);
case DXGI_FORMAT_B8G8R8A8_UNORM:
return Format::Get(Format::ID::B8G8R8A8_UNORM);
case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB:
......@@ -456,7 +456,7 @@ const Format &GetFormat(DXGI_FORMAT dxgiFormat)
case DXGI_FORMAT_R8G8B8A8_SNORM:
return Format::Get(Format::ID::R8G8B8A8_SNORM);
case DXGI_FORMAT_R8G8B8A8_TYPELESS:
break;
return Format::Get(Format::ID::R8G8B8A8_TYPELESS);
case DXGI_FORMAT_R8G8B8A8_UINT:
return Format::Get(Format::ID::R8G8B8A8_UINT);
case DXGI_FORMAT_R8G8B8A8_UNORM:
......
......@@ -98,8 +98,7 @@ types = {
'SHAREDEXP': 'GL_FLOAT'
}
angle_to_gl = angle_format.load_inverse_table('../../angle_format_map.json')
all_angle = angle_to_gl.keys()
all_angle = angle_format.get_all_angle_formats()
for dxgi_format, angle_format in sorted(dxgi_map.iteritems()):
......
......@@ -243,6 +243,12 @@ def parse_json_into_switch_angle_format_string(json_map, json_data):
if format_name not in json_data:
continue
# Typeless internal formats are dummy formats just used to fit support
# for typeless D3D textures into the format system. Their properties
# should not be queried.
if 'TYPELESS' in internal_format:
continue
angle_format = json_data[format_name]
supported_case, unsupported_case, support_test = parse_json_angle_format_case(
......
......@@ -21,6 +21,24 @@
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8"
},
"R8G8B8A8_TYPELESS": {
"texFormat": "DXGI_FORMAT_R8G8B8A8_TYPELESS",
"srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
"rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM",
"channels": "rgba",
"componentType": "typeless",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_RGBA8"
},
"R8G8B8A8_TYPELESS_SRGB": {
"texFormat": "DXGI_FORMAT_R8G8B8A8_TYPELESS",
"srvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
"rtvFormat": "DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",
"channels": "rgba",
"componentType": "typeless",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_SRGB8_ALPHA8"
},
"R16G16B16A16_UNORM": {
"texFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
"srvFormat": "DXGI_FORMAT_R16G16B16A16_UNORM",
......@@ -68,6 +86,24 @@
"bits": {"red": 8, "green": 8, "blue": 8,"alpha": 8},
"siwzzleFormat": "GL_RGBA8"
},
"B8G8R8A8_TYPELESS": {
"texFormat": "DXGI_FORMAT_B8G8R8A8_TYPELESS",
"srvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",
"rtvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",
"channels": "bgra",
"componentType": "typeless",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_BGRA8_EXT"
},
"B8G8R8A8_TYPELESS_SRGB": {
"texFormat": "DXGI_FORMAT_B8G8R8A8_TYPELESS",
"srvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",
"rtvFormat": "DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",
"channels": "bgra",
"componentType": "typeless",
"bits": { "red": 8, "green": 8, "blue": 8, "alpha": 8 },
"glInternalFormat": "GL_BGRA8_SRGB_ANGLEX"
},
"BC1_RGBA_UNORM_BLOCK": {
"texFormat": "DXGI_FORMAT_BC1_UNORM",
"srvFormat": "DXGI_FORMAT_BC1_UNORM",
......
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_texture_format_table.py using data from texture_format_data.json
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Copyright 2018 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.
//
......
......@@ -308,6 +308,19 @@ egl::Error D3DTextureSurfaceWGL::initialize(const egl::Display *display)
ANGLE_TRY(GetD3DTextureInfo(mBuftype, mClientBuffer, mDisplayD3D11Device, &mWidth, &mHeight,
&mColorFormat, &mObject, &device));
if (mColorFormat)
{
if (mState.attributes.contains(EGL_GL_COLORSPACE))
{
if (mColorFormat->id != angle::Format::ID::R8G8B8A8_TYPELESS &&
mColorFormat->id != angle::Format::ID::B8G8R8A8_TYPELESS)
{
return egl::EglBadMatch()
<< "EGL_GL_COLORSPACE may only be specified for TYPELESS textures";
}
}
}
// Grab the keyed mutex, if one exists
mObject->QueryInterface(&mKeyedMutex);
......
// GENERATED FILE - DO NOT EDIT.
// Generated by gen_vk_format_table.py using data from vk_format_map.json
//
// Copyright 2017 The ANGLE Project Authors. All rights reserved.
// Copyright 2018 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.
//
......@@ -372,6 +372,14 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
}
case angle::Format::ID::B8G8R8A8_TYPELESS:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::B8G8R8A8_TYPELESS_SRGB:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::B8G8R8A8_UNORM:
{
internalFormat = GL_BGRA8_EXT;
......@@ -1047,6 +1055,14 @@ void Format::initialize(VkPhysicalDevice physicalDevice, const angle::Format &an
break;
}
case angle::Format::ID::R8G8B8A8_TYPELESS:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::R8G8B8A8_TYPELESS_SRGB:
// This format is not implemented in Vulkan.
break;
case angle::Format::ID::R8G8B8A8_UINT:
{
internalFormat = GL_RGBA8UI;
......
......@@ -1166,12 +1166,23 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
return EglBadAttribute() << "<buftype> doesn't support texture internal format";
}
break;
case EGL_GL_COLORSPACE:
if (buftype != EGL_D3D_TEXTURE_ANGLE)
{
return EglBadAttribute() << "<buftype> doesn't support setting GL colorspace";
}
break;
default:
return EglBadAttribute();
}
}
EGLAttrib colorspace = attributes.get(EGL_GL_COLORSPACE, EGL_GL_COLORSPACE_LINEAR);
if (colorspace != EGL_GL_COLORSPACE_LINEAR && colorspace != EGL_GL_COLORSPACE_SRGB)
{
return EglBadAttribute() << "invalid GL colorspace";
}
if (!(config->surfaceType & EGL_PBUFFER_BIT))
{
return EglBadMatch();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment