[Mesa-dev] [PATCH 3/3] freedreno/a4xx: lower srgb in shader for astc textures

Rob Clark robdclark at gmail.com
Tue Apr 19 15:36:42 UTC 2016


On Tue, Apr 19, 2016 at 10:09 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> atic void
>> +fd4_set_sampler_views(struct pipe_context *pctx, unsigned shader,
>> +               unsigned start, unsigned nr,
>> +               struct pipe_sampler_view **views)
>> +{
>> +       struct fd_context *ctx = fd_context(pctx);
>> +       struct fd4_context *fd4_ctx = fd4_context(ctx);
>> +       uint16_t lower_srgb = 0;
>> +       unsigned i;
>> +
>> +       for (i = 0; i < nr; i++) {
>> +               if (views[i]) {
>> +                       struct fd4_pipe_sampler_view *view =
>> +                                       fd4_pipe_sampler_view(views[i]);
>> +                       if (view->lower_srgb)
>> +                               lower_srgb |= (1 << i);
>> +               }
>> +       }
>> +
>> +       fd_set_sampler_views(pctx, shader, start, nr, views);
>> +
>> +       if (shader == PIPE_SHADER_FRAGMENT) {
>> +               fd4_ctx->flower_srgb = lower_srgb;
>> +       } else if (shader == PIPE_SHADER_VERTEX) {
>> +               fd4_ctx->vlower_srgb = lower_srgb;
>> +       }
>
> I think you want something a bit more complex... the API allows start
> != 0, and nr != 16. So you need to mask out the relevant bits, and
> shift lower_srgb into the right spot.

api does.. but implementation does not..  no idea why the start param
is passed in, but we assert(start==0) for both sampler states and
views (where we do a similar thing)..  a3ed98f seems to indicate that
start is expected to be zero.  I guess we'll have to fix that up in a
number of places eventually but it at least shouldn't be a problem
right now.

BR,
-R


More information about the mesa-dev mailing list