summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2018-01-16 21:53:29 -0700
committerBrian Paul <[email protected]>2018-01-17 11:17:56 -0700
commit7421e34dd69dfb8911e99b6004f8806707c323d1 (patch)
treeaf8a43a0f72cc48cb8723bee573220b453c7ebf7 /src/mesa/program
parent6dc8896726b8fdfb69705dbe298e074a21cd05cf (diff)
mesa: move gl_external_samplers() to program.[ch]
The function is only called from a couple places. It doesn't make sense to have it in mtypes.h Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/mesa/program')
-rw-r--r--src/mesa/program/program.c17
-rw-r--r--src/mesa/program/program.h5
2 files changed, 22 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;
+}
diff --git a/src/mesa/program/program.h b/src/mesa/program/program.h
index 0e105c35fc2..376da7b2d41 100644
--- a/src/mesa/program/program.h
+++ b/src/mesa/program/program.h
@@ -158,6 +158,11 @@ _mesa_shader_stage_to_program(unsigned stage)
return GL_VERTEX_PROGRAM_ARB;
}
+
+GLbitfield
+gl_external_samplers(const struct gl_program *prog);
+
+
#ifdef __cplusplus
} /* extern "C" */
#endif