Skip to content

Commit 2a3b28b

Browse files
committed
Reviewed some comments
1 parent 2fd058c commit 2a3b28b

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/external/rlsw.h

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@ typedef struct {
937937
int allocSz; // Allocated size
938938
SWfilter minFilter; // Minification filter
939939
SWfilter magFilter; // Magnification filter
940-
SWwrap sWrap; // texcoord.x wrap mode
941-
SWwrap tWrap; // texcoord.y wrap mode
940+
SWwrap sWrap; // Wrap mode for texcoord.x
941+
SWwrap tWrap; // Wrap mode for texcoord.y
942942
float tx; // Texel width
943943
float ty; // Texel height
944944
} sw_texture_t;
@@ -1285,7 +1285,7 @@ static inline uint16_t sw_float_to_half_ui(uint32_t ui)
12851285
// Overflow: infinity; 143 encodes exponent 16
12861286
h = (em >= (143 << 23))? 0x7c00 : h;
12871287

1288-
// NaN; note that we convert all types of NaN to qNaN
1288+
// NaN; note that all types of NaN are converted to qNaN
12891289
h = (em > (255 << 23))? 0x7e00 : h;
12901290

12911291
return (uint16_t)(s | h);
@@ -1302,8 +1302,8 @@ static inline uint32_t sw_half_to_float_ui(uint16_t h)
13021302
// Denormal: flush to zero
13031303
r = (em < (1 << 10))? 0 : r;
13041304

1305-
// Infinity/NaN; note that we preserve NaN payload as a byproduct of unifying inf/nan cases
1306-
// 112 is an exponent bias fixup; since we already applied it once, applying it twice converts 31 to 255
1305+
// Infinity/NaN; note that NaN payload is preeserved as a byproduct of unifying inf/nan cases
1306+
// 112 is an exponent bias fixup; since it was already applied once, applying it twice converts 31 to 255
13071307
r += (em >= (31 << 10))? (112 << 23) : 0;
13081308

13091309
return s | r;
@@ -2487,8 +2487,9 @@ static inline void sw_texture_sample_linear(float *SW_RESTRICT color, const sw_t
24872487
static inline void sw_texture_sample(float *SW_RESTRICT color, const sw_texture_t *SW_RESTRICT tex,
24882488
float u, float v, float dUdx, float dUdy, float dVdx, float dVdy)
24892489
{
2490-
// Previous method: There is no need to compute the square root
2491-
// because using the squared value, the comparison remains (L2 > 1.0f*1.0f)
2490+
// NOTE: Commented there is the previous method used
2491+
// There was no need to compute the square root because
2492+
// using the squared value, the comparison remains (L2 > 1.0f*1.0f)
24922493
//float du = sqrtf(dUdx*dUdx + dUdy*dUdy);
24932494
//float dv = sqrtf(dVdx*dVdx + dVdy*dVdy);
24942495
//float L = (du > dv)? du : dv;
@@ -2534,10 +2535,9 @@ static inline void sw_default_framebuffer_free(sw_default_framebuffer_t *fb)
25342535

25352536
static inline void sw_framebuffer_fill_color(sw_texture_t *colorBuffer, const float color[4])
25362537
{
2537-
// NOTE: MSVC doesn't support VLA, so we allocate the largest possible size
2538-
//uint8_t pixel[SW_FRAMEBUFFER_COLOR_SIZE];
2539-
2540-
uint8_t pixel[16];
2538+
// NOTE: MSVC doesn't support VLA, so the largest possible size is allocated: 16 bytes
2539+
//uint8_t pixel[SW_FRAMEBUFFER_COLOR_SIZE] = { 0 };
2540+
uint8_t pixel[16] = { 0 };
25412541
SW_FRAMEBUFFER_COLOR_SET(pixel, color, 0);
25422542

25432543
uint8_t *dst = (uint8_t *)colorBuffer->pixels;
@@ -2574,10 +2574,9 @@ static inline void sw_framebuffer_fill_color(sw_texture_t *colorBuffer, const fl
25742574

25752575
static inline void sw_framebuffer_fill_depth(sw_texture_t *depthBuffer, float depth)
25762576
{
2577-
// NOTE: MSVC doesn't support VLA, so we allocate the largest possible size
2578-
//uint8_t pixel[SW_FRAMEBUFFER_DEPTH_SIZE];
2579-
2580-
uint8_t pixel[4];
2577+
// NOTE: MSVC doesn't support VLA, so the largest possible size is allocated: 4 bytes
2578+
//uint8_t pixel[SW_FRAMEBUFFER_DEPTH_SIZE] = { 0 };
2579+
uint8_t pixel[4] = { 0 };
25812580
SW_FRAMEBUFFER_DEPTH_SET(pixel, depth, 0);
25822581

25832582
uint8_t *dst = (uint8_t *)depthBuffer->pixels;
@@ -3740,7 +3739,7 @@ static inline void sw_poly_fill_render(uint32_t state)
37403739
//-------------------------------------------------------------------------------------------
37413740
static void sw_immediate_push_vertex(const float position[4], const float color[4], const float texcoord[2])
37423741
{
3743-
// Check if we are in a valid draw mode
3742+
// Check if the draw mode is valid
37443743
if (!sw_is_draw_mode_valid(RLSW.drawMode))
37453744
{
37463745
RLSW.errCode = SW_INVALID_OPERATION;
@@ -4480,7 +4479,7 @@ void swOrtho(double left, double right, double bottom, double top, double znear,
44804479

44814480
void swBegin(SWdraw mode)
44824481
{
4483-
// Check if we can render
4482+
// Check if render is possible
44844483
if (!sw_is_ready_to_render())
44854484
{
44864485
RLSW.errCode = SW_INVALID_OPERATION;

0 commit comments

Comments
 (0)