[SPIR-V] Add Vertex execution model (#142369)

Adds backend handling of the vertex shader type compiling from HLSL.

Fixes #136961
This commit is contained in:
Nathan Gauër
2025-06-10 14:48:25 +02:00
committed by GitHub
parent ee3f50939d
commit 6f23116507
2 changed files with 16 additions and 0 deletions

View File

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

View File

@@ -0,0 +1,12 @@
; RUN: llc -O0 -mtriple=spirv-unknown-vulkan1.3-vertex %s -o - | FileCheck %s
; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan1.3-vertex %s -o - -filetype=obj | spirv-val --target-env vulkan1.3 %}
; CHECK: OpCapability Shader
; CHECK: OpEntryPoint Vertex %[[#entry:]] "main"
define void @main() #1 {
entry:
ret void
}
attributes #1 = { "hlsl.shader"="vertex" }