On Mon, Jun 11, 2018 at 3:59 PM, Roland Scheidegger <srol...@vmware.com> wrote:
> Am 12.06.2018 um 00:32 schrieb Jason Ekstrand: > > On Wed, Jun 6, 2018 at 7:43 AM, Rob Clark <robdcl...@gmail.com > > <mailto:robdcl...@gmail.com>> wrote: > > > > Signed-off-by: Rob Clark <robdcl...@gmail.com > > <mailto:robdcl...@gmail.com>> > > --- > > I can't say for sure that this will work on all drivers, but it is > > what the blob driver does, and it seems to make deqp happy. I could > > move this to it's own pass inside ir3, but that seemed like overkill > > > > src/compiler/nir/nir.h | 10 ++++++++++ > > src/compiler/nir/nir_lower_system_values.c | 17 +++++++++++++++++ > > src/gallium/drivers/freedreno/ir3/ir3_nir.c | 1 + > > 3 files changed, 28 insertions(+) > > > > diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h > > index 073ab4e82ea..de3d55d83af 100644 > > --- a/src/compiler/nir/nir.h > > +++ b/src/compiler/nir/nir.h > > @@ -1963,6 +1963,16 @@ typedef struct nir_shader_compiler_options { > > */ > > bool lower_base_vertex; > > > > + /** > > + * If enabled, gl_HelperInvocation will be lowered as: > > + * > > + * !((1 << gl_SampleID) & gl_SampleMaskIN[0])) > > > > > > This only works for multi-sampling. What about the single-sampled case? > It doesn't make sense to me for msaa neither. > gl_SampleID forces per-sample execution, which clearly isn't what you > want. Yes, we do not want gl_HelperInvocation to force per-sample shading. It doesn't mean we can't lower to it, it just means that the back-end needs to be very careful that it decides whether or not to execute per-sample before it does this lowering. > Plus, gl_SampleMaskIN is specified to only contain bits for the > current shader invocation, so for msaa with forced per-sample execution > that would only contain the single bit corresponding to gl_SampleID > anyway (that is my interpretation at least - I know hw sample mask > inputs will probably always contains all the bits from rasterization, > regardless of gl_SampleID), so the "1 << gl_SampleID &" part will do > nothing at all. I think it also relies on gl_SampleMaskIN to give 0 for helper invocations. This is likely true but I don't know how well-defined all this is in the world of helper invocations. > So I think that part is more about lowering the hw > rasterization sample mask to gl_SampleMaskIN rather than lowering to > gl_HelperInvocation. > But yes, !gl_SampleMaskIN should give gl_HelperInvocation - I think all > hw can give you raster sample mask even without msaa but I'm not > entirely sure if it's guaranteed to work in GL with single sampling > (similar for sample id, which should just be stuck at 0). > The GL spec doesn't seem to say. It does say that gl_SampleID is guaranteed to be 0 for single-sampled but it says nothing about gl_SampleMaskIN. --Jason
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev