gallium: normalized_coords -> unnormalized_coords
A lot of code zero-initializes pipe_sampler_state, and sets the states the non-zero fields manually. This means that normalized_coords is the "default" setting. However, setting normalized_coords to true isn't allways allowed, and we'd need to check PIPE_CAP_TEXRECT first. So it's not really the ideal default here. There's recently been found quite a bit of bugs in this area, where the state-tracker didn't properly lower texrects. Let's switch this around to avoid more bugs like this in the future. Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18971>
This commit is contained in:

committed by
Marge Bot

parent
4e7b9aaa06
commit
55f6a2bb51
@@ -80,14 +80,14 @@ compare_mode
|
||||
If set to PIPE_TEX_COMPARE_NONE, no comparison calculation is performed.
|
||||
compare_func
|
||||
The inequality operator used when compare_mode=1. One of PIPE_FUNC_x.
|
||||
normalized_coords
|
||||
If set, the incoming texture coordinates (nominally in the range [0,1])
|
||||
will be scaled by the texture width, height, depth to compute texel
|
||||
addresses. Otherwise, the texture coords are used as-is (they are not
|
||||
scaled by the texture dimensions).
|
||||
When normalized_coords=0, only a subset of the texture wrap modes are
|
||||
allowed: PIPE_TEX_WRAP_CLAMP, PIPE_TEX_WRAP_CLAMP_TO_EDGE and
|
||||
PIPE_TEX_WRAP_CLAMP_TO_BORDER.
|
||||
unnormalized_coords
|
||||
If set, incoming texture coordinates are used as-is to compute
|
||||
texel addresses. When set, only a subset of the texture wrap
|
||||
modes are allowed: PIPE_TEX_WRAP_CLAMP, PIPE_TEX_WRAP_CLAMP_TO_EDGE,
|
||||
and PIPE_TEX_WRAP_CLAMP_TO_BORDER. If unset, the incoming texture
|
||||
coordinates are assumed to be normalized to the range [0, 1],
|
||||
and will be scaled by the texture dimensions to compute texel
|
||||
addresses.
|
||||
lod_bias
|
||||
Bias factor which is added to the computed level of detail.
|
||||
The normal level of detail is computed from the partial derivatives of
|
||||
|
@@ -544,7 +544,7 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state)
|
||||
trace_dump_member(uint, state, mag_img_filter);
|
||||
trace_dump_member(uint, state, compare_mode);
|
||||
trace_dump_member(uint, state, compare_func);
|
||||
trace_dump_member(bool, state, normalized_coords);
|
||||
trace_dump_member(bool, state, unnormalized_coords);
|
||||
trace_dump_member(uint, state, max_anisotropy);
|
||||
trace_dump_member(bool, state, seamless_cube_map);
|
||||
trace_dump_member(float, state, lod_bias);
|
||||
|
@@ -238,7 +238,7 @@ lp_sampler_static_sampler_state(struct lp_static_sampler_state *state,
|
||||
state->compare_func = sampler->compare_func;
|
||||
}
|
||||
|
||||
state->normalized_coords = sampler->normalized_coords;
|
||||
state->normalized_coords = !sampler->unnormalized_coords;
|
||||
}
|
||||
|
||||
/* build aniso pmin value */
|
||||
|
@@ -1945,7 +1945,6 @@ hud_create(struct cso_context *cso, struct st_context_iface *st,
|
||||
hud->font_sampler_state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
hud->font_sampler_state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
hud->font_sampler_state.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
hud->font_sampler_state.normalized_coords = 1;
|
||||
|
||||
/* constants */
|
||||
hud->constbuf.buffer_size = sizeof(hud->constants);
|
||||
|
@@ -101,14 +101,12 @@ pp_init_prog(struct pp_queue_t *ppq, struct pipe_context *pipe,
|
||||
p->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
p->sampler.min_img_filter = p->sampler.mag_img_filter =
|
||||
PIPE_TEX_FILTER_LINEAR;
|
||||
p->sampler.normalized_coords = 1;
|
||||
|
||||
p->sampler_point.wrap_s = p->sampler_point.wrap_t =
|
||||
p->sampler_point.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
p->sampler_point.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
p->sampler_point.min_img_filter = p->sampler_point.mag_img_filter =
|
||||
PIPE_TEX_FILTER_NEAREST;
|
||||
p->sampler_point.normalized_coords = 1;
|
||||
|
||||
p->velem.count = 2;
|
||||
p->velem.velems[0].src_offset = 0;
|
||||
|
@@ -273,19 +273,19 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe)
|
||||
sampler_state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
sampler_state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
sampler_state.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
sampler_state.normalized_coords = 1;
|
||||
sampler_state.unnormalized_coords = 0;
|
||||
ctx->sampler_state = pipe->create_sampler_state(pipe, &sampler_state);
|
||||
if (ctx->has_texrect) {
|
||||
sampler_state.normalized_coords = 0;
|
||||
sampler_state.unnormalized_coords = 1;
|
||||
ctx->sampler_state_rect = pipe->create_sampler_state(pipe, &sampler_state);
|
||||
}
|
||||
|
||||
sampler_state.min_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler_state.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler_state.normalized_coords = 1;
|
||||
sampler_state.unnormalized_coords = 0;
|
||||
ctx->sampler_state_linear = pipe->create_sampler_state(pipe, &sampler_state);
|
||||
if (ctx->has_texrect) {
|
||||
sampler_state.normalized_coords = 0;
|
||||
sampler_state.unnormalized_coords = 1;
|
||||
ctx->sampler_state_rect_linear = pipe->create_sampler_state(pipe, &sampler_state);
|
||||
}
|
||||
|
||||
|
@@ -125,7 +125,6 @@ void util_compute_blit(struct pipe_context *ctx, struct pipe_blit_info *blit_inf
|
||||
sampler_state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
sampler_state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
sampler_state.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
sampler_state.normalized_coords = 1;
|
||||
|
||||
if (blit_info->filter == PIPE_TEX_FILTER_LINEAR) {
|
||||
sampler_state.min_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
|
@@ -689,7 +689,7 @@ util_dump_sampler_state(FILE *stream, const struct pipe_sampler_state *state)
|
||||
util_dump_member(stream, enum_tex_filter, state, mag_img_filter);
|
||||
util_dump_member(stream, uint, state, compare_mode);
|
||||
util_dump_member(stream, enum_func, state, compare_func);
|
||||
util_dump_member(stream, bool, state, normalized_coords);
|
||||
util_dump_member(stream, bool, state, unnormalized_coords);
|
||||
util_dump_member(stream, uint, state, max_anisotropy);
|
||||
util_dump_member(stream, bool, state, seamless_cube_map);
|
||||
util_dump_member(stream, float, state, lod_bias);
|
||||
|
@@ -157,7 +157,6 @@ util_pstipple_create_sampler(struct pipe_context *pipe)
|
||||
templat.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
templat.min_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
templat.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
templat.normalized_coords = 1;
|
||||
templat.min_lod = 0.0f;
|
||||
templat.max_lod = 0.0f;
|
||||
|
||||
|
@@ -292,7 +292,6 @@ vl_bicubic_filter_init(struct vl_bicubic_filter *filter, struct pipe_context *pi
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
filter->sampler = pipe->create_sampler_state(pipe, &sampler);
|
||||
if (!filter->sampler)
|
||||
goto error_sampler;
|
||||
|
@@ -147,7 +147,6 @@ init_pipe_state(struct vl_compositor *c)
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
|
||||
c->sampler_linear = c->pipe->create_sampler_state(c->pipe, &sampler);
|
||||
|
||||
|
@@ -302,7 +302,6 @@ vl_deint_filter_init(struct vl_deint_filter *filter, struct pipe_context *pipe,
|
||||
sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler.normalized_coords = 1;
|
||||
filter->sampler[0] = pipe->create_sampler_state(pipe, &sampler);
|
||||
filter->sampler[1] = filter->sampler[2] = filter->sampler[3] = filter->sampler[0];
|
||||
if (!filter->sampler[0])
|
||||
|
@@ -552,7 +552,6 @@ init_state(struct vl_idct *idct)
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
idct->samplers[i] = idct->pipe->create_sampler_state(idct->pipe, &sampler);
|
||||
if (!idct->samplers[i])
|
||||
goto error_samplers;
|
||||
|
@@ -184,7 +184,6 @@ vl_matrix_filter_init(struct vl_matrix_filter *filter, struct pipe_context *pipe
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
filter->sampler = pipe->create_sampler_state(pipe, &sampler);
|
||||
if (!filter->sampler)
|
||||
goto error_sampler;
|
||||
|
@@ -391,7 +391,6 @@ init_pipe_state(struct vl_mc *r)
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
r->sampler_ref = r->pipe->create_sampler_state(r->pipe, &sampler);
|
||||
if (!r->sampler_ref)
|
||||
goto error_sampler_ref;
|
||||
|
@@ -313,7 +313,6 @@ vl_median_filter_init(struct vl_median_filter *filter, struct pipe_context *pipe
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
filter->sampler = pipe->create_sampler_state(pipe, &sampler);
|
||||
if (!filter->sampler)
|
||||
goto error_sampler;
|
||||
|
@@ -889,7 +889,6 @@ init_pipe_state(struct vl_mpeg12_decoder *dec)
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
dec->sampler_ycbcr = dec->context->create_sampler_state(dec->context, &sampler);
|
||||
if (!dec->sampler_ycbcr)
|
||||
return false;
|
||||
|
@@ -333,7 +333,6 @@ init_state(struct vl_zscan *zscan)
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
sampler.compare_func = PIPE_FUNC_ALWAYS;
|
||||
sampler.normalized_coords = 1;
|
||||
zscan->samplers[i] = zscan->pipe->create_sampler_state(zscan->pipe, &sampler);
|
||||
if (!zscan->samplers[i])
|
||||
goto error_samplers;
|
||||
|
@@ -361,7 +361,7 @@ agx_create_sampler_state(struct pipe_context *pctx,
|
||||
cfg.wrap_s = agx_wrap_from_pipe(state->wrap_s);
|
||||
cfg.wrap_t = agx_wrap_from_pipe(state->wrap_t);
|
||||
cfg.wrap_r = agx_wrap_from_pipe(state->wrap_r);
|
||||
cfg.pixel_coordinates = !state->normalized_coords;
|
||||
cfg.pixel_coordinates = state->unnormalized_coords;
|
||||
cfg.compare_func = agx_compare_funcs[state->compare_func];
|
||||
}
|
||||
|
||||
|
@@ -2372,7 +2372,7 @@ crocus_upload_sampler_state(struct crocus_batch *batch,
|
||||
samp.TCZAddressControlMode = wrap_r;
|
||||
|
||||
#if GFX_VER >= 6
|
||||
samp.NonnormalizedCoordinateEnable = !state->normalized_coords;
|
||||
samp.NonnormalizedCoordinateEnable = state->unnormalized_coords;
|
||||
#endif
|
||||
samp.MinModeFilter = state->min_img_filter;
|
||||
samp.MagModeFilter = cso->mag_img_filter;
|
||||
|
@@ -746,7 +746,6 @@ get_sampler_state(struct d3d12_context *ctx)
|
||||
state.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
state.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
state.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE;
|
||||
state.normalized_coords = 1;
|
||||
|
||||
return ctx->sampler_state = ctx->base.create_sampler_state(&ctx->base, &state);
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@ fd2_sampler_state_create(struct pipe_context *pctx,
|
||||
|
||||
/* TODO
|
||||
* cso->max_anisotropy
|
||||
* cso->normalized_coords (dealt with by shader for rect textures?)
|
||||
* cso->unnormalized_coords (dealt with by shader for rect textures?)
|
||||
*/
|
||||
|
||||
/* SQ_TEX0_PITCH() must be OR'd in later when we know the bound texture: */
|
||||
|
@@ -92,7 +92,7 @@ fd3_sampler_state_create(struct pipe_context *pctx,
|
||||
|
||||
so->needs_border = false;
|
||||
so->texsamp0 =
|
||||
COND(!cso->normalized_coords, A3XX_TEX_SAMP_0_UNNORM_COORDS) |
|
||||
COND(cso->unnormalized_coords, A3XX_TEX_SAMP_0_UNNORM_COORDS) |
|
||||
COND(!cso->seamless_cube_map, A3XX_TEX_SAMP_0_CUBEMAPSEAMLESSFILTOFF) |
|
||||
COND(miplinear, A3XX_TEX_SAMP_0_MIPFILTER_LINEAR) |
|
||||
A3XX_TEX_SAMP_0_XY_MAG(tex_filter(cso->mag_img_filter, aniso)) |
|
||||
|
@@ -104,7 +104,7 @@ fd4_sampler_state_create(struct pipe_context *pctx,
|
||||
so->texsamp1 =
|
||||
// COND(miplinear, A4XX_TEX_SAMP_1_MIPFILTER_LINEAR_FAR) |
|
||||
COND(!cso->seamless_cube_map, A4XX_TEX_SAMP_1_CUBEMAPSEAMLESSFILTOFF) |
|
||||
COND(!cso->normalized_coords, A4XX_TEX_SAMP_1_UNNORM_COORDS);
|
||||
COND(cso->unnormalized_coords, A4XX_TEX_SAMP_1_UNNORM_COORDS);
|
||||
|
||||
if (cso->min_mip_filter != PIPE_TEX_MIPFILTER_NONE) {
|
||||
so->texsamp1 |= A4XX_TEX_SAMP_1_MIN_LOD(cso->min_lod) |
|
||||
|
@@ -102,7 +102,7 @@ fd5_sampler_state_create(struct pipe_context *pctx,
|
||||
|
||||
so->texsamp1 =
|
||||
COND(!cso->seamless_cube_map, A5XX_TEX_SAMP_1_CUBEMAPSEAMLESSFILTOFF) |
|
||||
COND(!cso->normalized_coords, A5XX_TEX_SAMP_1_UNNORM_COORDS);
|
||||
COND(cso->unnormalized_coords, A5XX_TEX_SAMP_1_UNNORM_COORDS);
|
||||
|
||||
so->texsamp0 |= A5XX_TEX_SAMP_0_LOD_BIAS(cso->lod_bias);
|
||||
|
||||
|
@@ -119,7 +119,7 @@ fd6_sampler_state_create(struct pipe_context *pctx,
|
||||
COND(cso->min_mip_filter == PIPE_TEX_MIPFILTER_NONE,
|
||||
A6XX_TEX_SAMP_1_MIPFILTER_LINEAR_FAR) |
|
||||
COND(!cso->seamless_cube_map, A6XX_TEX_SAMP_1_CUBEMAPSEAMLESSFILTOFF) |
|
||||
COND(!cso->normalized_coords, A6XX_TEX_SAMP_1_UNNORM_COORDS);
|
||||
COND(cso->unnormalized_coords, A6XX_TEX_SAMP_1_UNNORM_COORDS);
|
||||
|
||||
so->texsamp0 |= A6XX_TEX_SAMP_0_LOD_BIAS(cso->lod_bias);
|
||||
so->texsamp1 |= A6XX_TEX_SAMP_1_MIN_LOD(cso->min_lod) |
|
||||
|
@@ -318,7 +318,7 @@ i915_create_sampler_state(struct pipe_context *pipe,
|
||||
(translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) |
|
||||
(translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT));
|
||||
|
||||
if (sampler->normalized_coords)
|
||||
if (!sampler->unnormalized_coords)
|
||||
cso->state[1] |= SS3_NORMALIZED_COORDS;
|
||||
|
||||
{
|
||||
|
@@ -2064,7 +2064,7 @@ fill_sampler_state(uint32_t *sampler_state,
|
||||
samp.TCYAddressControlMode = translate_wrap(state->wrap_t);
|
||||
samp.TCZAddressControlMode = translate_wrap(state->wrap_r);
|
||||
samp.CubeSurfaceControlMode = state->seamless_cube_map;
|
||||
samp.NonnormalizedCoordinateEnable = !state->normalized_coords;
|
||||
samp.NonnormalizedCoordinateEnable = state->unnormalized_coords;
|
||||
samp.MinModeFilter = state->min_img_filter;
|
||||
samp.MagModeFilter = mag_img_filter;
|
||||
samp.MipModeFilter = translate_mip_filter(state->min_mip_filter);
|
||||
|
@@ -185,7 +185,7 @@ lima_update_tex_desc(struct lima_context *ctx, struct lima_sampler_state *sample
|
||||
break;
|
||||
}
|
||||
|
||||
if (!sampler->base.normalized_coords)
|
||||
if (sampler->base.unnormalized_coords)
|
||||
desc->unnorm_coords = 1;
|
||||
|
||||
first_level = texture->base.u.tex.first_level;
|
||||
|
@@ -97,24 +97,24 @@ nv30_fragtex_validate(struct nv30_context *nv30)
|
||||
*/
|
||||
if (ss->pipe.compare_mode != PIPE_TEX_COMPARE_R_TO_TEXTURE) {
|
||||
if (fmt->nv30 == NV30_3D_TEX_FORMAT_FORMAT_Z16) {
|
||||
if (ss->pipe.normalized_coords)
|
||||
if (!ss->pipe.unnormalized_coords)
|
||||
format |= NV30_3D_TEX_FORMAT_FORMAT_A8L8;
|
||||
else
|
||||
format |= NV30_3D_TEX_FORMAT_FORMAT_A8L8_RECT;
|
||||
} else
|
||||
if (fmt->nv30 == NV30_3D_TEX_FORMAT_FORMAT_Z24) {
|
||||
if (ss->pipe.normalized_coords)
|
||||
if (!ss->pipe.unnormalized_coords)
|
||||
format |= NV30_3D_TEX_FORMAT_FORMAT_HILO16;
|
||||
else
|
||||
format |= NV30_3D_TEX_FORMAT_FORMAT_HILO16_RECT;
|
||||
} else {
|
||||
if (ss->pipe.normalized_coords)
|
||||
if (!ss->pipe.unnormalized_coords)
|
||||
format |= fmt->nv30;
|
||||
else
|
||||
format |= fmt->nv30_rect;
|
||||
}
|
||||
} else {
|
||||
if (ss->pipe.normalized_coords)
|
||||
if (!ss->pipe.unnormalized_coords)
|
||||
format |= fmt->nv30;
|
||||
else
|
||||
format |= fmt->nv30_rect;
|
||||
|
@@ -152,7 +152,7 @@ nv30_sampler_state_create(struct pipe_context *pipe,
|
||||
if (eng3d->oclass >= NV40_3D_CLASS) {
|
||||
unsigned aniso = cso->max_anisotropy;
|
||||
|
||||
if (!cso->normalized_coords)
|
||||
if (cso->unnormalized_coords)
|
||||
so->fmt |= NV40_3D_TEX_FORMAT_RECT;
|
||||
|
||||
if (aniso > 1) {
|
||||
|
@@ -40,8 +40,8 @@
|
||||
#include "nouveau_gldefs.h"
|
||||
|
||||
/* Caveats:
|
||||
* ! pipe_sampler_state.normalized_coords is ignored - rectangle textures will
|
||||
* use non-normalized coordinates, everything else won't
|
||||
* ! pipe_sampler_state.unnormalized_coords is ignored - rectangle textures
|
||||
* will use non-normalized coordinates, everything else won't
|
||||
* (The relevant bit is in the TIC entry and not the TSC entry.)
|
||||
*
|
||||
* ! pipe_sampler_state.seamless_cube_map is ignored - seamless filtering is
|
||||
@@ -530,7 +530,7 @@ nv50_sampler_state_create(struct pipe_context *pipe,
|
||||
if (nouveau_screen(pipe->screen)->class_3d >= NVE4_3D_CLASS) {
|
||||
if (cso->seamless_cube_map)
|
||||
so->tsc[1] |= GK104_TSC_1_CUBEMAP_INTERFACE_FILTERING;
|
||||
if (!cso->normalized_coords)
|
||||
if (cso->unnormalized_coords)
|
||||
so->tsc[1] |= GK104_TSC_1_FLOAT_COORD_NORMALIZATION_FORCE_UNNORMALIZED_COORDS;
|
||||
} else {
|
||||
so->seamless_cube_map = cso->seamless_cube_map;
|
||||
|
@@ -217,7 +217,7 @@ panfrost_create_sampler_state(
|
||||
cfg.magnify_nearest = cso->mag_img_filter == PIPE_TEX_FILTER_NEAREST;
|
||||
cfg.minify_nearest = cso->min_img_filter == PIPE_TEX_FILTER_NEAREST;
|
||||
|
||||
cfg.normalized_coordinates = cso->normalized_coords;
|
||||
cfg.normalized_coordinates = !cso->unnormalized_coords;
|
||||
cfg.lod_bias = FIXED_16(cso->lod_bias, true);
|
||||
cfg.minimum_lod = FIXED_16(cso->min_lod, false);
|
||||
cfg.maximum_lod = FIXED_16(cso->max_lod, false);
|
||||
|
@@ -4772,7 +4772,7 @@ static void *si_create_sampler_state(struct pipe_context *ctx,
|
||||
(S_008F30_CLAMP_X(si_tex_wrap(state->wrap_s)) | S_008F30_CLAMP_Y(si_tex_wrap(state->wrap_t)) |
|
||||
S_008F30_CLAMP_Z(si_tex_wrap(state->wrap_r)) | S_008F30_MAX_ANISO_RATIO(max_aniso_ratio) |
|
||||
S_008F30_DEPTH_COMPARE_FUNC(si_tex_compare(state->compare_func)) |
|
||||
S_008F30_FORCE_UNNORMALIZED(!state->normalized_coords) |
|
||||
S_008F30_FORCE_UNNORMALIZED(state->unnormalized_coords) |
|
||||
S_008F30_ANISO_THRESHOLD(max_aniso_ratio >> 1) | S_008F30_ANISO_BIAS(max_aniso_ratio) |
|
||||
S_008F30_DISABLE_CUBE_WRAP(!state->seamless_cube_map) |
|
||||
S_008F30_TRUNC_COORD(trunc_coord) |
|
||||
|
@@ -3079,7 +3079,7 @@ get_img_filter(const struct sp_sampler_view *sp_sview,
|
||||
*/
|
||||
if (!gather && sp_sview->pot2d &&
|
||||
sampler->wrap_s == sampler->wrap_t &&
|
||||
sampler->normalized_coords)
|
||||
!sampler->unnormalized_coords)
|
||||
{
|
||||
switch (sampler->wrap_s) {
|
||||
case PIPE_TEX_WRAP_REPEAT:
|
||||
@@ -3479,7 +3479,7 @@ softpipe_create_sampler_state(struct pipe_context *pipe,
|
||||
* nearest_texcoord_s may be active at the same time, if the
|
||||
* sampler min_img_filter differs from its mag_img_filter.
|
||||
*/
|
||||
if (sampler->normalized_coords) {
|
||||
if (!sampler->unnormalized_coords) {
|
||||
samp->linear_texcoord_s = get_linear_wrap( sampler->wrap_s );
|
||||
samp->linear_texcoord_t = get_linear_wrap( sampler->wrap_t );
|
||||
samp->linear_texcoord_p = get_linear_wrap( sampler->wrap_r );
|
||||
@@ -3514,7 +3514,7 @@ softpipe_create_sampler_state(struct pipe_context *pipe,
|
||||
|
||||
case PIPE_TEX_MIPFILTER_LINEAR:
|
||||
if (sampler->min_img_filter == sampler->mag_img_filter &&
|
||||
sampler->normalized_coords &&
|
||||
!sampler->unnormalized_coords &&
|
||||
sampler->wrap_s == PIPE_TEX_WRAP_REPEAT &&
|
||||
sampler->wrap_t == PIPE_TEX_WRAP_REPEAT &&
|
||||
sampler->min_img_filter == PIPE_TEX_FILTER_LINEAR &&
|
||||
|
@@ -246,7 +246,7 @@ svga_create_sampler_state(struct pipe_context *pipe,
|
||||
cso->addressu = translate_wrap_mode(sampler->wrap_s);
|
||||
cso->addressv = translate_wrap_mode(sampler->wrap_t);
|
||||
cso->addressw = translate_wrap_mode(sampler->wrap_r);
|
||||
cso->normalized_coords = sampler->normalized_coords;
|
||||
cso->normalized_coords = !sampler->unnormalized_coords;
|
||||
cso->compare_mode = sampler->compare_mode;
|
||||
cso->compare_func = sampler->compare_func;
|
||||
|
||||
|
@@ -330,7 +330,7 @@ zink_create_sampler_state(struct pipe_context *pctx,
|
||||
sci.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||
if (screen->info.have_EXT_non_seamless_cube_map && !state->seamless_cube_map)
|
||||
sci.flags |= VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT;
|
||||
assert(state->normalized_coords);
|
||||
assert(!state->unnormalized_coords);
|
||||
sci.magFilter = zink_filter(state->mag_img_filter);
|
||||
if (sci.unnormalizedCoordinates)
|
||||
sci.minFilter = sci.magFilter;
|
||||
|
@@ -51,7 +51,7 @@ void *
|
||||
sampler::bind(command_queue &q) {
|
||||
struct pipe_sampler_state info {};
|
||||
|
||||
info.normalized_coords = norm_mode();
|
||||
info.unnormalized_coords = !norm_mode();
|
||||
|
||||
info.wrap_s = info.wrap_t = info.wrap_r =
|
||||
(addr_mode() == CL_ADDRESS_CLAMP_TO_EDGE ? PIPE_TEX_WRAP_CLAMP_TO_EDGE :
|
||||
|
@@ -482,8 +482,6 @@ CreateSampler(D3D10DDI_HDEVICE hDevice, // IN
|
||||
state.compare_func = translate_comparison(pSamplerDesc->ComparisonFunc);
|
||||
}
|
||||
|
||||
state.normalized_coords = 1;
|
||||
|
||||
/* Level of detail. */
|
||||
state.lod_bias = pSamplerDesc->MipLODBias;
|
||||
state.min_lod = pSamplerDesc->MinLOD;
|
||||
|
@@ -2248,7 +2248,7 @@ VKAPI_ATTR VkResult VKAPI_CALL lvp_CreateSampler(
|
||||
sampler->state.max_anisotropy = pCreateInfo->maxAnisotropy;
|
||||
else
|
||||
sampler->state.max_anisotropy = 1;
|
||||
sampler->state.normalized_coords = !pCreateInfo->unnormalizedCoordinates;
|
||||
sampler->state.unnormalized_coords = pCreateInfo->unnormalizedCoordinates;
|
||||
sampler->state.compare_mode = pCreateInfo->compareEnable ? PIPE_TEX_COMPARE_R_TO_TEXTURE : PIPE_TEX_COMPARE_NONE;
|
||||
sampler->state.compare_func = pCreateInfo->compareOp;
|
||||
sampler->state.seamless_cube_map = !(pCreateInfo->flags & VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT);
|
||||
|
@@ -547,7 +547,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
|
||||
samp.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
samp.compare_mode = PIPE_TEX_COMPARE_NONE;
|
||||
samp.compare_func = PIPE_FUNC_LEQUAL;
|
||||
samp.normalized_coords = 1;
|
||||
samp.unnormalized_coords = 0;
|
||||
samp.seamless_cube_map = 0;
|
||||
This->dummy_sampler_state = samp;
|
||||
}
|
||||
|
@@ -246,7 +246,7 @@ nine_convert_sampler_state(struct cso_context *ctx, int idx, const DWORD *ss)
|
||||
samp.max_anisotropy = 0;
|
||||
samp.compare_mode = ss[NINED3DSAMP_SHADOW] ? PIPE_TEX_COMPARE_R_TO_TEXTURE : PIPE_TEX_COMPARE_NONE;
|
||||
samp.compare_func = PIPE_FUNC_LEQUAL;
|
||||
samp.normalized_coords = 1;
|
||||
samp.unnormalized_coords = 0;
|
||||
samp.seamless_cube_map = 0;
|
||||
samp.border_color_is_integer = 0;
|
||||
samp.reduction_mode = 0;
|
||||
|
@@ -1089,7 +1089,7 @@ impl Sampler {
|
||||
|
||||
res.set_min_img_filter(img_filter);
|
||||
res.set_mag_img_filter(img_filter);
|
||||
res.set_normalized_coords(normalized_coords.into());
|
||||
res.set_unnormalized_coords((!normalized_coords).into());
|
||||
res.set_wrap_r(wrap);
|
||||
res.set_wrap_s(wrap);
|
||||
res.set_wrap_t(wrap);
|
||||
|
@@ -470,7 +470,6 @@ bind_samplers(struct xa_context *ctx,
|
||||
src_sampler.min_img_filter = filter;
|
||||
src_sampler.mag_img_filter = filter;
|
||||
src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
|
||||
src_sampler.normalized_coords = 1;
|
||||
samplers[0] = &src_sampler;
|
||||
u_sampler_view_default_template(&view_templ,
|
||||
src_pic->srf->tex,+ src_pic->srf->tex->format);
|
||||
@@ -491,7 +490,6 @@ bind_samplers(struct xa_context *ctx,
|
||||
mask_sampler.min_img_filter = filter;
|
||||
mask_sampler.mag_img_filter = filter;
|
||||
src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
|
||||
mask_sampler.normalized_coords = 1;
|
||||
samplers[num_samplers] = &mask_sampler;
|
||||
u_sampler_view_default_template(&view_templ,
|
||||
mask_pic->srf->tex,
|
||||
|
@@ -433,7 +433,6 @@ renderer_copy_prepare(struct xa_context *r,
|
||||
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.normalized_coords = 1;
|
||||
cso_set_samplers(r->cso, PIPE_SHADER_FRAGMENT, 1, &p_sampler);
|
||||
r->num_bound_samplers = 1;
|
||||
}
|
||||
|
@@ -81,7 +81,6 @@ xa_yuv_bind_samplers(struct xa_context *r, struct xa_surface *yuv[])
|
||||
sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR;
|
||||
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST;
|
||||
sampler.normalized_coords = 1;
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
samplers[i] = &sampler;
|
||||
|
@@ -425,7 +425,7 @@ struct pipe_sampler_state
|
||||
unsigned mag_img_filter:1; /**< PIPE_TEX_FILTER_x */
|
||||
unsigned compare_mode:1; /**< PIPE_TEX_COMPARE_x */
|
||||
unsigned compare_func:3; /**< PIPE_FUNC_x */
|
||||
unsigned normalized_coords:1; /**< Are coords normalized to [0,1]? */
|
||||
unsigned unnormalized_coords:1; /**< Are coords normalized to [0,1]? */
|
||||
unsigned max_anisotropy:5;
|
||||
unsigned seamless_cube_map:1;
|
||||
unsigned border_color_is_integer:1;
|
||||
|
@@ -373,9 +373,7 @@ static void destroy_compute_resources(struct context *ctx)
|
||||
static void init_sampler_states(struct context *ctx, int n)
|
||||
{
|
||||
struct pipe_context *pipe = ctx->pipe;
|
||||
struct pipe_sampler_state smp = {
|
||||
.normalized_coords = 1,
|
||||
};
|
||||
struct pipe_sampler_state smp = {0};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < n; ++i) {
|
||||
|
@@ -212,7 +212,6 @@ static void init_prog(struct program *p)
|
||||
p->sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
p->sampler.min_img_filter = PIPE_TEX_MIPFILTER_LINEAR;
|
||||
p->sampler.mag_img_filter = PIPE_TEX_MIPFILTER_LINEAR;
|
||||
p->sampler.normalized_coords = 1;
|
||||
|
||||
surf_tmpl.format = PIPE_FORMAT_B8G8R8A8_UNORM; /* All drivers support this */
|
||||
surf_tmpl.u.tex.level = 0;
|
||||
|
@@ -240,7 +240,7 @@ new_texture_handle(struct gl_context *ctx, struct gl_texture_object *texObj,
|
||||
true, false);
|
||||
} else {
|
||||
view = st_get_buffer_sampler_view_from_stobj(st, texObj, false);
|
||||
sampler.normalized_coords = 1;
|
||||
sampler.unnormalized_coords = 0;
|
||||
}
|
||||
|
||||
return pipe->create_texture_handle(pipe, view, &sampler);
|
||||
|
@@ -77,8 +77,8 @@ st_convert_sampler(const struct st_context *st,
|
||||
sampler->mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
}
|
||||
|
||||
if (texobj->Target != GL_TEXTURE_RECTANGLE_ARB || st->lower_rect_tex)
|
||||
sampler->normalized_coords = 1;
|
||||
if (texobj->Target == GL_TEXTURE_RECTANGLE_ARB && !st->lower_rect_tex)
|
||||
sampler->unnormalized_coords = 1;
|
||||
|
||||
sampler->lod_bias += tex_unit_lod_bias;
|
||||
|
||||
|
@@ -561,8 +561,9 @@ init_bitmap_state(struct st_context *st)
|
||||
st->bitmap.sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
st->bitmap.sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
st->bitmap.sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
st->bitmap.sampler.normalized_coords = st->internal_target == PIPE_TEXTURE_2D ||
|
||||
(st->internal_target == PIPE_TEXTURE_RECT && st->lower_rect_tex);
|
||||
st->bitmap.sampler.unnormalized_coords = !(st->internal_target == PIPE_TEXTURE_2D ||
|
||||
(st->internal_target == PIPE_TEXTURE_RECT &&
|
||||
st->lower_rect_tex));
|
||||
|
||||
/* init baseline rasterizer state once */
|
||||
memset(&st->bitmap.rasterizer, 0, sizeof(st->bitmap.rasterizer));
|
||||
|
@@ -837,7 +837,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
|
||||
sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE;
|
||||
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
|
||||
sampler.normalized_coords = normalized;
|
||||
sampler.unnormalized_coords = !normalized;
|
||||
|
||||
if (fpv) {
|
||||
/* drawing a color image */
|
||||
|
@@ -159,7 +159,6 @@ try_pbo_readpixels(struct st_context *st, struct gl_renderbuffer *rb,
|
||||
struct pipe_sampler_view templ;
|
||||
struct pipe_sampler_view *sampler_view;
|
||||
struct pipe_sampler_state sampler = {0};
|
||||
sampler.normalized_coords = true;
|
||||
const struct pipe_sampler_state *samplers[1] = {&sampler};
|
||||
|
||||
u_sampler_view_default_template(&templ, texture, src_format);
|
||||
|
@@ -1829,7 +1829,6 @@ try_pbo_download(struct st_context *st,
|
||||
struct pipe_sampler_view templ;
|
||||
struct pipe_sampler_view *sampler_view;
|
||||
struct pipe_sampler_state sampler = {0};
|
||||
sampler.normalized_coords = true;
|
||||
const struct pipe_sampler_state *samplers[1] = {&sampler};
|
||||
unsigned level = texImage->TexObject->Attrib.MinLevel + texImage->Level;
|
||||
unsigned max_layer = util_max_layer(texture, level);
|
||||
|
@@ -1016,7 +1016,6 @@ download_texture_compute(struct st_context *st,
|
||||
struct pipe_sampler_view templ;
|
||||
struct pipe_sampler_view *sampler_view;
|
||||
struct pipe_sampler_state sampler = {0};
|
||||
sampler.normalized_coords = true;
|
||||
const struct pipe_sampler_state *samplers[1] = {&sampler};
|
||||
const struct util_format_description *desc = util_format_description(dst_format);
|
||||
|
||||
|
Reference in New Issue
Block a user