radeonsi/gfx10: fix the legacy pipeline by storing as_ngg in the shader cache
It could load an NGG shader when we want a legacy shader and vice versa. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
parent
6342d43ae9
commit
810846e157
|
@ -147,7 +147,7 @@ static void si_create_compute_state_async(void *job, int thread_index)
|
|||
program->num_cs_user_data_dwords =
|
||||
sel->info.properties[TGSI_PROPERTY_CS_USER_DATA_COMPONENTS_AMD];
|
||||
|
||||
void *ir_binary = si_get_ir_binary(sel);
|
||||
void *ir_binary = si_get_ir_binary(sel, false);
|
||||
|
||||
/* Try to load the shader from the shader cache. */
|
||||
mtx_lock(&sscreen->shader_cache_mutex);
|
||||
|
|
|
@ -573,7 +573,7 @@ si_compute_fast_udiv_info32(uint32_t D, unsigned num_bits);
|
|||
void si_emit_dpbb_state(struct si_context *sctx);
|
||||
|
||||
/* si_state_shaders.c */
|
||||
void *si_get_ir_binary(struct si_shader_selector *sel);
|
||||
void *si_get_ir_binary(struct si_shader_selector *sel, bool as_ngg);
|
||||
bool si_shader_cache_load_shader(struct si_screen *sscreen, void *ir_binary,
|
||||
struct si_shader *shader);
|
||||
bool si_shader_cache_insert_shader(struct si_screen *sscreen, void *ir_binary,
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
* Return the IR binary in a buffer. For TGSI the first 4 bytes contain its
|
||||
* size as integer.
|
||||
*/
|
||||
void *si_get_ir_binary(struct si_shader_selector *sel)
|
||||
void *si_get_ir_binary(struct si_shader_selector *sel, bool as_ngg)
|
||||
{
|
||||
struct blob blob;
|
||||
unsigned ir_size;
|
||||
|
@ -64,14 +64,15 @@ void *si_get_ir_binary(struct si_shader_selector *sel)
|
|||
ir_size = blob.size;
|
||||
}
|
||||
|
||||
unsigned size = 4 + ir_size + sizeof(sel->so);
|
||||
unsigned size = 4 + 4 + ir_size + sizeof(sel->so);
|
||||
char *result = (char*)MALLOC(size);
|
||||
if (!result)
|
||||
return NULL;
|
||||
|
||||
*((uint32_t*)result) = size;
|
||||
memcpy(result + 4, ir_binary, ir_size);
|
||||
memcpy(result + 4 + ir_size, &sel->so, sizeof(sel->so));
|
||||
((uint32_t*)result)[0] = size;
|
||||
((uint32_t*)result)[1] = as_ngg;
|
||||
memcpy(result + 8, ir_binary, ir_size);
|
||||
memcpy(result + 8 + ir_size, &sel->so, sizeof(sel->so));
|
||||
|
||||
if (sel->nir)
|
||||
blob_finish(&blob);
|
||||
|
@ -2462,7 +2463,7 @@ static void si_init_shader_selector_async(void *job, int thread_index)
|
|||
shader->key.as_ngg = 1;
|
||||
|
||||
if (sel->tokens || sel->nir)
|
||||
ir_binary = si_get_ir_binary(sel);
|
||||
ir_binary = si_get_ir_binary(sel, shader->key.as_ngg);
|
||||
|
||||
/* Try to load the shader from the shader cache. */
|
||||
mtx_lock(&sscreen->shader_cache_mutex);
|
||||
|
|
Loading…
Reference in New Issue