gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 547 forks source link

dx12: Root constant alignment issues #1797

Open msiglreith opened 6 years ago

msiglreith commented 6 years ago

At certain circumstances push constants can be split correctly into push constants. We need to further reflect the SPIR-V push constant block fields and offset to adjust the root constant blocks accordingly.

Example:

push_constant {
    float a; // offset: 0
    vec3 b; // offset: 16
}

While push constants ranges specified as 0..4 & 16..32 would be fine, a range like 0..4 & 4..32 would result in misaligment of b in the second cbuffer block in HLSL.

msiglreith commented 6 years ago

We might want to actually merge overlapping push constants into one root constant, then we shouldn't have this issue I guess (for a small performance hit due to visibility flags?)