DirectXShaderCompiler
DirectXShaderCompiler copied to clipboard
wgf11shader5x: Index\Samplers & Index\ConstantBuffers convert error in dxbcconv.dll that dynamic index only support Interface
Description
dxbcconv.dll convert error that dynamic index only support Interface. Steps to Reproduce
Running test case HLK wgf11shader5x.exe:Index\Samplers:1 and HLK wgf11shader5x.exe:Index\ConstantBuffers.
Actual Behavior
For Index\Samplers, If the indexComputation is not ImemediateConstant, case will use "m_pClassInstanceSamples", but this variable is null, it seems is gived to Interface only. For Index\ConstantBuffers, If not ImemediateConstant, case will use "m_pClassInstanceCbuffers", it is null too. Environment
- DXC version <!-- replace with the output of 'dxc --version' --> The newest version.
- Host Operating System Windows 10.
Please Help.
Hi @Siomarry,
Did you mean dxilconv? What actually happens when you run these tests and can you give more information about where you got them?
Probably related to #5836
Hi, @pow2clk
yes, it converted fail from dxbc -> dxil. The sampler case dxbc is:
case wgf11shader5x.exe:Index\Samplers:1 failed to getSpaceID because the DxilResourceBase is null just shown in the picture below.
I checked that in this case, the instruction**:sample indexable(Texture2D) (float,float,float,float) r0, rl, t[r2.x], s[r2.x)**, opcode matchs:D3D10_SB_OPCODE_SAMPLE, while in loadOperand() function, the operand src3 type is D3D10_SB_OPERAND_TYPE_SAMPLER and the index type is D3D10_SB_OPERAND_INDEX_RELATIVE , pR = m_pClassInstanceSamplers, it is null.
MeanWhile, I found "m_pClassInstanceSamplers" is only assigned in function InsertInterfaceResourceDecls(), this function is only called while Instruction opcode is D3D_SB_OPCODE_DCL_INTERFACE in AnalyzeShader().
Same issue in ConstantBuffer, dxbc shader is:
The instruction:mov r0, cb[r2.x][0], src0 type is D3D10_SB_OPERAND_TYPE_CONSTANT BUFFER:
the index type is D3D10_SB_OPERAND_INDEX_RELATIVE, *pR = m pClassInstanceCBuffers which is also null. pClassInstanceCBuffers is only assigned in function InsertInterfaceResourceDecls(). So it failed to getSpaceID() too.
@pow2clk. Hi,How is this problem going?Do you need more detail information?
@Siomarry - hi, sorry for the delay in getting back to you. Is this an urgent issue for you? As this is an HLK issue, have you reported this to Microsoft through some other channel? If you would like to get in contact with me directly could you send an email to [email protected], referencing this issue in the subject line? Thanks.
@damyanp Hi, sorry for the delay in getting back to you. Yes, it is an important and urgent issue for us. I have send this error to your email. It will be very appriciate for us If you can help us.
As it turns out, the ID3D11Interface functionality is the only way to officially use dynamic resource indexing before SM 5.1 (FXC disallows explicit dynamic indexing in SM 5.0). The assembly-based test doesn't actually need interfaces to dynamically index a resource, so it was written without any dcl_interface instruction.
If you use the feature through interfaces, you will have a dcl_interface instruction, which DxilConv looks for to set up the needed state to translate these features.
However, since the D3D11 spec doesn't mention any dcl_interface requirement for uniform indexing at the instruction level (DXBC), the test could be considered technically valid, even though you shouldn't see this in the wild without interfaces.
The test was disabled for 11on12 runs before interface support was added to 11on12. It was never re-enabled there, so support for this corner case slipped through the cracks.
While we could update DxilConv to handle this without seeing the dcl_interface instruction, it seems unnecessary (or at least a very low priority), since the only way to target that scenario is to circumvent FXC and craft a shader from assembly (which is an unsupported scenario for DXBC).
There are no plans to make any changes to the code stored in this repo to handle this. We currently think that this is best resolved by modifying the HLK tests or by granting exceptions.
Please file an exception request for these HLK failures through the normal channels and the issue will be resolved in that way.