diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:47 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-12-09 12:01:47 +0300 |
commit | 7c76bdca1b7195720a769c4911678d85825907fe (patch) | |
tree | 003fab9c0a71af49b89f49eda0076b8018b6cfe8 /source/blender/gpu/intern | |
parent | 9f546d690899e05b25a6ef764cc8cf2f5db918b0 (diff) |
Cleanup: move public doc-strings into headers for 'gpu'
Ref T92709
Diffstat (limited to 'source/blender/gpu/intern')
27 files changed, 21 insertions, 298 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index 6ff67e1f043..2874dea775f 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -90,7 +90,6 @@ void GPU_batch_init_ex(GPUBatch *batch, batch->shader = nullptr; } -/* This will share the VBOs with the new batch. */ void GPU_batch_copy(GPUBatch *batch_dst, GPUBatch *batch_src) { GPU_batch_init_ex( @@ -137,7 +136,6 @@ void GPU_batch_discard(GPUBatch *batch) /** \name Buffers Management * \{ */ -/* NOTE: Override ONLY the first instance vbo (and free them if owned). */ void GPU_batch_instbuf_set(GPUBatch *batch, GPUVertBuf *inst, bool own_vbo) { BLI_assert(inst); @@ -151,7 +149,6 @@ void GPU_batch_instbuf_set(GPUBatch *batch, GPUVertBuf *inst, bool own_vbo) SET_FLAG_FROM_TEST(batch->flag, own_vbo, GPU_BATCH_OWNS_INST_VBO); } -/* NOTE: Override any previously assigned elem (and free it if owned). */ void GPU_batch_elembuf_set(GPUBatch *batch, GPUIndexBuf *elem, bool own_ibo) { BLI_assert(elem); @@ -188,7 +185,6 @@ int GPU_batch_instbuf_add_ex(GPUBatch *batch, GPUVertBuf *insts, bool own_vbo) return -1; } -/* Returns the index of verts in the batch. */ int GPU_batch_vertbuf_add_ex(GPUBatch *batch, GPUVertBuf *verts, bool own_vbo) { BLI_assert(verts); @@ -243,7 +239,6 @@ void GPU_batch_draw_range(GPUBatch *batch, int v_first, int v_count) GPU_batch_draw_advanced(batch, v_first, v_count, 0, 0); } -/* Draw multiple instance of a batch without having any instance attributes. */ void GPU_batch_draw_instanced(GPUBatch *batch, int i_count) { BLI_assert(batch->inst[0] == nullptr); @@ -301,9 +296,6 @@ void GPU_batch_program_set_builtin(GPUBatch *batch, eGPUBuiltinShader shader_id) GPU_batch_program_set_builtin_with_config(batch, shader_id, GPU_SHADER_CFG_DEFAULT); } -/* Bind program bound to IMM to the batch. - * XXX Use this with much care. Drawing with the GPUBatch API is not compatible with IMM. - * DO NOT DRAW WITH THE BATCH BEFORE CALLING immUnbindProgram. */ void GPU_batch_program_set_imm_shader(GPUBatch *batch) { GPU_batch_set_shader(batch, immGetShader()); diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c index 6a1645a71d8..b97378ad638 100644 --- a/source/blender/gpu/intern/gpu_batch_presets.c +++ b/source/blender/gpu/intern/gpu_batch_presets.c @@ -154,7 +154,6 @@ GPUBatch *GPU_batch_preset_sphere_wire(int lod) /** \name Create Sphere (3D) * \{ */ -/* Replacement for gluSphere */ GPUBatch *gpu_batch_sphere(int lat_res, int lon_res) { const float lon_inc = 2 * M_PI / lon_res; @@ -331,7 +330,6 @@ GPUBatch *GPU_batch_preset_panel_drag_widget(const float pixelsize, return g_presets_2d.batch.panel_drag_widget; } -/* To be used with procedural placement inside shader. */ GPUBatch *GPU_batch_preset_quad(void) { if (!g_presets_2d.batch.quad) { diff --git a/source/blender/gpu/intern/gpu_batch_utils.c b/source/blender/gpu/intern/gpu_batch_utils.c index e2d03d27035..a381df5974a 100644 --- a/source/blender/gpu/intern/gpu_batch_utils.c +++ b/source/blender/gpu/intern/gpu_batch_utils.c @@ -33,15 +33,6 @@ /** \name Polygon Creation (2D) * \{ */ -/** - * Creates triangles from a byte-array of polygons. - * - * See 'make_shape_2d_from_blend.py' utility to create data to pass to this function. - * - * \param polys_flat: Pairs of X, Y coordinates (repeating to signify closing the polygon). - * \param polys_flat_len: Length of the array (must be an even number). - * \param rect: Optional region to map the byte 0..255 coords to. When not set use -1..1. - */ GPUBatch *GPU_batch_tris_from_poly_2d_encoded(const uchar *polys_flat, uint polys_flat_len, const rctf *rect) diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 43483916236..fdc3eed87d9 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -204,7 +204,6 @@ static bool gpu_pbvh_is_looptri_visible(const MLoopTri *lt, sculpt_face_sets[lt->poly] > SCULPT_FACE_SET_NONE); } -/* Threaded - do not call any functions that use OpenGL calls! */ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, const MVert *mvert, const float *vmask, @@ -337,7 +336,6 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, buffers->mvert = mvert; } -/* Threaded - do not call any functions that use OpenGL calls! */ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const MPoly *mpoly, const MLoop *mloop, const MLoopTri *looptri, @@ -584,7 +582,6 @@ void GPU_pbvh_grid_buffers_update_free(GPU_PBVH_Buffers *buffers, } } -/* Threaded - do not call any functions that use OpenGL calls! */ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers, SubdivCCG *subdiv_ccg, CCGElem **grids, @@ -764,7 +761,6 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers, buffers->show_overlay = !empty_mask || !default_face_set; } -/* Threaded - do not call any functions that use OpenGL calls! */ GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, BLI_bitmap **grid_hidden) { GPU_PBVH_Buffers *buffers; @@ -878,9 +874,6 @@ void GPU_pbvh_bmesh_buffers_update_free(GPU_PBVH_Buffers *buffers) } } -/* Creates a vertex buffer (coordinate, normal, color) and, if smooth - * shading, an element index buffer. - * Threaded - do not call any functions that use OpenGL calls! */ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers, BMesh *bm, GSet *bm_faces, @@ -1048,7 +1041,6 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers, /** \name Generic * \{ */ -/* Threaded - do not call any functions that use OpenGL calls! */ GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading) { GPU_PBVH_Buffers *buffers; diff --git a/source/blender/gpu/intern/gpu_capabilities.cc b/source/blender/gpu/intern/gpu_capabilities.cc index fe04d1db03c..f12fd96d1ba 100644 --- a/source/blender/gpu/intern/gpu_capabilities.cc +++ b/source/blender/gpu/intern/gpu_capabilities.cc @@ -189,7 +189,6 @@ void GPU_mem_stats_get(int *totalmem, int *freemem) Context::get()->memory_statistics_get(totalmem, freemem); } -/* Return support for the active context + window. */ bool GPU_stereo_quadbuffer_support() { return Context::get()->front_right != nullptr; diff --git a/source/blender/gpu/intern/gpu_context.cc b/source/blender/gpu/intern/gpu_context.cc index 85be7b593eb..5af15d1bc3d 100644 --- a/source/blender/gpu/intern/gpu_context.cc +++ b/source/blender/gpu/intern/gpu_context.cc @@ -109,7 +109,6 @@ GPUContext *GPU_context_create(void *ghost_window) return wrap(ctx); } -/* to be called after GPU_context_active_set(ctx_to_destroy) */ void GPU_context_discard(GPUContext *ctx_) { Context *ctx = unwrap(ctx_); @@ -117,7 +116,6 @@ void GPU_context_discard(GPUContext *ctx_) active_ctx = nullptr; } -/* ctx can be NULL */ void GPU_context_active_set(GPUContext *ctx_) { Context *ctx = unwrap(ctx_); diff --git a/source/blender/gpu/intern/gpu_debug.cc b/source/blender/gpu/intern/gpu_debug.cc index 5f061bd1bee..85cec67d2a7 100644 --- a/source/blender/gpu/intern/gpu_debug.cc +++ b/source/blender/gpu/intern/gpu_debug.cc @@ -55,10 +55,6 @@ void GPU_debug_group_end() ctx->debug_group_end(); } -/** - * Return a formatted string showing the current group hierarchy in this format: - * "Group1 > Group 2 > Group3 > ... > GroupN : " - */ void GPU_debug_get_groups_names(int name_buf_len, char *r_name_buf) { Context *ctx = Context::get(); @@ -77,7 +73,6 @@ void GPU_debug_get_groups_names(int name_buf_len, char *r_name_buf) r_name_buf[sz - 3] = '\0'; } -/* Return true if inside a debug group with the same name. */ bool GPU_debug_group_match(const char *ref) { /* Otherwise there will be no names. */ diff --git a/source/blender/gpu/intern/gpu_framebuffer.cc b/source/blender/gpu/intern/gpu_framebuffer.cc index ea37afd2885..3404eb67e28 100644 --- a/source/blender/gpu/intern/gpu_framebuffer.cc +++ b/source/blender/gpu/intern/gpu_framebuffer.cc @@ -216,18 +216,12 @@ void GPU_framebuffer_bind(GPUFrameBuffer *gpu_fb) unwrap(gpu_fb)->bind(enable_srgb); } -/** - * Workaround for binding a SRGB frame-buffer without doing the SRGB transform. - */ void GPU_framebuffer_bind_no_srgb(GPUFrameBuffer *gpu_fb) { const bool enable_srgb = false; unwrap(gpu_fb)->bind(enable_srgb); } -/** - * For stereo rendering. - */ void GPU_backbuffer_bind(eGPUBackBuffer buffer) { Context *ctx = Context::get(); @@ -251,7 +245,6 @@ GPUFrameBuffer *GPU_framebuffer_active_get() return wrap(ctx ? ctx->active_fb : nullptr); } -/* Returns the default frame-buffer. Will always exists even if it's just a dummy. */ GPUFrameBuffer *GPU_framebuffer_back_get() { Context *ctx = Context::get(); @@ -302,12 +295,6 @@ void GPU_framebuffer_texture_detach(GPUFrameBuffer *fb, GPUTexture *tex) unwrap(tex)->detach_from(unwrap(fb)); } -/** - * First GPUAttachment in *config is always the depth/depth_stencil buffer. - * Following GPUAttachments are color buffers. - * Setting GPUAttachment.mip to -1 will leave the texture in this slot. - * Setting GPUAttachment.tex to NULL will detach the texture in this slot. - */ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb, const GPUAttachment *config, int config_len) @@ -341,11 +328,6 @@ void GPU_framebuffer_config_array(GPUFrameBuffer *gpu_fb, /* ---------- Viewport & Scissor Region ----------- */ -/** - * Viewport and scissor size is stored per frame-buffer. - * It is only reset to its original dimensions explicitly OR when binding the frame-buffer after - * modifying its attachments. - */ void GPU_framebuffer_viewport_set(GPUFrameBuffer *gpu_fb, int x, int y, int width, int height) { int viewport_rect[4] = {x, y, width, height}; @@ -357,9 +339,6 @@ void GPU_framebuffer_viewport_get(GPUFrameBuffer *gpu_fb, int r_viewport[4]) unwrap(gpu_fb)->viewport_get(r_viewport); } -/** - * Reset to its attachment(s) size. - */ void GPU_framebuffer_viewport_reset(GPUFrameBuffer *gpu_fb) { unwrap(gpu_fb)->viewport_reset(); @@ -376,9 +355,6 @@ void GPU_framebuffer_clear(GPUFrameBuffer *gpu_fb, unwrap(gpu_fb)->clear(buffers, clear_col, clear_depth, clear_stencil); } -/** - * Clear all textures attached to this frame-buffer with a different color. - */ void GPU_framebuffer_multi_clear(GPUFrameBuffer *gpu_fb, const float (*clear_cols)[4]) { unwrap(gpu_fb)->clear_multi(clear_cols); @@ -425,7 +401,6 @@ void GPU_frontbuffer_read_pixels( Context::get()->front_left->read(GPU_COLOR_BIT, format, rect, channels, 0, data); } -/* read_slot and write_slot are only used for color buffers. */ /* TODO(fclem): port as texture operation. */ void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read, int read_slot, @@ -466,11 +441,6 @@ void GPU_framebuffer_blit(GPUFrameBuffer *gpufb_read, prev_fb->bind(true); } -/** - * Use this if you need to custom down-sample your texture and use the previous mip-level as - * input. This function only takes care of the correct texture handling. It execute the callback - * for each texture level. - */ void GPU_framebuffer_recursive_downsample(GPUFrameBuffer *gpu_fb, int max_lvl, void (*callback)(void *userData, int level), @@ -704,9 +674,6 @@ GPUTexture *GPU_offscreen_color_texture(const GPUOffScreen *ofs) return ofs->color; } -/** - * \note only to be used by viewport code! - */ void GPU_offscreen_viewport_data_get(GPUOffScreen *ofs, GPUFrameBuffer **r_fb, GPUTexture **r_color, diff --git a/source/blender/gpu/intern/gpu_immediate.cc b/source/blender/gpu/intern/gpu_immediate.cc index cdd56a117db..7ca93252683 100644 --- a/source/blender/gpu/intern/gpu_immediate.cc +++ b/source/blender/gpu/intern/gpu_immediate.cc @@ -89,7 +89,6 @@ void immUnbindProgram() imm->shader = nullptr; } -/* XXX do not use it. Special hack to use OCIO with batch API. */ GPUShader *immGetShader() { return imm->shader; @@ -603,7 +602,6 @@ void immUniform4fv(const char *name, const float data[4]) GPU_shader_uniform_4fv(imm->shader, name, data); } -/* Note array index is not supported for name (i.e: "array[0]"). */ void immUniformArray4fv(const char *name, const float *data, int count) { GPU_shader_uniform_4fv_array(imm->shader, name, count, (const float(*)[4])data); diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index df18b89bd67..4ef7492428e 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -143,17 +143,6 @@ void immRecti_complete(int x1, int y1, int x2, int y2, const float color[4]) } #endif -/** - * Pack color into 3 bytes - * - * This define converts a numerical value to the equivalent 24-bit - * color, while not being endian-sensitive. On little-endian, this - * is the same as doing a 'naive' indexing, on big-endian, it is not! - * - * \note BGR format (i.e. 0xBBGGRR)... - * - * \param x: color. - */ void imm_cpack(uint x) { immUniformColor3ub(((x)&0xFF), (((x) >> 8) & 0xFF), (((x) >> 16) & 0xFF)); @@ -175,31 +164,11 @@ static void imm_draw_circle(GPUPrimType prim_type, immEnd(); } -/** - * Draw a circle outline with the given \a radius. - * The circle is centered at \a x, \a y and drawn in the XY plane. - * - * \param shdr_pos: The vertex attribute number for position. - * \param x: Horizontal center. - * \param y: Vertical center. - * \param rad: The circle's radius. - * \param nsegments: The number of segments to use in drawing (more = smoother). - */ void imm_draw_circle_wire_2d(uint shdr_pos, float x, float y, float rad, int nsegments) { imm_draw_circle(GPU_PRIM_LINE_LOOP, shdr_pos, x, y, rad, rad, nsegments); } -/** - * Draw a filled circle with the given \a radius. - * The circle is centered at \a x, \a y and drawn in the XY plane. - * - * \param shdr_pos: The vertex attribute number for position. - * \param x: Horizontal center. - * \param y: Vertical center. - * \param rad: The circle's radius. - * \param nsegments: The number of segments to use in drawing (more = smoother). - */ void imm_draw_circle_fill_2d(uint shdr_pos, float x, float y, float rad, int nsegments) { imm_draw_circle(GPU_PRIM_TRI_FAN, shdr_pos, x, y, rad, rad, nsegments); @@ -274,21 +243,6 @@ static void imm_draw_disk_partial(GPUPrimType prim_type, immEnd(); } -/** - * Draw a filled arc with the given inner and outer radius. - * The circle is centered at \a x, \a y and drawn in the XY plane. - * - * \note Arguments are `gluPartialDisk` compatible. - * - * \param pos: The vertex attribute number for position. - * \param x: Horizontal center. - * \param y: Vertical center. - * \param rad_inner: The inner circle's radius. - * \param rad_outer: The outer circle's radius (can be zero). - * \param nsegments: The number of segments to use in drawing (more = smoother). - * \param start: Specifies the starting angle, in degrees, of the disk portion. - * \param sweep: Specifies the sweep angle, in degrees, of the disk portion. - */ void imm_draw_disk_partial_fill_2d(uint pos, float x, float y, @@ -328,15 +282,6 @@ void imm_draw_circle_fill_3d(uint pos, float x, float y, float rad, int nsegment imm_draw_circle_3D(GPU_PRIM_TRI_FAN, pos, x, y, rad, nsegments); } -/** - * Draw a lined box. - * - * \param pos: The vertex attribute number for position. - * \param x1: left. - * \param y1: bottom. - * \param x2: right. - * \param y2: top. - */ void imm_draw_box_wire_2d(uint pos, float x1, float y1, float x2, float y2) { immBegin(GPU_PRIM_LINE_LOOP, 4); @@ -358,9 +303,6 @@ void imm_draw_box_wire_3d(uint pos, float x1, float y1, float x2, float y2) immEnd(); } -/** - * Draw a standard checkerboard to indicate transparent backgrounds. - */ void imm_draw_box_checker_2d_ex(float x1, float y1, float x2, @@ -458,18 +400,6 @@ void imm_draw_cube_corners_3d(uint pos, immEnd(); } -/** - * Draw a cylinder. Replacement for gluCylinder. - * _warning_ : Slow, better use it only if you no other choices. - * - * \param pos: The vertex attribute number for position. - * \param nor: The vertex attribute number for normal. - * \param base: Specifies the radius of the cylinder at z = 0. - * \param top: Specifies the radius of the cylinder at z = height. - * \param height: Specifies the height of the cylinder. - * \param slices: Specifies the number of subdivisions around the z axis. - * \param stacks: Specifies the number of subdivisions along the z axis. - */ void imm_draw_cylinder_fill_normal_3d( uint pos, uint nor, float base, float top, float height, int slices, int stacks) { diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 6872a08e854..3804f2f0dd1 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -115,7 +115,6 @@ enum { /* Functions */ -/* Returns the address of the future pointer to coba_tex */ GPUTexture **gpu_material_ramp_texture_row_set(GPUMaterial *mat, int size, float *pixels, @@ -212,7 +211,6 @@ GPUShader *GPU_material_get_shader(GPUMaterial *material) return material->pass ? GPU_pass_shader_get(material->pass) : NULL; } -/* Return can be NULL if it's a world material. */ Material *GPU_material_get_material(GPUMaterial *material) { return material->ma; @@ -223,11 +221,6 @@ GPUUniformBuf *GPU_material_uniform_buffer_get(GPUMaterial *material) return material->ubo; } -/** - * Create dynamic UBO from parameters - * - * \param inputs: Items are #LinkData, data is #GPUInput (`BLI_genericNodeN(GPUInput)`). - */ void GPU_material_uniform_buffer_create(GPUMaterial *material, ListBase *inputs) { #ifndef NDEBUG @@ -545,7 +538,6 @@ GSet *gpu_material_used_libraries(GPUMaterial *material) return material->used_libraries; } -/* Return true if the material compilation has not yet begin or begin. */ eGPUMaterialStatus GPU_material_status(GPUMaterial *mat) { return mat->status; @@ -592,11 +584,6 @@ GPUMaterial *GPU_material_from_nodetree_find(ListBase *gpumaterials, return NULL; } -/** - * \note Caller must use #GPU_material_from_nodetree_find to re-use existing materials, - * This is enforced since constructing other arguments to this function may be expensive - * so only do this when they are needed. - */ GPUMaterial *GPU_material_from_nodetree(Scene *scene, struct Material *ma, struct bNodeTree *ntree, diff --git a/source/blender/gpu/intern/gpu_matrix.cc b/source/blender/gpu/intern/gpu_matrix.cc index 0cc0e944301..8004455fbdc 100644 --- a/source/blender/gpu/intern/gpu_matrix.cc +++ b/source/blender/gpu/intern/gpu_matrix.cc @@ -733,9 +733,6 @@ float GPU_polygon_offset_calc(const float (*winmat)[4], float viewdist, float di return winmat[3][2] * -0.0025f * dist; } -/** - * \note \a viewdist is only for ortho at the moment. - */ void GPU_polygon_offset(float viewdist, float dist) { static float winmat[4][4], offset = 0.0f; diff --git a/source/blender/gpu/intern/gpu_node_graph.c b/source/blender/gpu/intern/gpu_node_graph.c index 585cb296bac..50ff450ac79 100644 --- a/source/blender/gpu/intern/gpu_node_graph.c +++ b/source/blender/gpu/intern/gpu_node_graph.c @@ -791,7 +791,6 @@ static void gpu_node_free(GPUNode *node) MEM_freeN(node); } -/* Free intermediate node graph. */ void gpu_node_graph_free_nodes(GPUNodeGraph *graph) { GPUNode *node; @@ -803,7 +802,6 @@ void gpu_node_graph_free_nodes(GPUNodeGraph *graph) graph->outlink = NULL; } -/* Free both node graph and requested attributes and textures. */ void gpu_node_graph_free(GPUNodeGraph *graph) { BLI_freelistN(&graph->outlink_aovs); diff --git a/source/blender/gpu/intern/gpu_node_graph.h b/source/blender/gpu/intern/gpu_node_graph.h index 929191cff73..8a112ac9c4d 100644 --- a/source/blender/gpu/intern/gpu_node_graph.h +++ b/source/blender/gpu/intern/gpu_node_graph.h @@ -167,12 +167,21 @@ typedef struct GPUNodeGraph { void gpu_node_graph_prune_unused(GPUNodeGraph *graph); void gpu_node_graph_finalize_uniform_attrs(GPUNodeGraph *graph); +/** + * Free intermediate node graph. + */ void gpu_node_graph_free_nodes(GPUNodeGraph *graph); +/** + * Free both node graph and requested attributes and textures. + */ void gpu_node_graph_free(GPUNodeGraph *graph); /* Material calls */ struct GPUNodeGraph *gpu_material_node_graph(struct GPUMaterial *material); +/** + * Returns the address of the future pointer to coba_tex. + */ struct GPUTexture **gpu_material_ramp_texture_row_set(struct GPUMaterial *mat, int size, float *pixels, diff --git a/source/blender/gpu/intern/gpu_platform.cc b/source/blender/gpu/intern/gpu_platform.cc index 907dfa0fc1a..34834a62268 100644 --- a/source/blender/gpu/intern/gpu_platform.cc +++ b/source/blender/gpu/intern/gpu_platform.cc @@ -157,7 +157,6 @@ const char *GPU_platform_gpu_name() return GPG.gpu_name; } -/* GPU Types */ bool GPU_type_matches(eGPUDeviceType device, eGPUOSType os, eGPUDriverType driver) { BLI_assert(GPG.initialized); diff --git a/source/blender/gpu/intern/gpu_select.c b/source/blender/gpu/intern/gpu_select.c index 3c89f082e9b..aadb52fb49c 100644 --- a/source/blender/gpu/intern/gpu_select.c +++ b/source/blender/gpu/intern/gpu_select.c @@ -71,9 +71,6 @@ static GPUSelectState g_select_state = {0}; /** \name Public API * \{ */ -/** - * initialize and provide buffer for results - */ void GPU_select_begin(uint *buffer, uint bufsize, const rcti *input, char mode, int oldhits) { if (mode == GPU_SELECT_NEAREST_SECOND_PASS) { @@ -107,14 +104,6 @@ void GPU_select_begin(uint *buffer, uint bufsize, const rcti *input, char mode, } } -/** - * loads a new selection id and ends previous query, if any. - * In second pass of selection it also returns - * if id has been hit on the first pass already. - * Thus we can skip drawing un-hit objects. - * - * \warning We rely on the order of object rendering on passes to be the same for this to work. - */ bool GPU_select_load_id(uint id) { /* if no selection mode active, ignore */ @@ -133,11 +122,6 @@ bool GPU_select_load_id(uint id) } } -/** - * Cleanup and flush selection results to buffer. - * Return number of hits and hits in buffer. - * if \a dopass is true, we will do a second pass with occlusion queries to get the closest hit. - */ uint GPU_select_end(void) { uint hits = 0; @@ -205,12 +189,6 @@ bool GPU_select_is_cached(void) /** \name Utilities * \{ */ -/** - * Helper function, nothing special but avoids doing inline since hits aren't sorted by depth - * and purpose of 4x buffer indices isn't so clear. - * - * Note that comparing depth as uint is fine. - */ const uint *GPU_select_buffer_near(const uint *buffer, int hits) { const uint *buffer_near = NULL; @@ -244,7 +222,6 @@ uint GPU_select_buffer_remove_by_id(uint *buffer, int hits, uint select_id) return hits_final; } -/* Part of the solution copied from `rect_subregion_stride_calc`. */ void GPU_select_buffer_stride_realign(const rcti *src, const rcti *dst, uint *r_buf) { const int x = dst->xmin - src->xmin; diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c index a8907859bf4..737e4c6e874 100644 --- a/source/blender/gpu/intern/gpu_select_pick.c +++ b/source/blender/gpu/intern/gpu_select_pick.c @@ -730,7 +730,6 @@ void gpu_select_pick_cache_end(void) BLI_freelistN(&g_pick_state.cache.bufs); } -/* is drawing needed? */ bool gpu_select_pick_is_cached(void) { return g_pick_state.is_cached; diff --git a/source/blender/gpu/intern/gpu_select_private.h b/source/blender/gpu/intern/gpu_select_private.h index e49feb3fc50..e5a84a037a6 100644 --- a/source/blender/gpu/intern/gpu_select_private.h +++ b/source/blender/gpu/intern/gpu_select_private.h @@ -30,16 +30,21 @@ extern "C" { #endif /* gpu_select_pick */ + void gpu_select_pick_begin(uint (*buffer)[4], uint bufsize, const rcti *input, char mode); bool gpu_select_pick_load_id(uint id, bool end); uint gpu_select_pick_end(void); void gpu_select_pick_cache_begin(void); void gpu_select_pick_cache_end(void); +/** + * \return true if drawing is not needed. + */ bool gpu_select_pick_is_cached(void); void gpu_select_pick_cache_load_id(void); /* gpu_select_sample_query */ + void gpu_select_query_begin( uint (*buffer)[4], uint bufsize, const rcti *input, char mode, int oldhits); bool gpu_select_query_load_id(uint id); diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index 9340d311472..1b6cb196534 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -284,26 +284,6 @@ static const char *string_join_array_maybe_alloc(const char **str_arr, bool *r_i return str_arr[0]; } -/** - * Use via #GPU_shader_create_from_arrays macro (avoids passing in param). - * - * Similar to #DRW_shader_create_with_lib with the ability to include libs for each type of shader. - * - * It has the advantage that each item can be conditionally included - * without having to build the string inline, then free it. - * - * \param params: NULL terminated arrays of strings. - * - * Example: - * \code{.c} - * sh = GPU_shader_create_from_arrays({ - * .vert = (const char *[]){shader_lib_glsl, shader_vert_glsl, NULL}, - * .geom = (const char *[]){shader_geom_glsl, NULL}, - * .frag = (const char *[]){shader_frag_glsl, NULL}, - * .defs = (const char *[]){"#define DEFINE\n", test ? "#define OTHER_DEFINE\n" : "", NULL}, - * }); - * \endcode - */ struct GPUShader *GPU_shader_create_from_arrays_impl( const struct GPU_ShaderCreateFromArray_Params *params, const char *func, int line) { @@ -431,7 +411,6 @@ int GPU_shader_get_ssbo(GPUShader *shader, const char *name) return ssbo ? ssbo->location : -1; } -/* DEPRECATED. */ int GPU_shader_get_uniform_block(GPUShader *shader, const char *name) { ShaderInterface *interface = unwrap(shader)->interface; @@ -466,7 +445,6 @@ int GPU_shader_get_attribute(GPUShader *shader, const char *name) /** \name Getters * \{ */ -/* DEPRECATED: Kept only because of BGL API */ int GPU_shader_get_program(GPUShader *shader) { return unwrap(shader)->program_handle_get(); diff --git a/source/blender/gpu/intern/gpu_shader_interface.cc b/source/blender/gpu/intern/gpu_shader_interface.cc index ae94112b17b..1648446d21b 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.cc +++ b/source/blender/gpu/intern/gpu_shader_interface.cc @@ -65,11 +65,12 @@ 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() { + /* Sorts all inputs inside their respective array. + * This is to allow fast hash collision detection. + * See `ShaderInterface::input_lookup` for more details. */ + 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_)); diff --git a/source/blender/gpu/intern/gpu_shader_interface.hh b/source/blender/gpu/intern/gpu_shader_interface.hh index ebed7b15170..12a7ffabcc6 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.hh +++ b/source/blender/gpu/intern/gpu_shader_interface.hh @@ -130,7 +130,9 @@ class ShaderInterface { inline uint32_t set_input_name(ShaderInput *input, char *name, uint32_t name_len) const; - /* Finalize interface construction by sorting the ShaderInputs for faster lookups. */ + /** + * Finalize interface construction by sorting the #ShaderInputs for faster lookups. + */ void sort_inputs(void); private: diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index 9ee8a8b8d32..a43ddb09ff8 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -165,11 +165,6 @@ void GPU_depth_range(float near, float far) copy_v2_fl2(state.depth_range, near, far); } -/** - * \note By convention, this is set as needed and not reset back to 1.0. - * This means code that draws lines must always set the line width beforehand, - * but is not expected to restore it's previous value. - */ void GPU_line_width(float width) { width = max_ff(1.0f, width * PIXELSIZE); @@ -184,10 +179,6 @@ void GPU_point_size(float size) state.point_size = size * ((state.point_size > 0.0) ? 1.0f : -1.0f); } -/* Programmable point size - * - shaders set their own point size when enabled - * - use GPU_point_size when disabled */ -/* TODO: remove and use program point size everywhere. */ void GPU_program_point_size(bool enable) { StateManager *stack = Context::get()->state_manager; @@ -264,7 +255,6 @@ eGPUStencilTest GPU_stencil_test_get() return (eGPUStencilTest)state.stencil_test; } -/* NOTE: Already premultiplied by U.pixelsize. */ float GPU_line_width_get() { const GPUStateMutable &state = Context::get()->state_manager->mutable_state; @@ -363,7 +353,6 @@ void GPU_bgl_start() } } -/* Just turn off the bgl safeguard system. Can be called even without GPU_bgl_start. */ void GPU_bgl_end() { Context *ctx = Context::get(); diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 2744c0c5e17..c7e2043b790 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -298,7 +298,6 @@ GPUTexture *GPU_texture_create_cube_array( name, w, w, d, GPU_TEXTURE_CUBE_ARRAY, mip_len, format, GPU_DATA_FLOAT, data); } -/* DDS texture loading. Return NULL if support is not available. */ GPUTexture *GPU_texture_create_compressed_2d( const char *name, int w, int h, int miplen, eGPUTextureFormat tex_format, const void *data) { @@ -337,7 +336,6 @@ GPUTexture *GPU_texture_create_from_vertbuf(const char *name, GPUVertBuf *vert) return reinterpret_cast<GPUTexture *>(tex); } -/* Create an error texture that will bind an invalid texture (pink) at draw time. */ GPUTexture *GPU_texture_create_error(int dimension, bool is_array) { float pixel[4] = {1.0f, 0.0f, 1.0f, 1.0f}; @@ -386,27 +384,17 @@ void *GPU_texture_read(GPUTexture *tex_, eGPUDataFormat data_format, int miplvl) return tex->read(miplvl, data_format); } -/** - * Fills the whole texture with the same data for all pixels. - * \warning Only work for 2D texture for now. - * \warning Only clears the mip 0 of the texture. - * \param data_format: data format of the pixel data. - * \param data: 1 pixel worth of data to fill the texture with. - */ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void *data) { BLI_assert(data != nullptr); /* Do not accept NULL as parameter. */ reinterpret_cast<Texture *>(tex)->clear(data_format, data); } -/* NOTE: Updates only mip 0. */ void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *data) { reinterpret_cast<Texture *>(tex)->update(data_format, data); } -/* Makes data interpretation aware of the source layout. - * Skipping pixels correctly when changing rows when doing partial update. */ void GPU_unpack_row_length_set(uint len) { Context::get()->state_manager->texture_unpack_row_length_set(len); @@ -461,7 +449,6 @@ void GPU_texture_generate_mipmap(GPUTexture *tex) reinterpret_cast<Texture *>(tex)->generate_mipmap(); } -/* Copy a texture content to a similar texture. Only MIP 0 is copied. */ void GPU_texture_copy(GPUTexture *dst_, GPUTexture *src_) { Texture *src = reinterpret_cast<Texture *>(src_); @@ -626,7 +613,6 @@ void GPU_texture_get_mipmap_size(GPUTexture *tex, int lvl, int *r_size) * Override texture sampler state for one sampler unit only. * \{ */ -/* Update user defined sampler states. */ void GPU_samplers_update(void) { GPUBackend::get()->samplers_update(); diff --git a/source/blender/gpu/intern/gpu_uniform_buffer.cc b/source/blender/gpu/intern/gpu_uniform_buffer.cc index 6f2e9838955..332875ba81f 100644 --- a/source/blender/gpu/intern/gpu_uniform_buffer.cc +++ b/source/blender/gpu/intern/gpu_uniform_buffer.cc @@ -201,12 +201,6 @@ GPUUniformBuf *GPU_uniformbuf_create_ex(size_t size, const void *data, const cha return wrap(ubo); } -/** - * Create UBO from inputs list. - * Return NULL if failed to create or if \param inputs: is empty. - * - * \param inputs: ListBase of #BLI_genericNodeN(#GPUInput). - */ GPUUniformBuf *GPU_uniformbuf_create_from_list(ListBase *inputs, const char *name) { /* There is no point on creating an UBO if there is no arguments. */ diff --git a/source/blender/gpu/intern/gpu_vertex_buffer.cc b/source/blender/gpu/intern/gpu_vertex_buffer.cc index 7ff68242c17..5ed9648387f 100644 --- a/source/blender/gpu/intern/gpu_vertex_buffer.cc +++ b/source/blender/gpu/intern/gpu_vertex_buffer.cc @@ -159,7 +159,6 @@ void *GPU_vertbuf_unmap(const GPUVertBuf *verts, const void *mapped_data) return unwrap(verts)->unmap(mapped_data); } -/** Same as discard but does not free. */ void GPU_vertbuf_clear(GPUVertBuf *verts) { unwrap(verts)->clear(); @@ -183,21 +182,16 @@ void GPU_vertbuf_handle_ref_remove(GPUVertBuf *verts) /* -------- Data update -------- */ -/* create a new allocation, discarding any existing data */ void GPU_vertbuf_data_alloc(GPUVertBuf *verts, uint v_len) { unwrap(verts)->allocate(v_len); } -/* resize buffer keeping existing data */ void GPU_vertbuf_data_resize(GPUVertBuf *verts, uint v_len) { unwrap(verts)->resize(v_len); } -/* Set vertex count but does not change allocation. - * Only this many verts will be uploaded to the GPU and rendered. - * This is useful for streaming data. */ void GPU_vertbuf_data_len_set(GPUVertBuf *verts_, uint v_len) { VertBuf *verts = unwrap(verts_); @@ -229,7 +223,6 @@ void GPU_vertbuf_attr_fill(GPUVertBuf *verts_, uint a_idx, const void *data) GPU_vertbuf_attr_fill_stride(verts_, a_idx, stride, data); } -/** Fills a whole vertex (all attributes). Data must match packed layout. */ void GPU_vertbuf_vert_set(GPUVertBuf *verts_, uint v_idx, const void *data) { VertBuf *verts = unwrap(verts_); @@ -284,15 +277,12 @@ void GPU_vertbuf_attr_get_raw_data(GPUVertBuf *verts_, uint a_idx, GPUVertBufRaw /* -------- Getters -------- */ -/* NOTE: Be careful when using this. The data needs to match the expected format. */ void *GPU_vertbuf_get_data(const GPUVertBuf *verts) { /* TODO: Assert that the format has no padding. */ return unwrap(verts)->data; } -/* Returns the data buffer and set it to null internally to avoid freeing. - * NOTE: Be careful when using this. The data needs to match the expected format. */ void *GPU_vertbuf_steal_data(GPUVertBuf *verts_) { VertBuf *verts = unwrap(verts_); @@ -328,7 +318,6 @@ uint GPU_vertbuf_get_memory_usage() return VertBuf::memory_usage; } -/* Should be rename to GPU_vertbuf_data_upload */ void GPU_vertbuf_use(GPUVertBuf *verts) { unwrap(verts)->upload(); @@ -339,8 +328,6 @@ void GPU_vertbuf_bind_as_ssbo(struct GPUVertBuf *verts, int binding) unwrap(verts)->bind_as_ssbo(binding); } -/* XXX this is just a wrapper for the use of the Hair refine workaround. - * To be used with GPU_vertbuf_use(). */ void GPU_vertbuf_update_sub(GPUVertBuf *verts, uint start, uint len, void *data) { unwrap(verts)->update_sub(start, len, data); diff --git a/source/blender/gpu/intern/gpu_vertex_format.cc b/source/blender/gpu/intern/gpu_vertex_format.cc index 78a119bcec8..ad45f2a4d7b 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.cc +++ b/source/blender/gpu/intern/gpu_vertex_format.cc @@ -190,17 +190,6 @@ void GPU_vertformat_alias_add(GPUVertFormat *format, const char *alias) attr->names[attr->name_len++] = copy_attr_name(format, alias); } -/** - * Makes vertex attribute from the next vertices to be accessible in the vertex shader. - * For an attribute named "attr" you can access the next nth vertex using "attr{number}". - * Use this function after specifying all the attributes in the format. - * - * NOTE: This does NOT work when using indexed rendering. - * NOTE: Only works for first attribute name. (this limitation can be changed if needed) - * - * WARNING: this function creates a lot of aliases/attributes, make sure to keep the attribute - * name short to avoid overflowing the name-buffer. - */ void GPU_vertformat_multiload_enable(GPUVertFormat *format, int load_count) { /* Sanity check. Maximum can be upgraded if needed. */ @@ -271,8 +260,6 @@ static void safe_bytes(char out[11], const char data[8]) } } -/* Warning: Always add a prefix to the result of this function as - * the generated string can start with a number and not be a valid attribute name. */ void GPU_vertformat_safe_attr_name(const char *attr_name, char *r_safe_name, uint UNUSED(max_len)) { char data[8] = {0}; @@ -306,20 +293,6 @@ void GPU_vertformat_safe_attr_name(const char *attr_name, char *r_safe_name, uin #endif } -/** - * Make attribute layout non-interleaved. - * Warning! This does not change data layout! - * Use direct buffer access to fill the data. - * This is for advanced usage. - * - * De-interleaved data means all attribute data for each attribute - * is stored continuously like this: - * 000011112222 - * instead of: - * 012012012012 - * - * \note This is per attribute de-interleaving, NOT per component. - */ void GPU_vertformat_deinterleave(GPUVertFormat *format) { /* Ideally we should change the stride and offset here. This would allow diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index c9dbb94eb87..c604859fa94 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -194,7 +194,6 @@ void GPU_viewport_bind(GPUViewport *viewport, int view, const rcti *rect) viewport->active_view = view; } -/* Should be called from DRW after DRW_opengl_context_enable. */ void GPU_viewport_bind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs) { GPUTexture *color, *depth; @@ -258,7 +257,6 @@ void GPU_viewport_colorspace_set(GPUViewport *viewport, viewport->do_color_management = true; } -/* Merge the stereo textures. `color` and `overlay` texture will be modified. */ void GPU_viewport_stereo_composite(GPUViewport *viewport, Stereo3dFormat *stereo_format) { if (!ELEM(stereo_format->display_mode, S3D_DISPLAY_ANAGLYPH, S3D_DISPLAY_INTERLACE)) { @@ -452,10 +450,6 @@ static void gpu_viewport_draw_colormanaged(GPUViewport *viewport, } } -/** - * Version of #GPU_viewport_draw_to_screen() that lets caller decide if display colorspace - * transform should be performed. - */ void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, int view, const rcti *rect, @@ -508,21 +502,11 @@ void GPU_viewport_draw_to_screen_ex(GPUViewport *viewport, viewport, view, &pos_rect, &uv_rect, display_colorspace, do_overlay_merge); } -/** - * Merge and draw the buffers of \a viewport into the currently active framebuffer, performing - * color transform to display space. - * - * \param rect: Coordinates to draw into. By swapping min and max values, drawing can be done - * with inversed axis coordinates (upside down or sideways). - */ void GPU_viewport_draw_to_screen(GPUViewport *viewport, int view, const rcti *rect) { GPU_viewport_draw_to_screen_ex(viewport, view, rect, true, true); } -/** - * Clear vars assigned from offscreen, so we don't free data owned by `GPUOffScreen`. - */ void GPU_viewport_unbind_from_offscreen(GPUViewport *viewport, struct GPUOffScreen *ofs, bool display_colorspace, @@ -587,7 +571,6 @@ GPUTexture *GPU_viewport_depth_texture(GPUViewport *viewport) return viewport->depth_tx; } -/* Overlay framebuffer for drawing outside of DRW module. */ GPUFrameBuffer *GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport) { GPU_framebuffer_ensure_config( @@ -599,7 +582,6 @@ GPUFrameBuffer *GPU_viewport_framebuffer_overlay_get(GPUViewport *viewport) return viewport->overlay_fb; } -/* Must be executed inside Draw-manager OpenGL Context. */ void GPU_viewport_free(GPUViewport *viewport) { if (viewport->draw_data) { |