#include "brw_context.h"
#include "brw_nir.h"
#include "brw_program.h"
-#include "brw_shader.h"
#include "brw_state.h"
#include "program/prog_parameter.h"
brw_tes_debug_recompile(struct brw_context *brw, struct gl_program *prog,
const struct brw_tes_prog_key *key)
{
- struct brw_cache_item *c = NULL;
- const struct brw_tes_prog_key *old_key = NULL;
- bool found = false;
-
perf_debug("Recompiling tessellation evaluation shader for program %d\n",
prog->Id);
- for (unsigned int i = 0; i < brw->cache.size; i++) {
- for (c = brw->cache.items[i]; c; c = c->next) {
- if (c->cache_id == BRW_CACHE_TES_PROG) {
- old_key = c->key;
-
- if (old_key->program_string_id == key->program_string_id)
- break;
- }
- }
- if (c)
- break;
- }
+ bool found = false;
+ const struct brw_tes_prog_key *old_key =
+ brw_find_previous_compile(&brw->cache, BRW_CACHE_TES_PROG,
+ key->program_string_id);
- if (!c) {
+ if (!old_key) {
perf_debug(" Didn't find previous compile in the shader cache for "
"debug\n");
return;
brw_assign_common_binding_table_offsets(devinfo, &tep->program,
&prog_data.base.base, 0);
- STATIC_ASSERT(BRW_TESS_PARTITIONING_INTEGER == TESS_SPACING_EQUAL - 1);
- STATIC_ASSERT(BRW_TESS_PARTITIONING_ODD_FRACTIONAL ==
- TESS_SPACING_FRACTIONAL_ODD - 1);
- STATIC_ASSERT(BRW_TESS_PARTITIONING_EVEN_FRACTIONAL ==
- TESS_SPACING_FRACTIONAL_EVEN - 1);
-
- prog_data.partitioning = nir->info->tes.spacing - 1;
-
- switch (nir->info->tes.primitive_mode) {
- case GL_QUADS:
- prog_data.domain = BRW_TESS_DOMAIN_QUAD;
- break;
- case GL_TRIANGLES:
- prog_data.domain = BRW_TESS_DOMAIN_TRI;
- break;
- case GL_ISOLINES:
- prog_data.domain = BRW_TESS_DOMAIN_ISOLINE;
- break;
- default:
- unreachable("invalid domain shader primitive mode");
- }
-
- if (nir->info->tes.point_mode) {
- prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_POINT;
- } else if (nir->info->tes.primitive_mode == GL_ISOLINES) {
- prog_data.output_topology = BRW_TESS_OUTPUT_TOPOLOGY_LINE;
- } else {
- /* Hardware winding order is backwards from OpenGL */
- prog_data.output_topology =
- nir->info->tes.ccw ? BRW_TESS_OUTPUT_TOPOLOGY_TRI_CW
- : BRW_TESS_OUTPUT_TOPOLOGY_TRI_CCW;
- }
-
/* Allocate the references to the uniforms that will end up in the
* prog_data associated with the compiled program, and which will be freed
* by the state cache.
start_time = get_time();
}
+ struct brw_vue_map input_vue_map;
+ brw_compute_tess_vue_map(&input_vue_map, key->inputs_read,
+ key->patch_inputs_read);
+
void *mem_ctx = ralloc_context(NULL);
unsigned program_size;
char *error_str;
const unsigned *program =
- brw_compile_tes(compiler, brw, mem_ctx, key, &prog_data, nir,
- &tep->program, st_index, &program_size, &error_str);
+ brw_compile_tes(compiler, brw, mem_ctx, key, &input_vue_map, &prog_data,
+ nir, &tep->program, st_index, &program_size, &error_str);
if (program == NULL) {
- tep->program.sh.data->LinkStatus = false;
+ tep->program.sh.data->LinkStatus = linking_failure;
ralloc_strcat(&tep->program.sh.data->InfoLog, error_str);
_mesa_problem(NULL, "Failed to compile tessellation evaluation shader: "