From 55f6a2bb51a1fadcd68f9f09ccf4435a4e4ca269 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 5 Oct 2022 16:20:27 +0200 Subject: [PATCH] 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 Part-of: --- docs/gallium/cso/sampler.rst | 16 ++++++++-------- .../auxiliary/driver_trace/tr_dump_state.c | 2 +- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 2 +- src/gallium/auxiliary/hud/hud_context.c | 1 - src/gallium/auxiliary/postprocess/pp_program.c | 2 -- src/gallium/auxiliary/util/u_blitter.c | 8 ++++---- src/gallium/auxiliary/util/u_compute.c | 1 - src/gallium/auxiliary/util/u_dump_state.c | 2 +- src/gallium/auxiliary/util/u_pstipple.c | 1 - src/gallium/auxiliary/vl/vl_bicubic_filter.c | 1 - src/gallium/auxiliary/vl/vl_compositor.c | 1 - src/gallium/auxiliary/vl/vl_deint_filter.c | 1 - src/gallium/auxiliary/vl/vl_idct.c | 1 - src/gallium/auxiliary/vl/vl_matrix_filter.c | 1 - src/gallium/auxiliary/vl/vl_mc.c | 1 - src/gallium/auxiliary/vl/vl_median_filter.c | 1 - src/gallium/auxiliary/vl/vl_mpeg12_decoder.c | 1 - src/gallium/auxiliary/vl/vl_zscan.c | 1 - src/gallium/drivers/asahi/agx_state.c | 2 +- src/gallium/drivers/crocus/crocus_state.c | 2 +- src/gallium/drivers/d3d12/d3d12_blit.cpp | 1 - src/gallium/drivers/freedreno/a2xx/fd2_texture.c | 2 +- src/gallium/drivers/freedreno/a3xx/fd3_texture.c | 2 +- src/gallium/drivers/freedreno/a4xx/fd4_texture.c | 2 +- src/gallium/drivers/freedreno/a5xx/fd5_texture.c | 2 +- src/gallium/drivers/freedreno/a6xx/fd6_texture.c | 2 +- src/gallium/drivers/i915/i915_state.c | 2 +- src/gallium/drivers/iris/iris_state.c | 2 +- src/gallium/drivers/lima/lima_texture.c | 2 +- src/gallium/drivers/nouveau/nv30/nv30_fragtex.c | 8 ++++---- src/gallium/drivers/nouveau/nv30/nv30_texture.c | 2 +- src/gallium/drivers/nouveau/nv50/nv50_state.c | 6 +++--- src/gallium/drivers/panfrost/pan_cmdstream.c | 2 +- src/gallium/drivers/radeonsi/si_state.c | 2 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 6 +++--- src/gallium/drivers/svga/svga_pipe_sampler.c | 2 +- src/gallium/drivers/zink/zink_context.c | 2 +- src/gallium/frontends/clover/core/sampler.cpp | 2 +- src/gallium/frontends/d3d10umd/Shader.cpp | 2 -- src/gallium/frontends/lavapipe/lvp_device.c | 2 +- src/gallium/frontends/nine/device9.c | 2 +- src/gallium/frontends/nine/nine_pipe.c | 2 +- src/gallium/frontends/rusticl/core/memory.rs | 2 +- src/gallium/frontends/xa/xa_composite.c | 2 -- src/gallium/frontends/xa/xa_renderer.c | 1 - src/gallium/frontends/xa/xa_yuv.c | 1 - src/gallium/include/pipe/p_state.h | 2 +- src/gallium/tests/trivial/compute.c | 4 +--- src/gallium/tests/trivial/quad-tex.c | 1 - src/mesa/main/texturebindless.c | 2 +- src/mesa/state_tracker/st_atom_sampler.c | 4 ++-- src/mesa/state_tracker/st_cb_bitmap.c | 5 +++-- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- src/mesa/state_tracker/st_cb_readpixels.c | 1 - src/mesa/state_tracker/st_cb_texture.c | 1 - src/mesa/state_tracker/st_pbo_compute.c | 1 - 56 files changed, 54 insertions(+), 80 deletions(-) diff --git a/docs/gallium/cso/sampler.rst b/docs/gallium/cso/sampler.rst index f7223162bc4..33b62520009 100644 --- a/docs/gallium/cso/sampler.rst +++ b/docs/gallium/cso/sampler.rst @@ -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 diff --git a/src/gallium/auxiliary/driver_trace/tr_dump_state.c b/src/gallium/auxiliary/driver_trace/tr_dump_state.c index da1dbf795de..036e43c0ad8 100644 --- a/src/gallium/auxiliary/driver_trace/tr_dump_state.c +++ b/src/gallium/auxiliary/driver_trace/tr_dump_state.c @@ -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); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 405b53b5c6e..3c2a44419b0 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -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 */ diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 242ca9faebe..6b6e1565337 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -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); diff --git a/src/gallium/auxiliary/postprocess/pp_program.c b/src/gallium/auxiliary/postprocess/pp_program.c index 258133bb3c5..cf367f5140b 100644 --- a/src/gallium/auxiliary/postprocess/pp_program.c +++ b/src/gallium/auxiliary/postprocess/pp_program.c @@ -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; diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index a1d8a9781b3..4c0c960ded9 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -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); } diff --git a/src/gallium/auxiliary/util/u_compute.c b/src/gallium/auxiliary/util/u_compute.c index 8d4d871b2ff..169460cc755 100644 --- a/src/gallium/auxiliary/util/u_compute.c +++ b/src/gallium/auxiliary/util/u_compute.c @@ -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; diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index c950de7f3fd..67446dc755d 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -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); diff --git a/src/gallium/auxiliary/util/u_pstipple.c b/src/gallium/auxiliary/util/u_pstipple.c index 0e1da9fb9fe..2ed3d803586 100644 --- a/src/gallium/auxiliary/util/u_pstipple.c +++ b/src/gallium/auxiliary/util/u_pstipple.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_bicubic_filter.c b/src/gallium/auxiliary/vl/vl_bicubic_filter.c index 457f2cf68bd..bc434841383 100644 --- a/src/gallium/auxiliary/vl/vl_bicubic_filter.c +++ b/src/gallium/auxiliary/vl/vl_bicubic_filter.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 66abf7325b8..b545b9c297b 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -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); diff --git a/src/gallium/auxiliary/vl/vl_deint_filter.c b/src/gallium/auxiliary/vl/vl_deint_filter.c index 20b33c6f2b3..f0c860ff2cd 100644 --- a/src/gallium/auxiliary/vl/vl_deint_filter.c +++ b/src/gallium/auxiliary/vl/vl_deint_filter.c @@ -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]) diff --git a/src/gallium/auxiliary/vl/vl_idct.c b/src/gallium/auxiliary/vl/vl_idct.c index 0e071ce87e8..a499e929b80 100644 --- a/src/gallium/auxiliary/vl/vl_idct.c +++ b/src/gallium/auxiliary/vl/vl_idct.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_matrix_filter.c b/src/gallium/auxiliary/vl/vl_matrix_filter.c index 1cc701b2167..5530444347c 100644 --- a/src/gallium/auxiliary/vl/vl_matrix_filter.c +++ b/src/gallium/auxiliary/vl/vl_matrix_filter.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_mc.c b/src/gallium/auxiliary/vl/vl_mc.c index 74fecc78ce7..5963286c735 100644 --- a/src/gallium/auxiliary/vl/vl_mc.c +++ b/src/gallium/auxiliary/vl/vl_mc.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_median_filter.c b/src/gallium/auxiliary/vl/vl_median_filter.c index 866babe84f1..38c9597fb72 100644 --- a/src/gallium/auxiliary/vl/vl_median_filter.c +++ b/src/gallium/auxiliary/vl/vl_median_filter.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c index 8ce89351a1b..26681c53251 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_decoder.c @@ -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; diff --git a/src/gallium/auxiliary/vl/vl_zscan.c b/src/gallium/auxiliary/vl/vl_zscan.c index 543c9340fd8..3093ad1fe7d 100644 --- a/src/gallium/auxiliary/vl/vl_zscan.c +++ b/src/gallium/auxiliary/vl/vl_zscan.c @@ -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; diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index 61a94dcb042..462ec409a8d 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -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]; } diff --git a/src/gallium/drivers/crocus/crocus_state.c b/src/gallium/drivers/crocus/crocus_state.c index 87a70e0bebc..a44fc3e06e6 100644 --- a/src/gallium/drivers/crocus/crocus_state.c +++ b/src/gallium/drivers/crocus/crocus_state.c @@ -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; diff --git a/src/gallium/drivers/d3d12/d3d12_blit.cpp b/src/gallium/drivers/d3d12/d3d12_blit.cpp index 6bc1ab8299b..de967598d77 100644 --- a/src/gallium/drivers/d3d12/d3d12_blit.cpp +++ b/src/gallium/drivers/d3d12/d3d12_blit.cpp @@ -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); } diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c index 5b5e5910c83..1e98becd73d 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_texture.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_texture.c @@ -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: */ diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c index b742291dcef..0e591585f09 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_texture.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_texture.c @@ -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)) | diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c index 5ada89eabc3..14310b02cf9 100644 --- a/src/gallium/drivers/freedreno/a4xx/fd4_texture.c +++ b/src/gallium/drivers/freedreno/a4xx/fd4_texture.c @@ -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) | diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c index 908c8e7366d..a91df5db78e 100644 --- a/src/gallium/drivers/freedreno/a5xx/fd5_texture.c +++ b/src/gallium/drivers/freedreno/a5xx/fd5_texture.c @@ -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); diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c index ce80d50dd40..c33c09ed38a 100644 --- a/src/gallium/drivers/freedreno/a6xx/fd6_texture.c +++ b/src/gallium/drivers/freedreno/a6xx/fd6_texture.c @@ -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) | diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 74670ba7e0a..cb5db6208af 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -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; { diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 51e868e192c..2b2f74cd37e 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -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); diff --git a/src/gallium/drivers/lima/lima_texture.c b/src/gallium/drivers/lima/lima_texture.c index 0be241edeac..90413eb22ec 100644 --- a/src/gallium/drivers/lima/lima_texture.c +++ b/src/gallium/drivers/lima/lima_texture.c @@ -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; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c b/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c index a46c4c4f1d9..5d62661c678 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_fragtex.c @@ -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; diff --git a/src/gallium/drivers/nouveau/nv30/nv30_texture.c b/src/gallium/drivers/nouveau/nv30/nv30_texture.c index 38edd65bc2d..2d82f11fc1e 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_texture.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_texture.c @@ -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) { diff --git a/src/gallium/drivers/nouveau/nv50/nv50_state.c b/src/gallium/drivers/nouveau/nv50/nv50_state.c index f3669691517..21758408253 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_state.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_state.c @@ -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; diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 47ec03bcde5..8c403dc993f 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -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); diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 3fd29ea5816..664c802341d 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -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) | diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 73721505093..e250ed9f70b 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -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 && diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 3e0e26c7628..eb398459a9f 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -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; diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index e284307ed16..a58af193f4e 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -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; diff --git a/src/gallium/frontends/clover/core/sampler.cpp b/src/gallium/frontends/clover/core/sampler.cpp index 6f2784b538e..3a0dd4dc7c3 100644 --- a/src/gallium/frontends/clover/core/sampler.cpp +++ b/src/gallium/frontends/clover/core/sampler.cpp @@ -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 : diff --git a/src/gallium/frontends/d3d10umd/Shader.cpp b/src/gallium/frontends/d3d10umd/Shader.cpp index e70d58a9f15..867f4772305 100644 --- a/src/gallium/frontends/d3d10umd/Shader.cpp +++ b/src/gallium/frontends/d3d10umd/Shader.cpp @@ -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; diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index 94d88abcec6..941ec0d668a 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -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); diff --git a/src/gallium/frontends/nine/device9.c b/src/gallium/frontends/nine/device9.c index 236f426ff28..a03a89c3b92 100644 --- a/src/gallium/frontends/nine/device9.c +++ b/src/gallium/frontends/nine/device9.c @@ -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; } diff --git a/src/gallium/frontends/nine/nine_pipe.c b/src/gallium/frontends/nine/nine_pipe.c index d35211ac221..57064eece7f 100644 --- a/src/gallium/frontends/nine/nine_pipe.c +++ b/src/gallium/frontends/nine/nine_pipe.c @@ -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; diff --git a/src/gallium/frontends/rusticl/core/memory.rs b/src/gallium/frontends/rusticl/core/memory.rs index c4b4eea3847..8d8dbc9c205 100644 --- a/src/gallium/frontends/rusticl/core/memory.rs +++ b/src/gallium/frontends/rusticl/core/memory.rs @@ -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); diff --git a/src/gallium/frontends/xa/xa_composite.c b/src/gallium/frontends/xa/xa_composite.c index 49497cfb10f..fde8abce462 100644 --- a/src/gallium/frontends/xa/xa_composite.c +++ b/src/gallium/frontends/xa/xa_composite.c @@ -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, diff --git a/src/gallium/frontends/xa/xa_renderer.c b/src/gallium/frontends/xa/xa_renderer.c index 10b3f6a1f21..5f818fd74c4 100644 --- a/src/gallium/frontends/xa/xa_renderer.c +++ b/src/gallium/frontends/xa/xa_renderer.c @@ -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; } diff --git a/src/gallium/frontends/xa/xa_yuv.c b/src/gallium/frontends/xa/xa_yuv.c index 0da841333c8..ac381b45945 100644 --- a/src/gallium/frontends/xa/xa_yuv.c +++ b/src/gallium/frontends/xa/xa_yuv.c @@ -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; diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 22b1dae016e..0155eecb3f9 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -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; diff --git a/src/gallium/tests/trivial/compute.c b/src/gallium/tests/trivial/compute.c index 2fd4756644e..1def2182fd8 100644 --- a/src/gallium/tests/trivial/compute.c +++ b/src/gallium/tests/trivial/compute.c @@ -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) { diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c index 5e69537bb0d..5a54d00ec25 100644 --- a/src/gallium/tests/trivial/quad-tex.c +++ b/src/gallium/tests/trivial/quad-tex.c @@ -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; diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c index 57c66202b6a..4c45413f780 100644 --- a/src/mesa/main/texturebindless.c +++ b/src/mesa/main/texturebindless.c @@ -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); diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 239847985bc..0e3cb600269 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -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; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 6d95f9b77a3..bfe8de4fd0c 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -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)); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 9566a45a23d..7b21f2ccbbb 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -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 */ diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 5c96e1fb210..6364d8f9444 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -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); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 8d0b911161b..48af25a1df6 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -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); diff --git a/src/mesa/state_tracker/st_pbo_compute.c b/src/mesa/state_tracker/st_pbo_compute.c index 158435c0e17..45a06d9c192 100644 --- a/src/mesa/state_tracker/st_pbo_compute.c +++ b/src/mesa/state_tracker/st_pbo_compute.c @@ -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);