mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 14:41:50 +00:00
OpenGL: add support for GL_ANGLE_base_vertex_base_instance.
Change-Id: Ib327cb2e66bd5f02cce9c5321207483e16b40a40 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/121500 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Stephen White <senorblanco@chromium.org>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
70e45a4263
commit
25e1f12228
@@ -112,6 +112,8 @@ if (dawn_enable_opengl) {
|
||||
args = [
|
||||
"--gl-xml",
|
||||
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",
|
||||
rebase_path("opengl/supported_extensions.json", root_build_dir),
|
||||
]
|
||||
|
||||
@@ -413,6 +413,8 @@ if (DAWN_ENABLE_OPENGL)
|
||||
PRINT_NAME "OpenGL function loader"
|
||||
ARGS "--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"
|
||||
"${Dawn_SOURCE_DIR}/src/dawn/native/opengl/supported_extensions.json"
|
||||
RESULT_VARIABLE "DAWN_NATIVE_OPENGL_AUTOGEN_SOURCES"
|
||||
|
||||
@@ -194,6 +194,11 @@ void Adapter::SetupBackendDeviceToggles(TogglesState* deviceToggles) const {
|
||||
// (gl.IsAtLeastGLES(3, 1) && gl.IsGLExtensionSupported("EXT_base_instance")) ||
|
||||
// (gl.IsAtLeastGL(3, 1) && gl.IsGLExtensionSupported("ARB_base_instance"));
|
||||
|
||||
if (gl.IsAtLeastGLES(3, 1) && gl.IsGLExtensionSupported("GL_ANGLE_base_vertex_base_instance")) {
|
||||
supportsBaseVertex = true;
|
||||
supportsBaseInstance = true;
|
||||
}
|
||||
|
||||
// TODO(crbug.com/dawn/343): Investigate emulation.
|
||||
deviceToggles->Default(Toggle::DisableBaseVertex, !supportsBaseVertex);
|
||||
deviceToggles->Default(Toggle::DisableBaseInstance, !supportsBaseInstance);
|
||||
|
||||
@@ -1007,7 +1007,11 @@ MaybeError CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass) {
|
||||
vertexStateBufferBindingTracker.Apply(gl);
|
||||
bindGroupTracker.Apply(gl);
|
||||
|
||||
if (draw->firstInstance > 0) {
|
||||
if (gl.DrawArraysInstancedBaseInstanceANGLE) {
|
||||
gl.DrawArraysInstancedBaseInstanceANGLE(
|
||||
lastPipeline->GetGLPrimitiveTopology(), draw->firstVertex,
|
||||
draw->vertexCount, draw->instanceCount, draw->firstInstance);
|
||||
} else if (draw->firstInstance > 0) {
|
||||
gl.DrawArraysInstancedBaseInstance(lastPipeline->GetGLPrimitiveTopology(),
|
||||
draw->firstVertex, draw->vertexCount,
|
||||
draw->instanceCount, draw->firstInstance);
|
||||
@@ -1025,7 +1029,13 @@ MaybeError CommandBuffer::ExecuteRenderPass(BeginRenderPassCmd* renderPass) {
|
||||
vertexStateBufferBindingTracker.Apply(gl);
|
||||
bindGroupTracker.Apply(gl);
|
||||
|
||||
if (draw->firstInstance > 0) {
|
||||
if (gl.DrawElementsInstancedBaseVertexBaseInstanceANGLE) {
|
||||
gl.DrawElementsInstancedBaseVertexBaseInstanceANGLE(
|
||||
lastPipeline->GetGLPrimitiveTopology(), draw->indexCount, indexBufferFormat,
|
||||
reinterpret_cast<void*>(draw->firstIndex * indexFormatSize +
|
||||
indexBufferBaseOffset),
|
||||
draw->instanceCount, draw->baseVertex, draw->firstInstance);
|
||||
} else if (draw->firstInstance > 0) {
|
||||
gl.DrawElementsInstancedBaseVertexBaseInstance(
|
||||
lastPipeline->GetGLPrimitiveTopology(), draw->indexCount, indexBufferFormat,
|
||||
reinterpret_cast<void*>(draw->firstIndex * indexFormatSize +
|
||||
|
||||
@@ -21,5 +21,9 @@
|
||||
"GL_OES_EGL_image",
|
||||
"GL_EXT_texture_format_BGRA8888",
|
||||
"GL_APPLE_texture_format_BGRA8888"
|
||||
],
|
||||
|
||||
"supported_angle_extensions": [
|
||||
"GL_ANGLE_base_vertex_base_instance"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user