summaryrefslogtreecommitdiff
path: root/slang.h
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-04-03 09:30:46 -0400
committerGitHub <noreply@github.com>2024-04-03 09:30:46 -0400
commita697b2c6707ee699cb734a03fa529dd214ac66cc (patch)
tree1b68f4267159828092b512361faff4729510ea39 /slang.h
parentc0482ec12d683e53aca56543b620a4ec02082e29 (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 'slang.h')
-rw-r--r--slang.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/slang.h b/slang.h
index 0c3c41fe0..4014be401 100644
--- a/slang.h
+++ b/slang.h
@@ -2149,6 +2149,7 @@ extern "C"
SLANG_BYTE_ADDRESS_BUFFER = 0x07,
SLANG_RESOURCE_UNKNOWN = 0x08,
SLANG_ACCELERATION_STRUCTURE = 0x09,
+ SLANG_TEXTURE_SUBPASS = 0x0A,
SLANG_RESOURCE_EXT_SHAPE_MASK = 0xF0,
@@ -2163,6 +2164,7 @@ extern "C"
SLANG_TEXTURE_2D_MULTISAMPLE = SLANG_TEXTURE_2D | SLANG_TEXTURE_MULTISAMPLE_FLAG,
SLANG_TEXTURE_2D_MULTISAMPLE_ARRAY = SLANG_TEXTURE_2D | SLANG_TEXTURE_MULTISAMPLE_FLAG | SLANG_TEXTURE_ARRAY_FLAG,
+ SLANG_TEXTURE_SUBPASS_MULTISAMPLE = SLANG_TEXTURE_SUBPASS | SLANG_TEXTURE_MULTISAMPLE_FLAG,
};
#endif
typedef unsigned int SlangResourceAccessIntegral;
@@ -2251,6 +2253,9 @@ extern "C"
// The register space offset for the sub-elements that occupies register spaces.
SLANG_PARAMETER_CATEGORY_SUB_ELEMENT_REGISTER_SPACE,
+ // The input_attachment_index subpass occupancy tracker
+ SLANG_PARAMETER_CATEGORY_SUBPASS,
+
//
SLANG_PARAMETER_CATEGORY_COUNT,
@@ -2258,6 +2263,7 @@ extern "C"
// DEPRECATED:
SLANG_PARAMETER_CATEGORY_VERTEX_INPUT = SLANG_PARAMETER_CATEGORY_VARYING_INPUT,
SLANG_PARAMETER_CATEGORY_FRAGMENT_OUTPUT = SLANG_PARAMETER_CATEGORY_VARYING_OUTPUT,
+ SLANG_PARAMETER_CATEGORY_COUNT_V1 = SLANG_PARAMETER_CATEGORY_SUBPASS,
};
/** Types of API-managed bindings that a parameter might use.
@@ -2813,6 +2819,8 @@ namespace slang
SubElementRegisterSpace = SLANG_PARAMETER_CATEGORY_SUB_ELEMENT_REGISTER_SPACE,
+ InputAttachmentIndex = SLANG_PARAMETER_CATEGORY_SUBPASS,
+
// DEPRECATED:
VertexInput = SLANG_PARAMETER_CATEGORY_VERTEX_INPUT,
FragmentOutput = SLANG_PARAMETER_CATEGORY_FRAGMENT_OUTPUT,