HLSL: handle multiple clip/cull semantic IDs
HLSL allows several variables to be declared. There are packing rules involved: e.g, a float3 and a float1 can be packed into a single array[4], while for a float3 and another float3, the second one will skip the third array entry to avoid straddling This is implements that ability. Because there can be multiple variables involved, and the final output array will often be a different type altogether (to fuse the values into a single destination), a new variable is synthesized, unlike the prior clip/cull support which used the declared variable. The new variable name is taken from one of the declared ones, so the old tests are unchanged. Several new tests are added to test various packing scenarios. Only two semantic IDs are supported: 0, and 1, per HLSL rules. This is encapsulated in static const int maxClipCullRegs = 2; and the algorithm (probably :) ) generalizes to larger values, although there are a few issues around how HLSL would pack (e.g, would 4 scalars be packed into a single HLSL float4 out reg? Probably, and this algorithm assumes so).
Showing
- Test/baseResults/hlsl.clipdistance-4.vert.out 2 additions, 0 deletionsTest/baseResults/hlsl.clipdistance-4.vert.out
- Test/baseResults/hlsl.clipdistance-5.vert.out 2 additions, 0 deletionsTest/baseResults/hlsl.clipdistance-5.vert.out
- Test/baseResults/hlsl.clipdistance-6.vert.out 562 additions, 0 deletionsTest/baseResults/hlsl.clipdistance-6.vert.out
- Test/baseResults/hlsl.clipdistance-7.vert.out 511 additions, 0 deletionsTest/baseResults/hlsl.clipdistance-7.vert.out
- Test/baseResults/hlsl.clipdistance-8.vert.out 342 additions, 0 deletionsTest/baseResults/hlsl.clipdistance-8.vert.out
- Test/baseResults/hlsl.clipdistance-9.vert.out 305 additions, 0 deletionsTest/baseResults/hlsl.clipdistance-9.vert.out
- Test/baseResults/hlsl.semantic.geom.out 4 additions, 0 deletionsTest/baseResults/hlsl.semantic.geom.out
- Test/baseResults/hlsl.semantic.vert.out 266 additions, 354 deletionsTest/baseResults/hlsl.semantic.vert.out
- Test/hlsl.clipdistance-6.vert 23 additions, 0 deletionsTest/hlsl.clipdistance-6.vert
- Test/hlsl.clipdistance-7.vert 23 additions, 0 deletionsTest/hlsl.clipdistance-7.vert
- Test/hlsl.clipdistance-8.vert 20 additions, 0 deletionsTest/hlsl.clipdistance-8.vert
- Test/hlsl.clipdistance-9.vert 19 additions, 0 deletionsTest/hlsl.clipdistance-9.vert
- Test/hlsl.semantic.vert 3 additions, 5 deletionsTest/hlsl.semantic.vert
- gtests/Hlsl.FromFile.cpp 4 additions, 0 deletionsgtests/Hlsl.FromFile.cpp
- hlsl/hlslParseHelper.cpp 157 additions, 44 deletionshlsl/hlslParseHelper.cpp
- hlsl/hlslParseHelper.h 14 additions, 1 deletionhlsl/hlslParseHelper.h
- hlsl/hlslScanContext.cpp 0 additions, 26 deletionshlsl/hlslScanContext.cpp
Loading
Please register or sign in to comment