30template<
typename DrawCommandBufType>
class PassBase;
65 facing = this->inverted_view == facing;
381 uint expanded_prim_len,
390 this->expand_prim_type = expanded_prim_type;
391 this->expand_prim_len = expanded_prim_len;
410 std::string
serialize(
const std::string &line_prefix)
const;
534 ResourceIdBuf resource_id_buf_;
536 uint resource_id_count_ = 0;
541 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
553 uint16_t expanded_prim_len)
556 vertex_first = vertex_first != -1 ? vertex_first : 0;
557 instance_len = instance_len != -1 ? instance_len : 1;
559 BLI_assert_msg(custom_id == 0,
"Custom ID is not supported in PassSimple");
565 commands[index].draw = {
batch,
577 SubPassVector &sub_passes);
584 SubPassVector &sub_passes,
585 uint &resource_id_count,
586 ResourceIdBuf &resource_id_buf);
629 using DrawGroupKey = std::pair<uint, gpu::Batch *>;
632 DrawGroupMap group_ids_;
635 DrawGroupBuf group_buf_ = {
"DrawGroupBuf"};
637 DrawPrototypeBuf prototype_buf_ = {
"DrawPrototypeBuf"};
639 DrawCommandBuf command_buf_ = {
"DrawCommandBuf"};
641 ResourceIdBuf resource_id_buf_ = {
"ResourceIdBuf"};
643 uint header_id_counter_ = 0;
645 uint group_count_ = 0;
647 uint prototype_count_ = 0;
649 uint resource_id_count_ = 0;
654 group_buf_.trim_to_next_power_of_2(group_count_);
656 command_buf_.trim_to_next_power_of_2(group_count_ * 2);
657 prototype_buf_.trim_to_next_power_of_2(prototype_count_);
658 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
659 header_id_counter_ = 0;
661 prototype_count_ = 0;
674 uint16_t expanded_prim_len)
678 const bool custom_group = ((vertex_first != 0 && vertex_first != -1) || vertex_len != -1);
681 vertex_len = vertex_len == -1 ? 0 : vertex_len;
682 instance_len = instance_len != -1 ? instance_len : 1;
688 commands[index].draw_multi = {
batch,
this, (
uint)-1, header_id_counter_++};
691 DrawMulti &cmd = commands.
last().draw_multi;
693 uint &group_id = group_ids_.lookup_or_add(DrawGroupKey(cmd.
uuid,
batch),
uint(-1));
699 draw.res_handle = uint32_t(handle);
700 draw.custom_id = custom_id;
701 draw.instance_len = instance_len;
702 draw.group_id = group_id;
704 if (group_id ==
uint(-1) || custom_group) {
705 uint new_group_id = group_count_++;
706 draw.group_id = new_group_id;
708 DrawGroup &group = group_buf_.get_or_resize(new_group_id);
710 group.
len = instance_len;
720 "Not enough bits to store primitive expansion");
723 group_id = new_group_id;
732 group.
len += instance_len;
751 int visibility_word_per_draw,
753 bool use_custom_ids);
#define BLI_assert_msg(a, msg)
MINLINE uint min_uu(uint a, uint b)
#define UNUSED_VARS_NDEBUG(...)
void GPU_front_facing(bool invert)
void GPU_storagebuf_debug_unbind_all()
void GPU_texture_image_unbind_all()
void GPU_texture_unbind_all()
int64_t append_and_get_index(const T &value)
void append(const T &value)
const T & last(const int64_t n=0) const
void append_draw(Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, gpu::Batch *batch, uint instance_len, uint vertex_len, uint vertex_first, ResourceHandleRange handle_range, uint custom_id, GPUPrimType expanded_prim_type, uint16_t expanded_prim_len)
void generate_commands(Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, VisibilityBuf &visibility_buf, int visibility_word_per_draw, int view_len, bool use_custom_ids)
void bind(RecordingState &state)
void append_draw(Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, gpu::Batch *batch, uint instance_len, uint vertex_len, uint vertex_first, ResourceHandleRange handle_range, uint custom_id, GPUPrimType expanded_prim_type, uint16_t expanded_prim_len)
#define DRW_STATE_DEFAULT
struct @242053044010324116347033273112253060004051364061::@051143074301336237271216303350234260141112266062 batch
static GPUTexture * as_texture(Image *img)
BLI_STATIC_ASSERT(MBC_BATCH_LEN< 64, "Number of batches exceeded the limit of bit fields")
StorageArrayBuffer< uint, 4, true > VisibilityBuf
VecBase< int32_t, 4 > int4
bool assign_if_different(T &old_value, T new_value)
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
VecBase< float, 3 > float3
IndexRange index_range() const
ResourceHandle handle_first
bool has_inverted_handedness() const
std::string serialize() const
std::string serialize() const
std::string serialize() const
GPUStorageBuf ** indirect_buf
std::string serialize() const
void execute(RecordingState &state) const
Dispatch(int3 *group_len)
std::string serialize() const
void execute(RecordingState &state) const
uint32_t expand_prim_type
struct blender::draw::command::DrawGroup::@212141076370127054257266066330034007065275050006 desc
uint front_facing_counter
void execute(RecordingState &state) const
std::string serialize() const
GPUStorageBuf ** indirect_buf
std::string serialize(const std::string &line_prefix) const
DrawMultiBuf * multi_draw_buf
void execute(RecordingState &state) const
bool is_primitive_expansion() const
void execute(RecordingState &state) const
std::string serialize() const
Draw(gpu::Batch *batch, uint instance_len, uint vertex_len, uint vertex_first, GPUPrimType expanded_prim_type, uint expanded_prim_len, ResourceHandle handle)
GPUFrameBuffer ** framebuffer
std::string serialize() const
PushConstant(int loc, const float4x4 *val)
PushConstant(int loc, const float3 *val, int arr)
PushConstant(int loc, const int3 *val, int arr)
void execute(RecordingState &state) const
PushConstant(int loc, const int4 *val, int arr)
const float4 * float4_ref
PushConstant(int loc, const float2 *val, int arr)
std::string serialize() const
PushConstant(int loc, const int3 &val)
enum blender::draw::command::PushConstant::Type type
PushConstant(int loc, const float3 &val)
PushConstant(int loc, const int2 &val)
PushConstant(int loc, const int &val)
PushConstant(int loc, const int2 *val, int arr)
PushConstant(int loc, const float *val, int arr)
const float3 * float3_ref
PushConstant(int loc, const float4 &val)
PushConstant(int loc, const float2 &val)
PushConstant(int loc, const float4 *val, int arr)
PushConstant(int loc, const float &val)
const float2 * float2_ref
PushConstant(int loc, const int *val, int arr)
const float4x4 * float4x4_ref
PushConstant(int loc, const int4 &val)
bool shader_use_specialization
GPUStorageBuf * resource_id_buf
gpu::shader::SpecializationConstants specialization_constants
void front_facing_set(bool facing)
const gpu::shader::SpecializationConstants * specialization_constants_get()
bool specialization_constants_in_use
GPUStorageBuf ** storage_buf_ref
ResourceBind(int slot_, gpu::VertBuf **res, Type)
ResourceBind(int slot_, GPUUniformBuf **res, Type)
gpu::VertBuf * vertex_buf
GPUUniformBuf ** uniform_buf_ref
enum blender::draw::command::ResourceBind::Type type
ResourceBind(int slot_, draw::Image *res)
GPUStorageBuf * storage_buf
gpu::VertBuf ** vertex_buf_ref
GPUUniformBuf * uniform_buf
ResourceBind(int slot_, gpu::VertBuf *res)
ResourceBind(int slot_, GPUUniformBuf *res)
ResourceBind(int slot_, GPUStorageBuf *res)
ResourceBind(int slot_, GPUTexture *res, GPUSamplerState state)
ResourceBind(int slot_, GPUStorageBuf **res)
gpu::IndexBuf * index_buf
ResourceBind(int slot_, draw::Image **res)
ResourceBind(int slot_, GPUTexture **res, GPUSamplerState state)
ResourceBind(int slot_, gpu::VertBuf **res)
std::string serialize() const
ResourceBind(int slot_, gpu::IndexBuf *res, Type)
gpu::IndexBuf ** index_buf_ref
ResourceBind(int slot_, GPUUniformBuf **res)
GPUTexture ** texture_ref
ResourceBind(int slot_, gpu::VertBuf *res, Type)
ResourceBind(int slot_, GPUUniformBuf *res, Type)
ResourceBind(int slot_, gpu::IndexBuf **res, Type)
void execute(RecordingState &state) const
std::string serialize() const
SpecializeConstant(GPUShader *sh, int loc, const float &val)
SpecializeConstant(GPUShader *sh, int loc, const bool &val)
SpecializeConstant(GPUShader *sh, int loc, const bool *val)
SpecializeConstant(GPUShader *sh, int loc, const uint &val)
void execute(RecordingState &state) const
SpecializeConstant(GPUShader *sh, int loc, const uint *val)
SpecializeConstant(GPUShader *sh, int loc, const int &val)
SpecializeConstant()=default
SpecializeConstant(GPUShader *sh, int loc, const float *val)
enum blender::draw::command::SpecializeConstant::Type type
SpecializeConstant(GPUShader *sh, int loc, const int *val)
std::string serialize() const
std::string serialize() const
void execute(RecordingState &state) const
static void set(DRWState state=DRW_STATE_DEFAULT)
std::string serialize() const
std::string serialize() const
FramebufferBind framebuffer_bind
DrawIndirect draw_indirect
ResourceBind resource_bind
DispatchIndirect dispatch_indirect
SubPassTransition subpass_transition
PushConstant push_constant
SpecializeConstant specialize_constant