texcoord = nir_load_var(b, get_texcoord(shader));
+ const struct glsl_type *sampler2D =
+ glsl_sampler_type(GLSL_SAMPLER_DIM_2D, false, false, GLSL_TYPE_FLOAT);
+
+ nir_variable *tex_var =
+ nir_variable_create(shader, nir_var_uniform, sampler2D, "bitmap_tex");
+ tex_var->data.binding = options->sampler;
+
tex = nir_tex_instr_create(shader, 1);
tex->op = nir_texop_tex;
tex->sampler_dim = GLSL_SAMPLER_DIM_2D;
const nir_lower_drawpixels_options *options;
nir_shader *shader;
nir_builder b;
- nir_variable *texcoord, *scale, *bias;
+ nir_variable *texcoord, *scale, *bias, *tex, *pixelmap;
} lower_drawpixels_state;
static nir_ssa_def *
texcoord = get_texcoord(state);
+ const struct glsl_type *sampler2D =
+ glsl_sampler_type(GLSL_SAMPLER_DIM_2D, false, false, GLSL_TYPE_FLOAT);
+
+ if (!state->tex) {
+ state->tex =
+ nir_variable_create(b->shader, nir_var_uniform, sampler2D, "drawpix");
+ state->tex->data.binding = state->options->drawpix_sampler;
+ }
+
/* replace load_var(gl_Color) w/ texture sample:
* TEX def, texcoord, drawpix_sampler, 2D
*/
}
if (state->options->pixel_maps) {
+ if (!state->pixelmap) {
+ state->pixelmap = nir_variable_create(b->shader, nir_var_uniform,
+ sampler2D, "pixelmap");
+ state->pixelmap->data.binding = state->options->pixelmap_sampler;
+ }
+
/* do four pixel map look-ups with two TEX instructions: */
nir_ssa_def *def_xy, *def_zw;