diff options
| author | ArielG-NV <159081215+ArielG-NV@users.noreply.github.com> | 2024-04-03 09:30:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-03 09:30:46 -0400 |
| commit | a697b2c6707ee699cb734a03fa529dd214ac66cc (patch) | |
| tree | 1b68f4267159828092b512361faff4729510ea39 /source/slang/slang-capabilities.capdef | |
| parent | c0482ec12d683e53aca56543b620a4ec02082e29 (diff) | |
Implement 8.14-8.19 of OpenGL-GLSL specification
The following PR implements 8.14-8.19 of the [OpenGL-GLSL specification](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf).
Fully implements all functions and built-in type's, resolves https://github.com/shader-slang/slang/issues/3692 for GLSL & SPRI-V targets.
_Notes:_
Testing Tools:
* Fragment shaders cannot test computational results. Only OpCodes are checked for proper emitting.
Implementation Notes:
* SubpassInput requires an unknown image format.
* SubpassInput is disjoint from TextureType: __SubpassImpl (.slang) & SubpassInputType (Compiler) to reduce code generation required.
* SubpassInput required an additional input layout modifier, input_attachment_index, this was added as a new parameter binding attribute. Since the following qualifiers can overlap with different resources (`layout(input_attachment_index = 0, binding = 0, set = 0)`) input_attachment_index is checked for overlapping resource bindings separately from other qualifiers with `LayoutResourceKind::InputAttachmentIndex`.
* `GLSLInputAttachmentIndexLayoutModifier` was added to enforce function parameters only accepting `in` decorated variables.
* `in` decorated variables needed to have emitting modified to allow directly emitting the variable into function calls if used as a parameter, normally Slang has a "global variable" shadow as a "global parameter" through a copy. This does not work and is solved using `GlobalVariableShadowingGlobalParameterDecoration` to build a relationship of "global variable" to "global parameter", we then resolve this relationship and replace "global variable" uses later in compile.
* `AtomicCounterMemory` memory-constraint requires `OpCapability AtomicStorage`, `AtomicStorage` is invalid for Vulkan targets. glslang outputs for `barrier`, `memoryBarrier`, and `groupMemoryBarrier` `AtomicCounterMemory` as a memory constraint. This compiles as valid SPIR-V for Vulkan since `OpCapability AtomicStorage` is not declared. This behavior of glslang is undefined as per [3.31.Capability of the SPIR-V specification](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_capability). We will omit `AtomicCounterMemory` from our barrier calls.
Diffstat (limited to 'source/slang/slang-capabilities.capdef')
| -rw-r--r-- | source/slang/slang-capabilities.capdef | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/source/slang/slang-capabilities.capdef b/source/slang/slang-capabilities.capdef index b8d97d021..b83585c5c 100644 --- a/source/slang/slang-capabilities.capdef +++ b/source/slang/slang-capabilities.capdef @@ -65,7 +65,7 @@ alias any_target = hlsl | glsl | c | cpp | cuda | spirv; alias any_textual_target = hlsl | glsl | c | cpp | cuda; alias any_gfx_target = hlsl | glsl | spirv; alias any_cpp_target = cpp | cuda; - +alias glsl_spirv = glsl | spirv; // Capabilities that stand for target spirv version for GLSL backend. // These are not compilation targets. def glsl_spirv_1_0 : glsl; @@ -109,6 +109,10 @@ def _sm_6_7 : _sm_6_6; def hlsl_nvapi : hlsl; +// stage alias +alias tess_control = hull; +alias tess_eval = domain; + // SPIRV extensions. def SPV_EXT_fragment_shader_interlock : spirv_1_0; @@ -249,6 +253,12 @@ alias GL_NV_ray_tracing = GL_EXT_ray_tracing; // Define feature names +alias tess_control_gfx = tess_control + any_gfx_target; +alias tess_eval_gfx = tess_control + any_gfx_target; +alias fragment_gfx = fragment + any_gfx_target; +alias compute_gfx = compute + any_gfx_target; +alias compute_tess_gfx = compute_gfx + tess_control_gfx + tess_eval_gfx; + alias nvapi = hlsl_nvapi; alias raytracing = GL_EXT_ray_tracing | _sm_6_5 | cuda; alias raytracing_pos = GL_EXT_ray_tracing + GL_EXT_ray_tracing_position_fetch | _sm_6_5 | cuda; @@ -269,8 +279,12 @@ alias groupnonuniform = GL_KHR_shader_subgroup_ballot + GL_KHR_shader_subgroup_s + GL_KHR_shader_subgroup_arithmetic + GL_KHR_shader_subgroup_quad + GL_KHR_shader_subgroup_vote | _sm_6_0 | cuda; alias fragmentshaderbarycentric = GL_EXT_fragment_shader_barycentric | _sm_6_1; - - +alias fragmentprocessing = fragment_gfx + glsl_spirv | fragment + _sm_5_0; +alias fragmentprocessing_derivativecontrol = fragmentprocessing + GL_ARB_derivative_control; +alias shadermemorycontrol = glsl | spirv_1_0 | _sm_5_0; +alias shadermemorycontrol_compute = compute_gfx + shadermemorycontrol; +alias subpass = fragment_gfx; +alias shaderinvocationgroup = GL_KHR_shader_subgroup_vote + glsl | spirv_1_3 | _sm_6_0; // Define what each HLSL shader model means on different targets. @@ -371,9 +385,6 @@ alias GLSL_440 = glsl + sm_6_0 | spirv_1_5 + sm_6_0; alias GLSL_450 = glsl + sm_6_3 | spirv_1_5 + sm_6_3; alias GLSL_460 = glsl_spirv_1_5 + all | spirv_1_5 + all; -alias tess_control = hull; -alias tess_eval = domain; - alias DX_4_0 = sm_4_0; alias DX_4_1 = sm_4_1; alias DX_5_0 = sm_5_0; |
