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
535 uint resource_id_count_ = 0;
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 *>;
644 uint header_id_counter_ = 0;
646 uint group_count_ = 0;
648 uint prototype_count_ = 0;
650 uint resource_id_count_ = 0;
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_++};
698 bool inverted = handle.has_inverted_handedness();
706 if (group_id ==
uint(-1) || custom_group) {
707 uint new_group_id = group_count_++;
712 group.len = instance_len;
713 group.front_facing_len = inverted ? 0 : instance_len;
714 group.front_facing_counter = 0;
715 group.back_facing_counter = 0;
716 group.desc.vertex_len = vertex_len;
717 group.desc.vertex_first = vertex_first;
718 group.desc.gpu_batch =
batch;
719 group.desc.expand_prim_type = expanded_prim_type;
720 group.desc.expand_prim_len = expanded_prim_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;
730 (inverted ? group.back_facing_counter : group.front_facing_counter)++;
736 group.len += instance_len;
737 group.front_facing_len += inverted ? 0 : instance_len;
739 (inverted ? group.back_facing_counter : group.front_facing_counter)++;
746 BLI_assert(group.desc.expand_prim_type == expanded_prim_type);
747 BLI_assert(group.desc.expand_prim_len == expanded_prim_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
Value & lookup_or_add(const Key &key, const Value &value)
int64_t append_and_get_index(const T &value)
void append(const T &value)
const T & last(const int64_t n=0) const
T & get_or_resize(int64_t index)
void trim_to_next_power_of_2(int64_t required_size)
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)
static GPUTexture * as_texture(Image *img)
BLI_STATIC_ASSERT(MBC_BATCH_LEN< 32, "Number of batches exceeded the limit of bit fields")
bool assign_if_different(T &old_value, T new_value)
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
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