Skip to content

Commit

Permalink
vcc: added checkerboard.frag.c test
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugobros3 committed Oct 24, 2023
1 parent 54614f7 commit 5be78ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/vcc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ endforeach()
spv_outputting_test(NAME test/vcc/empty.comp.c COMPILER vcc EXTRA_ARGS --entry-point main)

spv_outputting_test(NAME test/vcc/simple.frag.c COMPILER vcc EXTRA_ARGS --entry-point main --no-dynamic-scheduling --execution-model Fragment)
spv_outputting_test(NAME test/vcc/checkerboard.frag.c COMPILER vcc EXTRA_ARGS --entry-point main --no-dynamic-scheduling --execution-model Fragment)
20 changes: 20 additions & 0 deletions test/vcc/checkerboard.frag.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <stdint.h>

#define location(i) __attribute__((annotate("shady::location::"#i)))
#define input __attribute__((address_space(389)))
#define output __attribute__((address_space(390)))

typedef float vec4 __attribute__((ext_vector_type(4)));

location(0) output vec4 fragColor;

__attribute__((annotate("shady::builtin::FragCoord")))
input vec4 fragCoord;

__attribute__((annotate("shady::entry_point::Fragment")))
void main() {
int fillx = (((int) fragCoord[0]) / 16) % 2;
int filly = (((int) fragCoord[1]) / 16) % 2;
int fill = fillx ^ filly;
fragColor = (vec4) {fill, fill, 0.0f, 1.0f };
}

0 comments on commit 5be78ad

Please sign in to comment.