if (vpv->draw_shader)
draw_delete_vertex_shader( st->draw, vpv->draw_shader );
- delete_ir(&vpv->tgsi);
+ delete_ir(&vpv->state);
free( vpv );
}
stvp->variants = NULL;
- delete_ir(&stvp->tgsi);
+ delete_ir(&stvp->state);
}
stfp->variants = NULL;
- delete_ir(&stfp->tgsi);
+ delete_ir(&stfp->state);
}
}
p->variants = NULL;
- delete_ir(&p->tgsi);
+ delete_ir(&p->state);
}
/* Translate stream output info. */
struct pipe_stream_output_info *so_info = NULL;
if (prog->info.stage == MESA_SHADER_VERTEX)
- so_info = &((struct st_vertex_program*)prog)->tgsi.stream_output;
+ so_info = &((struct st_vertex_program*)prog)->state.stream_output;
else
- so_info = &((struct st_common_program*)prog)->tgsi.stream_output;
+ so_info = &((struct st_common_program*)prog)->state.stream_output;
for (unsigned i = 0; i < info->NumOutputs; i++) {
so_info->output[i].register_index =
return false;
}
- stvp->tgsi.tokens = ureg_get_tokens(ureg, &stvp->num_tgsi_tokens);
+ stvp->state.tokens = ureg_get_tokens(ureg, &stvp->num_tgsi_tokens);
ureg_destroy(ureg);
if (stvp->glsl_to_tgsi) {
nir_shader *nir =
st_translate_prog_to_nir(st, &stvp->Base, MESA_SHADER_VERTEX);
- if (stvp->tgsi.ir.nir)
- ralloc_free(stvp->tgsi.ir.nir);
- stvp->tgsi.type = PIPE_SHADER_IR_NIR;
- stvp->tgsi.ir.nir = nir;
+ if (stvp->state.ir.nir)
+ ralloc_free(stvp->state.ir.nir);
+ stvp->state.type = PIPE_SHADER_IR_NIR;
+ stvp->state.ir.nir = nir;
stvp->Base.nir = nir;
return true;
}
- return stvp->tgsi.tokens != NULL;
+ return stvp->state.tokens != NULL;
}
static const gl_state_index16 depth_range_state[STATE_LENGTH] =
struct gl_program_parameter_list *params = stvp->Base.Parameters;
vpv->key = *key;
- vpv->tgsi.stream_output = stvp->tgsi.stream_output;
+ vpv->state.stream_output = stvp->state.stream_output;
vpv->num_inputs = stvp->num_inputs;
/* When generating a NIR program, we usually don't have TGSI tokens.
* programs which we may need to use with the draw module for legacy
* feedback/select emulation. If they exist, copy them.
*/
- if (stvp->tgsi.tokens)
- vpv->tgsi.tokens = tgsi_dup_tokens(stvp->tgsi.tokens);
+ if (stvp->state.tokens)
+ vpv->state.tokens = tgsi_dup_tokens(stvp->state.tokens);
- if (stvp->tgsi.type == PIPE_SHADER_IR_NIR) {
- vpv->tgsi.type = PIPE_SHADER_IR_NIR;
- vpv->tgsi.ir.nir = nir_shader_clone(NULL, stvp->tgsi.ir.nir);
+ if (stvp->state.type == PIPE_SHADER_IR_NIR) {
+ vpv->state.type = PIPE_SHADER_IR_NIR;
+ vpv->state.ir.nir = nir_shader_clone(NULL, stvp->state.ir.nir);
if (key->clamp_color)
- NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_clamp_color_outputs);
+ NIR_PASS_V(vpv->state.ir.nir, nir_lower_clamp_color_outputs);
if (key->passthrough_edgeflags) {
- NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_passthrough_edgeflags);
+ NIR_PASS_V(vpv->state.ir.nir, nir_lower_passthrough_edgeflags);
vpv->num_inputs++;
}
if (key->lower_point_size) {
_mesa_add_state_reference(params, point_size_state);
- NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_point_size_mov,
+ NIR_PASS_V(vpv->state.ir.nir, nir_lower_point_size_mov,
point_size_state);
}
_mesa_add_state_reference(params, clipplane_state[i]);
}
- NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_clip_vs, key->lower_ucp,
+ NIR_PASS_V(vpv->state.ir.nir, nir_lower_clip_vs, key->lower_ucp,
true, can_compact, clipplane_state);
- NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_io_to_temporaries,
- nir_shader_get_entrypoint(vpv->tgsi.ir.nir), true, false);
+ NIR_PASS_V(vpv->state.ir.nir, nir_lower_io_to_temporaries,
+ nir_shader_get_entrypoint(vpv->state.ir.nir), true, false);
}
st_finalize_nir(st, &stvp->Base, stvp->shader_program,
- vpv->tgsi.ir.nir);
+ vpv->state.ir.nir);
- vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
+ vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->state);
/* driver takes ownership of IR: */
- vpv->tgsi.ir.nir = NULL;
+ vpv->state.ir.nir = NULL;
return vpv;
}
(key->clamp_color ? TGSI_EMU_CLAMP_COLOR_OUTPUTS : 0) |
(key->passthrough_edgeflags ? TGSI_EMU_PASSTHROUGH_EDGEFLAG : 0);
- tokens = tgsi_emulate(vpv->tgsi.tokens, flags);
+ tokens = tgsi_emulate(vpv->state.tokens, flags);
if (tokens) {
- tgsi_free_tokens(vpv->tgsi.tokens);
- vpv->tgsi.tokens = tokens;
+ tgsi_free_tokens(vpv->state.tokens);
+ vpv->state.tokens = tokens;
if (key->passthrough_edgeflags)
vpv->num_inputs++;
_mesa_add_state_reference(params, depth_range_state);
const struct tgsi_token *tokens;
- tokens = st_tgsi_lower_depth_clamp(vpv->tgsi.tokens, depth_range_const,
+ tokens = st_tgsi_lower_depth_clamp(vpv->state.tokens, depth_range_const,
key->clip_negative_one_to_one);
- if (tokens != vpv->tgsi.tokens)
- tgsi_free_tokens(vpv->tgsi.tokens);
- vpv->tgsi.tokens = tokens;
+ if (tokens != vpv->state.tokens)
+ tgsi_free_tokens(vpv->state.tokens);
+ vpv->state.tokens = tokens;
}
if (ST_DEBUG & DEBUG_TGSI) {
- tgsi_dump(vpv->tgsi.tokens, 0);
+ tgsi_dump(vpv->state.tokens, 0);
debug_printf("\n");
}
- vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
+ vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->state);
return vpv;
}
nir_shader *nir =
st_translate_prog_to_nir(st, &stfp->Base, MESA_SHADER_FRAGMENT);
- if (stfp->tgsi.ir.nir)
- ralloc_free(stfp->tgsi.ir.nir);
- stfp->tgsi.type = PIPE_SHADER_IR_NIR;
- stfp->tgsi.ir.nir = nir;
+ if (stfp->state.ir.nir)
+ ralloc_free(stfp->state.ir.nir);
+ stfp->state.type = PIPE_SHADER_IR_NIR;
+ stfp->state.ir.nir = nir;
stfp->Base.nir = nir;
return true;
}
fs_output_semantic_name,
fs_output_semantic_index);
- stfp->tgsi.tokens = ureg_get_tokens(ureg, &stfp->num_tgsi_tokens);
+ stfp->state.tokens = ureg_get_tokens(ureg, &stfp->num_tgsi_tokens);
ureg_destroy(ureg);
if (stfp->glsl_to_tgsi) {
st_store_ir_in_disk_cache(st, &stfp->Base, false);
}
- return stfp->tgsi.tokens != NULL;
+ return stfp->state.tokens != NULL;
}
static struct st_fp_variant *
if (!variant)
return NULL;
- if (stfp->tgsi.type == PIPE_SHADER_IR_NIR) {
+ if (stfp->state.type == PIPE_SHADER_IR_NIR) {
tgsi.type = PIPE_SHADER_IR_NIR;
- tgsi.ir.nir = nir_shader_clone(NULL, stfp->tgsi.ir.nir);
+ tgsi.ir.nir = nir_shader_clone(NULL, stfp->state.ir.nir);
if (key->clamp_color)
NIR_PASS_V(tgsi.ir.nir, nir_lower_clamp_color_outputs);
return variant;
}
- tgsi.tokens = stfp->tgsi.tokens;
+ tgsi.tokens = stfp->state.tokens;
assert(!(key->bitmap && key->drawpixels));
tokens = tgsi_emulate(tgsi.tokens, flags);
if (tokens) {
- if (tgsi.tokens != stfp->tgsi.tokens)
+ if (tgsi.tokens != stfp->state.tokens)
tgsi_free_tokens(tgsi.tokens);
tgsi.tokens = tokens;
} else
PIPE_FORMAT_R8_UNORM);
if (tokens) {
- if (tgsi.tokens != stfp->tgsi.tokens)
+ if (tgsi.tokens != stfp->state.tokens)
tgsi_free_tokens(tgsi.tokens);
tgsi.tokens = tokens;
} else
texcoord_const, st->internal_target);
if (tokens) {
- if (tgsi.tokens != stfp->tgsi.tokens)
+ if (tgsi.tokens != stfp->state.tokens)
tgsi_free_tokens(tgsi.tokens);
tgsi.tokens = tokens;
} else
key->external.lower_yx_xuxv,
key->external.lower_iyuv);
if (tokens) {
- if (tgsi.tokens != stfp->tgsi.tokens)
+ if (tgsi.tokens != stfp->state.tokens)
tgsi_free_tokens(tgsi.tokens);
tgsi.tokens = tokens;
} else {
const struct tgsi_token *tokens;
tokens = st_tgsi_lower_depth_clamp_fs(tgsi.tokens, depth_range_const);
- if (tgsi.tokens != stfp->tgsi.tokens)
+ if (tgsi.tokens != stfp->state.tokens)
tgsi_free_tokens(tgsi.tokens);
tgsi.tokens = tokens;
}
variant->driver_shader = pipe->create_fs_state(pipe, &tgsi);
variant->key = *key;
- if (tgsi.tokens != stfp->tgsi.tokens)
+ if (tgsi.tokens != stfp->state.tokens)
tgsi_free_tokens(tgsi.tokens);
return variant;
}
memset(inputSlotToAttr, 0, sizeof(inputSlotToAttr));
memset(inputMapping, 0, sizeof(inputMapping));
memset(outputMapping, 0, sizeof(outputMapping));
- memset(&stcp->tgsi, 0, sizeof(stcp->tgsi));
+ memset(&stcp->state, 0, sizeof(stcp->state));
if (prog->info.clip_distance_array_size)
ureg_property(ureg, TGSI_PROPERTY_NUM_CLIPDIST_ENABLED,
output_semantic_name,
output_semantic_index);
- stcp->tgsi.tokens = ureg_get_tokens(ureg, &stcp->num_tgsi_tokens);
+ stcp->state.tokens = ureg_get_tokens(ureg, &stcp->num_tgsi_tokens);
ureg_destroy(ureg);
}
if (ST_DEBUG & DEBUG_TGSI) {
- tgsi_dump(stcp->tgsi.tokens, 0);
+ tgsi_dump(stcp->state.tokens, 0);
debug_printf("\n");
}
v = CALLOC_STRUCT(st_basic_variant);
if (v) {
- if (prog->tgsi.type == PIPE_SHADER_IR_NIR) {
+ if (prog->state.type == PIPE_SHADER_IR_NIR) {
tgsi.type = PIPE_SHADER_IR_NIR;
- tgsi.ir.nir = nir_shader_clone(NULL, prog->tgsi.ir.nir);
+ tgsi.ir.nir = nir_shader_clone(NULL, prog->state.ir.nir);
if (key->clamp_color)
NIR_PASS_V(tgsi.ir.nir, nir_lower_clamp_color_outputs);
- tgsi.stream_output = prog->tgsi.stream_output;
+ tgsi.stream_output = prog->state.stream_output;
st_finalize_nir(st, &prog->Base, prog->shader_program,
tgsi.ir.nir);
const struct tgsi_token *tokens;
tokens =
- st_tgsi_lower_depth_clamp(prog->tgsi.tokens,
+ st_tgsi_lower_depth_clamp(prog->state.tokens,
depth_range_const,
key->clip_negative_one_to_one);
- if (tokens != prog->tgsi.tokens)
- tgsi_free_tokens(prog->tgsi.tokens);
+ if (tokens != prog->state.tokens)
+ tgsi_free_tokens(prog->state.tokens);
- prog->tgsi.tokens = tokens;
+ prog->state.tokens = tokens;
prog->num_tgsi_tokens = tgsi_num_tokens(tokens);
}
- tgsi = prog->tgsi;
+ tgsi = prog->state;
}
/* fill in new variant */
switch (prog->Base.info.stage) {
for (stv = stvp->variants; stv; stv = stv->next) {
debug_printf("variant %p\n", stv);
- tgsi_dump(stv->tgsi.tokens, 0);
+ tgsi_dump(stv->state.tokens, 0);
}
}
}
blob_write_bytes(&blob, stvp->result_to_output,
sizeof(stvp->result_to_output));
- write_stream_out_to_cache(&blob, &stvp->tgsi);
+ write_stream_out_to_cache(&blob, &stvp->state);
if (nir)
write_nir_to_cache(&blob, prog);
else
- write_tgsi_to_cache(&blob, stvp->tgsi.tokens, prog,
+ write_tgsi_to_cache(&blob, stvp->state.tokens, prog,
stvp->num_tgsi_tokens);
break;
}
if (prog->info.stage == MESA_SHADER_TESS_EVAL ||
prog->info.stage == MESA_SHADER_GEOMETRY)
- write_stream_out_to_cache(&blob, &stcp->tgsi);
+ write_stream_out_to_cache(&blob, &stcp->state);
if (nir)
write_nir_to_cache(&blob, prog);
else
- write_tgsi_to_cache(&blob, stcp->tgsi.tokens, prog,
+ write_tgsi_to_cache(&blob, stcp->state.tokens, prog,
stcp->num_tgsi_tokens);
break;
}
if (nir)
write_nir_to_cache(&blob, prog);
else
- write_tgsi_to_cache(&blob, stfp->tgsi.tokens, prog,
+ write_tgsi_to_cache(&blob, stfp->state.tokens, prog,
stfp->num_tgsi_tokens);
break;
}
blob_copy_bytes(&blob_reader, (uint8_t *) stvp->result_to_output,
sizeof(stvp->result_to_output));
- read_stream_out_from_cache(&blob_reader, &stvp->tgsi);
+ read_stream_out_from_cache(&blob_reader, &stvp->state);
if (nir) {
- stvp->tgsi.type = PIPE_SHADER_IR_NIR;
+ stvp->state.type = PIPE_SHADER_IR_NIR;
stvp->shader_program = shProg;
- stvp->tgsi.ir.nir = nir_deserialize(NULL, options, &blob_reader);
- prog->nir = stvp->tgsi.ir.nir;
+ stvp->state.ir.nir = nir_deserialize(NULL, options, &blob_reader);
+ prog->nir = stvp->state.ir.nir;
} else {
- read_tgsi_from_cache(&blob_reader, &stvp->tgsi.tokens,
+ read_tgsi_from_cache(&blob_reader, &stvp->state.tokens,
&stvp->num_tgsi_tokens);
}
if (prog->info.stage == MESA_SHADER_TESS_EVAL ||
prog->info.stage == MESA_SHADER_GEOMETRY)
- read_stream_out_from_cache(&blob_reader, &stcp->tgsi);
+ read_stream_out_from_cache(&blob_reader, &stcp->state);
if (nir) {
- stcp->tgsi.type = PIPE_SHADER_IR_NIR;
- stcp->tgsi.ir.nir = nir_deserialize(NULL, options, &blob_reader);
+ stcp->state.type = PIPE_SHADER_IR_NIR;
+ stcp->state.ir.nir = nir_deserialize(NULL, options, &blob_reader);
stcp->shader_program = shProg;
- prog->nir = stcp->tgsi.ir.nir;
+ prog->nir = stcp->state.ir.nir;
} else {
- read_tgsi_from_cache(&blob_reader, &stcp->tgsi.tokens,
+ read_tgsi_from_cache(&blob_reader, &stcp->state.tokens,
&stcp->num_tgsi_tokens);
}
st_release_fp_variants(st, stfp);
if (nir) {
- stfp->tgsi.type = PIPE_SHADER_IR_NIR;
+ stfp->state.type = PIPE_SHADER_IR_NIR;
stfp->shader_program = shProg;
- stfp->tgsi.ir.nir = nir_deserialize(NULL, options, &blob_reader);
- prog->nir = stfp->tgsi.ir.nir;
+ stfp->state.ir.nir = nir_deserialize(NULL, options, &blob_reader);
+ prog->nir = stfp->state.ir.nir;
} else {
- read_tgsi_from_cache(&blob_reader, &stfp->tgsi.tokens,
+ read_tgsi_from_cache(&blob_reader, &stfp->state.tokens,
&stfp->num_tgsi_tokens);
}