28template<
typename DrawCommandBufType>
class PassBase;
359#ifdef WITH_METAL_BACKEND
371#ifdef WITH_METAL_BACKEND
375 uint expanded_prim_len,
380#ifdef WITH_METAL_BACKEND
381 this->shader = shader;
387 this->expand_prim_type = expanded_prim_type;
388 this->expand_prim_len = expanded_prim_len;
407 std::string
serialize(
const std::string &line_prefix)
const;
506#ifdef WITH_METAL_BACKEND
533 ResourceIdBuf resource_id_buf_;
535 uint resource_id_count_ = 0;
540 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
551#ifdef WITH_METAL_BACKEND
557 vertex_first = vertex_first != -1 ? vertex_first : 0;
558 instance_len = instance_len != -1 ? instance_len : 1;
560 BLI_assert_msg(custom_id == 0,
"Custom ID is not supported in PassSimple");
565 commands[index].draw = {
batch,
569#ifdef WITH_METAL_BACKEND
580 SubPassVector &sub_passes);
585 SubPassVector &sub_passes,
586 uint &resource_id_count,
587 ResourceIdBuf &resource_id_buf);
630 using DrawGroupKey = std::pair<uint, gpu::Batch *>;
633 DrawGroupMap group_ids_;
636 DrawGroupBuf group_buf_ = {
"DrawGroupBuf"};
638 DrawPrototypeBuf prototype_buf_ = {
"DrawPrototypeBuf"};
640 DrawCommandBuf command_buf_ = {
"DrawCommandBuf"};
642 ResourceIdBuf resource_id_buf_ = {
"ResourceIdBuf"};
644 uint header_id_counter_ = 0;
646 uint group_count_ = 0;
648 uint prototype_count_ = 0;
650 uint resource_id_count_ = 0;
655 group_buf_.trim_to_next_power_of_2(group_count_);
657 command_buf_.trim_to_next_power_of_2(group_count_ * 2);
658 prototype_buf_.trim_to_next_power_of_2(prototype_count_);
659 resource_id_buf_.trim_to_next_power_of_2(resource_id_count_);
660 header_id_counter_ = 0;
662 prototype_count_ = 0;
674#ifdef WITH_METAL_BACKEND
681 const bool custom_group = ((vertex_first != 0 && vertex_first != -1) || vertex_len != -1);
684 vertex_len = vertex_len == -1 ? 0 : vertex_len;
685 instance_len = instance_len != -1 ? instance_len : 1;
691 commands[index].draw_multi = {
batch,
this, (
uint)-1, header_id_counter_++};
694 DrawMulti &cmd = commands.
last().draw_multi;
696 uint &group_id = group_ids_.lookup_or_add(DrawGroupKey(cmd.
uuid,
batch),
uint(-1));
701 draw.resource_handle = handle.
raw;
702 draw.custom_id = custom_id;
703 draw.instance_len = instance_len;
704 draw.group_id = group_id;
706 if (group_id ==
uint(-1) || custom_group) {
707 uint new_group_id = group_count_++;
708 draw.group_id = new_group_id;
710 DrawGroup &group = group_buf_.get_or_resize(new_group_id);
712 group.
len = instance_len;
721 BLI_assert_msg(expanded_prim_len < (1 << 3),
"Not enough bits to store primitive expansion");
722#ifdef WITH_METAL_BACKEND
723 group.
desc.gpu_shader = shader;
727 group_id = new_group_id;
736 group.
len += instance_len;
748#ifdef WITH_METAL_BACKEND
758 int visibility_word_per_draw,
760 bool use_custom_ids);
#define BLI_assert_msg(a, msg)
#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()
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a producing a negative Combine Generate a color from its and blue Hue Saturation Apply a color transformation in the HSV color model Specular Similar to the Principled BSDF node but uses the specular workflow instead of which functions by specifying the facing(along normal) reflection color. Energy is not conserved
struct GPUShader GPUShader
int64_t append_and_get_index(const T &value)
void append(const T &value)
const T & last(const int64_t n=0) const
void bind(RecordingState &state, Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, SubPassVector &sub_passes)
void append_draw(Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, gpu::Batch *batch, uint instance_len, uint vertex_len, uint vertex_first, ResourceHandle handle, 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, ResourceHandle handle, uint custom_id, GPUPrimType expanded_prim_type, uint16_t expanded_prim_len)
void bind(RecordingState &state, Vector< Header, 0 > &headers, Vector< Undetermined, 0 > &commands, VisibilityBuf &visibility_buf, int visibility_word_per_draw, int view_len, bool use_custom_ids)
struct @157336070235062372277311340362362342103123126032::@262166344314164341202215145112231240022370055142 batch
static GPUTexture * as_texture(Image *img)
BLI_STATIC_ASSERT(MBC_BATCH_LEN< 32, "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
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::@131066307251071357023240231171140341257077117032 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)
GPUStorageBuf * resource_id_buf
void front_facing_set(bool facing)
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)
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
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