microsoft / D3D12TranslationLayer

A library containing utilities for mapping higher-level graphics work to D3D12
MIT License
327 stars 47 forks source link

Check shader decls before binding SRV, CB, samplers #86

Closed vdwtanner closed 1 year ago

vdwtanner commented 1 year ago

The Apply*Helper()s didn't verify that the shader they were trying to bind resources to actually used that type of resource, so there were cases where we would try to bind invalid data to shaders that didn't reference it. This didn't cause issues in applications, but does log a breaking error in the debug layer.

jenatali commented 1 year ago

Discussed offline - there's a problem I can see with this where we'll still clear the "need to reapply" bit at the end, meaning that a future draw/dispatch could end up not having a bound table. We're going to try a different approach, where the dirty-ness of a descriptor table will be tracked up to the size of the root signature bucket for that type, rather than the shader decls directly.