+#include "main/atifragshader.h"
+#include "program/program.h"
+#include "pipe/p_state.h"
+#include "tgsi/tgsi_from_mesa.h"
+#include "st_context.h"
+#include "st_texture.h"
+#include "st_glsl_to_tgsi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ST_DOUBLE_ATTRIB_PLACEHOLDER 0xff
+
+struct st_external_sampler_key
+{
+ GLuint lower_nv12; /**< bitmask of 2 plane YUV samplers */
+ GLuint lower_iyuv; /**< bitmask of 3 plane YUV samplers */
+};
+
+static inline struct st_external_sampler_key
+st_get_external_sampler_key(struct st_context *st, struct gl_program *prog)
+{
+ unsigned mask = prog->ExternalSamplersUsed;
+ struct st_external_sampler_key key;
+
+ memset(&key, 0, sizeof(key));
+
+ while (unlikely(mask)) {
+ unsigned unit = u_bit_scan(&mask);
+ struct st_texture_object *stObj =
+ st_get_texture_object(st->ctx, prog, unit);
+
+ switch (st_get_view_format(stObj)) {
+ case PIPE_FORMAT_NV12:
+ key.lower_nv12 |= (1 << unit);
+ break;
+ case PIPE_FORMAT_IYUV:
+ key.lower_iyuv |= (1 << unit);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return key;
+}
+
+/** Fragment program variant key */
+struct st_fp_variant_key
+{
+ struct st_context *st; /**< variants are per-context */
+
+ /** for glBitmap */
+ GLuint bitmap:1; /**< glBitmap variant? */
+
+ /** for glDrawPixels */
+ GLuint drawpixels:1; /**< glDrawPixels variant */
+ GLuint scaleAndBias:1; /**< glDrawPixels w/ scale and/or bias? */
+ GLuint pixelMaps:1; /**< glDrawPixels w/ pixel lookup map? */
+
+ /** for ARB_color_buffer_float */
+ GLuint clamp_color:1;
+
+ /** for ARB_sample_shading */
+ GLuint persample_shading:1;
+
+ /** needed for ATI_fragment_shader */
+ GLuint fog:2;