Cleanup: Clang-Tidy, modernize-redundant-void-arg
This commit is contained in:
		@@ -43,7 +43,6 @@ Checks:  >
 | 
			
		||||
  -modernize-use-emplace,
 | 
			
		||||
  -modernize-use-nodiscard,
 | 
			
		||||
  -modernize-use-using,
 | 
			
		||||
  -modernize-redundant-void-arg,
 | 
			
		||||
  -modernize-use-bool-literals,
 | 
			
		||||
  -modernize-loop-convert,
 | 
			
		||||
  -modernize-pass-by-value,
 | 
			
		||||
 
 | 
			
		||||
@@ -73,7 +73,7 @@ void DepsgraphDebug::end_graph_evaluation()
 | 
			
		||||
  is_ever_evaluated = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool terminal_do_color(void)
 | 
			
		||||
bool terminal_do_color()
 | 
			
		||||
{
 | 
			
		||||
  return (G.debug & G_DEBUG_DEPSGRAPH_PRETTY) != 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -90,7 +90,7 @@ string color_for_pointer(const void *pointer)
 | 
			
		||||
  return string(buffer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
string color_end(void)
 | 
			
		||||
string color_end()
 | 
			
		||||
{
 | 
			
		||||
  if (!terminal_do_color()) {
 | 
			
		||||
    return "";
 | 
			
		||||
 
 | 
			
		||||
@@ -188,7 +188,7 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer()
 | 
			
		||||
  BKE_main_free(freestyle_bmain);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
float BlenderStrokeRenderer::get_stroke_vertex_z(void) const
 | 
			
		||||
float BlenderStrokeRenderer::get_stroke_vertex_z() const
 | 
			
		||||
{
 | 
			
		||||
  float z = _z;
 | 
			
		||||
  BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this);
 | 
			
		||||
@@ -199,7 +199,7 @@ float BlenderStrokeRenderer::get_stroke_vertex_z(void) const
 | 
			
		||||
  return -z;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned int BlenderStrokeRenderer::get_stroke_mesh_id(void) const
 | 
			
		||||
unsigned int BlenderStrokeRenderer::get_stroke_mesh_id() const
 | 
			
		||||
{
 | 
			
		||||
  unsigned mesh_id = _mesh_id;
 | 
			
		||||
  BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this);
 | 
			
		||||
 
 | 
			
		||||
@@ -80,12 +80,12 @@ Context::~Context()
 | 
			
		||||
  delete imm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool Context::is_active_on_thread(void)
 | 
			
		||||
bool Context::is_active_on_thread()
 | 
			
		||||
{
 | 
			
		||||
  return (this == active_ctx) && pthread_equal(pthread_self(), thread_);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Context *Context::get(void)
 | 
			
		||||
Context *Context::get()
 | 
			
		||||
{
 | 
			
		||||
  return active_ctx;
 | 
			
		||||
}
 | 
			
		||||
@@ -188,7 +188,7 @@ void GPU_backend_exit(void)
 | 
			
		||||
  g_backend = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GPUBackend *GPUBackend::get(void)
 | 
			
		||||
GPUBackend *GPUBackend::get()
 | 
			
		||||
{
 | 
			
		||||
  return g_backend;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -496,7 +496,7 @@ static void gpuPushFrameBuffer(GPUFrameBuffer *fb)
 | 
			
		||||
  FrameBufferStack.top++;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static GPUFrameBuffer *gpuPopFrameBuffer(void)
 | 
			
		||||
static GPUFrameBuffer *gpuPopFrameBuffer()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(FrameBufferStack.top > 0);
 | 
			
		||||
  FrameBufferStack.top--;
 | 
			
		||||
 
 | 
			
		||||
@@ -41,17 +41,17 @@ using namespace blender::gpu;
 | 
			
		||||
 | 
			
		||||
static thread_local Immediate *imm = NULL;
 | 
			
		||||
 | 
			
		||||
void immActivate(void)
 | 
			
		||||
void immActivate()
 | 
			
		||||
{
 | 
			
		||||
  imm = Context::get()->imm;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void immDeactivate(void)
 | 
			
		||||
void immDeactivate()
 | 
			
		||||
{
 | 
			
		||||
  imm = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GPUVertFormat *immVertexFormat(void)
 | 
			
		||||
GPUVertFormat *immVertexFormat()
 | 
			
		||||
{
 | 
			
		||||
  GPU_vertformat_clear(&imm->vertex_format);
 | 
			
		||||
  return &imm->vertex_format;
 | 
			
		||||
@@ -81,7 +81,7 @@ void immBindBuiltinProgram(eGPUBuiltinShader shader_id)
 | 
			
		||||
  imm->builtin_shader_bound = shader_id;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void immUnbindProgram(void)
 | 
			
		||||
void immUnbindProgram()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(imm->shader != NULL);
 | 
			
		||||
 | 
			
		||||
@@ -90,7 +90,7 @@ void immUnbindProgram(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* XXX do not use it. Special hack to use OCIO with batch API. */
 | 
			
		||||
GPUShader *immGetShader(void)
 | 
			
		||||
GPUShader *immGetShader()
 | 
			
		||||
{
 | 
			
		||||
  return imm->shader;
 | 
			
		||||
}
 | 
			
		||||
@@ -187,7 +187,7 @@ static void wide_line_workaround_start(GPUPrimType prim_type)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void wide_line_workaround_end(void)
 | 
			
		||||
static void wide_line_workaround_end()
 | 
			
		||||
{
 | 
			
		||||
  if (imm->prev_shader) {
 | 
			
		||||
    immUnbindProgram();
 | 
			
		||||
@@ -249,7 +249,7 @@ GPUBatch *immBeginBatchAtMost(GPUPrimType prim_type, uint vertex_len)
 | 
			
		||||
  return immBeginBatch(prim_type, vertex_len);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void immEnd(void)
 | 
			
		||||
void immEnd()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* Make sure we're between a Begin/End pair. */
 | 
			
		||||
  BLI_assert(imm->vertex_data || imm->batch);
 | 
			
		||||
@@ -480,7 +480,7 @@ void immAttrSkip(uint attr_id)
 | 
			
		||||
  setAttrValueBit(attr_id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void immEndVertex(void) /* and move on to the next vertex */
 | 
			
		||||
static void immEndVertex() /* and move on to the next vertex */
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(imm->prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
 | 
			
		||||
  BLI_assert(imm->vertex_idx < imm->vertex_len);
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ void GPUPlatformGlobal::create_gpu_name(const char *vendor,
 | 
			
		||||
  BLI_str_replace_char(gpu_name, '\r', ' ');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GPUPlatformGlobal::clear(void)
 | 
			
		||||
void GPUPlatformGlobal::clear()
 | 
			
		||||
{
 | 
			
		||||
  MEM_SAFE_FREE(GPG.support_key);
 | 
			
		||||
  MEM_SAFE_FREE(GPG.gpu_name);
 | 
			
		||||
@@ -94,12 +94,12 @@ void GPUPlatformGlobal::clear(void)
 | 
			
		||||
 | 
			
		||||
using namespace blender::gpu;
 | 
			
		||||
 | 
			
		||||
eGPUSupportLevel GPU_platform_support_level(void)
 | 
			
		||||
eGPUSupportLevel GPU_platform_support_level()
 | 
			
		||||
{
 | 
			
		||||
  return GPG.support_level;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *GPU_platform_support_level_key(void)
 | 
			
		||||
const char *GPU_platform_support_level_key()
 | 
			
		||||
{
 | 
			
		||||
  return GPG.support_key;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -32,12 +32,12 @@
 | 
			
		||||
 | 
			
		||||
namespace blender::gpu {
 | 
			
		||||
 | 
			
		||||
ShaderInterface::ShaderInterface(void)
 | 
			
		||||
ShaderInterface::ShaderInterface()
 | 
			
		||||
{
 | 
			
		||||
  /* TODO(fclem): add unique ID for debugging. */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ShaderInterface::~ShaderInterface(void)
 | 
			
		||||
ShaderInterface::~ShaderInterface()
 | 
			
		||||
{
 | 
			
		||||
  /* Free memory used by name_buffer. */
 | 
			
		||||
  MEM_freeN(name_buffer_);
 | 
			
		||||
@@ -70,14 +70,14 @@ static void sort_input_list(MutableSpan<ShaderInput> dst)
 | 
			
		||||
/* Sorts all inputs inside their respective array.
 | 
			
		||||
 * This is to allow fast hash collision detection.
 | 
			
		||||
 * See ShaderInterface::input_lookup for more details. */
 | 
			
		||||
void ShaderInterface::sort_inputs(void)
 | 
			
		||||
void ShaderInterface::sort_inputs()
 | 
			
		||||
{
 | 
			
		||||
  sort_input_list(MutableSpan<ShaderInput>(inputs_, attr_len_));
 | 
			
		||||
  sort_input_list(MutableSpan<ShaderInput>(inputs_ + attr_len_, ubo_len_));
 | 
			
		||||
  sort_input_list(MutableSpan<ShaderInput>(inputs_ + attr_len_ + ubo_len_, uniform_len_));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ShaderInterface::debug_print(void)
 | 
			
		||||
void ShaderInterface::debug_print()
 | 
			
		||||
{
 | 
			
		||||
  Span<ShaderInput> attrs = Span<ShaderInput>(inputs_, attr_len_);
 | 
			
		||||
  Span<ShaderInput> ubos = Span<ShaderInput>(inputs_ + attr_len_, ubo_len_);
 | 
			
		||||
 
 | 
			
		||||
@@ -260,7 +260,7 @@ eGPUStencilTest GPU_stencil_test_get()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* NOTE: Already premultiplied by U.pixelsize. */
 | 
			
		||||
float GPU_line_width_get(void)
 | 
			
		||||
float GPU_line_width_get()
 | 
			
		||||
{
 | 
			
		||||
  GPUStateMutable &state = Context::get()->state_manager->mutable_state;
 | 
			
		||||
  return state.line_width;
 | 
			
		||||
@@ -285,13 +285,13 @@ void GPU_viewport_size_get_i(int coords[4])
 | 
			
		||||
  Context::get()->active_fb->viewport_get(coords);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GPU_depth_mask_get(void)
 | 
			
		||||
bool GPU_depth_mask_get()
 | 
			
		||||
{
 | 
			
		||||
  GPUState &state = Context::get()->state_manager->state;
 | 
			
		||||
  return (state.write_mask & GPU_WRITE_DEPTH) != 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GPU_mipmap_enabled(void)
 | 
			
		||||
bool GPU_mipmap_enabled()
 | 
			
		||||
{
 | 
			
		||||
  /* TODO(fclem): this used to be a userdef option. */
 | 
			
		||||
  return true;
 | 
			
		||||
@@ -303,17 +303,17 @@ bool GPU_mipmap_enabled(void)
 | 
			
		||||
/** \name Context Utils
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GPU_flush(void)
 | 
			
		||||
void GPU_flush()
 | 
			
		||||
{
 | 
			
		||||
  Context::get()->flush();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GPU_finish(void)
 | 
			
		||||
void GPU_finish()
 | 
			
		||||
{
 | 
			
		||||
  Context::get()->finish();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GPU_apply_state(void)
 | 
			
		||||
void GPU_apply_state()
 | 
			
		||||
{
 | 
			
		||||
  Context::get()->state_manager->apply_state();
 | 
			
		||||
}
 | 
			
		||||
@@ -328,7 +328,7 @@ void GPU_apply_state(void)
 | 
			
		||||
 * bgl functions.
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GPU_bgl_start(void)
 | 
			
		||||
void GPU_bgl_start()
 | 
			
		||||
{
 | 
			
		||||
  Context *ctx = Context::get();
 | 
			
		||||
  if (!(ctx && ctx->state_manager)) {
 | 
			
		||||
@@ -345,7 +345,7 @@ void GPU_bgl_start(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Just turn off the bgl safeguard system. Can be called even without GPU_bgl_start. */
 | 
			
		||||
void GPU_bgl_end(void)
 | 
			
		||||
void GPU_bgl_end()
 | 
			
		||||
{
 | 
			
		||||
  Context *ctx = Context::get();
 | 
			
		||||
  if (!(ctx && ctx->state_manager)) {
 | 
			
		||||
@@ -359,7 +359,7 @@ void GPU_bgl_end(void)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GPU_bgl_get(void)
 | 
			
		||||
bool GPU_bgl_get()
 | 
			
		||||
{
 | 
			
		||||
  return Context::get()->state_manager->use_bgl;
 | 
			
		||||
}
 | 
			
		||||
@@ -381,7 +381,7 @@ void GPU_memory_barrier(eGPUBarrier barrier)
 | 
			
		||||
/** \name Default State
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
StateManager::StateManager(void)
 | 
			
		||||
StateManager::StateManager()
 | 
			
		||||
{
 | 
			
		||||
  /* Set default state. */
 | 
			
		||||
  state.write_mask = GPU_WRITE_COLOR;
 | 
			
		||||
 
 | 
			
		||||
@@ -66,13 +66,13 @@ void VertBuf::init(const GPUVertFormat *format, GPUUsageType usage)
 | 
			
		||||
  flag |= GPU_VERTBUF_INIT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VertBuf::clear(void)
 | 
			
		||||
void VertBuf::clear()
 | 
			
		||||
{
 | 
			
		||||
  this->release_data();
 | 
			
		||||
  flag = GPU_VERTBUF_INVALID;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VertBuf *VertBuf::duplicate(void)
 | 
			
		||||
VertBuf *VertBuf::duplicate()
 | 
			
		||||
{
 | 
			
		||||
  VertBuf *dst = GPUBackend::get()->vertbuf_alloc();
 | 
			
		||||
  /* Full copy. */
 | 
			
		||||
@@ -107,7 +107,7 @@ void VertBuf::resize(uint vert_len)
 | 
			
		||||
  flag |= GPU_VERTBUF_DATA_DIRTY;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void VertBuf::upload(void)
 | 
			
		||||
void VertBuf::upload()
 | 
			
		||||
{
 | 
			
		||||
  this->upload_data();
 | 
			
		||||
}
 | 
			
		||||
@@ -125,7 +125,7 @@ using namespace blender::gpu;
 | 
			
		||||
 | 
			
		||||
/* -------- Creation & deletion -------- */
 | 
			
		||||
 | 
			
		||||
GPUVertBuf *GPU_vertbuf_calloc(void)
 | 
			
		||||
GPUVertBuf *GPU_vertbuf_calloc()
 | 
			
		||||
{
 | 
			
		||||
  return wrap(GPUBackend::get()->vertbuf_alloc());
 | 
			
		||||
}
 | 
			
		||||
@@ -313,7 +313,7 @@ GPUVertBufStatus GPU_vertbuf_get_status(const GPUVertBuf *verts)
 | 
			
		||||
  return unwrap(verts)->flag;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint GPU_vertbuf_get_memory_usage(void)
 | 
			
		||||
uint GPU_vertbuf_get_memory_usage()
 | 
			
		||||
{
 | 
			
		||||
  return VertBuf::memory_usage;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,7 @@ namespace blender::gpu {
 | 
			
		||||
/** \name Platform
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GLBackend::platform_init(void)
 | 
			
		||||
void GLBackend::platform_init()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(!GPG.initialized);
 | 
			
		||||
  GPG.initialized = true;
 | 
			
		||||
@@ -135,7 +135,7 @@ void GLBackend::platform_init(void)
 | 
			
		||||
  GPG.create_gpu_name(vendor, renderer, version);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLBackend::platform_exit(void)
 | 
			
		||||
void GLBackend::platform_exit()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(GPG.initialized);
 | 
			
		||||
  GPG.clear();
 | 
			
		||||
@@ -147,7 +147,7 @@ void GLBackend::platform_exit(void)
 | 
			
		||||
/** \name Capabilities
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
static bool detect_mip_render_workaround(void)
 | 
			
		||||
static bool detect_mip_render_workaround()
 | 
			
		||||
{
 | 
			
		||||
  int cube_size = 2;
 | 
			
		||||
  float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f};
 | 
			
		||||
@@ -192,7 +192,7 @@ static bool detect_mip_render_workaround(void)
 | 
			
		||||
  return enable_workaround;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void detect_workarounds(void)
 | 
			
		||||
static void detect_workarounds()
 | 
			
		||||
{
 | 
			
		||||
  const char *vendor = (const char *)glGetString(GL_VENDOR);
 | 
			
		||||
  const char *renderer = (const char *)glGetString(GL_RENDERER);
 | 
			
		||||
@@ -376,7 +376,7 @@ bool GLContext::debug_layer_workaround = false;
 | 
			
		||||
bool GLContext::unused_fb_slot_workaround = false;
 | 
			
		||||
float GLContext::derivative_signs[2] = {1.0f, 1.0f};
 | 
			
		||||
 | 
			
		||||
void GLBackend::capabilities_init(void)
 | 
			
		||||
void GLBackend::capabilities_init()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(GLEW_VERSION_3_3);
 | 
			
		||||
  /* Common Capabilities. */
 | 
			
		||||
 
 | 
			
		||||
@@ -50,7 +50,7 @@ using namespace blender::gpu;
 | 
			
		||||
 * TODO(fclem): Could be revisited to avoid so much cross references.
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
GLVaoCache::GLVaoCache(void)
 | 
			
		||||
GLVaoCache::GLVaoCache()
 | 
			
		||||
{
 | 
			
		||||
  init();
 | 
			
		||||
}
 | 
			
		||||
@@ -60,7 +60,7 @@ GLVaoCache::~GLVaoCache()
 | 
			
		||||
  this->clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLVaoCache::init(void)
 | 
			
		||||
void GLVaoCache::init()
 | 
			
		||||
{
 | 
			
		||||
  context_ = NULL;
 | 
			
		||||
  interface_ = NULL;
 | 
			
		||||
@@ -149,7 +149,7 @@ void GLVaoCache::remove(const GLShaderInterface *interface)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLVaoCache::clear(void)
 | 
			
		||||
void GLVaoCache::clear()
 | 
			
		||||
{
 | 
			
		||||
  GLContext *ctx = GLContext::get();
 | 
			
		||||
  const int count = (is_dynamic_vao_count) ? dynamic_vaos.count : GPU_VAO_STATIC_LEN;
 | 
			
		||||
@@ -207,7 +207,7 @@ GLuint GLVaoCache::lookup(const GLShaderInterface *interface)
 | 
			
		||||
 | 
			
		||||
/* The GLVaoCache object is only valid for one GLContext.
 | 
			
		||||
 * Reset the cache if trying to draw in another context; */
 | 
			
		||||
void GLVaoCache::context_check(void)
 | 
			
		||||
void GLVaoCache::context_check()
 | 
			
		||||
{
 | 
			
		||||
  GLContext *ctx = GLContext::get();
 | 
			
		||||
  BLI_assert(ctx);
 | 
			
		||||
@@ -282,7 +282,7 @@ GLuint GLVaoCache::vao_get(GPUBatch *batch)
 | 
			
		||||
/** \name Creation & Deletion
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
GLBatch::GLBatch(void)
 | 
			
		||||
GLBatch::GLBatch()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -121,7 +121,7 @@ GLContext::~GLContext()
 | 
			
		||||
/** \name Activate / Deactivate context
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GLContext::activate(void)
 | 
			
		||||
void GLContext::activate()
 | 
			
		||||
{
 | 
			
		||||
  /* Make sure no other context is already bound to this thread. */
 | 
			
		||||
  BLI_assert(is_active_ == false);
 | 
			
		||||
@@ -160,7 +160,7 @@ void GLContext::activate(void)
 | 
			
		||||
  immActivate();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLContext::deactivate(void)
 | 
			
		||||
void GLContext::deactivate()
 | 
			
		||||
{
 | 
			
		||||
  immDeactivate();
 | 
			
		||||
  is_active_ = false;
 | 
			
		||||
@@ -172,12 +172,12 @@ void GLContext::deactivate(void)
 | 
			
		||||
/** \name Flush, Finish & sync
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GLContext::flush(void)
 | 
			
		||||
void GLContext::flush()
 | 
			
		||||
{
 | 
			
		||||
  glFlush();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLContext::finish(void)
 | 
			
		||||
void GLContext::finish()
 | 
			
		||||
{
 | 
			
		||||
  glFinish();
 | 
			
		||||
}
 | 
			
		||||
@@ -191,7 +191,7 @@ void GLContext::finish(void)
 | 
			
		||||
 * In this case we delay the deletion until the context is bound again.
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GLSharedOrphanLists::orphans_clear(void)
 | 
			
		||||
void GLSharedOrphanLists::orphans_clear()
 | 
			
		||||
{
 | 
			
		||||
  /* Check if any context is active on this thread! */
 | 
			
		||||
  BLI_assert(GLContext::get());
 | 
			
		||||
@@ -208,7 +208,7 @@ void GLSharedOrphanLists::orphans_clear(void)
 | 
			
		||||
  lists_mutex.unlock();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void GLContext::orphans_clear(void)
 | 
			
		||||
void GLContext::orphans_clear()
 | 
			
		||||
{
 | 
			
		||||
  /* Check if context has been activated by another thread! */
 | 
			
		||||
  BLI_assert(this->is_active_on_thread());
 | 
			
		||||
 
 | 
			
		||||
@@ -141,7 +141,7 @@ static void APIENTRY debug_callback(GLenum UNUSED(source),
 | 
			
		||||
#undef APIENTRY
 | 
			
		||||
 | 
			
		||||
/* This function needs to be called once per context. */
 | 
			
		||||
void init_gl_callbacks(void)
 | 
			
		||||
void init_gl_callbacks()
 | 
			
		||||
{
 | 
			
		||||
  CLOG_ENSURE(&LOG);
 | 
			
		||||
 | 
			
		||||
@@ -369,7 +369,7 @@ void GLContext::debug_group_begin(const char *name, int index)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLContext::debug_group_end(void)
 | 
			
		||||
void GLContext::debug_group_end()
 | 
			
		||||
{
 | 
			
		||||
  if ((G.debug & G_DEBUG_GPU) && (GLEW_VERSION_4_3 || GLEW_KHR_debug)) {
 | 
			
		||||
    glPopDebugGroup();
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,7 @@ DEBUG_FUNC_DECLARE(PFNGLUSEPROGRAMPROC, void, glUseProgram, GLuint, program);
 | 
			
		||||
/* Init a fallback layer (to KHR_debug) that covers only some functions.
 | 
			
		||||
 * We override the functions pointers by our own implementation that just checks glGetError.
 | 
			
		||||
 * Some additional functions (not overridable) are covered inside the header using wrappers. */
 | 
			
		||||
void init_debug_layer(void)
 | 
			
		||||
void init_debug_layer()
 | 
			
		||||
{
 | 
			
		||||
#define DEBUG_WRAP(function) \
 | 
			
		||||
  do { \
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,7 @@ GLDrawList::~GLDrawList()
 | 
			
		||||
  GLContext::buf_free(buffer_id_);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLDrawList::init(void)
 | 
			
		||||
void GLDrawList::init()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(GLContext::get());
 | 
			
		||||
  BLI_assert(MDI_ENABLED);
 | 
			
		||||
@@ -169,7 +169,7 @@ void GLDrawList::append(GPUBatch *gpu_batch, int i_first, int i_count)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLDrawList::submit(void)
 | 
			
		||||
void GLDrawList::submit()
 | 
			
		||||
{
 | 
			
		||||
  if (command_len_ == 0) {
 | 
			
		||||
    return;
 | 
			
		||||
 
 | 
			
		||||
@@ -92,7 +92,7 @@ GLFrameBuffer::~GLFrameBuffer()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLFrameBuffer::init(void)
 | 
			
		||||
void GLFrameBuffer::init()
 | 
			
		||||
{
 | 
			
		||||
  context_ = GLContext::get();
 | 
			
		||||
  state_manager_ = static_cast<GLStateManager *>(context_->state_manager);
 | 
			
		||||
@@ -154,7 +154,7 @@ bool GLFrameBuffer::check(char err_out[256])
 | 
			
		||||
  return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLFrameBuffer::update_attachments(void)
 | 
			
		||||
void GLFrameBuffer::update_attachments()
 | 
			
		||||
{
 | 
			
		||||
  /* Default frame-buffers cannot have attachments. */
 | 
			
		||||
  BLI_assert(immutable_ == false);
 | 
			
		||||
@@ -236,7 +236,7 @@ void GLFrameBuffer::update_attachments(void)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLFrameBuffer::apply_state(void)
 | 
			
		||||
void GLFrameBuffer::apply_state()
 | 
			
		||||
{
 | 
			
		||||
  if (dirty_state_ == false) {
 | 
			
		||||
    return;
 | 
			
		||||
 
 | 
			
		||||
@@ -135,7 +135,7 @@ uchar *GLImmediate::begin()
 | 
			
		||||
  return (uchar *)data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLImmediate::end(void)
 | 
			
		||||
void GLImmediate::end()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(prim_type != GPU_PRIM_NONE); /* make sure we're between a Begin/End pair */
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ GLIndexBuf::~GLIndexBuf()
 | 
			
		||||
  GLContext::buf_free(ibo_id_);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLIndexBuf::bind(void)
 | 
			
		||||
void GLIndexBuf::bind()
 | 
			
		||||
{
 | 
			
		||||
  if (is_subrange_) {
 | 
			
		||||
    static_cast<GLIndexBuf *>(src_)->bind();
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ void GLQueryPool::reset(GPUQueryType type)
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void GLQueryPool::begin_query(void)
 | 
			
		||||
void GLQueryPool::begin_query()
 | 
			
		||||
{
 | 
			
		||||
  /* TODO add assert about expected usage. */
 | 
			
		||||
  while (query_issued_ >= query_ids_.size()) {
 | 
			
		||||
@@ -59,7 +59,7 @@ void GLQueryPool::begin_query(void)
 | 
			
		||||
  glBeginQuery(gl_type_, query_ids_[query_issued_++]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLQueryPool::end_query(void)
 | 
			
		||||
void GLQueryPool::end_query()
 | 
			
		||||
{
 | 
			
		||||
  /* TODO add assert about expected usage. */
 | 
			
		||||
  glEndQuery(gl_type_);
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ GLShader::GLShader(const char *name) : Shader(name)
 | 
			
		||||
  debug::object_label(GL_PROGRAM, shader_program_, name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GLShader::~GLShader(void)
 | 
			
		||||
GLShader::~GLShader()
 | 
			
		||||
{
 | 
			
		||||
#if 0 /* Would be nice to have, but for now the Deferred compilation \
 | 
			
		||||
       * does not have a GPUContext. */
 | 
			
		||||
@@ -72,7 +72,7 @@ GLShader::~GLShader(void)
 | 
			
		||||
/** \name Shader stage creation
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
char *GLShader::glsl_patch_get(void)
 | 
			
		||||
char *GLShader::glsl_patch_get()
 | 
			
		||||
{
 | 
			
		||||
  /** Used for shader patching. Init once. */
 | 
			
		||||
  static char patch[512] = "\0";
 | 
			
		||||
@@ -172,7 +172,7 @@ void GLShader::fragment_shader_from_glsl(MutableSpan<const char *> sources)
 | 
			
		||||
  frag_shader_ = this->create_shader_stage(GL_FRAGMENT_SHADER, sources);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool GLShader::finalize(void)
 | 
			
		||||
bool GLShader::finalize()
 | 
			
		||||
{
 | 
			
		||||
  if (compilation_failed_) {
 | 
			
		||||
    return false;
 | 
			
		||||
@@ -201,13 +201,13 @@ bool GLShader::finalize(void)
 | 
			
		||||
/** \name Binding
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GLShader::bind(void)
 | 
			
		||||
void GLShader::bind()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(shader_program_ != 0);
 | 
			
		||||
  glUseProgram(shader_program_);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLShader::unbind(void)
 | 
			
		||||
void GLShader::unbind()
 | 
			
		||||
{
 | 
			
		||||
#ifndef NDEBUG
 | 
			
		||||
  glUseProgram(0);
 | 
			
		||||
@@ -259,7 +259,7 @@ bool GLShader::transform_feedback_enable(GPUVertBuf *buf_)
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLShader::transform_feedback_disable(void)
 | 
			
		||||
void GLShader::transform_feedback_disable()
 | 
			
		||||
{
 | 
			
		||||
  glEndTransformFeedback();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -42,7 +42,7 @@ namespace blender::gpu {
 | 
			
		||||
/** \name GLStateManager
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
GLStateManager::GLStateManager(void)
 | 
			
		||||
GLStateManager::GLStateManager()
 | 
			
		||||
{
 | 
			
		||||
  /* Set other states that never change. */
 | 
			
		||||
  glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
 | 
			
		||||
@@ -71,7 +71,7 @@ GLStateManager::GLStateManager(void)
 | 
			
		||||
  set_mutable_state(mutable_state);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLStateManager::apply_state(void)
 | 
			
		||||
void GLStateManager::apply_state()
 | 
			
		||||
{
 | 
			
		||||
  if (!this->use_bgl) {
 | 
			
		||||
    this->set_state(this->state);
 | 
			
		||||
@@ -84,7 +84,7 @@ void GLStateManager::apply_state(void)
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Will set all the states regardless of the current ones. */
 | 
			
		||||
void GLStateManager::force_state(void)
 | 
			
		||||
void GLStateManager::force_state()
 | 
			
		||||
{
 | 
			
		||||
  /* Little exception for clip distances since they need to keep the old count correct. */
 | 
			
		||||
  uint32_t clip_distances = current_.clip_distances;
 | 
			
		||||
@@ -511,7 +511,7 @@ void GLStateManager::texture_unbind(Texture *tex_)
 | 
			
		||||
  tex->is_bound_ = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLStateManager::texture_unbind_all(void)
 | 
			
		||||
void GLStateManager::texture_unbind_all()
 | 
			
		||||
{
 | 
			
		||||
  for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
 | 
			
		||||
    if (textures_[i] != 0) {
 | 
			
		||||
@@ -523,7 +523,7 @@ void GLStateManager::texture_unbind_all(void)
 | 
			
		||||
  this->texture_bind_apply();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLStateManager::texture_bind_apply(void)
 | 
			
		||||
void GLStateManager::texture_bind_apply()
 | 
			
		||||
{
 | 
			
		||||
  if (dirty_texture_binds_ == 0) {
 | 
			
		||||
    return;
 | 
			
		||||
@@ -555,7 +555,7 @@ void GLStateManager::texture_unpack_row_length_set(uint len)
 | 
			
		||||
  glPixelStorei(GL_UNPACK_ROW_LENGTH, len);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint64_t GLStateManager::bound_texture_slots(void)
 | 
			
		||||
uint64_t GLStateManager::bound_texture_slots()
 | 
			
		||||
{
 | 
			
		||||
  uint64_t bound_slots = 0;
 | 
			
		||||
  for (int i = 0; i < ARRAY_SIZE(textures_); i++) {
 | 
			
		||||
@@ -603,7 +603,7 @@ void GLStateManager::image_unbind(Texture *tex_)
 | 
			
		||||
  tex->is_bound_ = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLStateManager::image_unbind_all(void)
 | 
			
		||||
void GLStateManager::image_unbind_all()
 | 
			
		||||
{
 | 
			
		||||
  for (int i = 0; i < ARRAY_SIZE(images_); i++) {
 | 
			
		||||
    if (images_[i] != 0) {
 | 
			
		||||
@@ -614,7 +614,7 @@ void GLStateManager::image_unbind_all(void)
 | 
			
		||||
  this->image_bind_apply();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLStateManager::image_bind_apply(void)
 | 
			
		||||
void GLStateManager::image_bind_apply()
 | 
			
		||||
{
 | 
			
		||||
  if (dirty_image_binds_ == 0) {
 | 
			
		||||
    return;
 | 
			
		||||
@@ -638,7 +638,7 @@ void GLStateManager::image_bind_apply(void)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
uint8_t GLStateManager::bound_image_slots(void)
 | 
			
		||||
uint8_t GLStateManager::bound_image_slots()
 | 
			
		||||
{
 | 
			
		||||
  uint8_t bound_slots = 0;
 | 
			
		||||
  for (int i = 0; i < ARRAY_SIZE(images_); i++) {
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ GLTexture::~GLTexture()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Return true on success. */
 | 
			
		||||
bool GLTexture::init_internal(void)
 | 
			
		||||
bool GLTexture::init_internal()
 | 
			
		||||
{
 | 
			
		||||
  if ((format_ == GPU_DEPTH24_STENCIL8) && GPU_depth_blitting_workaround()) {
 | 
			
		||||
    /* MacOS + Radeon Pro fails to blit depth on GPU_DEPTH24_STENCIL8
 | 
			
		||||
@@ -294,7 +294,7 @@ void GLTexture::update_sub(
 | 
			
		||||
 * WARNING: Depth textures are not populated but they have their mips correctly defined.
 | 
			
		||||
 * WARNING: This resets the mipmap range.
 | 
			
		||||
 */
 | 
			
		||||
void GLTexture::generate_mipmap(void)
 | 
			
		||||
void GLTexture::generate_mipmap()
 | 
			
		||||
{
 | 
			
		||||
  this->ensure_mipmaps(9999);
 | 
			
		||||
  /* Some drivers have bugs when using glGenerateMipmap with depth textures (see T56789).
 | 
			
		||||
@@ -440,7 +440,7 @@ void GLTexture::mip_range_set(int min, int max)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
struct GPUFrameBuffer *GLTexture::framebuffer_get(void)
 | 
			
		||||
struct GPUFrameBuffer *GLTexture::framebuffer_get()
 | 
			
		||||
{
 | 
			
		||||
  if (framebuffer_) {
 | 
			
		||||
    return framebuffer_;
 | 
			
		||||
@@ -461,7 +461,7 @@ struct GPUFrameBuffer *GLTexture::framebuffer_get(void)
 | 
			
		||||
 | 
			
		||||
GLuint GLTexture::samplers_[GPU_SAMPLER_MAX] = {0};
 | 
			
		||||
 | 
			
		||||
void GLTexture::samplers_init(void)
 | 
			
		||||
void GLTexture::samplers_init()
 | 
			
		||||
{
 | 
			
		||||
  glGenSamplers(GPU_SAMPLER_MAX, samplers_);
 | 
			
		||||
  for (int i = 0; i <= GPU_SAMPLER_ICON - 1; i++) {
 | 
			
		||||
@@ -517,7 +517,7 @@ void GLTexture::samplers_init(void)
 | 
			
		||||
  debug::object_label(GL_SAMPLER, icon_sampler, "icons");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLTexture::samplers_update(void)
 | 
			
		||||
void GLTexture::samplers_update()
 | 
			
		||||
{
 | 
			
		||||
  if (!GLContext::texture_filter_anisotropic_support) {
 | 
			
		||||
    return;
 | 
			
		||||
@@ -536,7 +536,7 @@ void GLTexture::samplers_update(void)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLTexture::samplers_free(void)
 | 
			
		||||
void GLTexture::samplers_free()
 | 
			
		||||
{
 | 
			
		||||
  glDeleteSamplers(GPU_SAMPLER_MAX, samplers_);
 | 
			
		||||
}
 | 
			
		||||
@@ -649,7 +649,7 @@ bool GLTexture::proxy_check(int mip)
 | 
			
		||||
 | 
			
		||||
/** \} */
 | 
			
		||||
 | 
			
		||||
void GLTexture::check_feedback_loop(void)
 | 
			
		||||
void GLTexture::check_feedback_loop()
 | 
			
		||||
{
 | 
			
		||||
  /* Recursive down sample workaround break this check.
 | 
			
		||||
   * See #recursive_downsample() for more information. */
 | 
			
		||||
@@ -679,7 +679,7 @@ void GLTexture::check_feedback_loop(void)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* TODO(fclem): Legacy. Should be removed at some point. */
 | 
			
		||||
uint GLTexture::gl_bindcode_get(void) const
 | 
			
		||||
uint GLTexture::gl_bindcode_get() const
 | 
			
		||||
{
 | 
			
		||||
  return tex_id_;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ GLUniformBuf::~GLUniformBuf()
 | 
			
		||||
/** \name Data upload / update
 | 
			
		||||
 * \{ */
 | 
			
		||||
 | 
			
		||||
void GLUniformBuf::init(void)
 | 
			
		||||
void GLUniformBuf::init()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(GLContext::get());
 | 
			
		||||
 | 
			
		||||
@@ -111,7 +111,7 @@ void GLUniformBuf::bind(int slot)
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLUniformBuf::unbind(void)
 | 
			
		||||
void GLUniformBuf::unbind()
 | 
			
		||||
{
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
  /* NOTE: This only unbinds the last bound slot. */
 | 
			
		||||
 
 | 
			
		||||
@@ -27,19 +27,19 @@
 | 
			
		||||
 | 
			
		||||
namespace blender::gpu {
 | 
			
		||||
 | 
			
		||||
void GLVertBuf::acquire_data(void)
 | 
			
		||||
void GLVertBuf::acquire_data()
 | 
			
		||||
{
 | 
			
		||||
  /* Discard previous data if any. */
 | 
			
		||||
  MEM_SAFE_FREE(data);
 | 
			
		||||
  data = (uchar *)MEM_mallocN(sizeof(uchar) * this->size_alloc_get(), __func__);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLVertBuf::resize_data(void)
 | 
			
		||||
void GLVertBuf::resize_data()
 | 
			
		||||
{
 | 
			
		||||
  data = (uchar *)MEM_reallocN(data, sizeof(uchar) * this->size_alloc_get());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLVertBuf::release_data(void)
 | 
			
		||||
void GLVertBuf::release_data()
 | 
			
		||||
{
 | 
			
		||||
  if (vbo_id_ != 0) {
 | 
			
		||||
    GLContext::buf_free(vbo_id_);
 | 
			
		||||
@@ -75,12 +75,12 @@ void GLVertBuf::duplicate_data(VertBuf *dst_)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLVertBuf::upload_data(void)
 | 
			
		||||
void GLVertBuf::upload_data()
 | 
			
		||||
{
 | 
			
		||||
  this->bind();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void GLVertBuf::bind(void)
 | 
			
		||||
void GLVertBuf::bind()
 | 
			
		||||
{
 | 
			
		||||
  BLI_assert(GLContext::get() != NULL);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ struct ExportJobData {
 | 
			
		||||
  bool export_ok;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void ensure_usd_plugin_path_registered(void)
 | 
			
		||||
static void ensure_usd_plugin_path_registered()
 | 
			
		||||
{
 | 
			
		||||
  static bool plugin_path_registered = false;
 | 
			
		||||
  if (plugin_path_registered) {
 | 
			
		||||
 
 | 
			
		||||
@@ -520,7 +520,7 @@ static bNodeSocketType *make_standard_socket_type(int type, int subtype)
 | 
			
		||||
 | 
			
		||||
extern "C" void ED_init_node_socket_type_virtual(bNodeSocketType *);
 | 
			
		||||
 | 
			
		||||
static bNodeSocketType *make_socket_type_virtual(void)
 | 
			
		||||
static bNodeSocketType *make_socket_type_virtual()
 | 
			
		||||
{
 | 
			
		||||
  const char *socket_idname = "NodeSocketVirtual";
 | 
			
		||||
  bNodeSocketType *stype;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user