Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/draw')
-rw-r--r--source/blender/draw/CMakeLists.txt2
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.c12
-rw-r--r--source/blender/draw/engines/eevee/eevee_lightcache.h2
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_camera.cc4
-rw-r--r--source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc4
-rw-r--r--source/blender/draw/engines/workbench/workbench_materials.c6
-rw-r--r--source/blender/draw/intern/DRW_gpu_wrapper.hh17
-rw-r--r--source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc4
-rw-r--r--source/blender/draw/intern/draw_command.cc38
-rw-r--r--source/blender/draw/intern/draw_command.hh24
-rw-r--r--source/blender/draw/intern/draw_manager_shader.c4
-rw-r--r--source/blender/draw/intern/draw_pass.hh63
-rw-r--r--source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc4
13 files changed, 145 insertions, 39 deletions
diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt
index 4010b491141..5902dc18165 100644
--- a/source/blender/draw/CMakeLists.txt
+++ b/source/blender/draw/CMakeLists.txt
@@ -24,6 +24,8 @@ set(INC
../render
../render/intern
../compositor/realtime_compositor
+ ../compositor/realtime_compositor/algorithms
+ ../compositor/realtime_compositor/cached_resources
../windowmanager
../../../intern/atomic
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c
index 9bf0cce2af2..26a264c1716 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.c
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.c
@@ -142,7 +142,7 @@ typedef struct EEVEE_LightBake {
struct GPUTexture *dummy_layer_color;
int total, done; /* to compute progress */
- short *stop, *do_update;
+ bool *stop, *do_update;
float *progress;
/** For only handling the resources. */
@@ -778,7 +778,7 @@ wmJob *EEVEE_lightbake_job_create(struct wmWindowManager *wm,
}
if (old_lbake->stop != NULL) {
- *old_lbake->stop = 1;
+ *old_lbake->stop = true;
}
BLI_mutex_unlock(old_lbake->mutex);
}
@@ -1359,13 +1359,13 @@ static bool lightbake_do_sample(EEVEE_LightBake *lbake,
DRW_custom_pipeline(&draw_engine_eevee_type, depsgraph, render_callback, lbake);
lbake->done += 1;
*lbake->progress = lbake->done / (float)lbake->total;
- *lbake->do_update = 1;
+ *lbake->do_update = true;
eevee_lightbake_context_disable(lbake);
return true;
}
-void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress)
+void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress)
{
EEVEE_LightBake *lbake = (EEVEE_LightBake *)custom_data;
Depsgraph *depsgraph = lbake->depsgraph;
@@ -1394,8 +1394,8 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float
/* Resource allocation can fail. Early exit in this case. */
if (lbake->lcache->flag & LIGHTCACHE_INVALID) {
- *lbake->stop = 1;
- *lbake->do_update = 1;
+ *lbake->stop = true;
+ *lbake->do_update = true;
lbake->lcache->flag &= ~LIGHTCACHE_BAKING;
eevee_lightbake_context_disable(lbake);
eevee_lightbake_delete_resources(lbake);
diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h
index 4e94e1914a7..73961f1919d 100644
--- a/source/blender/draw/engines/eevee/eevee_lightcache.h
+++ b/source/blender/draw/engines/eevee/eevee_lightcache.h
@@ -42,7 +42,7 @@ void *EEVEE_lightbake_job_data_alloc(struct Main *bmain,
int frame);
void EEVEE_lightbake_job_data_free(void *custom_data);
void EEVEE_lightbake_update(void *custom_data);
-void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float *progress);
+void EEVEE_lightbake_job(void *custom_data, bool *stop, bool *do_update, float *progress);
/**
* This is to update the world irradiance and reflection contribution from
diff --git a/source/blender/draw/engines/eevee_next/eevee_camera.cc b/source/blender/draw/engines/eevee_next/eevee_camera.cc
index ad22219f0ae..4331db4bc4c 100644
--- a/source/blender/draw/engines/eevee_next/eevee_camera.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_camera.cc
@@ -32,7 +32,7 @@ void Camera::init()
CameraData &data = data_;
- if (camera_eval) {
+ if (camera_eval && camera_eval->type == OB_CAMERA) {
const ::Camera *cam = reinterpret_cast<const ::Camera *>(camera_eval->data);
switch (cam->type) {
default:
@@ -112,7 +112,7 @@ void Camera::sync()
data.uv_bias = float2(0.0f);
}
- if (camera_eval) {
+ if (camera_eval && camera_eval->type == OB_CAMERA) {
const ::Camera *cam = reinterpret_cast<const ::Camera *>(camera_eval->data);
data.clip_near = cam->clip_start;
data.clip_far = cam->clip_end;
diff --git a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc
index e4c4f6f3f6f..8672cce80b6 100644
--- a/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc
+++ b/source/blender/draw/engines/eevee_next/eevee_depth_of_field.cc
@@ -44,7 +44,7 @@ void DepthOfField::init()
{
const SceneEEVEE &sce_eevee = inst_.scene->eevee;
const Object *camera_object_eval = inst_.camera_eval_object;
- const ::Camera *camera = (camera_object_eval) ?
+ const ::Camera *camera = (camera_object_eval && camera_object_eval->type == OB_CAMERA) ?
reinterpret_cast<const ::Camera *>(camera_object_eval->data) :
nullptr;
if (camera == nullptr) {
@@ -70,7 +70,7 @@ void DepthOfField::sync()
{
const Camera &camera = inst_.camera;
const Object *camera_object_eval = inst_.camera_eval_object;
- const ::Camera *camera_data = (camera_object_eval) ?
+ const ::Camera *camera_data = (camera_object_eval && camera_object_eval->type == OB_CAMERA) ?
reinterpret_cast<const ::Camera *>(camera_object_eval->data) :
nullptr;
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c
index 4744c0db6ce..7c5e8313532 100644
--- a/source/blender/draw/engines/workbench/workbench_materials.c
+++ b/source/blender/draw/engines/workbench/workbench_materials.c
@@ -88,14 +88,14 @@ BLI_INLINE Material *workbench_object_material_get(Object *ob, int mat_nr)
BLI_INLINE void workbench_material_get_image(
Object *ob, int mat_nr, Image **r_image, ImageUser **r_iuser, eGPUSamplerState *r_sampler)
{
- bNode *node;
+ const bNode *node;
*r_sampler = 0;
ED_object_get_active_image(ob, mat_nr, r_image, r_iuser, &node, NULL);
if (node && *r_image) {
switch (node->type) {
case SH_NODE_TEX_IMAGE: {
- NodeTexImage *storage = node->storage;
+ const NodeTexImage *storage = node->storage;
const bool use_filter = (storage->interpolation != SHD_INTERP_CLOSEST);
const bool use_repeat = (storage->extension == SHD_IMAGE_EXTENSION_REPEAT);
const bool use_clip = (storage->extension == SHD_IMAGE_EXTENSION_CLIP);
@@ -105,7 +105,7 @@ BLI_INLINE void workbench_material_get_image(
break;
}
case SH_NODE_TEX_ENVIRONMENT: {
- NodeTexEnvironment *storage = node->storage;
+ const NodeTexEnvironment *storage = node->storage;
const bool use_filter = (storage->interpolation != SHD_INTERP_CLOSEST);
SET_FLAG_FROM_TEST(*r_sampler, use_filter, GPU_SAMPLER_FILTER);
break;
diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh
index 3be50d471e2..bf701dcf2cd 100644
--- a/source/blender/draw/intern/DRW_gpu_wrapper.hh
+++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh
@@ -318,7 +318,7 @@ template<
/** Type of the values stored in this uniform buffer. */
typename T,
/** The number of values that can be stored in this storage buffer at creation. */
- int64_t len = 16u / sizeof(T),
+ int64_t len = max_ii(1u, 512u / sizeof(T)),
/** True if created on device and no memory host memory is allocated. */
bool device_only = false>
class StorageArrayBuffer : public detail::StorageCommon<T, len, device_only> {
@@ -372,7 +372,7 @@ template<
/** Type of the values stored in this uniform buffer. */
typename T,
/** The number of values that can be stored in this storage buffer at creation. */
- int64_t len = 16u / sizeof(T)>
+ int64_t len = max_ii(1u, 512u / sizeof(T))>
class StorageVectorBuffer : public StorageArrayBuffer<T, len, false> {
private:
/* Number of items, not the allocated length. */
@@ -1029,6 +1029,11 @@ class Framebuffer : NonCopyable {
return fb_;
}
+ GPUFrameBuffer **operator&()
+ {
+ return &fb_;
+ }
+
/**
* Swap the content of the two framebuffer.
*/
@@ -1056,7 +1061,13 @@ template<typename T, int64_t len> class SwapChain {
void swap()
{
for (auto i : IndexRange(len - 1)) {
- T::swap(chain_[i], chain_[(i + 1) % len]);
+ auto i_next = (i + 1) % len;
+ if constexpr (std::is_trivial_v<T>) {
+ SWAP(T, chain_[i], chain_[i_next]);
+ }
+ else {
+ T::swap(chain_[i], chain_[i_next]);
+ }
}
}
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
index f606701ed09..1f5157e6b8b 100644
--- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
+++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
@@ -376,8 +376,8 @@ void mesh_render_data_update_normals(MeshRenderData *mr, const eMRDataType data_
is_auto_smooth,
split_angle,
nullptr,
- clnors,
- nullptr);
+ nullptr,
+ clnors);
}
}
else {
diff --git a/source/blender/draw/intern/draw_command.cc b/source/blender/draw/intern/draw_command.cc
index 10dd63e05dc..69e1c069ff8 100644
--- a/source/blender/draw/intern/draw_command.cc
+++ b/source/blender/draw/intern/draw_command.cc
@@ -32,7 +32,7 @@ void ShaderBind::execute(RecordingState &state) const
void FramebufferBind::execute() const
{
- GPU_framebuffer_bind(framebuffer);
+ GPU_framebuffer_bind(*framebuffer);
}
void ResourceBind::execute() const
@@ -44,6 +44,9 @@ void ResourceBind::execute() const
case ResourceBind::Type::Sampler:
GPU_texture_bind_ex(is_reference ? *texture_ref : texture, sampler, slot, false);
break;
+ case ResourceBind::Type::BufferSampler:
+ GPU_vertbuf_bind_as_texture(is_reference ? *vertex_buf_ref : vertex_buf, slot);
+ break;
case ResourceBind::Type::Image:
GPU_texture_image_bind(is_reference ? *texture_ref : texture, slot);
break;
@@ -158,6 +161,12 @@ void Clear::execute() const
GPU_framebuffer_clear(fb, (eGPUFrameBufferBits)clear_channels, color, depth, stencil);
}
+void ClearMulti::execute() const
+{
+ GPUFrameBuffer *fb = GPU_framebuffer_active_get();
+ GPU_framebuffer_multi_clear(fb, (const float(*)[4])colors);
+}
+
void StateSet::execute(RecordingState &recording_state) const
{
/**
@@ -166,7 +175,10 @@ void StateSet::execute(RecordingState &recording_state) const
*/
BLI_assert(DST.state_lock == 0);
- if (!assign_if_different(recording_state.pipeline_state, new_state)) {
+ bool state_changed = assign_if_different(recording_state.pipeline_state, new_state);
+ bool clip_changed = assign_if_different(recording_state.clip_plane_count, clip_plane_count);
+
+ if (!state_changed && !clip_changed) {
return;
}
@@ -190,12 +202,7 @@ void StateSet::execute(RecordingState &recording_state) const
}
/* TODO: this should be part of shader state. */
- if (new_state & DRW_STATE_CLIP_PLANES) {
- GPU_clip_distances(recording_state.view_clip_plane_count);
- }
- else {
- GPU_clip_distances(0);
- }
+ GPU_clip_distances(recording_state.clip_plane_count);
if (new_state & DRW_STATE_IN_FRONT_SELECT) {
/* XXX `GPU_depth_range` is not a perfect solution
@@ -236,7 +243,8 @@ std::string ShaderBind::serialize() const
std::string FramebufferBind::serialize() const
{
- return std::string(".framebuffer_bind(") + GPU_framebuffer_get_name(framebuffer) + ")";
+ return std::string(".framebuffer_bind(") +
+ (*framebuffer == nullptr ? "nullptr" : GPU_framebuffer_get_name(*framebuffer)) + ")";
}
std::string ResourceBind::serialize() const
@@ -246,6 +254,9 @@ std::string ResourceBind::serialize() const
return std::string(".bind_texture") + (is_reference ? "_ref" : "") + "(" +
std::to_string(slot) +
(sampler != GPU_SAMPLER_MAX ? ", sampler=" + std::to_string(sampler) : "") + ")";
+ case Type::BufferSampler:
+ return std::string(".bind_vertbuf_as_texture") + (is_reference ? "_ref" : "") + "(" +
+ std::to_string(slot) + ")";
case Type::Image:
return std::string(".bind_image") + (is_reference ? "_ref" : "") + "(" +
std::to_string(slot) + ")";
@@ -472,6 +483,15 @@ std::string Clear::serialize() const
return std::string(".clear(") + ss.str() + ")";
}
+std::string ClearMulti::serialize() const
+{
+ std::stringstream ss;
+ for (float4 color : Span<float4>(colors, colors_len)) {
+ ss << color << ", ";
+ }
+ return std::string(".clear_multi(colors={") + ss.str() + "})";
+}
+
std::string StateSet::serialize() const
{
/* TODO(@fclem): Better serialization... */
diff --git a/source/blender/draw/intern/draw_command.hh b/source/blender/draw/intern/draw_command.hh
index ed75ac21031..607f0b36583 100644
--- a/source/blender/draw/intern/draw_command.hh
+++ b/source/blender/draw/intern/draw_command.hh
@@ -39,7 +39,7 @@ struct RecordingState {
bool front_facing = true;
bool inverted_view = false;
DRWState pipeline_state = DRW_STATE_NO_DRAW;
- int view_clip_plane_count = 0;
+ int clip_plane_count = 0;
/** Used for gl_BaseInstance workaround. */
GPUStorageBuf *resource_id_buf = nullptr;
@@ -84,6 +84,7 @@ enum class Type : uint8_t {
/** Commands stored as Undetermined in regular command buffer. */
Barrier,
Clear,
+ ClearMulti,
Dispatch,
DispatchIndirect,
Draw,
@@ -120,7 +121,7 @@ struct ShaderBind {
};
struct FramebufferBind {
- GPUFrameBuffer *framebuffer;
+ GPUFrameBuffer **framebuffer;
void execute() const;
std::string serialize() const;
@@ -133,6 +134,7 @@ struct ResourceBind {
enum class Type : uint8_t {
Sampler = 0,
+ BufferSampler,
Image,
UniformBuf,
StorageBuf,
@@ -148,6 +150,8 @@ struct ResourceBind {
/** NOTE: Texture is used for both Sampler and Image binds. */
GPUTexture *texture;
GPUTexture **texture_ref;
+ GPUVertBuf *vertex_buf;
+ GPUVertBuf **vertex_buf_ref;
};
ResourceBind() = default;
@@ -168,6 +172,10 @@ struct ResourceBind {
: sampler(state), slot(slot_), is_reference(false), type(Type::Sampler), texture(res){};
ResourceBind(int slot_, GPUTexture **res, eGPUSamplerState state)
: sampler(state), slot(slot_), is_reference(true), type(Type::Sampler), texture_ref(res){};
+ ResourceBind(int slot_, GPUVertBuf *res)
+ : slot(slot_), is_reference(false), type(Type::BufferSampler), vertex_buf(res){};
+ ResourceBind(int slot_, GPUVertBuf **res)
+ : slot(slot_), is_reference(true), type(Type::BufferSampler), vertex_buf_ref(res){};
void execute() const;
std::string serialize() const;
@@ -323,8 +331,18 @@ struct Clear {
std::string serialize() const;
};
+struct ClearMulti {
+ /** \note This should be a Span<float4> but we need have to only have trivial types here. */
+ const float4 *colors;
+ int colors_len;
+
+ void execute() const;
+ std::string serialize() const;
+};
+
struct StateSet {
DRWState new_state;
+ int clip_plane_count;
void execute(RecordingState &state) const;
std::string serialize() const;
@@ -342,6 +360,7 @@ struct StencilSet {
union Undetermined {
ShaderBind shader_bind;
ResourceBind resource_bind;
+ FramebufferBind framebuffer_bind;
PushConstant push_constant;
Draw draw;
DrawMulti draw_multi;
@@ -350,6 +369,7 @@ union Undetermined {
DispatchIndirect dispatch_indirect;
Barrier barrier;
Clear clear;
+ ClearMulti clear_multi;
StateSet state_set;
StencilSet stencil_set;
};
diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c
index 40b05dff51f..85701a10f4b 100644
--- a/source/blender/draw/intern/draw_manager_shader.c
+++ b/source/blender/draw/intern/draw_manager_shader.c
@@ -64,8 +64,8 @@ static void drw_deferred_shader_compilation_exec(
void *custom_data,
/* Cannot be const, this function implements wm_jobs_start_callback.
* NOLINTNEXTLINE: readability-non-const-parameter. */
- short *stop,
- short *UNUSED(do_update),
+ bool *stop,
+ bool *UNUSED(do_update),
float *UNUSED(progress))
{
GPU_render_begin();
diff --git a/source/blender/draw/intern/draw_pass.hh b/source/blender/draw/intern/draw_pass.hh
index 892dfdddfcf..51b30674359 100644
--- a/source/blender/draw/intern/draw_pass.hh
+++ b/source/blender/draw/intern/draw_pass.hh
@@ -159,8 +159,10 @@ class PassBase {
*
* IMPORTANT: This does not set the stencil mask/reference values. Add a call to state_stencil()
* to ensure correct behavior of stencil aware draws.
+ *
+ * TODO(fclem): clip_plane_count should be part of shader state.
*/
- void state_set(DRWState state);
+ void state_set(DRWState state, int clip_plane_count = 0);
/**
* Clear the current frame-buffer.
@@ -170,6 +172,11 @@ class PassBase {
void clear_stencil(uint8_t stencil);
void clear_depth_stencil(float depth, uint8_t stencil);
void clear_color_depth_stencil(float4 color, float depth, uint8_t stencil);
+ /**
+ * Clear each color attachment with different values. Span needs to be appropriately sized.
+ * IMPORTANT: The source is dereference on pass submission.
+ */
+ void clear_multi(Span<float4> colors);
/**
* Reminders:
@@ -193,8 +200,9 @@ class PassBase {
/**
* Bind a framebuffer. This is equivalent to a deferred GPU_framebuffer_bind() call.
* \note Changes the global GPU state (outside of DRW).
+ * \note Capture reference to the framebuffer so it can be initialized later.
*/
- void framebuffer_set(GPUFrameBuffer *framebuffer);
+ void framebuffer_set(GPUFrameBuffer **framebuffer);
/**
* Bind a material shader along with its associated resources. Any following bind() or
@@ -271,8 +279,12 @@ class PassBase {
void bind_image(int slot, GPUTexture **image);
void bind_texture(const char *name, GPUTexture *texture, eGPUSamplerState state = sampler_auto);
void bind_texture(const char *name, GPUTexture **texture, eGPUSamplerState state = sampler_auto);
+ void bind_texture(const char *name, GPUVertBuf *buffer);
+ void bind_texture(const char *name, GPUVertBuf **buffer);
void bind_texture(int slot, GPUTexture *texture, eGPUSamplerState state = sampler_auto);
void bind_texture(int slot, GPUTexture **texture, eGPUSamplerState state = sampler_auto);
+ void bind_texture(int slot, GPUVertBuf *buffer);
+ void bind_texture(int slot, GPUVertBuf **buffer);
void bind_ssbo(const char *name, GPUStorageBuf *buffer);
void bind_ssbo(const char *name, GPUStorageBuf **buffer);
void bind_ssbo(int slot, GPUStorageBuf *buffer);
@@ -466,6 +478,11 @@ inline void PassBase<T>::clear(eGPUFrameBufferBits planes,
create_command(command::Type::Clear).clear = {uint8_t(planes), stencil, depth, color};
}
+template<class T> inline void PassBase<T>::clear_multi(Span<float4> colors)
+{
+ create_command(command::Type::ClearMulti).clear_multi = {colors.data(), colors.size()};
+}
+
template<class T> inline GPUBatch *PassBase<T>::procedural_batch_get(GPUPrimType primitive)
{
switch (primitive) {
@@ -504,6 +521,9 @@ template<class T> void PassBase<T>::submit(command::RecordingState &state) const
case Type::SubPass:
sub_passes_[header.index].submit(state);
break;
+ case command::Type::FramebufferBind:
+ commands_[header.index].framebuffer_bind.execute();
+ break;
case command::Type::ShaderBind:
commands_[header.index].shader_bind.execute(state);
break;
@@ -534,6 +554,9 @@ template<class T> void PassBase<T>::submit(command::RecordingState &state) const
case command::Type::Clear:
commands_[header.index].clear.execute();
break;
+ case command::Type::ClearMulti:
+ commands_[header.index].clear_multi.execute();
+ break;
case command::Type::StateSet:
commands_[header.index].state_set.execute(state);
break;
@@ -559,6 +582,9 @@ template<class T> std::string PassBase<T>::serialize(std::string line_prefix) co
case Type::SubPass:
ss << sub_passes_[header.index].serialize(line_prefix);
break;
+ case Type::FramebufferBind:
+ ss << line_prefix << commands_[header.index].framebuffer_bind.serialize() << std::endl;
+ break;
case Type::ShaderBind:
ss << line_prefix << commands_[header.index].shader_bind.serialize() << std::endl;
break;
@@ -589,6 +615,9 @@ template<class T> std::string PassBase<T>::serialize(std::string line_prefix) co
case Type::Clear:
ss << line_prefix << commands_[header.index].clear.serialize() << std::endl;
break;
+ case Type::ClearMulti:
+ ss << line_prefix << commands_[header.index].clear_multi.serialize() << std::endl;
+ break;
case Type::StateSet:
ss << line_prefix << commands_[header.index].state_set.serialize() << std::endl;
break;
@@ -731,9 +760,13 @@ template<class T> inline void PassBase<T>::barrier(eGPUBarrier type)
/** \name State Implementation
* \{ */
-template<class T> inline void PassBase<T>::state_set(DRWState state)
+template<class T> inline void PassBase<T>::state_set(DRWState state, int clip_plane_count)
{
- create_command(Type::StateSet).state_set = {state};
+ /** \note This is for compatibility with the old clip plane API. */
+ if (clip_plane_count > 0) {
+ state |= DRW_STATE_CLIP_PLANES;
+ }
+ create_command(Type::StateSet).state_set = {state, clip_plane_count};
}
template<class T>
@@ -748,7 +781,7 @@ template<class T> inline void PassBase<T>::shader_set(GPUShader *shader)
create_command(Type::ShaderBind).shader_bind = {shader};
}
-template<class T> inline void PassBase<T>::framebuffer_set(GPUFrameBuffer *framebuffer)
+template<class T> inline void PassBase<T>::framebuffer_set(GPUFrameBuffer **framebuffer)
{
create_command(Type::FramebufferBind).framebuffer_bind = {framebuffer};
}
@@ -820,6 +853,16 @@ inline void PassBase<T>::bind_texture(const char *name,
this->bind_texture(GPU_shader_get_texture_binding(shader_, name), texture, state);
}
+template<class T> inline void PassBase<T>::bind_texture(const char *name, GPUVertBuf *buffer)
+{
+ this->bind_texture(GPU_shader_get_texture_binding(shader_, name), buffer);
+}
+
+template<class T> inline void PassBase<T>::bind_texture(const char *name, GPUVertBuf **buffer)
+{
+ this->bind_texture(GPU_shader_get_texture_binding(shader_, name), buffer);
+}
+
template<class T> inline void PassBase<T>::bind_image(const char *name, GPUTexture *image)
{
this->bind_image(GPU_shader_get_texture_binding(shader_, name), image);
@@ -841,6 +884,16 @@ inline void PassBase<T>::bind_texture(int slot, GPUTexture *texture, eGPUSampler
create_command(Type::ResourceBind).resource_bind = {slot, texture, state};
}
+template<class T> inline void PassBase<T>::bind_texture(int slot, GPUVertBuf *buffer)
+{
+ create_command(Type::ResourceBind).resource_bind = {slot, buffer};
+}
+
+template<class T> inline void PassBase<T>::bind_texture(int slot, GPUVertBuf **buffer)
+{
+ create_command(Type::ResourceBind).resource_bind = {slot, buffer};
+}
+
template<class T> inline void PassBase<T>::bind_image(int slot, GPUTexture *image)
{
create_command(Type::ResourceBind).resource_bind = {slot, as_image(image)};
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
index a968bd07c87..de1f5181ac5 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
@@ -66,7 +66,7 @@ static void extract_edge_fac_init(const MeshRenderData *mr,
* We could have a flag in the mesh instead or check the modifier stack. */
const MEdge *med = mr->medge;
for (int e_index = 0; e_index < mr->edge_len; e_index++, med++) {
- if ((med->flag & ME_EDGERENDER) == 0) {
+ if ((med->flag & ME_EDGEDRAW) == 0) {
data->use_edge_render = true;
break;
}
@@ -118,7 +118,7 @@ static void extract_edge_fac_iter_poly_mesh(const MeshRenderData *mr,
if (data->use_edge_render) {
const MEdge *med = &mr->medge[ml->e];
- data->vbo_data[ml_index] = (med->flag & ME_EDGERENDER) ? 255 : 0;
+ data->vbo_data[ml_index] = (med->flag & ME_EDGEDRAW) ? 255 : 0;
}
else {