Skip to content

Commit

Permalink
gl: fix uninitialized parms variable, and use GL parameters/defaults …
Browse files Browse the repository at this point in the history
…for wrapping
  • Loading branch information
rasky committed Jun 19, 2023
1 parent 578d9c4 commit a022516
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/GL/texture.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ _Static_assert((1<<NEED_EYE_SPACE_SHIFT) == FLAG_NEED_EYE_SPACE);
_Static_assert((SOM_SAMPLE_BILINEAR >> 32) >> BILINEAR_TEX_OFFSET_SHIFT == HALF_TEXEL);

extern gl_state_t state;
inline void texture_get_texparms(gl_texture_object_t *obj, GLint level, rdpq_texparms_t *parms);

void gl_init_texture_object(gl_texture_object_t *obj)
{
Expand Down Expand Up @@ -317,12 +318,13 @@ void glSurfaceTexImageN64(GLenum target, GLint level, surface_t *surface, rdpq_t

rdpq_texparms_t parms;
if (texparms != NULL) {
memcpy(&parms, texparms, sizeof(parms));
parms = *texparms;
parms.s.scale_log = level;
parms.t.scale_log = level;
} else {
texture_get_texparms(obj, level, &parms);
}

parms.s.scale_log = level;
parms.t.scale_log = level;

texture_image_free_safe(obj, level);

obj->surfaces[level] = surface_make_sub(surface, 0, 0, surface->width, surface->height);
Expand Down

0 comments on commit a022516

Please sign in to comment.