diff --git a/doc/ExtensionSupport.md b/doc/ExtensionSupport.md index b0c3d95f1..efa6fd367 100644 --- a/doc/ExtensionSupport.md +++ b/doc/ExtensionSupport.md @@ -182,6 +182,7 @@ using data from registry_xml.py and gl.xml. | Extension Name | NVIDIA P400 Win10 | Intel 630 Win10 | NVIDIA P400 Linux | Intel 630 Linux | SwiftShader Win10 | Pixel 4 Android 11 | | -------------- | :---------------: | :-------------: | :---------------: | :-------------: | :---------------: | :----------------: | | [GL_ANGLE_base_vertex_base_instance](https://chromium.googlesource.com/angle/angle/+/refs/heads/main/extensions/ANGLE_base_vertex_base_instance.txt) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | +| [GL_ANGLE_base_vertex_base_instance_shader_builtin](https://chromium.googlesource.com/angle/angle/+/refs/heads/main/extensions/ANGLE_base_vertex_base_instance_shader_builtin.txt) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | [GL_CHROMIUM_bind_generates_resource](https://chromium.googlesource.com/angle/angle/+/refs/heads/main/extensions/CHROMIUM_bind_generates_resource.txt) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | [GL_CHROMIUM_bind_uniform_location](https://chromium.googlesource.com/angle/angle/+/refs/heads/main/extensions/CHROMIUM_bind_uniform_location.txt) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | | [GL_ANGLE_client_arrays](https://chromium.googlesource.com/angle/angle/+/refs/heads/main/extensions/ANGLE_client_arrays.txt) | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | diff --git a/extensions/ANGLE_base_vertex_base_instance.txt b/extensions/ANGLE_base_vertex_base_instance.txt index 83f7a1bf2..e3f43cc09 100644 --- a/extensions/ANGLE_base_vertex_base_instance.txt +++ b/extensions/ANGLE_base_vertex_base_instance.txt @@ -24,8 +24,8 @@ Status Version - Last Modified Date: July 14, 2020 - Author Revision: 2 + Last Modified Date: Nov 19, 2021 + Author Revision: 3 Number @@ -62,15 +62,6 @@ Overview of zero, and that of the set of elements are executed and the value of advances between each set. - Additionally, and builtins are added - to the shading language. - For any *BaseVertex* draw call variant, the of the draw may be - read by the vertex shader as . For non *BaseVertex* calls, - the value of is 0. - For any *BaseInstance draw call variant, the baseInstance of the draw may - be read by the vertex shader as . For non *BaseInstance - calls, the value of is 0. - IP Status No known IP claims. @@ -126,9 +117,6 @@ Additions to Chapter 10 of the OpenGL ES 3.2 Specification Behaves identically to DrawArraysInstanced except that is passed down to DrawArraysOneInstance instead of zero. - The base index of the instance may be read by a vertex shader as - . - The command void MultiDrawArraysInstancedBaseInstanceANGLE(GLenum mode, @@ -168,13 +156,6 @@ Additions to Chapter 10 of the OpenGL ES 3.2 Specification Behaves identically to DrawElementsInstanced except that and are passed down to DrawElementsOneInstance instead of zero. - The base index of the vertex may be read by a vertex shader as - . This value is also added to the . - - The base index of the instance may be read by a vertex shader as - . Note that this value is not added to the - . - The command void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode, @@ -220,19 +201,6 @@ Errors The error INVALID_VALUE is generated by the MultiDraw* functions if is less than zero. -Modifications to the OpenGL ES Shading Language Specification, Version 3.00 - - Including the following line in a shader can be used to control the - language featured described in this extension: - - #extension GL_ANGLE_base_vertex_base_instance : - - where is as specified in section 3.5. - - A new preprocessor #define is added to the OpenGL ES Shading Language: - - #define GL_ANGLE_base_vertex_base_instance 1 - Dependencies on GL_OES_draw_elements_base_vertex and GL_EXT_draw_elements_base_vertex @@ -250,3 +218,4 @@ Revision History ---- -------- ---------- -------------------------------------------- 1 08/13/19 Shrek Shao First revision. 2 07/14/20 Shrek Shao Fix baseInstance type from GLint to GLuint. + 3 11/19/21 Shrek Shao Decouple gl_BaseVertex/gl_BaseInstance. diff --git a/extensions/ANGLE_base_vertex_base_instance_shader_builtin.txt b/extensions/ANGLE_base_vertex_base_instance_shader_builtin.txt new file mode 100644 index 000000000..9ce541781 --- /dev/null +++ b/extensions/ANGLE_base_vertex_base_instance_shader_builtin.txt @@ -0,0 +1,137 @@ +Name + + ANGLE_base_vertex_base_instance_shader_builtin + +Name Strings + + GL_ANGLE_base_vertex_base_instance_shader_builtin + +Contributors + + Shrek Shao, Google Inc. + Contributors to the ANGLE_base_vertex_base_instance specification + Contributors to the ARB_shader_draw_parameters specification + +Contact + + Shrek Shao (shrekshao 'at' google.com) + +Status + + Incomplete + +Version + + Last Modified Date: Nov 19, 2021 + Author Revision: 1 + +Number + + OpenGL ES Extension XX + +Dependencies + + The extension is based on ANGLE_base_vertex_base_instance, all limitations of which + apply to this extension. + +Overview + + This extension is based on ANGLE_base_vertex_base_instance. It should be enabled + only if ANGLE_base_vertex_base_instance is enabled. + + Additional to the functionality exposed by ANGLE_base_vertex_base_instance, + and builtins are added to the shading language. + For any *BaseVertex* draw call variant, the of the draw may be + read by the vertex shader as . For non *BaseVertex* calls, + the value of is 0. + For any *BaseInstance draw call variant, the baseInstance of the draw may + be read by the vertex shader as . For non *BaseInstance + calls, the value of is 0. + +IP Status + + No known IP claims. + +New Procedures and Functions + + None. + +New Tokens + + None. + +Additions to Chapter 10 of the OpenGL ES 3.2 Specification + + Section 10.5 Drawing Commands Using Vertex Arrays: + + The base index of the instance may be read by a vertex shader as + , for the commands + + void DrawArraysInstancedBaseInstanceANGLE (GLenum mode, + GLint first, + GLsizei count, + GLsizei instanceCount, + GLuint baseInstance); + + and + + void MultiDrawArraysInstancedBaseInstanceANGLE(GLenum mode, + const GLint* firsts, + const GLsizei* counts, + const GLsizei* instanceCounts, + const GLuint* baseInstances, + GLsizei drawcount); + + The base index of the vertex may be read by a vertex shader as + . This value is also added to the . + + The base index of the instance may be read by a vertex shader as + . Note that this value is not added to the + , for the commands + + void DrawElementsInstancedBaseVertexBaseInstanceANGLE (GLenum mode, + GLsizei count, + GLenum type, + const GLvoid* indices, + GLsizei instanceCount, + GLint baseVertex, + GLuint baseInstance); + + and + + void MultiDrawElementsInstancedBaseVertexBaseInstanceANGLE(GLenum mode, + const GLsizei* counts, + GLenum type, + const GLvoid* const* indices, + const GLsizei* instanceCounts, + const GLint* baseVertices, + const GLuint* baseInstances, + GLsizei drawcount); + +Errors + + None. + +Modifications to the OpenGL ES Shading Language Specification, Version 3.00 + + Including the following line in a shader controls the + language featured described in this extension: + + #extension GL_ANGLE_base_vertex_base_instance_shader_builtin : + + where is as specified in section 3.5. + + A new preprocessor #define is added to the OpenGL ES Shading Language: + + #define GL_ANGLE_base_vertex_base_instance_shader_builtin 1 + + +Issues + + None + +Revision History + + Rev. Date Author Changes + ---- -------- ---------- -------------------------------------------- + 1 11/19/21 Shrek Shao First revision. diff --git a/include/GLSLANG/ShaderLang.h b/include/GLSLANG/ShaderLang.h index 74f523dc8..d5003e4e1 100644 --- a/include/GLSLANG/ShaderLang.h +++ b/include/GLSLANG/ShaderLang.h @@ -26,7 +26,7 @@ // Version number for shader translation API. // It is incremented every time the API changes. -#define ANGLE_SH_VERSION 267 +#define ANGLE_SH_VERSION 268 enum ShShaderSpec { @@ -400,6 +400,7 @@ struct ShBuiltInResources int OES_texture_3D; int ANGLE_texture_multisample; int ANGLE_multi_draw; + // TODO(angleproject:3402) remove after chromium side removal to pass compilation int ANGLE_base_vertex_base_instance; int WEBGL_video_texture; int APPLE_clip_distance; @@ -414,6 +415,7 @@ struct ShBuiltInResources int OES_sample_variables; int EXT_clip_cull_distance; int EXT_primitive_bounding_box; + int ANGLE_base_vertex_base_instance_shader_builtin; // Set to 1 to enable replacing GL_EXT_draw_buffers #extension directives // with GL_NV_draw_buffers in ESSL output. This flag can be used to emulate diff --git a/scripts/code_generation_hashes/Extension_files.json b/scripts/code_generation_hashes/Extension_files.json index 944c92d0a..40512dd77 100644 --- a/scripts/code_generation_hashes/Extension_files.json +++ b/scripts/code_generation_hashes/Extension_files.json @@ -1,6 +1,6 @@ { "doc/ExtensionSupport.md": - "2780ba4f99ed42d86db6c48dd2b71894", + "14185ec747682e4a338a9fae6972e3f1", "scripts/cl.xml": "f923201d4ea3e1130763b19fa7faa7a2", "scripts/egl.xml": @@ -8,31 +8,31 @@ "scripts/egl_angle_ext.xml": "bea2e9846b429ecf051a0a46e4f02374", "scripts/extension_data/intel_630_linux.json": - "4131eaca8a8e4fca9b0c5ff25b16026f", + "dbcae14638684f9c094c216110fd4fa3", "scripts/extension_data/intel_630_win10.json": - "bd89a6577d818c6d49f36df601cd99dd", + "4cf6bfad658bb2f0a818bed648042c23", "scripts/extension_data/nvidia_p400_linux.json": - "d5a85767739d7404ffb76cbc9f3dc57d", + "b9e39094658cf0378b0b6ca1fd69b32a", "scripts/extension_data/nvidia_p400_win10.json": - "8a8bf15d0fb0168d1eadbb228f32fe29", + "476eca14731550002205aef95c8ce3f6", "scripts/extension_data/pixel_4_android_11.json": - "2c05f8906022c6c5f99b56a7678e3d03", + "3e482d5647efe6e938101584885a1994", "scripts/extension_data/swiftshader_win10.json": - "396fde2ceb0c833fe2ce405c9f1bd901", + "6eac00fc10d4130e73323a048c92fca7", "scripts/extension_data/swiftshader_win10_gles1.json": - "368aa3eef8fcfc01ba322ea34ca505e9", + "fbf1c3dc83570c1e3fffdbee313bca30", "scripts/gl.xml": "a442a7aeff3a2f0a1fba52ee08089500", "scripts/gl_angle_ext.xml": "474989440f980a079935dff3ab4d7b24", "scripts/registry_xml.py": - "b7aba2b35bc12a88d2b2b1efd2efc096", + "1962da4e017cd117dea42bc4d6d112a1", "scripts/wgl.xml": "c36001431919e1c435f1215a85f7e1db", "src/libANGLE/gen_extensions.py": "db7ed1c2245bba536e074a1cf2bb2590", "src/libANGLE/gles_extensions_autogen.cpp": - "3c8b8918337a054e28c7078f7a4f609a", + "bec449f60a36c7615aaa331bada604a7", "src/libANGLE/gles_extensions_autogen.h": - "b4c0a303b26639a8956131ee19d2d431" + "c33d6d019b639cd64a1723bded359e2c" } \ No newline at end of file diff --git a/scripts/code_generation_hashes/GL_EGL_WGL_loader.json b/scripts/code_generation_hashes/GL_EGL_WGL_loader.json index f9f9a2610..6f3a5208b 100644 --- a/scripts/code_generation_hashes/GL_EGL_WGL_loader.json +++ b/scripts/code_generation_hashes/GL_EGL_WGL_loader.json @@ -12,7 +12,7 @@ "scripts/gl_angle_ext.xml": "474989440f980a079935dff3ab4d7b24", "scripts/registry_xml.py": - "b7aba2b35bc12a88d2b2b1efd2efc096", + "1962da4e017cd117dea42bc4d6d112a1", "scripts/wgl.xml": "c36001431919e1c435f1215a85f7e1db", "src/libEGL/egl_loader_autogen.cpp": diff --git a/scripts/code_generation_hashes/GL_EGL_entry_points.json b/scripts/code_generation_hashes/GL_EGL_entry_points.json index 6f7c808a5..b367a7f9a 100644 --- a/scripts/code_generation_hashes/GL_EGL_entry_points.json +++ b/scripts/code_generation_hashes/GL_EGL_entry_points.json @@ -16,7 +16,7 @@ "scripts/gl_angle_ext.xml": "474989440f980a079935dff3ab4d7b24", "scripts/registry_xml.py": - "b7aba2b35bc12a88d2b2b1efd2efc096", + "1962da4e017cd117dea42bc4d6d112a1", "scripts/wgl.xml": "c36001431919e1c435f1215a85f7e1db", "src/common/entry_points_enum_autogen.cpp": @@ -42,7 +42,7 @@ "src/libANGLE/Context_gles_3_2_autogen.h": "48567dca16fd881dfe6d61fee0e3106f", "src/libANGLE/Context_gles_ext_autogen.h": - "658aaa61c874cf9fda0e9b420a1ce703", + "56ace18f08e6531df8fcdbc258db5a84", "src/libANGLE/capture/capture_gles_1_0_autogen.cpp": "7ec7ef8f779b809a45d74b97502c419b", "src/libANGLE/capture/capture_gles_1_0_autogen.h": diff --git a/scripts/code_generation_hashes/GLenum_value_to_string_map.json b/scripts/code_generation_hashes/GLenum_value_to_string_map.json index 497b77634..baa16bfd2 100644 --- a/scripts/code_generation_hashes/GLenum_value_to_string_map.json +++ b/scripts/code_generation_hashes/GLenum_value_to_string_map.json @@ -6,7 +6,7 @@ "scripts/gl_angle_ext.xml": "474989440f980a079935dff3ab4d7b24", "scripts/registry_xml.py": - "b7aba2b35bc12a88d2b2b1efd2efc096", + "1962da4e017cd117dea42bc4d6d112a1", "src/libANGLE/capture/gl_enum_utils_autogen.cpp": "2ea097051161668c1cef088043707735", "src/libANGLE/capture/gl_enum_utils_autogen.h": diff --git a/scripts/code_generation_hashes/Static_builtins.json b/scripts/code_generation_hashes/Static_builtins.json index d9c351b80..35a921ffd 100644 --- a/scripts/code_generation_hashes/Static_builtins.json +++ b/scripts/code_generation_hashes/Static_builtins.json @@ -6,15 +6,15 @@ "src/compiler/translator/Operator_autogen.h": "cdaafd06e84ef6a8e4721678d622d844", "src/compiler/translator/SymbolTable_ESSL_autogen.cpp": - "d5aee25a82129a6fc7ae042a85a3cfdf", + "3dd0c9b8e03b010e9644e5574480158f", "src/compiler/translator/SymbolTable_autogen.cpp": - "21d720b15db0dc774066d94da8635708", + "2a521e5bcffe7bf36b60de5307688fdb", "src/compiler/translator/SymbolTable_autogen.h": "291eba34a070f5fddbf2827a1577c598", "src/compiler/translator/builtin_function_declarations.txt": "cd5f022686be7e13174b672d6b32fc6d", "src/compiler/translator/builtin_variables.json": - "c8024a2d16554f32a8bc9e3f096772f7", + "de6accceb23ac374122a14dd80584eaa", "src/compiler/translator/gen_builtin_symbols.py": "74ac1eb203c04abfbb81174c5fdb257d", "src/compiler/translator/tree_util/BuiltIn_ESSL_autogen.h": diff --git a/scripts/code_generation_hashes/proc_table.json b/scripts/code_generation_hashes/proc_table.json index e7592222a..14a92465b 100644 --- a/scripts/code_generation_hashes/proc_table.json +++ b/scripts/code_generation_hashes/proc_table.json @@ -12,7 +12,7 @@ "scripts/gl_angle_ext.xml": "474989440f980a079935dff3ab4d7b24", "scripts/registry_xml.py": - "b7aba2b35bc12a88d2b2b1efd2efc096", + "1962da4e017cd117dea42bc4d6d112a1", "scripts/wgl.xml": "c36001431919e1c435f1215a85f7e1db", "src/libGL/proc_table_wgl_autogen.cpp": diff --git a/scripts/extension_data/intel_630_linux.json b/scripts/extension_data/intel_630_linux.json index c5d9276bd..21c03b19b 100644 --- a/scripts/extension_data/intel_630_linux.json +++ b/scripts/extension_data/intel_630_linux.json @@ -5,6 +5,7 @@ "ShaderLanguageVersion": "OpenGL ES GLSL ES 3.20 (ANGLE 2.1.16847 git hash: a097ee2ea7a9)", "Extensions": [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_client_arrays", "GL_ANGLE_compressed_texture_etc", "GL_ANGLE_copy_texture_3d", diff --git a/scripts/extension_data/intel_630_win10.json b/scripts/extension_data/intel_630_win10.json index ab70e6468..de28299d2 100644 --- a/scripts/extension_data/intel_630_win10.json +++ b/scripts/extension_data/intel_630_win10.json @@ -5,6 +5,7 @@ "ShaderLanguageVersion": "OpenGL ES GLSL ES 3.20 (ANGLE 2.1.16846 git hash: 22d8115a208b)", "Extensions": [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_client_arrays", "GL_ANGLE_compressed_texture_etc", "GL_ANGLE_copy_texture_3d", diff --git a/scripts/extension_data/nvidia_p400_linux.json b/scripts/extension_data/nvidia_p400_linux.json index 8b238a94c..11c0b54be 100644 --- a/scripts/extension_data/nvidia_p400_linux.json +++ b/scripts/extension_data/nvidia_p400_linux.json @@ -5,6 +5,7 @@ "ShaderLanguageVersion": "OpenGL ES GLSL ES 3.20 (ANGLE 2.1.16847 git hash: a097ee2ea7a9)", "Extensions": [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_client_arrays", "GL_ANGLE_copy_texture_3d", "GL_ANGLE_depth_texture", diff --git a/scripts/extension_data/nvidia_p400_win10.json b/scripts/extension_data/nvidia_p400_win10.json index ac98ec941..e0d7ce732 100644 --- a/scripts/extension_data/nvidia_p400_win10.json +++ b/scripts/extension_data/nvidia_p400_win10.json @@ -5,6 +5,7 @@ "ShaderLanguageVersion": "OpenGL ES GLSL ES 3.20 (ANGLE 2.1.16847 git hash: a097ee2ea7a9)", "Extensions": [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_client_arrays", "GL_ANGLE_copy_texture_3d", "GL_ANGLE_depth_texture", diff --git a/scripts/extension_data/pixel_4_android_11.json b/scripts/extension_data/pixel_4_android_11.json index 1dafe4c26..cf73aee0e 100644 --- a/scripts/extension_data/pixel_4_android_11.json +++ b/scripts/extension_data/pixel_4_android_11.json @@ -5,6 +5,7 @@ "ShaderLanguageVersion": "OpenGL ES GLSL ES 3.20 (ANGLE 2.1.16847 git hash: a097ee2ea7a9)", "Extensions": [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_client_arrays", "GL_ANGLE_compressed_texture_etc", "GL_ANGLE_copy_texture_3d", diff --git a/scripts/extension_data/swiftshader_win10.json b/scripts/extension_data/swiftshader_win10.json index 3d7ceee41..8cd8746fc 100644 --- a/scripts/extension_data/swiftshader_win10.json +++ b/scripts/extension_data/swiftshader_win10.json @@ -5,6 +5,7 @@ "ShaderLanguageVersion": "OpenGL ES GLSL ES 3.10 (ANGLE 2.1.16782 git hash: 368c0ce94472)", "Extensions": [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_client_arrays", "GL_ANGLE_compressed_texture_etc", "GL_ANGLE_copy_texture_3d", diff --git a/scripts/extension_data/swiftshader_win10_gles1.json b/scripts/extension_data/swiftshader_win10_gles1.json index 627a19001..d70010afb 100644 --- a/scripts/extension_data/swiftshader_win10_gles1.json +++ b/scripts/extension_data/swiftshader_win10_gles1.json @@ -5,6 +5,7 @@ "ShaderLanguageVersion": "OpenGL ES GLSL ES 1.00 (ANGLE 2.1.16782 git hash: 368c0ce94472)", "Extensions": [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_client_arrays", "GL_ANGLE_compressed_texture_etc", "GL_ANGLE_depth_texture", diff --git a/scripts/registry_xml.py b/scripts/registry_xml.py index 92bdfd6ae..7f415e28e 100644 --- a/scripts/registry_xml.py +++ b/scripts/registry_xml.py @@ -40,6 +40,7 @@ angle_toggleable_extensions = [ angle_requestable_extensions = [ "GL_ANGLE_base_vertex_base_instance", + "GL_ANGLE_base_vertex_base_instance_shader_builtin", "GL_ANGLE_compressed_texture_etc", "GL_ANGLE_copy_texture_3d", "GL_ANGLE_framebuffer_multisample", diff --git a/src/compiler/translator/Compiler.cpp b/src/compiler/translator/Compiler.cpp index aee68b431..2b4f99d0c 100644 --- a/src/compiler/translator/Compiler.cpp +++ b/src/compiler/translator/Compiler.cpp @@ -426,7 +426,8 @@ TIntermBlock *TCompiler::compileTreeImpl(const char *const shaderStrings[], (compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0; if (!glBaseVertexBaseInstanceSupported) { - auto it = mExtensionBehavior.find(TExtension::ANGLE_base_vertex_base_instance); + auto it = + mExtensionBehavior.find(TExtension::ANGLE_base_vertex_base_instance_shader_builtin); if (it != mExtensionBehavior.end()) { mExtensionBehavior.erase(it); @@ -860,7 +861,8 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root, } if (mShaderType == GL_VERTEX_SHADER && - IsExtensionEnabled(mExtensionBehavior, TExtension::ANGLE_base_vertex_base_instance)) + IsExtensionEnabled(mExtensionBehavior, + TExtension::ANGLE_base_vertex_base_instance_shader_builtin)) { if ((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0) { @@ -1158,7 +1160,7 @@ bool TCompiler::compile(const char *const shaderStrings[], (compileOptions & SH_EMULATE_GL_DRAW_ID) != 0; bool lookForBaseVertexBaseInstance = IsExtensionEnabled(mExtensionBehavior, - TExtension::ANGLE_base_vertex_base_instance) && + TExtension::ANGLE_base_vertex_base_instance_shader_builtin) && (compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0; if (lookForDrawID || lookForBaseVertexBaseInstance) @@ -1256,7 +1258,7 @@ void TCompiler::setResourceString() << ":MaxViewsOVR:" << mResources.MaxViewsOVR << ":NV_draw_buffers:" << mResources.NV_draw_buffers << ":ANGLE_multi_draw:" << mResources.ANGLE_multi_draw - << ":ANGLE_base_vertex_base_instance:" << mResources.ANGLE_base_vertex_base_instance + << ":ANGLE_base_vertex_base_instance_shader_builtin:" << mResources.ANGLE_base_vertex_base_instance_shader_builtin << ":APPLE_clip_distance:" << mResources.APPLE_clip_distance << ":OES_texture_cube_map_array:" << mResources.OES_texture_cube_map_array << ":EXT_texture_cube_map_array:" << mResources.EXT_texture_cube_map_array diff --git a/src/compiler/translator/ExtensionBehavior.cpp b/src/compiler/translator/ExtensionBehavior.cpp index 4089aaa39..5476da083 100644 --- a/src/compiler/translator/ExtensionBehavior.cpp +++ b/src/compiler/translator/ExtensionBehavior.cpp @@ -12,47 +12,47 @@ #include -#define LIST_EXTENSIONS(OP) \ - OP(ANGLE_base_vertex_base_instance) \ - OP(ANGLE_multi_draw) \ - OP(ANGLE_texture_multisample) \ - OP(APPLE_clip_distance) \ - OP(ARB_texture_rectangle) \ - OP(ARM_shader_framebuffer_fetch) \ - OP(EXT_blend_func_extended) \ - OP(EXT_clip_cull_distance) \ - OP(EXT_draw_buffers) \ - OP(EXT_frag_depth) \ - OP(EXT_geometry_shader) \ - OP(OES_geometry_shader) \ - OP(OES_shader_io_blocks) \ - OP(EXT_shader_io_blocks) \ - OP(EXT_gpu_shader5) \ - OP(EXT_primitive_bounding_box) \ - OP(EXT_shader_framebuffer_fetch) \ - OP(EXT_shader_framebuffer_fetch_non_coherent) \ - OP(EXT_shader_non_constant_global_initializers) \ - OP(EXT_shader_texture_lod) \ - OP(EXT_shadow_samplers) \ - OP(EXT_tessellation_shader) \ - OP(EXT_texture_buffer) \ - OP(EXT_texture_cube_map_array) \ - OP(EXT_YUV_target) \ - OP(NV_EGL_stream_consumer_external) \ - OP(NV_shader_framebuffer_fetch) \ - OP(NV_shader_noperspective_interpolation) \ - OP(OES_EGL_image_external) \ - OP(OES_EGL_image_external_essl3) \ - OP(OES_sample_variables) \ - OP(OES_shader_multisample_interpolation) \ - OP(OES_shader_image_atomic) \ - OP(OES_standard_derivatives) \ - OP(OES_texture_3D) \ - OP(OES_texture_buffer) \ - OP(OES_texture_cube_map_array) \ - OP(OES_texture_storage_multisample_2d_array) \ - OP(OVR_multiview) \ - OP(OVR_multiview2) \ +#define LIST_EXTENSIONS(OP) \ + OP(ANGLE_base_vertex_base_instance_shader_builtin) \ + OP(ANGLE_multi_draw) \ + OP(ANGLE_texture_multisample) \ + OP(APPLE_clip_distance) \ + OP(ARB_texture_rectangle) \ + OP(ARM_shader_framebuffer_fetch) \ + OP(EXT_blend_func_extended) \ + OP(EXT_clip_cull_distance) \ + OP(EXT_draw_buffers) \ + OP(EXT_frag_depth) \ + OP(EXT_geometry_shader) \ + OP(OES_geometry_shader) \ + OP(OES_shader_io_blocks) \ + OP(EXT_shader_io_blocks) \ + OP(EXT_gpu_shader5) \ + OP(EXT_primitive_bounding_box) \ + OP(EXT_shader_framebuffer_fetch) \ + OP(EXT_shader_framebuffer_fetch_non_coherent) \ + OP(EXT_shader_non_constant_global_initializers) \ + OP(EXT_shader_texture_lod) \ + OP(EXT_shadow_samplers) \ + OP(EXT_tessellation_shader) \ + OP(EXT_texture_buffer) \ + OP(EXT_texture_cube_map_array) \ + OP(EXT_YUV_target) \ + OP(NV_EGL_stream_consumer_external) \ + OP(NV_shader_framebuffer_fetch) \ + OP(NV_shader_noperspective_interpolation) \ + OP(OES_EGL_image_external) \ + OP(OES_EGL_image_external_essl3) \ + OP(OES_sample_variables) \ + OP(OES_shader_multisample_interpolation) \ + OP(OES_shader_image_atomic) \ + OP(OES_standard_derivatives) \ + OP(OES_texture_3D) \ + OP(OES_texture_buffer) \ + OP(OES_texture_cube_map_array) \ + OP(OES_texture_storage_multisample_2d_array) \ + OP(OVR_multiview) \ + OP(OVR_multiview2) \ OP(WEBGL_video_texture) namespace sh diff --git a/src/compiler/translator/ExtensionBehavior.h b/src/compiler/translator/ExtensionBehavior.h index 2b2ad8297..079dc67bc 100644 --- a/src/compiler/translator/ExtensionBehavior.h +++ b/src/compiler/translator/ExtensionBehavior.h @@ -19,7 +19,7 @@ enum class TExtension : uint8_t { UNDEFINED, // Special value used to indicate no extension. - ANGLE_base_vertex_base_instance, + ANGLE_base_vertex_base_instance_shader_builtin, ANGLE_multi_draw, ANGLE_texture_multisample, APPLE_clip_distance, diff --git a/src/compiler/translator/Initialize.cpp b/src/compiler/translator/Initialize.cpp index 37bbe8996..a6f644a67 100644 --- a/src/compiler/translator/Initialize.cpp +++ b/src/compiler/translator/Initialize.cpp @@ -125,9 +125,9 @@ void InitExtensionBehavior(const ShBuiltInResources &resources, TExtensionBehavi { extBehavior[TExtension::ANGLE_multi_draw] = EBhUndefined; } - if (resources.ANGLE_base_vertex_base_instance) + if (resources.ANGLE_base_vertex_base_instance_shader_builtin) { - extBehavior[TExtension::ANGLE_base_vertex_base_instance] = EBhUndefined; + extBehavior[TExtension::ANGLE_base_vertex_base_instance_shader_builtin] = EBhUndefined; } if (resources.WEBGL_video_texture) { diff --git a/src/compiler/translator/ShaderLang.cpp b/src/compiler/translator/ShaderLang.cpp index 849f12453..4af045283 100644 --- a/src/compiler/translator/ShaderLang.cpp +++ b/src/compiler/translator/ShaderLang.cpp @@ -191,47 +191,48 @@ void InitBuiltInResources(ShBuiltInResources *resources) resources->MaxDrawBuffers = 1; // Extensions. - resources->OES_standard_derivatives = 0; - resources->OES_EGL_image_external = 0; - resources->OES_EGL_image_external_essl3 = 0; - resources->NV_EGL_stream_consumer_external = 0; - resources->ARB_texture_rectangle = 0; - resources->EXT_blend_func_extended = 0; - resources->EXT_draw_buffers = 0; - resources->EXT_frag_depth = 0; - resources->EXT_shader_texture_lod = 0; - resources->EXT_shader_framebuffer_fetch = 0; - resources->EXT_shader_framebuffer_fetch_non_coherent = 0; - resources->NV_shader_framebuffer_fetch = 0; - resources->ARM_shader_framebuffer_fetch = 0; - resources->OVR_multiview = 0; - resources->OVR_multiview2 = 0; - resources->EXT_YUV_target = 0; - resources->EXT_geometry_shader = 0; - resources->OES_geometry_shader = 0; - resources->EXT_gpu_shader5 = 0; - resources->OES_shader_io_blocks = 0; - resources->EXT_shader_io_blocks = 0; - resources->EXT_shader_non_constant_global_initializers = 0; - resources->NV_shader_noperspective_interpolation = 0; - resources->OES_texture_storage_multisample_2d_array = 0; - resources->OES_texture_3D = 0; - resources->ANGLE_texture_multisample = 0; - resources->ANGLE_multi_draw = 0; - resources->ANGLE_base_vertex_base_instance = 0; - resources->WEBGL_video_texture = 0; - resources->APPLE_clip_distance = 0; - resources->OES_texture_cube_map_array = 0; - resources->EXT_texture_cube_map_array = 0; - resources->EXT_shadow_samplers = 0; - resources->OES_shader_multisample_interpolation = 0; - resources->NV_draw_buffers = 0; - resources->OES_shader_image_atomic = 0; - resources->EXT_tessellation_shader = 0; - resources->OES_texture_buffer = 0; - resources->EXT_texture_buffer = 0; - resources->OES_sample_variables = 0; - resources->EXT_clip_cull_distance = 0; + resources->OES_standard_derivatives = 0; + resources->OES_EGL_image_external = 0; + resources->OES_EGL_image_external_essl3 = 0; + resources->NV_EGL_stream_consumer_external = 0; + resources->ARB_texture_rectangle = 0; + resources->EXT_blend_func_extended = 0; + resources->EXT_draw_buffers = 0; + resources->EXT_frag_depth = 0; + resources->EXT_shader_texture_lod = 0; + resources->EXT_shader_framebuffer_fetch = 0; + resources->EXT_shader_framebuffer_fetch_non_coherent = 0; + resources->NV_shader_framebuffer_fetch = 0; + resources->ARM_shader_framebuffer_fetch = 0; + resources->OVR_multiview = 0; + resources->OVR_multiview2 = 0; + resources->EXT_YUV_target = 0; + resources->EXT_geometry_shader = 0; + resources->OES_geometry_shader = 0; + resources->EXT_gpu_shader5 = 0; + resources->OES_shader_io_blocks = 0; + resources->EXT_shader_io_blocks = 0; + resources->EXT_shader_non_constant_global_initializers = 0; + resources->NV_shader_noperspective_interpolation = 0; + resources->OES_texture_storage_multisample_2d_array = 0; + resources->OES_texture_3D = 0; + resources->ANGLE_texture_multisample = 0; + resources->ANGLE_multi_draw = 0; + resources->ANGLE_base_vertex_base_instance = 0; + resources->ANGLE_base_vertex_base_instance_shader_builtin = 0; + resources->WEBGL_video_texture = 0; + resources->APPLE_clip_distance = 0; + resources->OES_texture_cube_map_array = 0; + resources->EXT_texture_cube_map_array = 0; + resources->EXT_shadow_samplers = 0; + resources->OES_shader_multisample_interpolation = 0; + resources->NV_draw_buffers = 0; + resources->OES_shader_image_atomic = 0; + resources->EXT_tessellation_shader = 0; + resources->OES_texture_buffer = 0; + resources->EXT_texture_buffer = 0; + resources->OES_sample_variables = 0; + resources->EXT_clip_cull_distance = 0; resources->MaxClipDistances = 8; resources->MaxCullDistances = 8; diff --git a/src/compiler/translator/SymbolTable_ESSL_autogen.cpp b/src/compiler/translator/SymbolTable_ESSL_autogen.cpp index 073be4e2a..a3ac5ae83 100644 --- a/src/compiler/translator/SymbolTable_ESSL_autogen.cpp +++ b/src/compiler/translator/SymbolTable_ESSL_autogen.cpp @@ -2222,30 +2222,30 @@ namespace BuiltInVariable constexpr const unsigned int kArraySize4[1] = {4}; -constexpr const TVariable kangle_BaseInstance(BuiltInId::angle_BaseInstance, - BuiltInName::angle_BaseInstance, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); -constexpr const TVariable kangle_BaseVertex(BuiltInId::angle_BaseVertex, - BuiltInName::angle_BaseVertex, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); -constexpr const TVariable kgl_BaseInstance(BuiltInId::gl_BaseInstance, - BuiltInName::gl_BaseInstance, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); -constexpr const TVariable kgl_BaseVertex(BuiltInId::gl_BaseVertex, - BuiltInName::gl_BaseVertex, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); +constexpr const TVariable kangle_BaseInstance( + BuiltInId::angle_BaseInstance, + BuiltInName::angle_BaseInstance, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); +constexpr const TVariable kangle_BaseVertex( + BuiltInId::angle_BaseVertex, + BuiltInName::angle_BaseVertex, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); +constexpr const TVariable kgl_BaseInstance( + BuiltInId::gl_BaseInstance, + BuiltInName::gl_BaseInstance, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); +constexpr const TVariable kgl_BaseVertex( + BuiltInId::gl_BaseVertex, + BuiltInName::gl_BaseVertex, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); constexpr const TVariable kgl_DrawID(BuiltInId::gl_DrawID, BuiltInName::gl_DrawID, SymbolType::BuiltIn, @@ -21013,13 +21013,25 @@ constexpr SymbolRule kRules[] = { Rule::Get(&BuiltInVariable::kgl_VertexID), Rule::Get( &BuiltInVariable::kgl_DrawID), - Rule::Get( + Rule::Get( &BuiltInVariable::kgl_BaseVertex), - Rule::Get( + Rule::Get( &BuiltInVariable::kgl_BaseInstance), - Rule::Get( + Rule::Get( &BuiltInVariable::kangle_BaseVertex), - Rule::Get( + Rule::Get( &BuiltInVariable::kangle_BaseInstance), Rule::Get(&BuiltInVariable::kgl_NumWorkGroups), Rule::Get(&BuiltInVariable::kgl_WorkGroupSize), diff --git a/src/compiler/translator/SymbolTable_autogen.cpp b/src/compiler/translator/SymbolTable_autogen.cpp index 3575537c8..f074415a3 100644 --- a/src/compiler/translator/SymbolTable_autogen.cpp +++ b/src/compiler/translator/SymbolTable_autogen.cpp @@ -3419,30 +3419,30 @@ namespace BuiltInVariable constexpr const unsigned int kArraySize4[1] = {4}; -constexpr const TVariable kangle_BaseInstance(BuiltInId::angle_BaseInstance, - BuiltInName::angle_BaseInstance, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); -constexpr const TVariable kangle_BaseVertex(BuiltInId::angle_BaseVertex, - BuiltInName::angle_BaseVertex, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); -constexpr const TVariable kgl_BaseInstance(BuiltInId::gl_BaseInstance, - BuiltInName::gl_BaseInstance, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); -constexpr const TVariable kgl_BaseVertex(BuiltInId::gl_BaseVertex, - BuiltInName::gl_BaseVertex, - SymbolType::BuiltIn, - std::array{ - {TExtension::ANGLE_base_vertex_base_instance}}, - StaticType::Get()); +constexpr const TVariable kangle_BaseInstance( + BuiltInId::angle_BaseInstance, + BuiltInName::angle_BaseInstance, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); +constexpr const TVariable kangle_BaseVertex( + BuiltInId::angle_BaseVertex, + BuiltInName::angle_BaseVertex, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); +constexpr const TVariable kgl_BaseInstance( + BuiltInId::gl_BaseInstance, + BuiltInName::gl_BaseInstance, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); +constexpr const TVariable kgl_BaseVertex( + BuiltInId::gl_BaseVertex, + BuiltInName::gl_BaseVertex, + SymbolType::BuiltIn, + std::array{{TExtension::ANGLE_base_vertex_base_instance_shader_builtin}}, + StaticType::Get()); constexpr const TVariable kgl_DrawID(BuiltInId::gl_DrawID, BuiltInName::gl_DrawID, SymbolType::BuiltIn, @@ -34597,13 +34597,25 @@ constexpr SymbolRule kRules[] = { Rule::Get(&BuiltInVariable::kgl_VertexID), Rule::Get( &BuiltInVariable::kgl_DrawID), - Rule::Get( + Rule::Get( &BuiltInVariable::kgl_BaseVertex), - Rule::Get( + Rule::Get( &BuiltInVariable::kgl_BaseInstance), - Rule::Get( + Rule::Get( &BuiltInVariable::kangle_BaseVertex), - Rule::Get( + Rule::Get( &BuiltInVariable::kangle_BaseInstance), Rule::Get(&BuiltInVariable::kgl_NumWorkGroups), Rule::Get(&BuiltInVariable::kgl_NumWorkGroups), diff --git a/src/compiler/translator/TranslatorESSL.cpp b/src/compiler/translator/TranslatorESSL.cpp index f31523357..9136f7e96 100644 --- a/src/compiler/translator/TranslatorESSL.cpp +++ b/src/compiler/translator/TranslatorESSL.cpp @@ -165,7 +165,7 @@ void TranslatorESSL::writeExtensionBehavior(ShCompileOptions compileOptions) ASSERT((compileOptions & SH_EMULATE_GL_DRAW_ID) != 0); continue; } - else if (iter->first == TExtension::ANGLE_base_vertex_base_instance) + else if (iter->first == TExtension::ANGLE_base_vertex_base_instance_shader_builtin) { // Don't emit anything. This extension is emulated ASSERT((compileOptions & SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE) != 0); diff --git a/src/compiler/translator/builtin_variables.json b/src/compiler/translator/builtin_variables.json index b357ab2a8..4523df546 100644 --- a/src/compiler/translator/builtin_variables.json +++ b/src/compiler/translator/builtin_variables.json @@ -1091,7 +1091,7 @@ "variables":{ "gl_BaseVertex":{ "essl_level":"ESSL3_BUILTINS", - "essl_extension":"ANGLE_base_vertex_base_instance", + "essl_extension":"ANGLE_base_vertex_base_instance_shader_builtin", "type":{ "basic":"Int", "precision":"High", @@ -1100,7 +1100,7 @@ }, "gl_BaseInstance":{ "essl_level":"ESSL3_BUILTINS", - "essl_extension":"ANGLE_base_vertex_base_instance", + "essl_extension":"ANGLE_base_vertex_base_instance_shader_builtin", "type":{ "basic":"Int", "precision":"High", @@ -1109,7 +1109,7 @@ }, "angle_BaseVertex":{ "essl_level":"COMMON_BUILTINS", - "essl_extension":"ANGLE_base_vertex_base_instance", + "essl_extension":"ANGLE_base_vertex_base_instance_shader_builtin", "type":{ "basic":"Int", "precision":"High", @@ -1118,7 +1118,7 @@ }, "angle_BaseInstance":{ "essl_level":"COMMON_BUILTINS", - "essl_extension":"ANGLE_base_vertex_base_instance", + "essl_extension":"ANGLE_base_vertex_base_instance_shader_builtin", "type":{ "basic":"Int", "precision":"High", diff --git a/src/libANGLE/Compiler.cpp b/src/libANGLE/Compiler.cpp index 7dd1c25af..4a7f1a8fc 100644 --- a/src/libANGLE/Compiler.cpp +++ b/src/libANGLE/Compiler.cpp @@ -112,11 +112,12 @@ Compiler::Compiler(rx::GLImplFactory *implFactory, const State &state, egl::Disp mResources.EXT_shader_io_blocks = extensions.shaderIoBlocksEXT; mResources.OES_texture_storage_multisample_2d_array = extensions.textureStorageMultisample2dArrayOES; - mResources.OES_texture_3D = extensions.texture3DOES; - mResources.ANGLE_texture_multisample = extensions.textureMultisampleANGLE; - mResources.ANGLE_multi_draw = extensions.multiDrawANGLE; - mResources.ANGLE_base_vertex_base_instance = extensions.baseVertexBaseInstanceANGLE; - mResources.APPLE_clip_distance = extensions.clipDistanceAPPLE; + mResources.OES_texture_3D = extensions.texture3DOES; + mResources.ANGLE_texture_multisample = extensions.textureMultisampleANGLE; + mResources.ANGLE_multi_draw = extensions.multiDrawANGLE; + mResources.ANGLE_base_vertex_base_instance_shader_builtin = + extensions.baseVertexBaseInstanceShaderBuiltinANGLE; + mResources.APPLE_clip_distance = extensions.clipDistanceAPPLE; // OES_shader_multisample_interpolation mResources.OES_shader_multisample_interpolation = extensions.shaderMultisampleInterpolationOES; mResources.OES_shader_image_atomic = extensions.shaderImageAtomicOES; diff --git a/src/libANGLE/Context_gles_ext_autogen.h b/src/libANGLE/Context_gles_ext_autogen.h index a6daace46..13853c88b 100644 --- a/src/libANGLE/Context_gles_ext_autogen.h +++ b/src/libANGLE/Context_gles_ext_autogen.h @@ -312,6 +312,7 @@ PrimitiveMode modePacked, const GLsizei *counts, DrawElementsType typePacked, \ const GLvoid *const *indices, const GLsizei *instanceCounts, const GLint *baseVertices, \ const GLuint *baseInstances, GLsizei drawcount); \ + /* GL_ANGLE_base_vertex_base_instance_shader_builtin */ \ /* GL_ANGLE_client_arrays */ \ /* GL_ANGLE_compressed_texture_etc */ \ /* GL_ANGLE_copy_texture_3d */ \ diff --git a/src/libANGLE/Program.cpp b/src/libANGLE/Program.cpp index fc9f4c09d..67797d551 100644 --- a/src/libANGLE/Program.cpp +++ b/src/libANGLE/Program.cpp @@ -4444,7 +4444,7 @@ void Program::postResolveLink(const gl::Context *context) mState.mDrawIDLocation = getUniformLocation("gl_DrawID").value; } - if (context->getExtensions().baseVertexBaseInstanceANGLE) + if (context->getExtensions().baseVertexBaseInstanceShaderBuiltinANGLE) { mState.mBaseVertexLocation = getUniformLocation("gl_BaseVertex").value; mState.mBaseInstanceLocation = getUniformLocation("gl_BaseInstance").value; diff --git a/src/libANGLE/Program.h b/src/libANGLE/Program.h index 967c4481e..f66417d8f 100644 --- a/src/libANGLE/Program.h +++ b/src/libANGLE/Program.h @@ -398,7 +398,7 @@ class ProgramState final : angle::NonCopyable // GL_ANGLE_multi_draw int mDrawIDLocation; - // GL_ANGLE_base_vertex_base_instance + // GL_ANGLE_base_vertex_base_instance_shader_builtin int mBaseVertexLocation; int mBaseInstanceLocation; // Cached value of base vertex and base instance diff --git a/src/libANGLE/Shader.cpp b/src/libANGLE/Shader.cpp index 689bc894b..ec6f377f9 100644 --- a/src/libANGLE/Shader.cpp +++ b/src/libANGLE/Shader.cpp @@ -342,8 +342,7 @@ void Shader::compile(const Context *context) mState.mCompileStatus = CompileStatus::COMPILE_REQUESTED; mBoundCompiler.set(context, context->getCompiler()); - ShCompileOptions options = (SH_OBJECT_CODE | SH_VARIABLES | SH_EMULATE_GL_DRAW_ID | - SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE); + ShCompileOptions options = (SH_OBJECT_CODE | SH_VARIABLES | SH_EMULATE_GL_DRAW_ID); // Add default options to WebGL shaders to prevent unexpected behavior during // compilation. @@ -355,6 +354,12 @@ void Shader::compile(const Context *context) options |= SH_ENFORCE_PACKING_RESTRICTIONS; options |= SH_INIT_SHARED_VARIABLES; } + else + { + // Per https://github.com/KhronosGroup/WebGL/pull/3278 gl_BaseVertex/gl_BaseInstance are + // removed from WebGL + options |= SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE; + } // Some targets (e.g. D3D11 Feature Level 9_3 and below) do not support non-constant loop // indexes in fragment shaders. Shader compilation will fail. To provide a better error diff --git a/src/libANGLE/gles_extensions_autogen.cpp b/src/libANGLE/gles_extensions_autogen.cpp index 617e275ef..2db7f6199 100644 --- a/src/libANGLE/gles_extensions_autogen.cpp +++ b/src/libANGLE/gles_extensions_autogen.cpp @@ -194,6 +194,7 @@ const ExtensionInfoMap &GetExtensionInfoMap() // ANGLE unofficial extension strings // ---------------------------------- map["GL_ANGLE_base_vertex_base_instance"] = enableableExtension(&Extensions::baseVertexBaseInstanceANGLE); + map["GL_ANGLE_base_vertex_base_instance_shader_builtin"] = enableableExtension(&Extensions::baseVertexBaseInstanceShaderBuiltinANGLE); map["GL_CHROMIUM_bind_generates_resource"] = esOnlyExtension(&Extensions::bindGeneratesResourceCHROMIUM); map["GL_CHROMIUM_bind_uniform_location"] = esOnlyExtension(&Extensions::bindUniformLocationCHROMIUM); map["GL_ANGLE_client_arrays"] = esOnlyExtension(&Extensions::clientArraysANGLE); diff --git a/src/libANGLE/gles_extensions_autogen.h b/src/libANGLE/gles_extensions_autogen.h index fbefcb66a..65f913d29 100644 --- a/src/libANGLE/gles_extensions_autogen.h +++ b/src/libANGLE/gles_extensions_autogen.h @@ -529,6 +529,9 @@ struct Extensions // GL_ANGLE_base_vertex_base_instance bool baseVertexBaseInstanceANGLE = false; + // GL_ANGLE_base_vertex_base_instance_shader_builtin + bool baseVertexBaseInstanceShaderBuiltinANGLE = false; + // GL_CHROMIUM_bind_generates_resource bool bindGeneratesResourceCHROMIUM = false; diff --git a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp index c300f0847..a7e690769 100644 --- a/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp +++ b/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp @@ -1648,10 +1648,11 @@ void GenerateCaps(ID3D11Device *device, extensions->provokingVertexANGLE = true; extensions->blendFuncExtendedEXT = true; // http://anglebug.com/4926 - extensions->texture3DOES = false; - extensions->baseVertexBaseInstanceANGLE = true; - extensions->drawElementsBaseVertexOES = true; - extensions->drawElementsBaseVertexEXT = true; + extensions->texture3DOES = false; + extensions->baseVertexBaseInstanceANGLE = true; + extensions->baseVertexBaseInstanceShaderBuiltinANGLE = true; + extensions->drawElementsBaseVertexOES = true; + extensions->drawElementsBaseVertexEXT = true; if (!strstr(description, "Adreno")) { extensions->multisampledRenderToTextureEXT = true; diff --git a/src/libANGLE/renderer/gl/renderergl_utils.cpp b/src/libANGLE/renderer/gl/renderergl_utils.cpp index 138c8a5b5..2cbb5067f 100644 --- a/src/libANGLE/renderer/gl/renderergl_utils.cpp +++ b/src/libANGLE/renderer/gl/renderergl_utils.cpp @@ -1692,6 +1692,9 @@ void GenerateCaps(const FunctionsGL *functions, functions->hasGLESExtension("GL_OES_draw_elements_base_vertex") || functions->hasGLESExtension("GL_EXT_draw_elements_base_vertex"); + // ANGLE_base_vertex_base_instance_shader_builtin + extensions->baseVertexBaseInstanceShaderBuiltinANGLE = extensions->baseVertexBaseInstanceANGLE; + // OES_draw_elements_base_vertex extensions->drawElementsBaseVertexOES = functions->isAtLeastGL(gl::Version(3, 2)) || functions->isAtLeastGLES(gl::Version(3, 2)) || diff --git a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp index 36e050df7..10ca63004 100644 --- a/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp +++ b/src/libANGLE/renderer/vulkan/vk_caps_utils.cpp @@ -382,7 +382,8 @@ void RendererVk::ensureCapsInitialized() const mNativeExtensions.multiDrawIndirectEXT = true; // Enable ANGLE_base_vertex_base_instance - mNativeExtensions.baseVertexBaseInstanceANGLE = true; + mNativeExtensions.baseVertexBaseInstanceANGLE = true; + mNativeExtensions.baseVertexBaseInstanceShaderBuiltinANGLE = true; // Enable OES/EXT_draw_elements_base_vertex mNativeExtensions.drawElementsBaseVertexOES = true; diff --git a/src/tests/compiler_tests/EmulateGLBaseVertexBaseInstance_test.cpp b/src/tests/compiler_tests/EmulateGLBaseVertexBaseInstance_test.cpp index a196004f0..10074106a 100644 --- a/src/tests/compiler_tests/EmulateGLBaseVertexBaseInstance_test.cpp +++ b/src/tests/compiler_tests/EmulateGLBaseVertexBaseInstance_test.cpp @@ -21,17 +21,19 @@ class EmulateGLBaseVertexBaseInstanceTest : public MatchOutputCodeTest EmulateGLBaseVertexBaseInstanceTest() : MatchOutputCodeTest(GL_VERTEX_SHADER, SH_VARIABLES, SH_GLSL_COMPATIBILITY_OUTPUT) { - getResources()->ANGLE_base_vertex_base_instance = 1; + getResources()->ANGLE_base_vertex_base_instance_shader_builtin = 1; } protected: - void CheckCompileFailure(const std::string &shaderString, const char *expectedError = nullptr) + void CheckCompileFailure(const std::string &shaderString, + const char *expectedError = nullptr, + ShCompileOptions compileOptions = SH_VARIABLES) { std::string translatedCode; std::string infoLog; bool success = compileTestShader(GL_VERTEX_SHADER, SH_GLES3_SPEC, SH_GLSL_COMPATIBILITY_OUTPUT, shaderString, getResources(), - SH_VARIABLES, &translatedCode, &infoLog); + compileOptions, &translatedCode, &infoLog); EXPECT_FALSE(success); if (expectedError) { @@ -45,25 +47,39 @@ class EmulateGLBaseVertexBaseInstanceTest : public MatchOutputCodeTest TEST_F(EmulateGLBaseVertexBaseInstanceTest, RequiresEmulation) { CheckCompileFailure( - "#extension GL_ANGLE_base_vertex_base_instance : require\n" + "#version 300 es\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" "void main() {\n" " gl_Position = vec4(float(gl_BaseVertex), float(gl_BaseInstance), 0.0, 1.0);\n" "}\n", "extension is not supported"); } -// Check that compiling with emulation with gl_BaseVertex and gl_BaseInstance works with different -// shader versions +// Check that compiling with emulation with gl_BaseVertex and gl_BaseInstance works TEST_F(EmulateGLBaseVertexBaseInstanceTest, CheckCompile) { const std::string shaderString = + "#version 300 es\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" + "void main() {\n" + " gl_Position = vec4(float(gl_BaseVertex), float(gl_BaseInstance), 0.0, 1.0);\n" + "}\n"; + + compile(shaderString, SH_OBJECT_CODE | SH_VARIABLES | SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE); +} + +// Check that compiling with the old extension doesn't work +TEST_F(EmulateGLBaseVertexBaseInstanceTest, CheckCompileOldExtension) +{ + const std::string shaderString = + "#version 300 es\n" "#extension GL_ANGLE_base_vertex_base_instance : require\n" "void main() {\n" " gl_Position = vec4(float(gl_BaseVertex), float(gl_BaseInstance), 0.0, 1.0);\n" "}\n"; - compile("#version 300 es\n" + shaderString, - SH_OBJECT_CODE | SH_VARIABLES | SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE); + CheckCompileFailure(shaderString, "extension is not supported", + SH_OBJECT_CODE | SH_VARIABLES | SH_EMULATE_GL_BASE_VERTEX_BASE_INSTANCE); } // Check that gl_BaseVertex and gl_BaseInstance is properly emulated @@ -81,7 +97,7 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, EmulatesUniform) const std::string &shaderString = "#version 300 es\n" - "#extension GL_ANGLE_base_vertex_base_instance : require\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" "void main() {\n" " gl_Position = vec4(float(gl_BaseVertex), float(gl_BaseInstance), 0.0, 1.0);\n" "}\n"; @@ -92,7 +108,7 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, EmulatesUniform) EXPECT_TRUE(foundInCode("angle_BaseVertex")); EXPECT_TRUE(notFoundInCode("gl_BaseInstance")); EXPECT_TRUE(foundInCode("angle_BaseInstance")); - EXPECT_TRUE(notFoundInCode("GL_ANGLE_base_vertex_base_instance")); + EXPECT_TRUE(notFoundInCode("GL_ANGLE_base_vertex_base_instance_shader_builtin")); EXPECT_TRUE(foundInCode(SH_GLSL_COMPATIBILITY_OUTPUT, "uniform int angle_BaseVertex")); EXPECT_TRUE(foundInCode(SH_GLSL_COMPATIBILITY_OUTPUT, "uniform int angle_BaseInstance")); @@ -144,7 +160,7 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, DisallowsUserDefinedGLDrawID) // Check that it is not permitted with the extension CheckCompileFailure( "#version 300 es\n" - "#extension GL_ANGLE_base_vertex_base_instance : require\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" "uniform int gl_BaseVertex;\n" "void main() {\n" " gl_Position = vec4(float(gl_BaseVertex), 0.0, 0.0, 1.0);\n" @@ -153,7 +169,7 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, DisallowsUserDefinedGLDrawID) CheckCompileFailure( "#version 300 es\n" - "#extension GL_ANGLE_base_vertex_base_instance : require\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" "uniform int gl_BaseInstance;\n" "void main() {\n" " gl_Position = vec4(float(gl_BaseInstance), 0.0, 0.0, 1.0);\n" @@ -162,7 +178,7 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, DisallowsUserDefinedGLDrawID) CheckCompileFailure( "#version 300 es\n" - "#extension GL_ANGLE_base_vertex_base_instance : require\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" "void main() {\n" " int gl_BaseVertex = 0;\n" " gl_Position = vec4(float(gl_BaseVertex), 0.0, 0.0, 1.0);\n" @@ -171,7 +187,7 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, DisallowsUserDefinedGLDrawID) CheckCompileFailure( "#version 300 es\n" - "#extension GL_ANGLE_base_vertex_base_instance : require\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" "void main() {\n" " int gl_BaseInstance = 0;\n" " gl_Position = vec4(float(gl_BaseInstance), 0.0, 0.0, 1.0);\n" @@ -195,7 +211,7 @@ TEST_F(EmulateGLBaseVertexBaseInstanceTest, AllowsUserDefinedANGLEDrawID) const std::string &shaderString = "#version 300 es\n" - "#extension GL_ANGLE_base_vertex_base_instance : require\n" + "#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n" "uniform int angle_BaseVertex;\n" "uniform int angle_BaseInstance;\n" "void main() {\n" diff --git a/src/tests/gl_tests/DrawBaseVertexBaseInstanceTest.cpp b/src/tests/gl_tests/DrawBaseVertexBaseInstanceTest.cpp index c08f14c02..1acffa1fb 100644 --- a/src/tests/gl_tests/DrawBaseVertexBaseInstanceTest.cpp +++ b/src/tests/gl_tests/DrawBaseVertexBaseInstanceTest.cpp @@ -175,7 +175,7 @@ class DrawBaseVertexBaseInstanceTest std::stringstream shader; shader << ("#version 300 es\n") << (isMultiDraw ? "#extension GL_ANGLE_multi_draw : require\n" : "") - << ("#extension GL_ANGLE_base_vertex_base_instance : require\n") + << ("#extension GL_ANGLE_base_vertex_base_instance_shader_builtin : require\n") << "#define kCountX " << kCountX << "\n" << "#define kCountY " << kCountY << "\n" << R"( @@ -432,6 +432,11 @@ void main() return false; } + if (IsGLExtensionRequestable("GL_ANGLE_base_vertex_base_instance_shader_builtin")) + { + glRequestExtensionANGLE("GL_ANGLE_base_vertex_base_instance_shader_builtin"); + } + return true; } diff --git a/src/tests/gl_tests/DrawBaseVertexVariantsTest.cpp b/src/tests/gl_tests/DrawBaseVertexVariantsTest.cpp index dbfc6d03f..b603a1b65 100644 --- a/src/tests/gl_tests/DrawBaseVertexVariantsTest.cpp +++ b/src/tests/gl_tests/DrawBaseVertexVariantsTest.cpp @@ -339,7 +339,12 @@ void main() return false; } } - return EnsureGLExtensionEnabled("GL_ANGLE_base_vertex_base_instance"); + if (!EnsureGLExtensionEnabled("GL_ANGLE_base_vertex_base_instance")) + { + return false; + } + + return EnsureGLExtensionEnabled("GL_ANGLE_base_vertex_base_instance_shader_builtin"); } bool requestNativeBaseVertexExtensions()