• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2016 Google Inc.
3 //
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6 //
7 
8 #ifndef HS_GLSL_MACROS_VENDOR_ONCE
9 #define HS_GLSL_MACROS_VENDOR_ONCE
10 
11 //
12 //
13 //
14 
15 #include "../hs_glsl_macros.h"
16 
17 //
18 // Waiting for Intel's to provide an equivalent to their OpenCL
19 // "reqd_subgroup_size" attribute.
20 //
21 
22 #define HS_GLSL_SUBGROUP_SIZE()
23 
24 //
25 // OVERRIDE SUBGROUP IDENTIFIERS BECAUSE INTEL ISN'T GUARANTEEING A
26 // FIXED SUBGROUP SIZE AT THIS POINT IN TIME
27 //
28 
29 #if 1
30 
31 #define HS_SUBGROUP_PREAMBLE()                                          \
32   const uint hs_subgroup_id      = gl_LocalInvocationID.x / HS_SLAB_THREADS; \
33   const uint hs_subgroup_lane_id = gl_LocalInvocationID.x & (HS_SLAB_THREADS-1);
34 
35 #define HS_SUBGROUP_ID()        hs_subgroup_id
36 #define HS_SUBGROUP_LANE_ID()   hs_subgroup_lane_id
37 
38 #else
39 
40 #define HS_SUBGROUP_PREAMBLE()
41 
42 #define HS_SUBGROUP_ID()        gl_SubgroupID
43 #define HS_SUBGROUP_LANE_ID()   gl_SubgroupInvocationID
44 
45 #endif
46 
47 //
48 // CHOOSE A COMPARE-EXCHANGE IMPLEMENTATION
49 //
50 
51 #if   (HS_KEY_WORDS == 1)
52 #define HS_CMP_XCHG(a,b)  HS_CMP_XCHG_V0(a,b)
53 #elif (HS_KEY_WORDS == 2)
54 #define HS_CMP_XCHG(a,b)  HS_CMP_XCHG_V1(a,b)
55 #endif
56 
57 //
58 // CHOOSE A CONDITIONAL MIN/MAX IMPLEMENTATION
59 //
60 
61 #if   (HS_KEY_WORDS == 1)
62 #define HS_COND_MIN_MAX(lt,a,b) HS_COND_MIN_MAX_V0(lt,a,b)
63 #elif (HS_KEY_WORDS == 2)
64 #define HS_COND_MIN_MAX(lt,a,b) HS_COND_MIN_MAX_V0(lt,a,b)
65 #endif
66 
67 //
68 //
69 //
70 
71 #endif
72 
73 //
74 //
75 //
76