// RUN: %{ispc} --target=host --nowrap --nostdlib --debug-phase=first:first %s --emit-llvm-text -o - | FileCheck %s // CHECK: @programCount = internal constant i32 [[WIDTH:[0-9]+]] // CHECK: @glb_goo_bool = global <[[WIDTH]] x i8> // CHECK: %cst_boo_int8 = alloca <[[WIDTH]] x i8> // CHECK: %cst_boo_uint8 = alloca <[[WIDTH]] x i8> // CHECK: %cst_boo_int16 = alloca <[[WIDTH]] x i16> // CHECK: %cst_boo_uint16 = alloca <[[WIDTH]] x i16> // CHECK: %cst_boo_int32 = alloca <[[WIDTH]] x i32> // CHECK: %cst_boo_uint32 = alloca <[[WIDTH]] x i32> // CHECK: %cst_boo_int64 = alloca <[[WIDTH]] x i64> // CHECK: %cst_boo_uint64 = alloca <[[WIDTH]] x i64> // CHECK: %cst_boo_float = alloca <[[WIDTH]] x float> // CHECK: %cst_boo_double = alloca <[[WIDTH]] x double> #if TARGET_WIDTH == 2 #define INITIALIZER 1,0, #elif TARGET_WIDTH == 4 #define INITIALIZER 1,0,1,0, #elif TARGET_WIDTH == 8 #define INITIALIZER 1,0,1,0,1,0,1,0, #elif TARGET_WIDTH == 16 #define INITIALIZER 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, #elif TARGET_WIDTH == 32 #define INITIALIZER 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, #elif TARGET_WIDTH == 64 #define INITIALIZER 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0, #endif #define FOO(TYPE) \ void foo_##TYPE(uniform float dst[], const uniform uint32 b, const varying float src) \ { \ static const varying TYPE v_foo_##TYPE = { INITIALIZER }; \ if (v_foo_##TYPE != 0) { dst[b+programIndex] = src; } \ } FOO(bool) FOO(int8) FOO(uint8) FOO(int16) FOO(uint16) FOO(int32) FOO(uint32) FOO(int64) FOO(uint64) FOO(float) FOO(double) #define BOO(TYPE) \ void boo_##TYPE(uniform float dst[], const uniform uint32 b, const varying float src) \ { \ const varying TYPE cst_boo_##TYPE = { INITIALIZER }; \ if (cst_boo_##TYPE != 0) { dst[b+programIndex] = src; } \ } BOO(bool) BOO(int8) BOO(uint8) BOO(int16) BOO(uint16) BOO(int32) BOO(uint32) BOO(int64) BOO(uint64) BOO(float) BOO(double) #define GOO(TYPE) \ varying TYPE glb_goo_##TYPE = { INITIALIZER }; \ void goo_##TYPE(uniform float dst[], const uniform uint32 b, const varying float src) \ { \ if (glb_goo_##TYPE != 0) { dst[b+programIndex] = src; } \ } GOO(bool) GOO(int8) GOO(uint8) GOO(int16) GOO(uint16) GOO(int32) GOO(uint32) GOO(int64) GOO(uint64) GOO(float) GOO(double)