Conversation
|
this sounds nice, but I have troubles to see some real-life scenarios where it would be useful as is, since most NZSL code should be portable, do you have any example? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63 +/- ##
==========================================
- Coverage 76.78% 76.49% -0.29%
==========================================
Files 159 159
Lines 21835 21931 +96
Branches 6745 6790 +45
==========================================
+ Hits 16765 16777 +12
- Misses 4977 5061 +84
Partials 93 93
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
I've been thinking of supporting interop features similar to slang's (specifically this section). |
Sounds good to prepare the glsl/spir-v assembly feature. Style question: should it stay a separate attribute or be merged with the cond attribute? Like [cond(target(spirv))]
{
// SPIR-V specific
}Also, how to handle SPIR-V for OpenGL (with OpenGL 4.5) and SPIR-V for Vulkan? |
The
I am also thinking about this too. [cond(target(spirv) && ???)]
{
// GL SPIR-V specific
}Where |
It's more complicated than that, If we decide to add a One other option is to not add a
I don't think this is possible, So we should probably split the GLSL/SPIR-V targets from the GL/GL ES/Vulkan environment, we also could add a way to test if an extension is present, etc. |
8813401 to
2848d2c
Compare
|
This could be useful for possible future backends like WGSL, MSL or HLSL that may not support combined image sampler. We could use them when targeting Vulkan/OpenGL|ES and fallback on splited textures/samplers to avoid compiler's hacky and heavy emulations (if NZSL supports splited textures/samplers someday). [set(0), cond(target(spirv, glsl, gles))]
external
{
[binding(0)] texture: sampler2D[f32],
}
[set(0), cond(!target(spirv, glsl, gles))]
external
{
[binding(0)] texture: texture2D[f32],
[binding(1)] sampler: sampler,
} |
This pull request introduces a new attribute for
ScopedStatementcalledtarget. Target attribute allows programmer to write target (and optionally, it's version) specific shader code. Here is how it looks: