DescriptionDxilModule::CollectShaderFlagsForModule sets shader flag EnableRawAndStructuredBuffers when an SRV of RawBuffer or StructuredBuffer is present in the resources list.
This flag was originally added to mirror the DXBC global flag enableRawAndStructuredBuffers, or D3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS as the value, when doing conversion from DXBC to DXIL in DxilConv. Originally this made sense when we were keeping the shader model and all the flags from the converted shader, but later we upgraded all shaders to shader model 6.0.
This global flag was only set by FXC when the shader was ps_4_0 or ps_4_1 because this was an added feature at that time. It was never used for shader model 5.0 or above, or for compute stage (which was also supported in shader model 4.0+).
There is no reason to set this flag for DXIL, since there's no optional feature exposure here. There should be no regression risk in drivers because converted DXBC wouldn't have set this flag in many scenarios, including ones with indistinguishable DXIL from ones that do set the flag other than this flag setting. In other words, the same shader would produce same DXIL except the flag set or clear depending on whether the DXBC was ps_4_0 or ps_5_0.
Right now, since this flag is set in DxilModule::CollectShaderFlagsForModule, it is also checked by DXIL validation, impacting what we must output from the new clang compiler. We should stop setting this flag, so we don't have to keep carrying this unneeded flag into the future in the new compiler.
Description
DxilModule::CollectShaderFlagsForModule
sets shader flagEnableRawAndStructuredBuffers
when an SRV ofRawBuffer
orStructuredBuffer
is present in the resources list.https://github.com/microsoft/DirectXShaderCompiler/blob/ac36a797d3470e8ee906b98457a59270d01db30d/lib/DXIL/DxilModule.cpp#L357
This flag was originally added to mirror the DXBC global flag
enableRawAndStructuredBuffers
, orD3D11_SB_GLOBAL_FLAG_ENABLE_RAW_AND_STRUCTURED_BUFFERS
as the value, when doing conversion from DXBC to DXIL in DxilConv. Originally this made sense when we were keeping the shader model and all the flags from the converted shader, but later we upgraded all shaders to shader model 6.0.This global flag was only set by FXC when the shader was
ps_4_0
orps_4_1
because this was an added feature at that time. It was never used for shader model 5.0 or above, or for compute stage (which was also supported in shader model 4.0+).There is no reason to set this flag for DXIL, since there's no optional feature exposure here. There should be no regression risk in drivers because converted DXBC wouldn't have set this flag in many scenarios, including ones with indistinguishable DXIL from ones that do set the flag other than this flag setting. In other words, the same shader would produce same DXIL except the flag set or clear depending on whether the DXBC was ps_4_0 or ps_5_0.
Right now, since this flag is set in
DxilModule::CollectShaderFlagsForModule
, it is also checked by DXIL validation, impacting what we must output from the new clang compiler. We should stop setting this flag, so we don't have to keep carrying this unneeded flag into the future in the new compiler.Steps to Reproduce https://godbolt.org/z/7xesd8388
Note metadata:
i64 16
is theEnableRawAndStructuredBuffers
flag we should stop setting.Environment