Skip to content

Commit

Permalink
[vulkan] Fix vulkan rand (taichi-dev#2622)
Browse files Browse the repository at this point in the history
* Fix vulkan rand

* Auto Format

* cleanup

* Auto Format

Co-authored-by: Taichi Gardener <[email protected]>
  • Loading branch information
AmesingFlank and taichi-gardener authored Aug 1, 2021
1 parent acb7cf5 commit 471e388
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions taichi/backends/vulkan/spirv_ir_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,9 +460,24 @@ class IRBuilder {
// glsl 450 extension
Value ext_glsl450_;
// Special cached types
bool support_int8_, support_int16_, support_int64_, support_fp64_;
SType t_bool_, t_int8_, t_int16_, t_int32_, t_int64_, t_uint8_, t_uint16_,
t_uint32_, t_uint64_, t_fp32_, t_fp64_, t_void_, t_void_func_;
bool support_int8_{false};
bool support_int16_{false};
bool support_int64_{false};
bool support_fp64_{false};

SType t_bool_;
SType t_int8_;
SType t_int16_;
SType t_int32_;
SType t_int64_;
SType t_uint8_;
SType t_uint16_;
SType t_uint32_;
SType t_uint64_;
SType t_fp32_;
SType t_fp64_;
SType t_void_;
SType t_void_func_;
// gl compute shader related type(s) and variables
SType t_v3_uint_;
Value gl_global_invocation_id;
Expand All @@ -472,8 +487,11 @@ class IRBuilder {
// Float type atomic add function
Value float_atomic_add_;
// Random function and variables
bool init_rand_;
Value _rand_x_, _rand_y_, _rand_z_, _rand_w_; // per-thread local variable
bool init_rand_{false};
Value _rand_x_;
Value _rand_y_;
Value _rand_z_;
Value _rand_w_; // per-thread local variable

// map from value to its pointer type
std::map<std::pair<uint32_t, spv::StorageClass>, SType> pointer_type_tbl_;
Expand Down

0 comments on commit 471e388

Please sign in to comment.