mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 03:08:05 +02:00
nv20: Fix GL_CLAMP
v2: Force T and R wrap modes to GL_CLAMP_TO_EDGE for 1D textures. This fixes a regression in tex1d-2dborder. The test uses a 1D texture but it provides S and T texture coordinates. Since the T wrap mode would (correctly) be set to GL_CLAMP, the texture would gradually blend (incorrectly) with the border color. I also tried setting NV20_3D_TEX_FORMAT_DIMS_1D instead of NV20_3D_TEX_FORMAT_DIMS_2D for 1D textures, but that did not help. It is possible that the same problem exists for 2D textures with the R-wrap mode, but I don't think there are any piglit tests for that. No test changes on NV20 (10de:0201). Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
This commit is contained in:
parent
9c87150618
commit
953a3cf0fd
2 changed files with 32 additions and 3 deletions
|
|
@ -238,6 +238,25 @@ nvgl_wrap_mode(unsigned wrap)
|
|||
}
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
nvgl_wrap_mode_nv20(unsigned wrap)
|
||||
{
|
||||
switch (wrap) {
|
||||
case GL_REPEAT:
|
||||
return 0x1;
|
||||
case GL_MIRRORED_REPEAT:
|
||||
return 0x2;
|
||||
case GL_CLAMP:
|
||||
return 0x5;
|
||||
case GL_CLAMP_TO_EDGE:
|
||||
return 0x3;
|
||||
case GL_CLAMP_TO_BORDER:
|
||||
return 0x4;
|
||||
default:
|
||||
unreachable("Bad GL texture wrap mode");
|
||||
}
|
||||
}
|
||||
|
||||
static inline unsigned
|
||||
nvgl_filter_mode(unsigned filter)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -193,9 +193,19 @@ nv20_emit_tex_obj(struct gl_context *ctx, int emit)
|
|||
| NV20_3D_TEX_FORMAT_NO_BORDER
|
||||
| 1 << 16;
|
||||
|
||||
tx_wrap = nvgl_wrap_mode(sa->WrapR) << 16
|
||||
| nvgl_wrap_mode(sa->WrapT) << 8
|
||||
| nvgl_wrap_mode(sa->WrapS) << 0;
|
||||
switch (t->Target) {
|
||||
case GL_TEXTURE_1D:
|
||||
tx_wrap = NV20_3D_TEX_WRAP_R_CLAMP_TO_EDGE
|
||||
| NV20_3D_TEX_WRAP_T_CLAMP_TO_EDGE
|
||||
| nvgl_wrap_mode_nv20(sa->WrapS) << 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
tx_wrap = nvgl_wrap_mode_nv20(sa->WrapR) << 16
|
||||
| nvgl_wrap_mode_nv20(sa->WrapT) << 8
|
||||
| nvgl_wrap_mode_nv20(sa->WrapS) << 0;
|
||||
break;
|
||||
}
|
||||
|
||||
tx_filter = nvgl_filter_mode(sa->MagFilter) << 24
|
||||
| nvgl_filter_mode(sa->MinFilter) << 16
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue