+static struct gl_texture_object *
+update_single_program_texture(struct gl_context *ctx, struct gl_program *prog,
+ int s)
+{
+ gl_texture_index target_index;
+ struct gl_texture_unit *texUnit;
+ struct gl_texture_object *texObj;
+ struct gl_sampler_object *sampler;
+ int unit;
+
+ if (!(prog->SamplersUsed & (1 << s)))
+ return NULL;
+
+ unit = prog->SamplerUnits[s];
+ texUnit = &ctx->Texture.Unit[unit];
+
+ /* Note: If more than one bit was set in TexturesUsed[unit], then we should
+ * have had the draw call rejected already. From the GL 4.4 specification,
+ * section 7.10 ("Samplers"):
+ *
+ * "It is not allowed to have variables of different sampler types
+ * pointing to the same texture image unit within a program
+ * object. This situation can only be detected at the next rendering
+ * command issued which triggers shader invocations, and an
+ * INVALID_OPERATION error will then be generated."