Cleanup: spelling in comments

This commit is contained in:
Campbell Barton 2022-02-02 13:15:43 +11:00
parent 811606a064
commit d82372aee3
13 changed files with 57 additions and 46 deletions

View File

@ -273,7 +273,8 @@ struct TileChangeset {
const int previous_chunk_len = chunk_dirty_flags_.size();
chunk_dirty_flags_.resize(chunk_len);
/* Fast exit. When the changeset was already empty no need to re-init the chunk_validity. */
/* Fast exit. When the changeset was already empty no need to
* re-initialize the chunk_validity. */
if (!has_dirty_chunks()) {
return;
}

View File

@ -1182,8 +1182,8 @@ void BKE_modifier_blend_write(BlendWriter *writer, ListBase *modbase)
#if 0
CollisionModifierData *collmd = (CollisionModifierData *)md;
// TODO: CollisionModifier should use pointcache
// + have proper reset events before enabling this
/* TODO: CollisionModifier should use pointcache
* + have proper reset events before enabling this. */
writestruct(wd, DATA, MVert, collmd->numverts, collmd->x);
writestruct(wd, DATA, MVert, collmd->numverts, collmd->xnew);
writestruct(wd, DATA, MFace, collmd->numfaces, collmd->mfaces);

View File

@ -227,8 +227,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
GPUTexture *texture = info.texture;
const float texture_width = GPU_texture_width(texture);
const float texture_height = GPU_texture_height(texture);
// TODO
// early bound check.
/* TODO: early bound check. */
ImageTileWrapper tile_accessor(iterator.tile_data.tile);
float tile_offset_x = static_cast<float>(tile_accessor.get_tile_x_offset());
float tile_offset_y = static_cast<float>(tile_accessor.get_tile_y_offset());
@ -253,9 +252,9 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
if (!region_overlap) {
continue;
}
// convert the overlapping region to texel space and to ss_pixel space...
// TODO: first convert to ss_pixel space as integer based. and from there go back to texel
// space. But perhaps this isn't needed and we could use an extraction offset somehow.
/* Convert the overlapping region to texel space and to ss_pixel space...
* TODO: first convert to ss_pixel space as integer based. and from there go back to texel
* space. But perhaps this isn't needed and we could use an extraction offset somehow. */
rcti gpu_texture_region_to_update;
BLI_rcti_init(&gpu_texture_region_to_update,
floor((changed_overlapping_region_in_uv_space.xmin - info.uv_bounds.xmin) *
@ -275,8 +274,8 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
ceil((changed_overlapping_region_in_uv_space.ymin - tile_offset_y) * tile_height),
ceil((changed_overlapping_region_in_uv_space.ymax - tile_offset_y) * tile_height));
// Create an image buffer with a size
// extract and scale into an imbuf
/* Create an image buffer with a size.
* Extract and scale into an imbuf. */
const int texture_region_width = BLI_rcti_size_x(&gpu_texture_region_to_update);
const int texture_region_height = BLI_rcti_size_y(&gpu_texture_region_to_update);
@ -437,17 +436,17 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD
instance_data->partial_update.ensure_image(image);
instance_data->clear_dirty_flag();
// Step: Find out which screen space textures are needed to draw on the screen. Remove the
// screen space textures that aren't needed.
/* Step: Find out which screen space textures are needed to draw on the screen. Remove the
* screen space textures that aren't needed. */
const ARegion *region = draw_ctx->region;
method.update_screen_space_bounds(region);
method.update_uv_bounds(region);
// Step: Update the GPU textures based on the changes in the image.
/* Step: Update the GPU textures based on the changes in the image. */
instance_data->update_gpu_texture_allocations();
update_textures(*instance_data, image, iuser);
// Step: Add the GPU textures to the shgroup.
/* Step: Add the GPU textures to the shgroup. */
instance_data->update_batches();
add_depth_shgroups(*instance_data, image, iuser);
add_shgroups(instance_data);

View File

@ -999,7 +999,7 @@ static bool draw_subdiv_build_cache(DRWSubdivCache *cache,
cache->face_ptex_offset = BKE_subdiv_face_ptex_offset_get(subdiv);
// Build patch coordinates for all the face dots
/* Build patch coordinates for all the face dots. */
cache->fdots_patch_coords = gpu_vertbuf_create_from_format(get_blender_patch_coords_format(),
mesh_eval->totpoly);
CompressedPatchCoord *blender_fdots_patch_coords = (CompressedPatchCoord *)GPU_vertbuf_get_data(
@ -1760,7 +1760,7 @@ static void draw_subdiv_cache_ensure_mat_offsets(DRWSubdivCache *cache,
int *mat_start = static_cast<int *>(MEM_callocN(sizeof(int) * mat_len, "subdiv mat_start"));
int *subdiv_polygon_offset = cache->subdiv_polygon_offset;
// TODO: parallel_reduce?
/* TODO: parallel_reduce? */
for (int i = 0; i < mesh_eval->totpoly; i++) {
const MPoly *mpoly = &mesh_eval->mpoly[i];
const int next_offset = (i == mesh_eval->totpoly - 1) ? number_of_quads :

View File

@ -4635,7 +4635,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op)
}
}
/* Separate the entrie stroke. */
/* Separate the entire stroke. */
if (all_points_selected) {
/* deselect old stroke */
gps->flag &= ~GP_STROKE_SELECT;

View File

@ -51,7 +51,7 @@ typedef struct GPUSelectResult {
/**
* The nearest depth.
* - Only supported by picking modes (#GPU_SELECT_PICK_ALL and #GPU_SELECT_PICK_NEAREST)
* since occlusion quiries don't provide a convenient way of accessing the depth-buffer.
* since occlusion quires don't provide a convenient way of accessing the depth-buffer.
* - OpenGL's `GL_SELECT` supported both near and far depths,
* this has not been included as Blender doesn't need this however support could be added.
*/

View File

@ -272,7 +272,8 @@ void *GPU_texture_read(GPUTexture *tex, eGPUDataFormat data_format, int miplvl);
* 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. \note The format is float for unorm textures.
* \param data_format: data format of the pixel data.
* \note The format is float for unorm textures.
* \param data: 1 pixel worth of data to fill the texture with.
*/
void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat data_format, const void *data);

View File

@ -125,10 +125,10 @@ constexpr bool is_type_integral = (... && std::is_integral_v<std::decay_t<T>>);
template<typename... T>
constexpr bool is_type_string_related = (... && std::is_constructible_v<std::string, T>);
// gcc (at least 9.3) while compiling the obj_exporter_tests.cc with optimizations on,
// results in "obj_export_io.hh:205:18: warning: %s directive output truncated writing 34 bytes
// into a region of size 6" and similar warnings. Yes the output is truncated, and that is covered
// as an edge case by tests on purpose.
/* GCC (at least 9.3) while compiling the obj_exporter_tests.cc with optimizations on,
* results in "obj_export_io.hh:205:18: warning: %s directive output truncated writing 34 bytes
* into a region of size 6" and similar warnings. Yes the output is truncated, and that is covered
* as an edge case by tests on purpose. */
#if defined __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wformat-truncation"

View File

@ -237,7 +237,7 @@ static void rna_AssetMetaData_catalog_id_set(PointerRNA *ptr, const char *value)
}
if (!BLI_uuid_parse_string(&new_uuid, value)) {
// TODO(Sybren): raise ValueError exception once that's possible from an RNA setter.
/* TODO(@sybren): raise ValueError exception once that's possible from an RNA setter. */
printf("UUID %s not formatted correctly, ignoring new value\n", value);
return;
}

View File

@ -369,9 +369,10 @@ void rna_ViewLayer_active_aov_index_range(
PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
int rna_ViewLayer_active_aov_index_get(PointerRNA *ptr);
void rna_ViewLayer_active_aov_index_set(PointerRNA *ptr, int value);
/** Set `r_rna_path` with the base viewlayer path.
/**
* Set `r_rna_path` with the base view-layer path.
* `rna_path_buffer_size` should be at least `sizeof(ViewLayer.name) * 3`.
* \return actual length of the generayted RNA path.
* \return actual length of the generated RNA path.
*/
size_t rna_ViewLayer_path_buffer_get(struct ViewLayer *view_layer,
char *r_rna_path,

View File

@ -48,16 +48,17 @@
namespace blender::render::texturemargin {
/* The map class contains both a pixel map which maps out polygon indices for all UV-polygons and
/**
* The map class contains both a pixel map which maps out polygon indices for all UV-polygons and
* adjacency tables.
*/
class TextureMarginMap {
static const int directions[8][2];
static const int distances[8];
/* Maps UV-edges to their corresponding UV-edge. */
/** Maps UV-edges to their corresponding UV-edge. */
Vector<int> loop_adjacency_map_;
/* Maps UV-edges to their corresponding polygon. */
/** Maps UV-edges to their corresponding polygon. */
Vector<int> loop_to_poly_map_;
int w_, h_;
@ -132,9 +133,7 @@ class TextureMarginMap {
static void zscan_store_pixel(
void *map, int x, int y, [[maybe_unused]] float u, [[maybe_unused]] float v)
{
/* NOTE: Not thread safe, see comment above.
*
*/
/* NOTE: Not thread safe, see comment above. */
TextureMarginMap *m = static_cast<TextureMarginMap *>(map);
m->set_pixel(x, y, m->value_to_store_);
if (m->mask_) {
@ -153,7 +152,8 @@ class TextureMarginMap {
#define IsDijkstraPixel(dp) ((dp)&0x80000000)
#define DijkstraPixelIsUnset(dp) ((dp) == 0xFFFFFFFF)
/* Use dijkstra's algorithm to 'grow' a border around the polygons marked in the map.
/**
* Use dijkstra's algorithm to 'grow' a border around the polygons marked in the map.
* For each pixel mark which direction is the shortest way to a polygon.
*/
void grow_dijkstra(int margin)
@ -188,8 +188,10 @@ class TextureMarginMap {
}
}
// std::make_heap(active_pixels.begin(), active_pixels.end(), cmp_dijkstrapixel_fun);
// Not strictly needed because at this point it already is a heap.
/* Not strictly needed because at this point it already is a heap. */
#if 0
std::make_heap(active_pixels.begin(), active_pixels.end(), cmp_dijkstrapixel_fun);
#endif
while (active_pixels.size()) {
std::pop_heap(active_pixels.begin(), active_pixels.end(), cmp_dijkstrapixel_fun);
@ -215,7 +217,8 @@ class TextureMarginMap {
}
}
/* Walk over the map and for margin pixels follow the direction stored in the bottom 3
/**
* Walk over the map and for margin pixels follow the direction stored in the bottom 3
* bits back to the polygon.
* Then look up the pixel from the next polygon.
*/
@ -324,10 +327,12 @@ class TextureMarginMap {
}
}
/* Call lookup_pixel for the start_poly. If that fails, try the adjacent polygons as well.
* Because the Dijkstra is not vey exact in determining which polygon is the closest, the
/**
* Call lookup_pixel for the start_poly. If that fails, try the adjacent polygons as well.
* Because the Dijkstra is not very exact in determining which polygon is the closest, the
* polygon we need can be the one next to the one the Dijkstra map provides. To prevent missing
* pixels also check the neighbouring polygons. */
* pixels also check the neighboring polygons.
*/
bool lookup_pixel_polygon_neighbourhood(
float x, float y, uint32_t *r_start_poly, float *r_destx, float *r_desty, int *r_other_poly)
{
@ -344,8 +349,8 @@ class TextureMarginMap {
float mindist = -1.f;
/* Loop over all adjacent polyons and determine which edge is closest.
* This could be optimized by only inspecting neigbours which are on the edge of an island.
/* Loop over all adjacent polygons and determine which edge is closest.
* This could be optimized by only inspecting neighbors which are on the edge of an island.
* But it seems fast enough for now and that would add a lot of complexity. */
for (int i = 0; i < totloop; i++) {
int otherloop = loop_adjacency_map_[i + loopstart];
@ -370,10 +375,12 @@ class TextureMarginMap {
return mindist >= 0.f;
}
/* Find which edge of the src_poly is closest to x,y. Look up it's adjacent UV-edge and polygon.
/**
* Find which edge of the src_poly is closest to x,y. Look up it's adjacent UV-edge and polygon.
* Then return the location of the equivalent pixel in the other polygon.
* Returns true if a new pixel location was found, false if it wasn't, which can happen if the
* margin pixel is on a corner, or the UV-edge doesn't have an adjacent polygon. */
* margin pixel is on a corner, or the UV-edge doesn't have an adjacent polygon.
*/
bool lookup_pixel(float x,
float y,
int src_poly,
@ -568,7 +575,9 @@ static void generate_margin(ImBuf *ibuf,
vec[a][1] = uv[1] * (float)ibuf->y - (0.5f + 0.002f);
}
BLI_assert(lt->poly < 0x80000000); // NOTE: we need the top bit for the dijkstra distance map
/* NOTE: we need the top bit for the dijkstra distance map. */
BLI_assert(lt->poly < 0x80000000);
map.rasterize_tri(vec[0], vec[1], vec[2], lt->poly, draw_new_mask ? mask : nullptr);
}

View File

@ -297,7 +297,7 @@ static void seq_add_sound_av_sync(Main *bmain, Scene *scene, Sequence *seq, SeqL
const double av_stream_offset = sound_stream.start - load_data->r_video_stream_start;
const int frame_offset = av_stream_offset * FPS;
/* Set subframe offset. */
/* Set sub-frame offset. */
seq->sound->offset_time = ((double)frame_offset / FPS) - av_stream_offset;
SEQ_transform_translate_sequence(scene, seq, frame_offset);
}

View File

@ -162,7 +162,7 @@ def keymap_data_clean(keyconfig_data: typing.List, *, relaxed: bool) -> None:
item_prop.pop("properties")
# Needed so: `{"properties": ()}` matches `None` as there is no meaningful difference.
# Wruting `None` makes the most sense when explicitly written, however generated properties
# Writing `None` makes the most sense when explicitly written, however generated properties
# might be empty and it's not worth adding checks in the generation logic to use `None`
# just to satisfy this check.
if not item_prop: