diff options
Diffstat (limited to 'src/mesa/program/program.c')
-rw-r--r-- | src/mesa/program/program.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c index faf5b7fa28a..220efc35394 100644 --- a/src/mesa/program/program.c +++ b/src/mesa/program/program.c @@ -39,6 +39,7 @@ #include "prog_cache.h" #include "prog_parameter.h" #include "prog_instruction.h" +#include "util/bitscan.h" #include "util/ralloc.h" #include "util/u_atomic.h" @@ -547,3 +548,19 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx, } return 1; } + + +GLbitfield +gl_external_samplers(const struct gl_program *prog) +{ + GLbitfield external_samplers = 0; + GLbitfield mask = prog->SamplersUsed; + + while (mask) { + int idx = u_bit_scan(&mask); + if (prog->sh.SamplerTargets[idx] == TEXTURE_EXTERNAL_INDEX) + external_samplers |= (1 << idx); + } + + return external_samplers; +} |