forked from microsoft/DirectXShaderCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPIRV] Add support of the GL_EXT_spirv_intrinsics
Related to the issue: microsoft#3919 Add these attributes vk::ext_capability vk::ext_extension vk::ext_instruction
- Loading branch information
Showing
14 changed files
with
219 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
tools/clang/test/CodeGenSPIRV/spv.intrinsicInstruction.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Run: %dxc -T vs_6_0 -E main | ||
|
||
struct SInstanceData { | ||
float4x3 VisualToWorld; | ||
float4 Output; | ||
}; | ||
|
||
struct VS_INPUT { | ||
float3 Position : POSITION; | ||
SInstanceData InstanceData : TEXCOORD4; | ||
}; | ||
|
||
[[vk::ext_capability(5055)]] | ||
[[vk::ext_extension("SPV_KHR_shader_clock")]] | ||
[[vk::ext_instruction(/* OpReadClockKHR */ 5056)]] | ||
uint64_t ReadClock(uint scope); | ||
|
||
[[vk::ext_instruction(/* Sin*/ 13, "GLSL.std.450")]] | ||
float4 spv_sin(float4 v); | ||
|
||
// CHECK: OpCapability ShaderClockKHR | ||
// CHECK-NEXT: OpExtension "SPV_KHR_shader_clock" | ||
// CHECK-NEXT: {{%\d+}} = OpExtInstImport "GLSL.std.450" | ||
|
||
float4 main(const VS_INPUT v) : SV_Position { | ||
SInstanceData I = v.InstanceData; | ||
uint64_t clock; | ||
// CHECK: {{%\d+}} = OpExtInst %v4float {{%\d+}} Sin {{%\d+}} | ||
I.Output = spv_sin(v.InstanceData.Output); | ||
// CHECK: {{%\d+}} = OpReadClockKHR %ulong %uint_1 | ||
clock = ReadClock(vk::DeviceScope); | ||
|
||
return I.Output; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters