Home | History | Annotate | Download | only in nir

Lines Matching refs:state

42 get_texcoord(lower_drawpixels_state *state)
44 if (state->texcoord == NULL) {
48 nir_foreach_variable(var, &state->shader->inputs) {
57 texcoord = nir_variable_create(state->shader,
64 state->texcoord = texcoord;
66 return nir_load_var(&state->b, state->texcoord);
84 get_scale(lower_drawpixels_state *state)
86 if (state->scale == NULL) {
87 state->scale = create_uniform(state->shader, "gl_PTscale",
88 state->options->scale_state_tokens);
90 return nir_load_var(&state->b, state->scale);
94 get_bias(lower_drawpixels_state *state)
96 if (state->bias == NULL) {
97 state->bias = create_uniform(state->shader, "gl_PTbias",
98 state->options->bias_state_tokens);
100 return nir_load_var(&state->b, state->bias);
104 get_texcoord_const(lower_drawpixels_state *state)
106 if (state->bias == NULL) {
107 state->bias = create_uniform(state->shader, "gl_MultiTexCoord0",
108 state->options->texcoord_state_tokens);
110 return nir_load_var(&state->b, state->bias);
114 lower_color(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
116 nir_builder *b = &state->b;
125 texcoord = get_texcoord(state);
130 tex = nir_tex_instr_create(state->shader, 1);
134 tex->sampler_index = state->options->drawpix_sampler;
135 tex->texture_index = state->options->drawpix_sampler;
145 if (state->options->scale_and_bias) {
147 def = nir_ffma(b, def, get_scale(state), get_bias(state));
150 if (state->options->pixel_maps) {
158 tex = nir_tex_instr_create(state->shader, 1);
162 tex->sampler_index = state->options->pixelmap_sampler;
163 tex->texture_index = state->options->pixelmap_sampler;
173 tex = nir_tex_instr_create(state->shader, 1);
177 tex->sampler_index = state->options->pixelmap_sampler;
198 lower_texcoord(lower_drawpixels_state *state, nir_intrinsic_instr *intr)
200 state->b.cursor = nir_before_instr(&intr->instr);
202 nir_ssa_def *texcoord_const = get_texcoord_const(state);
207 lower_drawpixels_block(lower_drawpixels_state *state, nir_block *block)
219 lower_color(state, intr);
223 lower_texcoord(state, intr);
233 lower_drawpixels_impl(lower_drawpixels_state *state, nir_function_impl *impl)
235 nir_builder_init(&state->b, impl);
238 lower_drawpixels_block(state, block);
248 lower_drawpixels_state state = {
257 lower_drawpixels_impl(&state, function->impl);