Skip to content

Commit

Permalink
Publish GLSL_ARM_shader_core_builtins
Browse files Browse the repository at this point in the history
Change-Id: I33988b29010e274d0e5d906a17f3fed60b952486
Signed-off-by: Kevin Petit <kevin.petit@arm.com>
  • Loading branch information
kpet committed Mar 1, 2023
1 parent 3d48ca2 commit 84920af
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ which normatively accepts SPIR-V but does not normatively consume a high-level s
- [GL_EXT_mesh_shader](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_mesh_shader.txt)
- [GL_EXT_opacity_micromap](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_opacity_micromap.txt)
- [GL_NV_shader_invocation_reorder](https://github.com/KhronosGroup/GLSL/blob/master/extensions/nv/GLSL_NV_shader_invocation_reorder.txt)
- [GL_ARM_shader_core_builtins](https://github.com/KhronosGroup/GLSL/blob/master/extensions/arm/GLSL_ARM_shader_core_builtins.txt)
113 changes: 113 additions & 0 deletions extensions/arm/GLSL_ARM_shader_core_builtins.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
Name

ARM_shader_core_builtins

Name Strings

GL_ARM_shader_core_builtins

Contact

Kevin Petit (kevin.petit 'at' arm.com), Arm

Contributors

Kevin Petit, Arm
Christopher Gautier, Arm

Status

Complete

Version

Last Modified Date: 2022-07-20
Revision: 1

Number

N/A

Dependencies

This extension can be applied to OpenGL GLSL versions 1.40
(#version 140) and higher.

This extension can be applied to OpenGL ES ESSL versions 3.0
(#version 300) and higher.

This extension is written against revision 7 of the OpenGL Shading Language
version 4.50, dated May 9, 2017.

This extension interacts with revision 36 of the GL_KHR_vulkan_glsl
extension, dated February 13, 2017.

Overview

This extension adds builtin variables that enable shaders to query
information about the cores and warps they are running on.

Mapping to SPIR-V
-----------------

For informational purposes (non-specification), the following is an
expected way for an implementation to map GLSL constructs to SPIR-V
constructs:

gl_CoreIDARM -> CoreIDARM decorated OpVariable
gl_CoreCountARM -> CoreCountARM decorated OpVariable
gl_CoreMaxIDARM -> CoreMaxIDARM decorated OpVariable
gl_WarpIDARM -> WarpIDARM decorated OpVariable
gl_WarpMaxIDARM -> WarpMaxIDARM decorated OpVariable

Modifications to The OpenGL Shading Language Specification, Version 4.50
(Revision 7)

Including the following line in a shader can be used to control the
language features described in this extension:

#extension GL_ARM_shader_core_builtins : <behavior>

where <behavior> is as specified in section 3.3.

New preprocessor #defines are added to the OpenGL Shading Language:

#define GL_ARM_shader_core_builtins 1

Modify Section 7.1, Built-in Languages Variable, p. 122

(Add to the list of built-in variables for the compute, vertex,
geometry, tessellation control, tessellation evaluation, fragment,
ray generation, intersection, any-hit, closest-hit, miss, and callable
shading languages)

highp in uint gl_CoreIDARM;
highp in uint gl_CoreCountARM;
highp in uint gl_CoreMaxIDARM;
highp in uint gl_WarpIDARM;
highp in uint gl_WarpMaxIDARM;

The variable gl_CoreIDARM holds the ID of the shader core the executing
invocation is running on.
This variable is in the range 0 to gl_CoreMaxIDARM.

The variable gl_CoreCountARM holds the number of shader cores on the device.

The variable gl_CoreMaxIDARM holds the max ID of any shader core on the
device.

The variable gl_WarpIDARM holds the warp ID of the executing invocation.
This variable is in the range 0 to gl_MaxWarpIDARM.

The variable gl_WarpMaxIDARM holds the max ID that can be assigned to a
warp on the core the executing invocation is running on.

Issues

None.

Revision History

Rev. Date Author Changes
---- ---------- -------- -----------------------------------------
1 2022-07-20 Kevin Petit Internal revisions.

0 comments on commit 84920af

Please sign in to comment.