Rob Clark <robdcl...@gmail.com> writes: > On Tue, Apr 19, 2016 at 1:06 PM, Jason Ekstrand <ja...@jlekstrand.net> wrote: >> >> >> On Tue, Apr 19, 2016 at 6:58 AM, Rob Clark <robdcl...@gmail.com> wrote: >>> } nir_lower_tex_options; >>> >>> bool nir_lower_tex(nir_shader *shader, >>> diff --git a/src/compiler/nir/nir_lower_tex.c >>> b/src/compiler/nir/nir_lower_tex.c >>> index 7740e58..6bae3b7 100644 >>> --- a/src/compiler/nir/nir_lower_tex.c >>> +++ b/src/compiler/nir/nir_lower_tex.c >>> @@ -275,6 +275,45 @@ swizzle_result(nir_builder *b, nir_tex_instr *tex, >>> const uint8_t swizzle[4]) >>> swizzled->parent_instr); >>> } >>> >>> +static void >>> +linearize_srgb_result(nir_builder *b, nir_tex_instr *tex) >>> +{ >>> + assert(tex->dest.is_ssa); >>> + assert(nir_tex_instr_dest_size(tex) == 4); >>> + assert(nir_alu_type_get_base_type(tex->dest_type) == nir_type_float); >>> + >>> + b->cursor = nir_after_instr(&tex->instr); >>> + >>> + nir_ssa_def *components[4]; >>> + >>> + /* first three channels are rgb: */ >>> + for (unsigned i = 0; i < 3; i++) { >> >> >> Um... NIR is a vector IR. Why are we looping over channels? Just do a >> nir_swizzle to pick off the first three, do the sRGB conversion, and nir_vec >> them back together with the alpha channel. > > oh, hmm, yeah.. used to thinking in scalar
Other than scalar when we should probably be doing vector, this looks good to me, and I'll totally use it.
signature.asc
Description: PGP signature
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev