Skip to content

Commit

Permalink
tests: add test for the OpName of a generic function.
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyb committed Aug 27, 2021
1 parent bc33646 commit c3cb849
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ui/dis/generic-fn-op-name.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Test that generic functions' `OpName` correctly include generic arguments.

// build-pass
// compile-flags: -C llvm-args=--disassemble-globals
// normalize-stderr-test "OpCapability VulkanMemoryModel\n" -> ""
// normalize-stderr-test "OpExtension .SPV_KHR_vulkan_memory_model.\n" -> ""
// normalize-stderr-test "OpMemoryModel Logical Vulkan" -> "OpMemoryModel Logical Simple"

#![feature(const_generics)]
#![allow(incomplete_features)]

use spirv_std::image::Dimensionality;

fn generic<T, const DIM: Dimensionality>() {}

#[spirv(fragment)]
pub fn main() {
generic::<f32, {Dimensionality::TwoD}>();
}
13 changes: 13 additions & 0 deletions tests/ui/dis/generic-fn-op-name.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
OpCapability Float64
OpCapability Int16
OpCapability Int64
OpCapability Int8
OpCapability Shader
OpMemoryModel Logical Simple
OpEntryPoint Fragment %1 "main"
OpExecutionMode %1 OriginUpperLeft
%2 = OpString "$OPSTRING_FILENAME/generic-fn-op-name.rs"
OpName %3 "generic_fn_op_name::generic"
OpName %4 "generic_fn_op_name::main"
%5 = OpTypeVoid
%6 = OpTypeFunction %5

0 comments on commit c3cb849

Please sign in to comment.