mesa: Require per-sample shading if the `sample` qualifier is used.
authorChris Forbes <chrisf@ijw.co.nz>
Fri, 29 Nov 2013 08:44:13 +0000 (21:44 +1300)
committerChris Forbes <chrisf@ijw.co.nz>
Sat, 7 Dec 2013 04:15:05 +0000 (17:15 +1300)
Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/mesa/program/program.c

index 01f8c6f114700d5bc259f70aa6694d93ddd18a6e..cdf1c03fa91d11b8d97d42e26c115ce72900e676 100644 (file)
@@ -1049,6 +1049,14 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
     *  has no effect."
     */
    if (ctx->Multisample.Enabled) {
+      /* The ARB_gpu_shader5 specification says:
+       *
+       * "Use of the "sample" qualifier on a fragment shader input
+       *  forces per-sample shading"
+       */
+      if (prog->IsSample)
+         return MAX2(ctx->DrawBuffer->Visual.samples, 1);
+
       if (prog->Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
                                          SYSTEM_BIT_SAMPLE_POS))
          return MAX2(ctx->DrawBuffer->Visual.samples, 1);