From 31fd4c5654595a4763e492e4ec26f66ca3a8a405 Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 4 Nov 2013 12:08:23 +0100 Subject: libxtrans fontconfig mesa xserver pixman xkbcomp git update 4 nov 2013 xserver commit 33c85beed521c9db140cadd8c5aa9992398ee1fe xkbcomp commit e3e6e938535532bfad175c1635256ab7fb3ac943 pixman commit 8cbc7da4e525c96a8e089e4c1baee75dc8315218 libxtrans commit 1fb0fd555a16dd8fce4abc6d3fd22b315f46762a fontconfig commit 767108aa1327cf0156dfc6f024dbc8fb783ae067 mesa commit 2f896627175384fd5943f21804700a155ba4e8a0 --- mesalib/src/mesa/program/program.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'mesalib/src/mesa/program/program.c') diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index 093d37297..a102ec17a 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -32,6 +32,7 @@ #include "main/glheader.h" #include "main/context.h" #include "main/hash.h" +#include "main/macros.h" #include "program.h" #include "prog_cache.h" #include "prog_parameter.h" @@ -1024,3 +1025,34 @@ _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog) } } + +/* Gets the minimum number of shader invocations per fragment. + * This function is useful to determine if we need to do per + * sample shading or per fragment shading. + */ +GLint +_mesa_get_min_invocations_per_fragment(struct gl_context *ctx, + const struct gl_fragment_program *prog) +{ + /* From ARB_sample_shading specification: + * "Using gl_SampleID in a fragment shader causes the entire shader + * to be evaluated per-sample." + * + * "Using gl_SamplePosition in a fragment shader causes the entire + * shader to be evaluated per-sample." + * + * "If MULTISAMPLE or SAMPLE_SHADING_ARB is disabled, sample shading + * has no effect." + */ + if (ctx->Multisample.Enabled) { + if (prog->Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID | + SYSTEM_BIT_SAMPLE_POS)) + return MAX2(ctx->DrawBuffer->Visual.samples, 1); + else if (ctx->Multisample.SampleShading) + return MAX2(ceil(ctx->Multisample.MinSampleShadingValue * + ctx->DrawBuffer->Visual.samples), 1); + else + return 1; + } + return 1; +} -- cgit v1.2.3