diff options
Diffstat (limited to 'src/gallium/drivers/radeon')
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.c | 29 | ||||
-rw-r--r-- | src/gallium/drivers/radeon/r600_pipe_common.h | 2 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index 9d68f4ba7ab..0a9081b821e 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -25,6 +25,7 @@ */ #include "r600_pipe_common.h" +#include "tgsi/tgsi_parse.h" static const struct debug_named_value common_debug_options[] = { /* logging */ @@ -101,3 +102,31 @@ void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resour rctx->vram += rr->buf->size; } } + +static unsigned tgsi_get_processor_type(const struct tgsi_token *tokens) +{ + struct tgsi_parse_context parse; + + if (tgsi_parse_init( &parse, tokens ) != TGSI_PARSE_OK) { + debug_printf("tgsi_parse_init() failed in %s:%i!\n", __func__, __LINE__); + return ~0; + } + return parse.FullHeader.Processor.Processor; +} + +bool r600_can_dump_shader(struct r600_common_screen *rscreen, + const struct tgsi_token *tokens) +{ + switch (tgsi_get_processor_type(tokens)) { + case TGSI_PROCESSOR_VERTEX: + return (rscreen->debug_flags & DBG_VS) != 0; + case TGSI_PROCESSOR_GEOMETRY: + return (rscreen->debug_flags & DBG_GS) != 0; + case TGSI_PROCESSOR_FRAGMENT: + return (rscreen->debug_flags & DBG_PS) != 0; + case TGSI_PROCESSOR_COMPUTE: + return (rscreen->debug_flags & DBG_CS) != 0; + default: + return false; + } +} diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h index 63bc9b1fade..f2510b408ea 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.h +++ b/src/gallium/drivers/radeon/r600_pipe_common.h @@ -237,6 +237,8 @@ bool r600_common_context_init(struct r600_common_context *rctx, struct r600_common_screen *rscreen); void r600_common_context_cleanup(struct r600_common_context *rctx); void r600_context_add_resource_size(struct pipe_context *ctx, struct pipe_resource *r); +bool r600_can_dump_shader(struct r600_common_screen *rscreen, + const struct tgsi_token *tokens); /* r600_streamout.c */ void r600_streamout_buffers_dirty(struct r600_common_context *rctx); |