Cleanup: spelling in code comments

This commit is contained in:
Campbell Barton 2022-10-06 12:12:09 +11:00
parent 51bd26d0fa
commit 87d737cd79
33 changed files with 55 additions and 55 deletions

View File

@ -30,7 +30,7 @@ void BKE_blender_globals_main_replace(struct Main *bmain);
* Replace current global Main by the given one, returning the old one.
*
* \warning Advanced, risky workaround addressing the issue that current RNA is not able to process
* correectly non-G_MAIN data, use with (a lot of) care.
* correctly non-G_MAIN data, use with (a lot of) care.
*/
struct Main *BKE_blender_globals_main_swap(struct Main *new_gmain);

View File

@ -11,7 +11,7 @@
void main()
{
/* Compute plane normal in ndc space. */
/* Compute plane normal in NDC space. */
vec3 pos0 = gl_in[0].gl_Position.xyz / gl_in[0].gl_Position.w;
vec3 pos1 = gl_in[1].gl_Position.xyz / gl_in[1].gl_Position.w;
vec3 pos2 = gl_in[2].gl_Position.xyz / gl_in[2].gl_Position.w;
@ -33,7 +33,7 @@ void main()
/* HACK: Fix cases where the triangle is too small make it cover at least one pixel. */
gl_Position.xy += drw_view.viewport_size_inverse * gl_Position.w * ofs;
}
/* Test if the triangle is almost parralele with the view to avoid precision issues. */
/* Test if the triangle is almost parallel with the view to avoid precision issues. */
else if (any(is_subpixel) || is_coplanar) {
/* HACK: Fix cases where the triangle is Parallel to the view by deforming it slightly. */
vec2 ofs = (i == 0) ? vec2(-1.0) : ((i == 1) ? vec2(1.0, -1.0) : vec2(1.0));

View File

@ -47,7 +47,7 @@ HitData decode_hit_data(vec4 hit_data, float hit_depth)
return data;
}
/* Blue noise categorised into 4 sets of samples.
/* Blue noise categorized into 4 sets of samples.
* See "Stochastic all the things" presentation slide 32-37. */
const int resolve_samples_count = 9;
const vec2 resolve_sample_offsets[36] = vec2[36](

View File

@ -206,7 +206,7 @@ vec3 probe_evaluate_planar(int id, PlanarData pd, vec3 P, vec3 N, vec3 V, float
vec4 refco = ProjectionMatrix * (ViewMatrix * vec4(ref_pos, 1.0));
refco.xy /= refco.w;
/* TODO: If we support non-ssr planar reflection, we should blur them with gaussian
/* TODO: If we support non-SSR planar reflection, we should blur them with gaussian
* and chose the right mip depending on the cone footprint after projection */
/* NOTE: X is inverted here to compensate inverted drawing. */
vec3 radiance = textureLod(probePlanars, vec3(refco.xy * vec2(-0.5, 0.5) + 0.5, id), 0.0).rgb;

View File

@ -17,7 +17,7 @@
vec3 attr_load_orco(vec4 orco)
{
/* We know when there is no orco layer when orco.w is 1.0 because it uses the generic vertex
* attrib (which is [0,0,0,1]). */
* attribute (which is [0,0,0,1]). */
if (orco.w == 1.0) {
/* If the object does not have any deformation, the orco layer calculation is done on the fly
* using the orco_madd factors. */

View File

@ -239,7 +239,7 @@ void dof_gather_accumulate_sample_ring(DofGatherData ring_data,
}
}
/* FIXME(fclem) Seems to be wrong since it needs ringcount+1 as input for
/* FIXME(fclem) Seems to be wrong since it needs `ringcount + 1` as input for
* slightfocus gather. */
/* This should be replaced by web_sample_count_get() but doing so is breaking other things. */
int dof_gather_total_sample_count(const int ring_count, const int ring_density)

View File

@ -82,7 +82,7 @@ void main()
{
ivec2 texel = min(ivec2(gl_GlobalInvocationID.xy), imageSize(inout_color_lod0_img) - 1);
uvec2 texel_local = gl_LocalInvocationID.xy;
/* Increase readablility. */
/* Increase readability. */
#define LOCAL_INDEX texel_local.y][texel_local.x
#define LOCAL_OFFSET(x_, y_) texel_local.y + (y_)][texel_local.x + (x_)

View File

@ -187,7 +187,7 @@ void film_cryptomatte_layer_accum_and_store(
if (pass_id == -1) {
return;
}
/* x = hash, y = accumed weight. Only keep track of 4 highest weighted samples. */
/* x = hash, y = accumulated weight. Only keep track of 4 highest weighted samples. */
vec2 crypto_samples[4] = vec2[4](vec2(0.0), vec2(0.0), vec2(0.0), vec2(0.0));
for (int i = 0; i < film_buf.samples_len; i++) {
FilmSample src = film_sample_get(i, texel_film);

View File

@ -41,7 +41,7 @@ vec3 sampling_rng_3D_get(const eSamplingDimension dimension)
/** \name Random Number Generators.
* \{ */
/* Interlieved gradient noise by Jorge Jimenez
/* Interleaved gradient noise by Jorge Jimenez
* http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare
* Seeding found by Epic Game. */
float interlieved_gradient_noise(vec2 pixel, float seed, float offset)

View File

@ -32,7 +32,7 @@ vec4 velocity_surface(vec3 P_prv, vec3 P, vec3 P_nxt)
next_uv = curr_uv;
}
/* NOTE: We output both vectors in the same direction so we can reuse the same vector
* with rgrg swizzle in viewport. */
* with RGRG swizzle in viewport. */
vec4 motion = vec4(prev_uv - curr_uv, curr_uv - next_uv);
/* Convert NDC velocity to UV velocity */
motion *= 0.5;
@ -54,7 +54,7 @@ vec4 velocity_background(vec3 vV)
vec2 curr_uv = project_point(camera_curr.winmat, V).xy;
vec2 next_uv = project_point(camera_next.winmat, V).xy;
/* NOTE: We output both vectors in the same direction so we can reuse the same vector
* with rgrg swizzle in viewport. */
* with RGRG swizzle in viewport. */
vec4 motion = vec4(prev_uv - curr_uv, curr_uv - next_uv);
/* Convert NDC velocity to UV velocity */
motion *= 0.5;

View File

@ -101,33 +101,33 @@ void blend_mode_output(
{
switch (blend_mode) {
case MODE_REGULAR:
/* Reminder: Blending func is premult alpha blend (dst.rgba * (1 - src.a) + src.rgb). */
/* Reminder: Blending func is premult alpha blend `(dst.rgba * (1 - src.a) + src.rgb)`. */
color *= opacity;
frag_color = color;
frag_revealage = vec4(0.0, 0.0, 0.0, color.a);
break;
case MODE_MULTIPLY:
/* Reminder: Blending func is multiply blend (dst.rgba * src.rgba). */
/* Reminder: Blending func is multiply blend `(dst.rgba * src.rgba)`. */
color.a *= opacity;
frag_revealage = frag_color = (1.0 - color.a) + color.a * color;
break;
case MODE_DIVIDE:
/* Reminder: Blending func is multiply blend (dst.rgba * src.rgba). */
/* Reminder: Blending func is multiply blend `(dst.rgba * src.rgba)`. */
color.a *= opacity;
frag_revealage = frag_color = clamp(1.0 / max(vec4(1e-6), 1.0 - color * color.a), 0.0, 1e18);
break;
case MODE_HARDLIGHT: {
/* Reminder: Blending func is multiply blend (dst.rgba * src.rgba). */
/* Reminder: Blending func is multiply blend `(dst.rgba * src.rgba)`. */
/**
* We need to separate the overlay equation into 2 term (one mul and one add).
* This is the standard overlay equation (per channel):
* rtn = (src < 0.5) ? (2.0 * src * dst) : (1.0 - 2.0 * (1.0 - src) * (1.0 - dst));
* `rtn = (src < 0.5) ? (2.0 * src * dst) : (1.0 - 2.0 * (1.0 - src) * (1.0 - dst));`
* We rewrite the second branch like this:
* rtn = 1 - 2 * (1 - src) * (1 - dst);
* rtn = 1 - 2 (1 - dst + src * dst - src);
* rtn = 1 - 2 (1 - dst * (1 - src) - src);
* rtn = 1 - 2 + dst * (2 - 2 * src) + 2 * src;
* rtn = (- 1 + 2 * src) + dst * (2 - 2 * src);
* `rtn = 1 - 2 * (1 - src) * (1 - dst);`
* `rtn = 1 - 2 (1 - dst + src * dst - src);`
* `rtn = 1 - 2 (1 - dst * (1 - src) - src);`
* `rtn = 1 - 2 + dst * (2 - 2 * src) + 2 * src;`
* `rtn = (- 1 + 2 * src) + dst * (2 - 2 * src);`
*/
color = mix(vec4(0.5), color, color.a * opacity);
vec4 s = step(-0.5, -color);
@ -143,7 +143,7 @@ void blend_mode_output(
break;
case MODE_SUB:
case MODE_ADD:
/* Reminder: Blending func is additive / subtractive blend (dst.rgba +/- src.rgba). */
/* Reminder: Blending func is additive / subtractive blend `(dst.rgba +/- src.rgba)`. */
frag_color = color * color.a * opacity;
frag_revealage = vec4(0.0);
break;

View File

@ -25,8 +25,8 @@ void main()
* doing it per instance on CPU and sending it on via instance attribute. */
mat3 normal_mat = transpose(inverse(mat3(model_mat)));
/* TODO: FIX: there is still a problem with this vector
* when the bone is scaled or in persp mode. But it's
* barely visible at the outline corners. */
* when the bone is scaled or in perspective mode.
* But it's barely visible at the outline corners. */
geom_in.ssNor = normalize(normal_world_to_view(normal_mat * snor).xy);
geom_in.ssPos = proj(geom_in.pPos);

View File

@ -52,7 +52,7 @@ void do_vertex_shader(mat4 in_inst_obmat,
void main()
{
/* Outputs a singular vertex as part of a LineList primitive, however, requires access to
* neighbouring 4 vertices. */
* neighboring 4 vertices. */
/* Fetch verts from input type lines adjacency. */
int line_prim_id = (gl_VertexID / 2);
int line_vertex_id = gl_VertexID % 2;

View File

@ -18,8 +18,8 @@ float dither(void)
void main()
{
/* The blend equation is:
* resutl.rgb = SRC.rgb * (1 - DST.a) + DST.rgb * (SRC.a)
* result.a = SRC.a * 0 + DST.a * SRC.a
* `result.rgb = SRC.rgb * (1 - DST.a) + DST.rgb * (SRC.a)`
* `result.a = SRC.a * 0 + DST.a * SRC.a`
* This removes the alpha channel and put the background behind reference images
* while masking the reference images by the render alpha.
*/

View File

@ -65,7 +65,7 @@ void main()
* input primitive types which use restart indices. */
int base_vertex_id = quad_id * 2;
/* Fetch attribute values for self and neighbouring vertex. */
/* Fetch attribute values for self and neighboring vertex. */
vec3 in_pos0 = vertex_fetch_attribute(base_vertex_id, pos, vec3);
vec3 in_pos1 = vertex_fetch_attribute(base_vertex_id + 1, pos, vec3);
uchar4 in_data0 = vertex_fetch_attribute(base_vertex_id, data, uchar4);
@ -75,7 +75,7 @@ void main()
vec3 in_vnor1 = vec3_1010102_Inorm_to_vec3(
vertex_fetch_attribute(base_vertex_id + 1, vnor, vec3_1010102_Inorm));
/* Calculate values for self and neighbouring vertex. */
/* Calculate values for self and neighboring vertex. */
vec4 out_finalColor[2];
vec4 out_finalColorOuter[2];
int selectOveride[2];

View File

@ -4,8 +4,8 @@
* We want to know how much a pixel is covered by a line.
* We replace the square pixel with acircle of the same area and try to find the intersection area.
* The area we search is the circular segment. https://en.wikipedia.org/wiki/Circular_segment
* The formula for the area uses inverse trig function and is quite complexe. Instead,
* we approximate it by using the smoothstep function and a 1.05 factor to the disc radius.
* The formula for the area uses inverse trig function and is quite complex. Instead,
* we approximate it by using the smooth-step function and a 1.05 factor to the disc radius.
*/
#define M_1_SQRTPI 0.5641895835477563 /* 1/sqrt(pi) */
#define DISC_RADIUS (M_1_SQRTPI * 1.05)

View File

@ -28,7 +28,7 @@ void main()
half_size += (lineStyle == OVERLAY_UV_LINE_STYLE_OUTLINE) ?
max(sizeEdge * (doSmoothWire ? 1.0 : 3.0), 1.0) :
0.0;
/* Add 1 px for AA */
/* Add 1 PX for AA. */
if (doSmoothWire) {
half_size += 0.5;
}

View File

@ -104,7 +104,7 @@ void main()
* Note: Primitive is LineStrip for this shader. */
int base_vertex_id = quad_id;
/* Fetch attributes for self and neighbouring vertex. */
/* Fetch attributes for self and neighboring vertex. */
vec3 in_pos0 = vertex_fetch_attribute(base_vertex_id, pos, vec3);
vec3 in_pos1 = vertex_fetch_attribute(base_vertex_id + 1, pos, vec3);

View File

@ -10,8 +10,8 @@ void main()
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
/* Add offset in Z to avoid zfighting and render selected wires on top. */
/* TODO: scale this bias using znear and zfar range. */
/* Add offset in Z to avoid Z-fighting and render selected wires on top. */
/* TODO: scale this bias using Z-near and Z-far range. */
gl_Position.z -= (is_select ? 2e-4 : 1e-4);
if (is_hidden) {

View File

@ -10,8 +10,8 @@ void main()
vec3 world_pos = point_object_to_world(pos);
gl_Position = point_world_to_ndc(world_pos);
/* Add offset in Z to avoid zfighting and render selected wires on top. */
/* TODO: scale this bias using znear and zfar range. */
/* Add offset in Z to avoid Z-fighting and render selected wires on top. */
/* TODO: scale this bias using Z-near and Z-far range. */
gl_Position.z -= (is_select ? 2e-4 : 1e-4);
if (is_hidden) {

View File

@ -89,7 +89,7 @@ void main()
texel = (texel - 0.5) / vec4(textureSize(sceneColorTex, 0).xyxy);
/* Using texelFetch can bypass the mip range setting on some platform.
* Using texture Lod fix this issue. Note that we need to disable filtering to get the right
* Using texture LOD fixes this issue. Note that we need to disable filtering to get the right
* texel values. */
vec4 color1 = textureLod(sceneColorTex, texel.xy, 0.0);
vec4 color2 = textureLod(sceneColorTex, texel.zw, 0.0);
@ -200,7 +200,7 @@ void main()
vec2 get_random_vector(float offset)
{
/* Interlieved gradient noise by Jorge Jimenez
/* Interleaved gradient noise by Jorge Jimenez
* http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare */
float ign = fract(offset +
52.9829189 * fract(0.06711056 * gl_FragCoord.x + 0.00583715 * gl_FragCoord.y));

View File

@ -30,7 +30,7 @@ vec4 sample_tricubic(sampler3D ima, vec3 co)
vec3 f = co - tc;
vec3 f2 = f * f;
vec3 f3 = f2 * f;
/* Bspline coefs (optimized) */
/* Bspline coefficients (optimized). */
vec3 w3 = f3 / 6.0;
vec3 w0 = -w3 + f2 * 0.5 - f * 0.5 + 1.0 / 6.0;
vec3 w1 = f3 * 0.5 - f2 + 2.0 / 3.0;

View File

@ -21,7 +21,7 @@
*
* NOTE: Floating point representation might not be very precise (see drw_print_value(float)).
*
* IMPORTANT: Multipler drawcalls can write to the buffer in sequence (if they are from different
* IMPORTANT: Multiple drawcalls can write to the buffer in sequence (if they are from different
* shgroups). However, we add barriers to support this case and it might change the application
* behavior. Uncomment DISABLE_DEBUG_SHADER_drw_print_BARRIER to remove the barriers if that
* happens. But then you are limited to a single invocation output.
@ -92,7 +92,7 @@ void drw_print_char4(uint data)
* it is referenced as an index for char4 and thus do not capture the right
* reference. I do not know if this is undefined behavior. As a matter of
* precaution, we implement all the append function separately. This behavior
* was observed on both Mesa & amdgpu-pro.
* was observed on both MESA & AMDGPU-PRO.
*/
/* Using ascii char code. Expect char1 to be less or equal to 0xFF. Appends chars to the right. */
void drw_print_append_char(uint char1, inout uint char4)

View File

@ -312,7 +312,7 @@ float FxaaLuma(vec4 rgba)
/*--------------------------------------------------------------------------*/
vec4 FxaaPixelShader(
/*
* Use noperspective interpolation here (turn off perspective interpolation).
* Use no perspective interpolation here (turn off perspective interpolation).
* {xy} = center of pixel */
vec2 pos,
/*

View File

@ -91,7 +91,7 @@ vec4 pack_line_data(vec2 frag_co, vec2 edge_start, vec2 edge_pos)
edge /= len;
vec2 perp = vec2(-edge.y, edge.x);
float dist = dot(perp, frag_co - edge_start);
/* Add 0.1 to diffenrentiate with cleared pixels. */
/* Add 0.1 to differentiate with cleared pixels. */
return vec4(perp * 0.5 + 0.5, dist * 0.25 + 0.5 + 0.1, 1.0);
}
else {
@ -226,7 +226,7 @@ layout(std140) uniform modelBlock
# ifndef USE_GPU_SHADER_CREATE_INFO
/* Intel GPU seems to suffer performance impact when the model matrix is in UBO storage.
* So for now we just force using the legacy path. */
/* Note that this is also a workaround of a problem on osx (amd or nvidia)
/* Note that this is also a workaround of a problem on OSX (AMD or NVIDIA)
* and older amd driver on windows. */
uniform mat4 ModelMatrix;
uniform mat4 ModelMatrixInverse;

View File

@ -126,7 +126,7 @@ void math_pingpong(float a, float b, float c, out float result)
result = (b != 0.0) ? abs(fract((a - b) / (b * 2.0)) * b * 2.0 - b) : 0.0;
}
/* Adapted from godotengine math_funcs.h. */
/* Adapted from GODOT-engine math_funcs.h. */
void math_wrap(float a, float b, float c, out float result)
{
result = wrap(a, b, c);

View File

@ -132,7 +132,7 @@ vec3 fallback_pow(vec3 a, float b, vec3 fallback)
fallback_pow(a.z, b, fallback.z));
}
/* Matirx Math */
/* Matrix Math */
/* Return a 2D rotation matrix with the angle that the input 2D vector makes with the x axis. */
mat2 vector_to_rotation_matrix(vec2 vector)

View File

@ -6,7 +6,7 @@ vec3 compute_masks(vec2 uv)
bool right_half = uv.x > outRectSize.x * 0.5;
float corner_rad;
/* Correct aspect ratio for 2D views not using uniform scalling.
/* Correct aspect ratio for 2D views not using uniform scaling.
* uv is already in pixel space so a uniform scale should give us a ratio of 1. */
float ratio = (butCo != -2.0) ? (dFdy(uv.y) / dFdx(uv.x)) : 1.0;
vec2 uv_sdf = uv;

View File

@ -124,8 +124,8 @@ vec2 do_tria()
}
else if (triaType == 4.0) {
/* ROUNDBOX_TRIA_CHECK */
/* A bit more hacky: We use the two trias joined together to render
* both sides of the checkmark with different length. */
/* A bit more hacky: We use the two triangles joined together to render
* both sides of the check-mark with different length. */
pos = arrow_pos[min(vidx, 2)]; /* Only keep 1 triangle. */
pos.y = tria2 ? -pos.y : pos.y; /* Mirror along X */
pos = pos.x * vec2(0.0872, -0.996) + pos.y * vec2(0.996, 0.0872); /* Rotate (85deg) */

View File

@ -67,7 +67,7 @@ vec3 orco_get(vec3 local_pos, mat4 modelmatinv, vec4 orco_madd[2], vec4 orco)
/* If the object does not have any deformation, the orco layer calculation is done on the fly
* using the orco_madd factors.
* We know when there is no orco layer when orco.w is 1.0 because it uses the generic vertex
* attrib (which is [0,0,0,1]). */
* attribute (which is [0,0,0,1]). */
if (orco.w == 0.0) {
return orco.xyz * 0.5 + 0.5;
}

View File

@ -6,7 +6,7 @@ void main()
glyph_dim = abs(glyph_size);
interp_size = int(glyph_size.x < 0) + int(glyph_size.y < 0);
/* Quad expension using instanced rendering. */
/* Quad expansion using instanced rendering. */
float x = float(gl_VertexID % 2);
float y = float(gl_VertexID / 2);
vec2 quad = vec2(x, y);

View File

@ -91,7 +91,7 @@ void node_bsdf_principled(vec4 base_color,
diffuse_data.sss_id = uint(do_sss);
/* NOTE(@fclem): We need to blend the reflection color but also need to avoid applying the
* weights so we compule the ratio. */
* weights so we compute the ratio. */
float reflection_weight = specular_weight + glass_reflection_weight;
float reflection_weight_inv = safe_rcp(reflection_weight);
specular_weight *= reflection_weight_inv;

View File

@ -1,5 +1,5 @@
/* Texture format tokens -- Type explictness required by other Graphics APIs. */
/* Texture format tokens -- Type explicitness required by other Graphics APIs. */
#define depth2D sampler2D
#define depth2DArray sampler2DArray
#define depth2DMS sampler2DMS