Cleanup: Compiler warnings in new sculpt & workbench

Set but unused variables, unused arguments, unnecessary/incorrect type
casting, missing static qualifier. Unused arguments are removed.
This commit is contained in:
Hans Goudey 2023-01-23 14:57:26 -06:00
parent f24b9a7943
commit 79ba1a1ac8
Notes: blender-bot 2023-02-13 23:39:48 +01:00
Referenced by commit 361ebe98d5, Draw: Workbench Next: Fix shadow culling after recent cleanup commit
Referenced by commit 0ad4d07f10, Fix: Debug build compile error after recent cleanup commit
12 changed files with 23 additions and 55 deletions

View File

@ -99,12 +99,8 @@ struct SplitNodePair {
static void split_thread_job(TaskPool *__restrict pool, void *taskdata);
static void split_pixel_node(PBVH *pbvh,
SplitNodePair *split,
Mesh *mesh,
Image *image,
ImageUser *image_user,
SplitQueueData *tdata)
static void split_pixel_node(
PBVH *pbvh, SplitNodePair *split, Image *image, ImageUser *image_user, SplitQueueData *tdata)
{
BB cb;
PBVHNode *node = &split->node;
@ -304,7 +300,7 @@ static void split_thread_job(TaskPool *__restrict pool, void *taskdata)
SplitQueueData *tdata = static_cast<SplitQueueData *>(BLI_task_pool_user_data(pool));
SplitNodePair *split = static_cast<SplitNodePair *>(taskdata);
split_pixel_node(tdata->pbvh, split, tdata->mesh, tdata->image, tdata->image_user, tdata);
split_pixel_node(tdata->pbvh, split, tdata->image, tdata->image_user, tdata);
}
static void split_pixel_nodes(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user)

View File

@ -225,11 +225,7 @@ static void basic_cache_populate(void *vedata, Object *ob)
if (G.debug_value == 889 && ob->sculpt && ob->sculpt->pbvh) {
int debug_node_nr = 0;
DRW_debug_modelmat(ob->object_to_world);
BKE_pbvh_draw_debug_cb(
ob->sculpt->pbvh,
(void (*)(void *d, const float min[3], const float max[3], PBVHNodeFlags f))
DRW_sculpt_debug_cb,
&debug_node_nr);
BKE_pbvh_draw_debug_cb(ob->sculpt->pbvh, DRW_sculpt_debug_cb, &debug_node_nr);
}
}
}

View File

@ -888,11 +888,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
if (G.debug_value == 889 && ob->sculpt && ob->sculpt->pbvh) {
int debug_node_nr = 0;
DRW_debug_modelmat(ob->object_to_world);
BKE_pbvh_draw_debug_cb(
ob->sculpt->pbvh,
(void (*)(void *d, const float min[3], const float max[3], PBVHNodeFlags f))
DRW_sculpt_debug_cb,
&debug_node_nr);
BKE_pbvh_draw_debug_cb(ob->sculpt->pbvh, DRW_sculpt_debug_cb, &debug_node_nr);
}
}

View File

@ -38,7 +38,7 @@ void OutlinePass::sync(SceneResources &resources)
ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
}
void OutlinePass::draw(Manager &manager, View &view, SceneResources &resources, int2 resolution)
void OutlinePass::draw(Manager &manager, SceneResources &resources)
{
if (!enabled_) {
return;

View File

@ -272,7 +272,7 @@ class Instance {
}
if (object_state.draw_shadow) {
shadow_ps.object_sync(manager, scene_state, ob_ref, handle, has_transparent_material);
shadow_ps.object_sync(scene_state, ob_ref, handle, has_transparent_material);
}
}
@ -363,11 +363,11 @@ class Instance {
&shadow_ps,
transparent_ps.accumulation_ps_.is_empty());
transparent_ps.draw(manager, view, resources, resolution);
transparent_depth_ps.draw(manager, view, resources, resolution);
transparent_depth_ps.draw(manager, view, resources);
// volume_ps.draw_prepass(manager, view, resources.depth_tx);
outline_ps.draw(manager, view, resources, resolution);
outline_ps.draw(manager, resources);
dof_ps.draw(manager, view, resources, resolution);
anti_aliasing_ps.draw(manager, view, resources, resolution, depth_tx, color_tx);

View File

@ -216,12 +216,8 @@ void OpaquePass::draw(Manager &manager,
}
if (shadow_pass) {
shadow_pass->draw(manager,
view,
resources,
resolution,
*deferred_ps_stencil_tx,
!gbuffer_in_front_ps_.is_empty());
shadow_pass->draw(
manager, view, resources, *deferred_ps_stencil_tx, !gbuffer_in_front_ps_.is_empty());
}
opaque_fb.ensure(GPU_ATTACHMENT_NONE, GPU_ATTACHMENT_TEXTURE(resources.color_tx));
@ -359,10 +355,7 @@ void TransparentDepthPass::sync(const SceneState &scene_state, SceneResources &r
ePipelineType::OPAQUE, eLightingType::FLAT, clip, resources.shader_cache);
}
void TransparentDepthPass::draw(Manager &manager,
View &view,
SceneResources &resources,
int2 resolution)
void TransparentDepthPass::draw(Manager &manager, View &view, SceneResources &resources)
{
if (is_empty()) {
return;

View File

@ -244,7 +244,7 @@ class TransparentDepthPass {
Framebuffer merge_fb = {"TransparentDepth.Merge"};
void sync(const SceneState &scene_state, SceneResources &resources);
void draw(Manager &manager, View &view, SceneResources &resources, int2 resolution);
void draw(Manager &manager, View &view, SceneResources &resources);
bool is_empty() const;
};
@ -269,7 +269,7 @@ class ShadowPass {
ShadowView();
protected:
virtual void compute_visibility(ObjectBoundsBuf &bounds, uint resource_len, bool debug_freeze);
virtual void compute_visibility(ObjectBoundsBuf &bounds, uint resource_len);
virtual VisibilityBuf &get_visibility_buffer();
} view_ = {};
@ -299,15 +299,13 @@ class ShadowPass {
void init(const SceneState &scene_state, SceneResources &resources);
void update();
void sync();
void object_sync(Manager &manager,
SceneState &scene_state,
void object_sync(SceneState &scene_state,
ObjectRef &ob_ref,
ResourceHandle handle,
const bool has_transp_mat);
void draw(Manager &manager,
View &view,
SceneResources &resources,
int2 resolution,
GPUTexture &depth_stencil_tx,
/* Needed when there are opaque "In Front" objects in the scene */
bool force_fail_method);
@ -324,7 +322,7 @@ class OutlinePass {
public:
void init(const SceneState &scene_state);
void sync(SceneResources &resources);
void draw(Manager &manager, View &view, SceneResources &resources, int2 resolution);
void draw(Manager &manager, SceneResources &resources);
};
class DofPass {

View File

@ -8,7 +8,7 @@
namespace blender::workbench {
bool get_matcap_tx(Texture &matcap_tx, const StudioLight &studio_light)
static bool get_matcap_tx(Texture &matcap_tx, const StudioLight &studio_light)
{
ImBuf *matcap_diffuse = studio_light.matcap_diffuse.ibuf;
ImBuf *matcap_specular = studio_light.matcap_specular.ibuf;
@ -36,7 +36,7 @@ bool get_matcap_tx(Texture &matcap_tx, const StudioLight &studio_light)
return false;
}
float4x4 get_world_shading_rotation_matrix(float studiolight_rot_z)
static float4x4 get_world_shading_rotation_matrix(float studiolight_rot_z)
{
/* TODO(Miguel Pozo) C++ API ? */
float V[4][4], R[4][4];
@ -48,8 +48,8 @@ float4x4 get_world_shading_rotation_matrix(float studiolight_rot_z)
return float4x4(R);
}
LightData get_light_data_from_studio_solidlight(const SolidLight *sl,
float4x4 world_shading_rotation)
static LightData get_light_data_from_studio_solidlight(const SolidLight *sl,
float4x4 world_shading_rotation)
{
LightData light = {};
if (sl && sl->flag) {

View File

@ -131,11 +131,9 @@ void ShadowPass::ShadowView::setup(View &view, float3 light_direction, bool forc
float4 extruded_face = float4(UNPACK3(normal), math::dot(normal, corner_a));
/* Ensure the plane faces outwards */
bool flipped = false;
for (float3 corner : frustum_corners.vec) {
if (math::dot(float3(extruded_face), corner) > (extruded_face.w + 0.1)) {
BLI_assert(!flipped);
flipped = true;
extruded_face *= -1;
}
}
@ -201,9 +199,7 @@ void ShadowPass::ShadowView::set_mode(ShadowPass::PassType type)
current_pass_type_ = type;
}
void ShadowPass::ShadowView::compute_visibility(ObjectBoundsBuf &bounds,
uint resource_len,
bool debug_freeze)
void ShadowPass::ShadowView::compute_visibility(ObjectBoundsBuf &bounds, uint resource_len)
{
GPU_debug_group_begin("ShadowView.compute_visibility");
@ -390,8 +386,7 @@ void ShadowPass::sync()
}
}
void ShadowPass::object_sync(Manager &manager,
SceneState &scene_state,
void ShadowPass::object_sync(SceneState &scene_state,
ObjectRef &ob_ref,
ResourceHandle handle,
const bool has_transp_mat)
@ -436,7 +431,6 @@ void ShadowPass::object_sync(Manager &manager,
void ShadowPass::draw(Manager &manager,
View &view,
SceneResources &resources,
int2 resolution,
GPUTexture &depth_stencil_tx,
bool force_fail_method)
{

View File

@ -1807,8 +1807,6 @@ bool SCULPT_paint_image_canvas_get(struct PaintModeSettings *paint_mode_settings
void SCULPT_do_paint_brush_image(struct PaintModeSettings *paint_mode_settings,
Sculpt *sd,
Object *ob,
PBVHNode **nodes,
int totnode,
PBVHNode **texnodes,
int texnode_num) ATTR_NONNULL();
bool SCULPT_use_image_paint_brush(struct PaintModeSettings *settings, Object *ob) ATTR_NONNULL();

View File

@ -258,8 +258,7 @@ void SCULPT_do_paint_brush(PaintModeSettings *paint_mode_settings,
int texnodes_num)
{
if (SCULPT_use_image_paint_brush(paint_mode_settings, ob)) {
SCULPT_do_paint_brush_image(
paint_mode_settings, sd, ob, nodes, totnode, texnodes, texnodes_num);
SCULPT_do_paint_brush_image(paint_mode_settings, sd, ob, texnodes, texnodes_num);
return;
}

View File

@ -552,8 +552,6 @@ bool SCULPT_use_image_paint_brush(PaintModeSettings *settings, Object *ob)
void SCULPT_do_paint_brush_image(PaintModeSettings *paint_mode_settings,
Sculpt *sd,
Object *ob,
PBVHNode **nodes,
int totnode,
PBVHNode **texnodes,
int texnodes_num)
{