Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bindless not detected when using HLSL #73

Open
DGriffin91 opened this issue Apr 14, 2024 · 3 comments
Open

Bindless not detected when using HLSL #73

DGriffin91 opened this issue Apr 14, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@DGriffin91
Copy link
Contributor

I think this is maybe not sufficient for detecting bindless:

if descriptor_info.binding_count() == 0 {
descriptor_info.set_binding_count(info.bindless_descriptor_count);
}

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:

let descriptor_info = match desc_ty {
DescriptorType::AccelStruct() => {
I tried setting the binding count to 0 with:

if "Texture2DTable" == name.as_deref().unwrap_or_default() {
    binding_count = 0;
}

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)))

@attackgoat attackgoat self-assigned this Apr 15, 2024
@attackgoat attackgoat added the bug Something isn't working label Jul 17, 2024
@attackgoat
Copy link
Owner

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?

@DGriffin91
Copy link
Contributor Author

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?

@attackgoat
Copy link
Owner

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. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants