summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2016-11-29 12:25:54 +1100
committerJordan Justen <[email protected]>2017-10-31 23:36:54 -0700
commit42383faf51c69aa2c456d7dd5abfcb7c04c93709 (patch)
tree947d28659d58801b8b95b2d3d11af14bf78da188 /src/mesa/drivers
parent5a4afd822fa3c6f8879d1228d1ec08da90aacf35 (diff)
i965: add shader cache support for tess stages
v2: * Use MAYBE_UNUSED. (Matt) [[email protected]: *_cached_program => brw_disk_cache_*_program] Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i965/brw_disk_cache.c41
-rw-r--r--src/mesa/drivers/dri/i965/brw_tcs.c23
-rw-r--r--src/mesa/drivers/dri/i965/brw_tes.c22
3 files changed, 70 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_disk_cache.c b/src/mesa/drivers/dri/i965/brw_disk_cache.c
index f35d41e79d1..3511eaacf02 100644
--- a/src/mesa/drivers/dri/i965/brw_disk_cache.c
+++ b/src/mesa/drivers/dri/i965/brw_disk_cache.c
@@ -30,6 +30,7 @@
#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"
@@ -120,6 +121,14 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache,
*/
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;
@@ -182,6 +191,16 @@ read_and_upload(struct brw_context *brw, struct disk_cache *cache,
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;
@@ -287,6 +306,28 @@ brw_disk_cache_write_program(struct brw_context *brw)
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;
diff --git a/src/mesa/drivers/dri/i965/brw_tcs.c b/src/mesa/drivers/dri/i965/brw_tcs.c
index 685336eb973..4424efea4f0 100644
--- a/src/mesa/drivers/dri/i965/brw_tcs.c
+++ b/src/mesa/drivers/dri/i965/brw_tcs.c
@@ -337,14 +337,21 @@ brw_upload_tcs_prog(struct brw_context *brw)
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);
}
diff --git a/src/mesa/drivers/dri/i965/brw_tes.c b/src/mesa/drivers/dri/i965/brw_tes.c
index 225d2401c7e..4222d4231fe 100644
--- a/src/mesa/drivers/dri/i965/brw_tes.c
+++ b/src/mesa/drivers/dri/i965/brw_tes.c
@@ -195,14 +195,20 @@ brw_upload_tes_prog(struct brw_context *brw)
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);
}