diff options
author | Nicolai Hähnle <[email protected]> | 2017-06-09 15:12:23 +0200 |
---|---|---|
committer | Nicolai Hähnle <[email protected]> | 2017-07-05 12:27:11 +0200 |
commit | d91f97f91db4a826f7d5909a2a63a028a81188bb (patch) | |
tree | 402952f3b784482fe4b51d9fab77885d52307bb4 /src | |
parent | 10e1d2d9aa4b8fb240923c7b9b3d0bb3ce3b731a (diff) |
ddebug: handle some cases of non-TGSI shaders
NIR shaders are not captured properly in pipelined mode currently. This
would require shader cloning, which requires linking all the Gallium
drivers against NIR. We can always do that later.
v2: avoid immediate crashes in pipelined mode
Reviewed-by: Marek Olšák <[email protected]> (v1)
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/ddebug/dd_context.c | 6 | ||||
-rw-r--r-- | src/gallium/drivers/ddebug/dd_draw.c | 17 | ||||
-rw-r--r-- | src/gallium/drivers/ddebug/dd_screen.c | 11 |
3 files changed, 28 insertions, 6 deletions
diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c index 1ace9e52eb7..6b1ddc9d46b 100644 --- a/src/gallium/drivers/ddebug/dd_context.c +++ b/src/gallium/drivers/ddebug/dd_context.c @@ -314,7 +314,8 @@ DD_CSO_DELETE(vertex_elements) 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); \ } @@ -330,7 +331,8 @@ DD_CSO_DELETE(vertex_elements) 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; \ } \ \ diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c index 7edf6aff840..9c95d250d1a 100644 --- a/src/gallium/drivers/ddebug/dd_draw.c +++ b/src/gallium/drivers/ddebug/dd_draw.c @@ -98,8 +98,13 @@ dd_num_active_viewports(struct dd_draw_state *dstate) 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" @@ -831,8 +836,12 @@ dd_copy_draw_state(struct dd_draw_state *dst, struct dd_draw_state *src) 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; } diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c index 9642532bc02..a5d2be1402d 100644 --- a/src/gallium/drivers/ddebug/dd_screen.c +++ b/src/gallium/drivers/ddebug/dd_screen.c @@ -55,6 +55,16 @@ dd_screen_get_device_vendor(struct pipe_screen *_screen) 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) { @@ -411,6 +421,7 @@ ddebug_screen_create(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 |