diff options
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_dump.c | 25 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_dump.h | 17 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_parse.h | 3 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_sanity.h | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_text.c | 50 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_text.h | 6 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.c | 16 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_ureg.h | 4 |
8 files changed, 65 insertions, 62 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 77bde86..82cd8ea 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -138,7 +138,7 @@ static const char *immediate_type_names[] = }; const char * -tgsi_swizzle_names[] = +tgsi_swizzle_names[4] = { "x", "y", @@ -147,7 +147,7 @@ tgsi_swizzle_names[] = }; const char * -tgsi_texture_names[] = +tgsi_texture_names[TGSI_TEXTURE_COUNT] = { "UNKNOWN", "1D", @@ -160,16 +160,17 @@ tgsi_texture_names[] = "SHADOWRECT" }; -static const char *property_names[] = +const char *tgsi_property_names[TGSI_PROPERTY_COUNT] = { "GS_INPUT_PRIMITIVE", "GS_OUTPUT_PRIMITIVE", "GS_MAX_OUTPUT_VERTICES", "FS_COORD_ORIGIN", - "FS_COORD_PIXEL_CENTER" + "FS_COORD_PIXEL_CENTER", + "FS_COLOR0_WRITES_ALL_CBUFS", }; -static const char *primitive_names[] = +const char *tgsi_primitive_names[PIPE_PRIM_MAX] = { "POINTS", "LINES", @@ -187,13 +188,13 @@ static const char *primitive_names[] = "TRIANGLE_STRIP_ADJACENCY" }; -static const char *fs_coord_origin_names[] = +const char *tgsi_fs_coord_origin_names[2] = { "UPPER_LEFT", "LOWER_LEFT" }; -static const char *fs_coord_pixel_center_names[] = +const char *tgsi_fs_coord_pixel_center_names[2] = { "HALF_INTEGER", "INTEGER" @@ -484,10 +485,10 @@ iter_property( int i; struct dump_ctx *ctx = (struct dump_ctx *)iter; - assert(Elements(property_names) == TGSI_PROPERTY_COUNT); + assert(Elements(tgsi_property_names) == TGSI_PROPERTY_COUNT); TXT( "PROPERTY " ); - ENM(prop->Property.PropertyName, property_names); + ENM(prop->Property.PropertyName, tgsi_property_names); if (prop->Property.NrTokens > 1) TXT(" "); @@ -496,13 +497,13 @@ iter_property( switch (prop->Property.PropertyName) { case TGSI_PROPERTY_GS_INPUT_PRIM: case TGSI_PROPERTY_GS_OUTPUT_PRIM: - ENM(prop->u[i].Data, primitive_names); + ENM(prop->u[i].Data, tgsi_primitive_names); break; case TGSI_PROPERTY_FS_COORD_ORIGIN: - ENM(prop->u[i].Data, fs_coord_origin_names); + ENM(prop->u[i].Data, tgsi_fs_coord_origin_names); break; case TGSI_PROPERTY_FS_COORD_PIXEL_CENTER: - ENM(prop->u[i].Data, fs_coord_pixel_center_names); + ENM(prop->u[i].Data, tgsi_fs_coord_pixel_center_names); break; default: SID( prop->u[i].Data ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.h b/src/gallium/auxiliary/tgsi/tgsi_dump.h index fc0429a..2491e91 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.h +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.h @@ -29,6 +29,7 @@ #define TGSI_DUMP_H #include "pipe/p_compiler.h" +#include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" #if defined __cplusplus @@ -39,10 +40,22 @@ extern const char * tgsi_file_names[TGSI_FILE_COUNT]; extern const char * -tgsi_swizzle_names[]; +tgsi_swizzle_names[4]; extern const char * -tgsi_texture_names[]; +tgsi_texture_names[TGSI_TEXTURE_COUNT]; + +extern const char * +tgsi_property_names[TGSI_PROPERTY_COUNT]; + +extern const char * +tgsi_primitive_names[PIPE_PRIM_MAX]; + +extern const char * +tgsi_fs_coord_origin_names[2]; + +extern const char * +tgsi_fs_coord_pixel_center_names[2]; void tgsi_dump_str( diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index d4df585..2aafa2a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -136,7 +136,8 @@ tgsi_parse_token( static INLINE unsigned tgsi_num_tokens(const struct tgsi_token *tokens) { - struct tgsi_header header = *(const struct tgsi_header *) tokens; + struct tgsi_header header; + memcpy(&header, tokens, sizeof(header)); return header.HeaderSize + header.BodySize; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.h b/src/gallium/auxiliary/tgsi/tgsi_sanity.h index 73f0f41..707d11e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.h +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.h @@ -28,12 +28,14 @@ #ifndef TGSI_SANITY_H #define TGSI_SANITY_H -#include "pipe/p_shader_tokens.h" - #if defined __cplusplus extern "C" { #endif +#include "pipe/p_compiler.h" + +struct tgsi_token; + /* Check the given token stream for errors and common mistakes. * Diagnostic messages are printed out to the debug output, and is * controlled by the debug option TGSI_PRINT_SANITY (default false). diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 9a38c37..819b072 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -36,6 +36,7 @@ #include "tgsi_parse.h" #include "tgsi_sanity.h" #include "tgsi_util.h" +#include "tgsi_dump.h" static boolean is_alpha_underscore( const char *cur ) { @@ -1258,42 +1259,6 @@ static boolean parse_immediate( struct translate_ctx *ctx ) return TRUE; } -static const char *property_names[] = -{ - "GS_INPUT_PRIMITIVE", - "GS_OUTPUT_PRIMITIVE", - "GS_MAX_OUTPUT_VERTICES", - "FS_COORD_ORIGIN", - "FS_COORD_PIXEL_CENTER" -}; - -static const char *primitive_names[] = -{ - "POINTS", - "LINES", - "LINE_LOOP", - "LINE_STRIP", - "TRIANGLES", - "TRIANGLE_STRIP", - "TRIANGLE_FAN", - "QUADS", - "QUAD_STRIP", - "POLYGON" -}; - -static const char *fs_coord_origin_names[] = -{ - "UPPER_LEFT", - "LOWER_LEFT" -}; - -static const char *fs_coord_pixel_center_names[] = -{ - "HALF_INTEGER", - "INTEGER" -}; - - static boolean parse_primitive( const char **pcur, uint *primitive ) { @@ -1302,7 +1267,7 @@ parse_primitive( const char **pcur, uint *primitive ) for (i = 0; i < PIPE_PRIM_MAX; i++) { const char *cur = *pcur; - if (str_match_no_case( &cur, primitive_names[i])) { + if (str_match_no_case( &cur, tgsi_primitive_names[i])) { *primitive = i; *pcur = cur; return TRUE; @@ -1316,10 +1281,10 @@ parse_fs_coord_origin( const char **pcur, uint *fs_coord_origin ) { uint i; - for (i = 0; i < sizeof(fs_coord_origin_names) / sizeof(fs_coord_origin_names[0]); i++) { + for (i = 0; i < Elements(tgsi_fs_coord_origin_names); i++) { const char *cur = *pcur; - if (str_match_no_case( &cur, fs_coord_origin_names[i])) { + if (str_match_no_case( &cur, tgsi_fs_coord_origin_names[i])) { *fs_coord_origin = i; *pcur = cur; return TRUE; @@ -1333,10 +1298,10 @@ parse_fs_coord_pixel_center( const char **pcur, uint *fs_coord_pixel_center ) { uint i; - for (i = 0; i < sizeof(fs_coord_pixel_center_names) / sizeof(fs_coord_pixel_center_names[0]); i++) { + for (i = 0; i < Elements(tgsi_fs_coord_pixel_center_names); i++) { const char *cur = *pcur; - if (str_match_no_case( &cur, fs_coord_pixel_center_names[i])) { + if (str_match_no_case( &cur, tgsi_fs_coord_pixel_center_names[i])) { *fs_coord_pixel_center = i; *pcur = cur; return TRUE; @@ -1364,7 +1329,7 @@ static boolean parse_property( struct translate_ctx *ctx ) } for (property_name = 0; property_name < TGSI_PROPERTY_COUNT; ++property_name) { - if (streq_nocase_uprcase(property_names[property_name], id)) { + if (streq_nocase_uprcase(tgsi_property_names[property_name], id)) { break; } } @@ -1398,6 +1363,7 @@ static boolean parse_property( struct translate_ctx *ctx ) return FALSE; } break; + case TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS: default: if (!parse_uint(&ctx->cur, &values[0] )) { report_error( ctx, "Expected unsigned integer as property!" ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.h b/src/gallium/auxiliary/tgsi/tgsi_text.h index 8eeeeef..5fe53cf 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.h +++ b/src/gallium/auxiliary/tgsi/tgsi_text.h @@ -28,12 +28,14 @@ #ifndef TGSI_TEXT_H #define TGSI_TEXT_H -#include "pipe/p_shader_tokens.h" - #if defined __cplusplus extern "C" { #endif +#include "pipe/p_compiler.h" + +struct tgsi_token; + boolean tgsi_text_translate( const char *text, diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 7d13a17..02de12d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -148,6 +148,7 @@ struct ureg_program unsigned property_gs_max_vertices; unsigned char property_fs_coord_origin; /* = TGSI_FS_COORD_ORIGIN_* */ unsigned char property_fs_coord_pixel_center; /* = TGSI_FS_COORD_PIXEL_CENTER_* */ + unsigned char property_fs_color0_writes_all_cbufs; /* = TGSI_FS_COLOR0_WRITES_ALL_CBUFS * */ unsigned nr_addrs; unsigned nr_preds; @@ -284,7 +285,12 @@ ureg_property_fs_coord_pixel_center(struct ureg_program *ureg, ureg->property_fs_coord_pixel_center = fs_coord_pixel_center; } - +void +ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg, + unsigned fs_color0_writes_all_cbufs) +{ + ureg->property_fs_color0_writes_all_cbufs = fs_color0_writes_all_cbufs; +} struct ureg_src ureg_DECL_fs_input_cyl_centroid(struct ureg_program *ureg, @@ -1278,6 +1284,14 @@ static void emit_decls( struct ureg_program *ureg ) ureg->property_fs_coord_pixel_center); } + if (ureg->property_fs_color0_writes_all_cbufs) { + assert(ureg->processor == TGSI_PROCESSOR_FRAGMENT); + + emit_property(ureg, + TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS, + ureg->property_fs_color0_writes_all_cbufs); + } + if (ureg->processor == TGSI_PROCESSOR_VERTEX) { for (i = 0; i < UREG_MAX_INPUT; i++) { if (ureg->vs_inputs[i/32] & (1 << (i%32))) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index acc4632..807128a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -153,6 +153,10 @@ void ureg_property_fs_coord_pixel_center(struct ureg_program *ureg, unsigned fs_coord_pixel_center); +void +ureg_property_fs_color0_writes_all_cbufs(struct ureg_program *ureg, + unsigned fs_color0_writes_all_cbufs); + /*********************************************************************** * Build shader declarations: */ |