#include "util/mesa-sha1.h"
#include "brw_context.h"
+#include "brw_program.h"
#include "brw_gs.h"
#include "brw_state.h"
#include "brw_vs.h"
*/
prog_key.vs.program_string_id = 0;
break;
+ case MESA_SHADER_TESS_CTRL:
+ brw_tcs_populate_key(brw, &prog_key.tcs);
+ prog_key.tcs.program_string_id = 0;
+ break;
+ case MESA_SHADER_TESS_EVAL:
+ brw_tes_populate_key(brw, &prog_key.tes);
+ prog_key.tes.program_string_id = 0;
+ break;
case MESA_SHADER_GEOMETRY:
brw_gs_populate_key(brw, &prog_key.gs);
prog_key.gs.program_string_id = 0;
cache_id = BRW_CACHE_VS_PROG;
stage_state = &brw->vs.base;
break;
+ case MESA_SHADER_TESS_CTRL:
+ prog_key.tcs.program_string_id = brw_program(prog)->id;
+ cache_id = BRW_CACHE_TCS_PROG;
+ stage_state = &brw->tcs.base;
+ break;
+ case MESA_SHADER_TESS_EVAL:
+ prog_key.tes.program_string_id = brw_program(prog)->id;
+ cache_id = BRW_CACHE_TES_PROG;
+ stage_state = &brw->tes.base;
+ break;
case MESA_SHADER_GEOMETRY:
prog_key.gs.program_string_id = brw_program(prog)->id;
cache_id = BRW_CACHE_GS_PROG;
MESA_SHADER_VERTEX);
}
+ prog = brw->ctx._Shader->CurrentProgram[MESA_SHADER_TESS_CTRL];
+ if (prog && !prog->program_written_to_cache) {
+ struct brw_tcs_prog_key tcs_key;
+ brw_tcs_populate_key(brw, &tcs_key);
+ tcs_key.program_string_id = 0;
+
+ write_program_data(brw, prog, &tcs_key, brw->tcs.base.prog_data,
+ brw->tcs.base.prog_offset, cache,
+ MESA_SHADER_TESS_CTRL);
+ }
+
+ prog = brw->ctx._Shader->CurrentProgram[MESA_SHADER_TESS_EVAL];
+ if (prog && !prog->program_written_to_cache) {
+ struct brw_tes_prog_key tes_key;
+ brw_tes_populate_key(brw, &tes_key);
+ tes_key.program_string_id = 0;
+
+ write_program_data(brw, prog, &tes_key, brw->tes.base.prog_data,
+ brw->tes.base.prog_offset, cache,
+ MESA_SHADER_TESS_EVAL);
+ }
+
prog = brw->ctx._Shader->CurrentProgram[MESA_SHADER_GEOMETRY];
if (prog && !prog->program_written_to_cache) {
struct brw_gs_prog_key gs_key;
brw_tcs_populate_key(brw, &key);
- if (!brw_search_cache(&brw->cache, BRW_CACHE_TCS_PROG,
- &key, sizeof(key),
- &stage_state->prog_offset,
- &brw->tcs.base.prog_data)) {
- bool success = brw_codegen_tcs_prog(brw, tcp, tep, &key);
- assert(success);
- (void)success;
- }
+ if (brw_search_cache(&brw->cache, BRW_CACHE_TCS_PROG,
+ &key, sizeof(key),
+ &stage_state->prog_offset,
+ &brw->tcs.base.prog_data))
+ return;
+
+ if (brw_disk_cache_upload_program(brw, MESA_SHADER_TESS_CTRL))
+ return;
+
+ tcp = (struct brw_program *) brw->programs[MESA_SHADER_TESS_CTRL];
+ if (tcp)
+ tcp->id = key.program_string_id;
+
+ MAYBE_UNUSED bool success = brw_codegen_tcs_prog(brw, tcp, tep, &key);
+ assert(success);
}
brw_tes_populate_key(brw, &key);
- if (!brw_search_cache(&brw->cache, BRW_CACHE_TES_PROG,
- &key, sizeof(key),
- &stage_state->prog_offset,
- &brw->tes.base.prog_data)) {
- bool success = brw_codegen_tes_prog(brw, tep, &key);
- assert(success);
- (void)success;
- }
+ if (brw_search_cache(&brw->cache, BRW_CACHE_TES_PROG,
+ &key, sizeof(key),
+ &stage_state->prog_offset,
+ &brw->tes.base.prog_data))
+ return;
+
+ if (brw_disk_cache_upload_program(brw, MESA_SHADER_TESS_EVAL))
+ return;
+
+ tep = (struct brw_program *) brw->programs[MESA_SHADER_TESS_EVAL];
+ tep->id = key.program_string_id;
+
+ MAYBE_UNUSED bool success = brw_codegen_tes_prog(brw, tep, &key);
+ assert(success);
}