diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-11-21 08:42:28 -0500 |
---|---|---|
committer | Tomeu Vizoso <[email protected]> | 2019-11-22 05:07:19 +0000 |
commit | 4e07e7b2326d742a9832d16ca03aa0e806bd8bff (patch) | |
tree | a08f1969f8c60550239be7ac8f5dd3d76395b785 /src/gallium | |
parent | deaebc82a73ba3f34c4f2ecf97cedb7fc9b0b154 (diff) |
pan/midgard: Implement load_sampler_lod_paramaters_pan
We can stuff this information in as parametrized system values, like we
currently do texture size and SSBO addresses.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Tomeu Vizoso <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 08b208b703a..b1006f81ec9 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -761,6 +761,29 @@ static void panfrost_upload_ssbo_sysval( uniform->u[2] = sb.buffer_size; } +static void +panfrost_upload_sampler_sysval( + struct panfrost_context *ctx, + enum pipe_shader_type st, + unsigned sampler_index, + struct sysval_uniform *uniform) +{ + struct pipe_sampler_state *sampl = + &ctx->samplers[st][sampler_index]->base; + + uniform->f[0] = sampl->min_lod; + uniform->f[1] = sampl->max_lod; + uniform->f[2] = sampl->lod_bias; + + /* Even without any errata, Midgard represents "no mipmapping" as + * fixing the LOD with the clamps; keep behaviour consistent. c.f. + * panfrost_create_sampler_state which also explains our choice of + * epsilon value (again to keep behaviour consistent) */ + + if (sampl->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) + uniform->f[1] = uniform->f[0] + (1.0/256.0); +} + static void panfrost_upload_num_work_groups_sysval(struct panfrost_context *ctx, struct sysval_uniform *uniform) { @@ -796,7 +819,10 @@ static void panfrost_upload_sysvals(struct panfrost_context *ctx, void *buf, case PAN_SYSVAL_NUM_WORK_GROUPS: panfrost_upload_num_work_groups_sysval(ctx, &uniforms[i]); break; - + case PAN_SYSVAL_SAMPLER: + panfrost_upload_sampler_sysval(ctx, st, PAN_SYSVAL_ID(sysval), + &uniforms[i]); + break; default: assert(0); } |