Conversation
…esponding 32-bit types first - this fixes KhronosGroup#3607 - and this also fixes assertion failure in the PR KhronosGroup#3628 - this change emits appropriate Op{S|U}Convert instructions instead of OpCompositeExtract followed by OpCompositeConstruct for 8/16-bit integer types.
|
@arcady-lunarg , could you please add the unit tests on your side again? I've ran out of my time this weekend. I see the tests are failing and I think it is expected for |
|
I think the following set of SPIR-V instructions are inefficient as what more the SPV_KHR_{16|8}bit_storage extensions allow. Direct conversion from Any comments appreciated... |
|
@ravi688 I have some time to look at this, but it seems to be failing CIs. Could you update the PR and ping me? Thanks. |
dnovillo
left a comment
There was a problem hiding this comment.
Please add tests as well. You can use the new gtests/SpvPatternTest.cpp harness which should simplify adding tests for some combinations. At least the ones in the original issue. Thanks.
| aggregateOp = EOpConstructUint; | ||
| else | ||
| aggregateOp = (TOperator)(EOpConstructUVec2 + op - EOpConstructU16Vec2); | ||
| newNode = intermediate.setAggregateOperator(newNode, aggregateOp, tempType, node->getLoc()); |
There was a problem hiding this comment.
This same block is repeated 4 times. Consider extracting it into a helper function.
Convert 8/16-bit int (and their composite vector) types to their corresponding 32-bit types first and then convert the resulting 32-bit type to the target 8/16-bit type.
This change emits appropriate Op{S|U}Convert instructions instead of OpCompositeExtract followed by OpCompositeConstruct for 8/16-bit integer types.
What types of shaders are affected?
The following GLSL shader:
Now compiles to the SPIR-V (i.e. with this patch applied):
Earlier it used to be compiled to the following SPIR-V instructions (i.e. without patch applied):