Comments (5)
I updated the documentation. Removed out of date doc on the API. Please check the user guide for the compilation and reflection API.
from slang.
You are right, it should be SUB_ELEMENT_REGISTER_SPACE. I have updated the documentation here: https://shader-slang.com/slang/user-guide/reflection.html
You are right that the "binding" for ordinary uniforms are byte offsets for that uniform in the constant buffer. All global uniforms are placed in a default constant buffer that has the same binding. You can query the binding with getGlobalConstantBufferBinding
.
from slang.
When I add more parameters as follows:
uniform float a;
uniform float b;
ParameterBlock<Buffers> buffers;
ParameterBlock<Buffers> buffers2;
The GLSL is again what I'd expect (with a
and b
being located in the default set 0 now, and the parameter blocks occupying sets 1 and 2 respectively. However, again using the same loop as before, I see the following being printed:
set 0, binding 0: float a
set 0, binding 4: float b
set 0, binding 1: ParameterBlock buffers
set 0, binding 2: ParameterBlock buffers2
For some more context, I'm directly using Slang as a submodule (at the latest commit as of right now), and I'm using this as the target description:
slang::TargetDesc target_info = {
.format = SLANG_SPIRV,
.profile = global_session_->findProfile("glsl_450"),
.flags = SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY,
};
from slang.
You also need to add the result from calling variable->getOffset(SLANG_PARAMETER_CATEGORY_REGISTER_SPACE)
.
from slang.
Thank you for the quick response! I found that SLANG_PARAMETER_CATEGORY_SUB_ELEMENT_REGISTER_SPACE
seems to provide the expected result over SLANG_PARAMETER_CATEGORY_REGISTER_SPACE
. Or is it necessary to add both of them together?
In both cases, I'm still seeing the uniform float b
having an index of 4 even though I'd expect it to have an index of 1 in the default set. Is there also an offset I should be adding to the index as well?
EDIT: I see the documentation mentions that the index is actually the byte offset in its parent if the type is a Uniform. Will all "ordinary" resources be bound to the same uniform?
from slang.
Related Issues (20)
- Undetected recursion / ambiguous function call
- Invalid spirv generated for mesh shader HOT 1
- Invalid spirv generated for mesh shader 2 HOT 1
- Compiler crash HOT 3
- Support glslang [[spv::format_formatName]] syntax
- Cyclic type causes compiler crash.
- Generic `__init`? HOT 8
- Investigate why UE TSR runs slow with Slang HOT 1
- New pointer bug for spirv gen with arrays
- Slangc seemingly stuck in endless loop
- generic interface cannot be used as a generic argument HOT 2
- DXC takes longer to compile when UE TSR shaders are handled by Slang HOT 23
- Invalid GS spirv output when using `TriangleStream` in a function other than the entrypoint.
- Crash on recursive interface
- SLANG_COMPILE_FLAG_NO_MANGLING doesn't work as expected HOT 1
- Improve documentation for autodiff samples
- When an object is send to a function as its interface type, it gets assigned to a wrong temporary variable, "AnyValue16"
- Slang shaders for UE TSR need to be integrated from UE5.2 to the latest
- UE uses "unnamed struct" and Slang needs to support
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 slang.