Open DGriffin91 opened 7 months ago
I modified examples/bindless.rs
to use hassle-rs (DXC) and had some success:
RUST_LOG=info cargo run --example bindless -- --hlsl --hassle-rs
When I don't pass the --hassle-rs
flag it uses Shaderc and fails:
binding #0 with #63 descriptors being updated but this update oversteps the bounds
`main` entrypoint not found for stage VK_SHADER_STAGE_FRAGMENT_BIT
create_graphics_pipelines: An unknown error has occurred, due to an implementation or application bug
Could you provide a larger HLSL example?
Oh! I hadn't thought of that. It looks like bindless does work with dxc in my renderer! I've been using shaderc mostly as I haven't tried setting up hassle-rs with hot reloading yet, so I've been using my workaround from the first post. But I have a cargo feature to switch to dxc so it's easy to test both. (It's also handy to be able to pass -Od
to dxc to disable opt so it doesn't strip out things (like bindings) that screen-13 needs if you aren't using them in the shader yet.)
Yep! I can figure out a larger example. Are you looking for something that can be added to the repo as an official hlsl example, or just a larger code base in general that's using hlsl with screen-13?
I'm interested in finding the minimal HLSL that you think should work, but does not. Hopefully that would help figure out if there is anything this crate could change which would fix things, and probably make examples along the way.
I used HLSL professionally for years before switching to Vulkan and GLSL; personally at least for what I do I don't mind the clunkiness of the language because I avoid all of these random bugs. Unfortunately this has rotted my HLSL skills to basically zero - so my ask for an example is because I want to make sure I'm fixing the correct random bugs. 😊
I think this is maybe not sufficient for detecting bindless: https://github.com/attackgoat/screen-13/blob/71c1c05f74c17d0ca891ae784d3e701c8fdcbc12/src/driver/graphic.rs#L457-L459 In HLSL using
Texture2D Texture2DTable[] : register(t0, space0);
the binding count ends up being 1 instead of 0.I don't think it's really a solution, but as a test, before here: https://github.com/attackgoat/screen-13/blob/71c1c05f74c17d0ca891ae784d3e701c8fdcbc12/src/driver/shader.rs#L871-L873 I tried setting the binding count to 0 with:
And it actually made a HLSL version of the bindless example work (though I still haven't gotten samplers working correctly so this was just with
Texture2DTable[input.instance_index].Load(int3(0, 0, 0))
)