30template<
typename DrawCommandBufType>
class PassBase;
63 facing = this->inverted_view == facing;
380 uint expanded_prim_len,
389 this->expand_prim_type = expanded_prim_type;
390 this->expand_prim_len = expanded_prim_len;
409 std::string
serialize(
const std::string &line_prefix)
const;
533 ResourceIdBuf resource_id_buf_;
535 uint resource_id_count_ = 0;
540 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
552 uint16_t expanded_prim_len)
555 vertex_first = vertex_first != -1 ? vertex_first : 0;
556 instance_len = instance_len != -1 ? instance_len : 1;
558 BLI_assert_msg(custom_id == 0,
"Custom ID is not supported in PassSimple");
564 commands[index].draw = {
batch,
576 SubPassVector &sub_passes);
583 SubPassVector &sub_passes,
584 uint &resource_id_count,
585 ResourceIdBuf &resource_id_buf);
628 using DrawGroupKey = std::pair<uint, gpu::Batch *>;
631 DrawGroupMap group_ids_;
634 DrawGroupBuf group_buf_ = {
"DrawGroupBuf"};
636 DrawPrototypeBuf prototype_buf_ = {
"DrawPrototypeBuf"};
638 DrawCommandBuf command_buf_ = {
"DrawCommandBuf"};
640 ResourceIdBuf resource_id_buf_ = {
"ResourceIdBuf"};
642 uint header_id_counter_ = 0;
644 uint group_count_ = 0;
646 uint prototype_count_ = 0;
648 uint resource_id_count_ = 0;
653 group_buf_.trim_to_next_power_of_2(group_count_);
655 command_buf_.trim_to_next_power_of_2(group_count_ * 2);
656 prototype_buf_.trim_to_next_power_of_2(prototype_count_);
657 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
658 header_id_counter_ = 0;
660 prototype_count_ = 0;
673 uint16_t expanded_prim_len)
677 const bool custom_group = ((vertex_first != 0 && vertex_first != -1) || vertex_len != -1);
680 vertex_len = vertex_len == -1 ? 0 : vertex_len;
681 instance_len = instance_len != -1 ? instance_len : 1;
687 commands[index].draw_multi = {
batch,
this, (
uint)-1, header_id_counter_++};
690 DrawMulti &cmd = commands.
last().draw_multi;
692 uint &group_id = group_ids_.lookup_or_add(DrawGroupKey(cmd.
uuid,
batch),
uint(-1));
698 draw.res_index = uint32_t(res_index);
699 draw.custom_id = custom_id;
700 draw.instance_len = instance_len;
701 draw.group_id = group_id;
703 if (group_id ==
uint(-1) || custom_group) {
704 uint new_group_id = group_count_++;
705 draw.group_id = new_group_id;
707 DrawGroup &group = group_buf_.get_or_resize(new_group_id);
709 group.
len = instance_len;
719 "Not enough bits to store primitive expansion");
722 group_id = new_group_id;
731 group.
len += instance_len;
750 int visibility_word_per_draw,
752 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, ResourceIndexRange index_range, uint custom_id, GPUPrimType expanded_prim_type, uint16_t expanded_prim_len)
void append_draw(Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, gpu::Batch *batch, uint instance_len, uint vertex_len, uint vertex_first, ResourceIndexRange index_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)
#define DRW_STATE_DEFAULT
struct @021025263243242147216143265077100330027142264337::@225245033123204053237120173316075113304004012000 batch
static gpu::Texture * 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
bool has_inverted_handedness() const
IndexRange index_range() const
std::string serialize() const
std::string serialize() const
std::string serialize() const
std::string serialize() const
void execute(RecordingState &state) const
gpu::StorageBuf ** indirect_buf
Dispatch(int3 *group_len)
std::string serialize() const
void execute(RecordingState &state) const
uint32_t expand_prim_type
struct blender::draw::command::DrawGroup::@065172161005140006364026044166345126204356255202 desc
uint front_facing_counter
void execute(RecordingState &state) const
std::string serialize() const
gpu::StorageBuf ** 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, ResourceIndex res_index)
gpu::FrameBuffer ** 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
gpu::shader::SpecializationConstants specialization_constants
void front_facing_set(bool facing)
const gpu::shader::SpecializationConstants * specialization_constants_get()
bool specialization_constants_in_use
ResourceBind(int slot_, gpu::VertBuf **res, Type)
gpu::UniformBuf * uniform_buf
gpu::Texture ** texture_ref
gpu::VertBuf * vertex_buf
enum blender::draw::command::ResourceBind::Type type
ResourceBind(int slot_, draw::Image *res)
ResourceBind(int slot_, gpu::StorageBuf **res)
gpu::VertBuf ** vertex_buf_ref
ResourceBind(int slot_, gpu::VertBuf *res)
ResourceBind(int slot_, gpu::UniformBuf *res)
ResourceBind(int slot_, gpu::Texture **res, GPUSamplerState state)
ResourceBind(int slot_, gpu::UniformBuf **res)
ResourceBind(int slot_, gpu::UniformBuf **res, Type)
ResourceBind(int slot_, gpu::Texture *res, GPUSamplerState state)
gpu::UniformBuf ** uniform_buf_ref
gpu::IndexBuf * index_buf
ResourceBind(int slot_, draw::Image **res)
ResourceBind(int slot_, gpu::VertBuf **res)
gpu::StorageBuf * storage_buf
std::string serialize() const
ResourceBind(int slot_, gpu::IndexBuf *res, Type)
ResourceBind(int slot_, gpu::StorageBuf *res)
gpu::IndexBuf ** index_buf_ref
gpu::StorageBuf ** storage_buf_ref
ResourceBind(int slot_, gpu::UniformBuf *res, Type)
ResourceBind(int slot_, gpu::VertBuf *res, Type)
ResourceBind(int slot_, gpu::IndexBuf **res, Type)
void execute(RecordingState &state) const
std::string serialize() const
SpecializeConstant(gpu::Shader *sh, int loc, const uint *val)
SpecializeConstant(gpu::Shader *sh, int loc, const int &val)
SpecializeConstant(gpu::Shader *sh, int loc, const bool *val)
SpecializeConstant(gpu::Shader *sh, int loc, const float *val)
void execute(RecordingState &state) const
SpecializeConstant()=default
SpecializeConstant(gpu::Shader *sh, int loc, const uint &val)
SpecializeConstant(gpu::Shader *sh, int loc, const bool &val)
SpecializeConstant(gpu::Shader *sh, int loc, const int *val)
enum blender::draw::command::SpecializeConstant::Type type
SpecializeConstant(gpu::Shader *sh, int loc, const float &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