Dawn: Break dependency on ANGLE

Fixed: dawn:1715
Change-Id: I6d7965a9a73c42a2aca59b03379aa68aea1695c8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/124460
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Ben Clayton 2023-03-16 14:31:25 +00:00 committed by Dawn LUCI CQ
parent d7d8b80c81
commit d493c0f314
6 changed files with 25 additions and 19 deletions

View File

@ -240,10 +240,6 @@ class OpenGLLoaderGenerator(Generator):
required=True, required=True,
type=str, type=str,
help='The Khronos gl.xml to use.') help='The Khronos gl.xml to use.')
parser.add_argument('--gl-angle-ext-xml',
required=True,
type=str,
help='The ANGLE gl_angle_ext.xml to use.')
parser.add_argument( parser.add_argument(
'--supported-extensions', '--supported-extensions',
required=True, required=True,
@ -254,24 +250,14 @@ class OpenGLLoaderGenerator(Generator):
def get_file_renders(self, args): def get_file_renders(self, args):
supported_extensions = [] supported_extensions = []
supported_angle_extensions = []
with open(args.supported_extensions) as f: with open(args.supported_extensions) as f:
supported_extensions_json = json.loads(f.read()) supported_extensions_json = json.loads(f.read())
supported_extensions = supported_extensions_json[ supported_extensions = supported_extensions_json[
'supported_extensions'] 'supported_extensions']
supported_angle_extensions = supported_extensions_json[
'supported_angle_extensions']
params = compute_params( params = compute_params(
etree.parse(args.gl_xml).getroot(), supported_extensions) etree.parse(args.gl_xml).getroot(), supported_extensions)
angle_params = compute_params(
etree.parse(args.gl_angle_ext_xml).getroot(),
supported_angle_extensions)
for key, value in params.items():
params[key] += angle_params[key]
return [ return [
FileRender( FileRender(
'opengl/OpenGLFunctionsBase.cpp', 'opengl/OpenGLFunctionsBase.cpp',
@ -288,7 +274,6 @@ class OpenGLLoaderGenerator(Generator):
def get_dependencies(self, args): def get_dependencies(self, args):
return [ return [
os.path.abspath(args.gl_xml), os.path.abspath(args.gl_xml),
os.path.abspath(args.gl_angle_ext_xml),
os.path.abspath(args.supported_extensions) os.path.abspath(args.supported_extensions)
] ]

View File

@ -47,6 +47,15 @@ MaybeError OpenGLFunctionsBase::LoadOpenGLESProcs(GetProcAddress getProc, int ma
} }
{% endfor %} {% endfor %}
// GL_ANGLE_base_vertex_base_instance
// See crbug.com/dawn/1715 for why this is embedded
if (IsGLExtensionSupported("GL_ANGLE_base_vertex_base_instance")) {
DAWN_TRY(LoadProc(getProc, &DrawArraysInstancedBaseInstanceANGLE, "glDrawArraysInstancedBaseInstanceANGLE"));
DAWN_TRY(LoadProc(getProc, &DrawElementsInstancedBaseVertexBaseInstanceANGLE, "glDrawElementsInstancedBaseVertexBaseInstanceANGLE"));
DAWN_TRY(LoadProc(getProc, &MultiDrawArraysInstancedBaseInstanceANGLE, "glMultiDrawArraysInstancedBaseInstanceANGLE"));
DAWN_TRY(LoadProc(getProc, &MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE, "glMultiDrawElementsInstancedBaseVertexBaseInstanceANGLE"));
}
return {}; return {};
} }

View File

@ -32,6 +32,14 @@ namespace dawn::native::opengl {
{% endfor %} {% endfor %}
{% endfor%} {% endfor%}
// GL_ANGLE_base_vertex_base_instance
// See crbug.com/dawn/1715 for why this is embedded
PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEANGLEPROC DrawArraysInstancedBaseInstanceANGLE = nullptr;
PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEANGLEPROC DrawElementsInstancedBaseVertexBaseInstanceANGLE = nullptr;
PFNGLMULTIDRAWARRAYSINSTANCEDBASEINSTANCEANGLEPROC MultiDrawArraysInstancedBaseInstanceANGLE = nullptr;
PFNGLMULTIDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEANGLEPROC MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE = nullptr;
bool IsGLExtensionSupported(const char* extension) const; bool IsGLExtensionSupported(const char* extension) const;
protected: protected:

View File

@ -70,4 +70,12 @@ using GLDEBUGPROCAMD = void(KHRONOS_APIENTRY*)(GLuint id,
{% endfor %} {% endfor %}
{% endfor%} {% endfor%}
// GL_ANGLE_base_vertex_base_instance
// See crbug.com/dawn/1715 for why this is embedded
using PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEANGLEPROC = void(KHRONOS_APIENTRY *)(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount, GLuint baseInstance);
using PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEANGLEPROC = void(KHRONOS_APIENTRY *)(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices, GLsizei instanceCount, GLint baseVertex, GLuint baseInstance);
using PFNGLMULTIDRAWARRAYSINSTANCEDBASEINSTANCEANGLEPROC = void(KHRONOS_APIENTRY *)(GLenum mode, const GLint * firsts, const GLsizei * counts, const GLsizei * instanceCounts, const GLuint * baseInstances, GLsizei drawcount);
using PFNGLMULTIDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEANGLEPROC = void(KHRONOS_APIENTRY *)(GLenum mode, const GLsizei * counts, GLenum type, const GLvoid *const* indices, const GLsizei * instanceCounts, const GLint * baseVertices, const GLuint * baseInstances, GLsizei drawcount);
#undef DAWN_GL_APIENTRY #undef DAWN_GL_APIENTRY

View File

@ -112,8 +112,6 @@ if (dawn_enable_opengl) {
args = [ args = [
"--gl-xml", "--gl-xml",
rebase_path("${dawn_root}/third_party/khronos/gl.xml", root_build_dir), rebase_path("${dawn_root}/third_party/khronos/gl.xml", root_build_dir),
"--gl-angle-ext-xml",
rebase_path("${dawn_angle_dir}/scripts/gl_angle_ext.xml", root_build_dir),
"--supported-extensions", "--supported-extensions",
rebase_path("opengl/supported_extensions.json", root_build_dir), rebase_path("opengl/supported_extensions.json", root_build_dir),
] ]

View File

@ -427,8 +427,6 @@ if (DAWN_ENABLE_OPENGL)
PRINT_NAME "OpenGL function loader" PRINT_NAME "OpenGL function loader"
ARGS "--gl-xml" ARGS "--gl-xml"
"${Dawn_SOURCE_DIR}/third_party/khronos/gl.xml" "${Dawn_SOURCE_DIR}/third_party/khronos/gl.xml"
"--gl-angle-ext-xml"
"${Dawn_SOURCE_DIR}/third_party/angle/scripts/gl_angle_ext.xml"
"--supported-extensions" "--supported-extensions"
"${Dawn_SOURCE_DIR}/src/dawn/native/opengl/supported_extensions.json" "${Dawn_SOURCE_DIR}/src/dawn/native/opengl/supported_extensions.json"
RESULT_VARIABLE "DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES" RESULT_VARIABLE "DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES"