struct dd_state *hstate = state; \
\
pipe->delete_##name##_state(pipe, hstate->cso); \
- tgsi_free_tokens(hstate->state.shader.tokens); \
+ if (hstate->state.shader.type == PIPE_SHADER_IR_TGSI) \
+ tgsi_free_tokens(hstate->state.shader.tokens); \
FREE(hstate); \
}
return NULL; \
hstate->cso = pipe->create_##name##_state(pipe, state); \
hstate->state.shader = *state; \
- hstate->state.shader.tokens = tgsi_dup_tokens(state->tokens); \
+ if (hstate->state.shader.type == PIPE_SHADER_IR_TGSI) \
+ hstate->state.shader.tokens = tgsi_dup_tokens(state->tokens); \
return hstate; \
} \
\
else
return 1;
- tgsi_scan_shader(tokens, &info);
- return info.writes_viewport_index ? PIPE_MAX_VIEWPORTS : 1;
+ if (tokens) {
+ tgsi_scan_shader(tokens, &info);
+ if (info.writes_viewport_index)
+ return PIPE_MAX_VIEWPORTS;
+ }
+
+ return 1;
}
#define COLOR_RESET "\033[0m"
if (src->shaders[i]) {
dst->shaders[i]->state.shader = src->shaders[i]->state.shader;
- dst->shaders[i]->state.shader.tokens =
- tgsi_dup_tokens(src->shaders[i]->state.shader.tokens);
+ if (src->shaders[i]->state.shader.tokens) {
+ dst->shaders[i]->state.shader.tokens =
+ tgsi_dup_tokens(src->shaders[i]->state.shader.tokens);
+ } else {
+ dst->shaders[i]->state.shader.ir.nir = NULL;
+ }
} else {
dst->shaders[i] = NULL;
}
return screen->get_device_vendor(screen);
}
+static const void *
+dd_screen_get_compiler_options(struct pipe_screen *_screen,
+ enum pipe_shader_ir ir,
+ enum pipe_shader_type shader)
+{
+ struct pipe_screen *screen = dd_screen(_screen)->screen;
+
+ return screen->get_compiler_options(screen, ir, shader);
+}
+
static struct disk_cache *
dd_screen_get_disk_shader_cache(struct pipe_screen *_screen)
{
SCR_INIT(fence_finish);
SCR_INIT(get_driver_query_info);
SCR_INIT(get_driver_query_group_info);
+ SCR_INIT(get_compiler_options);
#undef SCR_INIT