Skip to content

Commit 42aef12

Browse files
Keenutstomtor
authored andcommitted
[SPIR-V] Add Vertex execution model (llvm#142369)
Adds backend handling of the vertex shader type compiling from HLSL. Fixes llvm#136961
1 parent 44d55a8 commit 42aef12

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

llvm/lib/Target/SPIRV/SPIRVCallLowering.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
280280
const auto value = attribute.getValueAsString();
281281
if (value == "compute")
282282
return SPIRV::ExecutionModel::GLCompute;
283+
if (value == "vertex")
284+
return SPIRV::ExecutionModel::Vertex;
283285

284286
report_fatal_error(
285287
"This HLSL entry point is not supported by this backend.");
@@ -302,6 +304,8 @@ getExecutionModel(const SPIRVSubtarget &STI, const Function &F) {
302304
const auto value = attribute.getValueAsString();
303305
if (value == "compute")
304306
return SPIRV::ExecutionModel::GLCompute;
307+
if (value == "vertex")
308+
return SPIRV::ExecutionModel::Vertex;
305309

306310
report_fatal_error("This HLSL entry point is not supported by this backend.");
307311
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
; RUN: llc -O0 -mtriple=spirv-unknown-vulkan1.3-vertex %s -o - | FileCheck %s
2+
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan1.3-vertex %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %}
3+
4+
; CHECK: OpCapability Shader
5+
; CHECK: OpEntryPoint Vertex %[[#entry:]] "main"
6+
7+
define void @main() #1 {
8+
entry:
9+
ret void
10+
}
11+
12+
attributes #1 = { "hlsl.shader"="vertex" }

0 commit comments

Comments
 (0)