Comments (2)
Maybe it would be helpful to describe the compile & link approach I've been using.
Pseudocode:
hlsl = read_file()
for each of 5 shader stages
{
stage = new TShader(stages[i]);
stage->setStringsWithLengthsAndNames(hlsl)
stage->setEntryPoint(entryPointNames[i])
success = stage->parse()
entrypoints = stage->getIntermediate()->getNumEntryPoints()
errors = stage->getIntermediate()->getNumErrors()
if (entrypoints != 1 || entrypoints != 0)
success = false
if (success)
program.addShader(stage)
}
program.link()
It should be noted that hlsl source might not contain entrypoints of all shader stages. So I cannot just do addShader
for all shader stages, because then linking will fail with errors such as this:
Linked geometry stage:
WARNING: Linking geometry stage: Entry point not found
ERROR: Linking geometry stage: At least one shader must specify an input layout primitive
ERROR: Linking geometry stage: At least one shader must specify an output layout primitive
ERROR: Linking geometry stage: At least one shader must specify a layout(max_vertices = value)
from glslang.
Right after writing previous comment, I thought of a different approach. Now I tried to create separate TProgram for each TShader. So that I can compile and link each stage individually.
But it seems that now I encountered another problem where Domain shader stage (EShLangTessEvaluation
) does not need an entrypoint to compile and link. So both compilation and linking is successful and spirv is generated. Also spirv-cross seems to be able to convert it to glsl. But it only generates this
#version 460
void main()
{
}
This glsl then fails to link for real in OpenGL when being used as a tesselation evaluation shader with error message:
Tessellation evaluation info
----------------------------
Internal error: assembly compile error for tessellation evaluation shader at offset 228:
-- error message --
line 10, column 1: error: program missing TESS_MODE declaration
-- internal assembly text --
!!NVtep5.0
OPTION NV_internal;
OPTION NV_bindless_texture;
# cgc version 3.4.0001, build date Feb 22 2024
# command line args:
#vendor NVIDIA Corporation
#version 3.4.0.1 COP Build Date Feb 22 2024
#profile gp5tp
#program main
TEMP T;
END
# 0 instructions, 0 R-regs
Since I have never used this stage I don't really know what is and isn't considered valid. As a temporary workaround I added
if (currentShaderStage == EShLangTessEvaluation && spirv.size() < 512)
continue;
after glslang::GlslangToSpv
because it seems to always produce small spirv.
from glslang.
Related Issues (20)
- Crash in glslang_program_SPIRV_generate_with_options in Android (arm64-v8a) HOT 2
- Incorrect SPIR-V generated when using a fixed-size array of sampler2D with -R (relaxed vulkan rules) HOT 3
- Compile warning on VS2022
- error in combination with preprocessor directives can obfuscate error location. HOT 4
- Glslang version output? HOT 1
- SPIR-V Validation Errors when using Vulkan Relaxed Rules
- Implement GL_NV_bindless_texture HOT 6
- Broken SPIRV generated if using ternary operator ( " a ? b : c " ) as a direct argument to a texelFetch call HOT 2
- Grammar railroad diagram HOT 2
- nonuniformEXT not working correctly in conditionals HOT 3
- When will this be fixed? I have already sent PR HOT 2
- glslang must really warn when using uninitialized variables
- Conditional compilation is not handled correctly
- Crash on WebASM HOT 6
- error report when use GL_OES_EGL_image_external_essl3 HOT 3
- ABI break in glslang-14.2 HOT 1
- Incorrect SPIR-V can be generated when using samplers in structs with relaxed rules HOT 4
- Miss glslang_shader_shader_set_entry_point HOT 1
- Location aliasing should allow mismatch in auxiliary qualifier HOT 1
- Usage of `std::filesystem::absolute` in `glslang/Include/InfoSink.h` removes support for macOS < 10.15 and iOS < 13.0 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glslang.