33template<
typename DrawCommandBufType>
class PassBase;
66 facing = this->inverted_view == facing;
390 uint expanded_prim_len,
421 std::string
serialize(
const std::string &line_prefix)
const;
562 ResourceIdBuf resource_id_buf_;
564 uint resource_id_count_ = 0;
569 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
584 vertex_first = vertex_first != -1 ? vertex_first : 0;
585 instance_len = instance_len != -1 ? instance_len : 1;
587 BLI_assert_msg(custom_id == 0,
"Custom ID is not supported in PassSimple");
590 for (
auto res_id : id_range.
id_range()) {
593 commands[
index].draw = {batch,
605 SubPassVector &sub_passes);
612 SubPassVector &sub_passes,
613 uint &resource_id_count,
614 ResourceIdBuf &resource_id_buf);
657 using DrawGroupKey = std::pair<uint, gpu::Batch *>;
660 DrawGroupMap group_ids_;
663 DrawGroupBuf group_buf_ = {
"DrawGroupBuf"};
665 DrawPrototypeBuf prototype_buf_ = {
"DrawPrototypeBuf"};
667 DrawCommandBuf command_buf_ = {
"DrawCommandBuf"};
669 ResourceIdBuf resource_id_buf_ = {
"ResourceIdBuf"};
671 uint header_id_counter_ = 0;
673 uint group_count_ = 0;
675 uint prototype_count_ = 0;
677 uint resource_id_count_ = 0;
682 group_buf_.trim_to_next_power_of_2(group_count_);
684 command_buf_.trim_to_next_power_of_2(group_count_ * 2);
685 prototype_buf_.trim_to_next_power_of_2(prototype_count_);
686 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
687 header_id_counter_ = 0;
689 prototype_count_ = 0;
706 const bool custom_group = ((vertex_first != 0 && vertex_first != -1) || vertex_len != -1);
709 vertex_len = vertex_len == -1 ? 0 : vertex_len;
710 instance_len = instance_len != -1 ? instance_len : 1;
716 commands[
index].draw_multi = {batch,
this,
uint(-1), header_id_counter_++};
719 DrawMulti &cmd = commands.
last().draw_multi;
721 uint &group_id = group_ids_.lookup_or_add(DrawGroupKey(cmd.
uuid, batch),
uint(-1));
725 for (
auto res_id : id_range.
id_range()) {
728 draw.custom_id = custom_id;
729 draw.instance_len = instance_len;
730 draw.group_id = group_id;
732 if (group_id ==
uint(-1) || custom_group) {
733 uint new_group_id = group_count_++;
734 draw.group_id = new_group_id;
736 DrawGroup &group = group_buf_.get_or_resize(new_group_id);
738 group.
len = instance_len;
744 group.
desc.gpu_batch = batch;
745 group.
desc.expand_prim_type = expanded_prim_type;
746 group.
desc.expand_prim_len = expanded_prim_len;
748 "Not enough bits to store primitive expansion");
751 group_id = new_group_id;
760 group.
len += instance_len;
779 int visibility_word_per_draw,
781 bool use_custom_ids);
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
virtual bool serialize(void *o_alignedDataBuffer, unsigned i_dataBufferSize, bool i_swapEndian) const
Data buffer MUST be 16 byte aligned.
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, ResourceIDRange id_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 append_draw(Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, gpu::Batch *batch, uint instance_len, uint vertex_len, uint vertex_first, ResourceIDRange id_range, uint custom_id, GPUPrimType expanded_prim_type, uint16_t expanded_prim_len)
void bind(RecordingState &state)
#define DRW_STATE_DEFAULT
TEX_TEMPLATE DataVec texture(T, FltCoord, float=0.0f) RET
ccl_device_inline float3x3 inverted(const float3x3 m)
BLI_STATIC_ASSERT(MBC_BATCH_LEN< 64, "Number of batches exceeded the limit of bit fields")
StorageArrayBuffer< uint, 4, true > VisibilityBuf
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void GPU_storagebuf_debug_unbind_all()
VecBase< int32_t, 4 > int4
bool assign_if_different(T &old_value, T &&new_value)
void GPU_texture_unbind_all()
MatBase< float, 4, 4 > float4x4
VecBase< float, 4 > float4
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
VecBase< int32_t, 3 > int3
void GPU_texture_image_unbind_all()
void GPU_front_facing(bool invert)
void GPU_uniformbuf_debug_unbind_all()
VecBase< float, 3 > float3
VecBase< double, 4 > double4
MINLINE uint min_uu(uint a, uint b)
bool has_inverted_handedness() const
IndexRange id_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)
void execute(RecordingState &state) const
struct blender::draw::command::DrawGroup::@260053362377366347260167202326266235125360167346 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
uint32_t expand_prim_type
Draw(gpu::Batch *batch, uint instance_len, uint vertex_len, uint vertex_first, GPUPrimType expanded_prim_type, uint expanded_prim_len, ResourceID res_id)
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)
PushConstant(int loc, const float2 *val, int arr)
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)
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)
PushConstant(int loc, const int *val, int arr)
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::TopLevelAS *res)
ResourceBind(int slot_, gpu::VertBuf **res, Type)
enum blender::draw::command::ResourceBind::Type type
ResourceBind(int slot_, draw::Image *res)
ResourceBind(int slot_, gpu::StorageBuf **res)
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)
ResourceBind(int slot_, draw::Image **res)
ResourceBind(int slot_, gpu::VertBuf **res)
ResourceBind(int slot_, gpu::IndexBuf *res, Type)
ResourceBind(int slot_, gpu::StorageBuf *res)
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
void execute(RecordingState &state) const
static void set(DRWState state=DRW_STATE_DEFAULT)
std::string serialize() const
std::string serialize() const
std::string serialize() const
const float4 * float4_ref
const float4x4 * float4x4_ref
const float2 * float2_ref
const float3 * float3_ref
gpu::UniformBuf * uniform_buf
gpu::Texture ** texture_ref
gpu::VertBuf * vertex_buf
gpu::StorageBuf * storage_buf
gpu::VertBuf ** vertex_buf_ref
gpu::IndexBuf ** index_buf_ref
gpu::UniformBuf ** uniform_buf_ref
gpu::StorageBuf ** storage_buf_ref
gpu::IndexBuf * index_buf
FramebufferBind framebuffer_bind
DrawIndirect draw_indirect
ResourceBind resource_bind
DispatchIndirect dispatch_indirect
SubPassTransition subpass_transition
PushConstant push_constant
SpecializeConstant specialize_constant