diff options
author | Marek Olšák <[email protected]> | 2017-04-24 16:29:22 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-04-28 21:47:35 +0200 |
commit | 46e48d404417ffe3c619287d6504f0504357d8b2 (patch) | |
tree | da3530a794da1daff64d06954fa7e96ff1ccce11 /src/gallium/auxiliary/tgsi/tgsi_scan.c | |
parent | fa15436e634f36d94d6d477675a2037404df1952 (diff) |
tgsi/scan: record compute shader system value usage
v2: just do indexing with swizzle[i]
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi/tgsi_scan.c')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_scan.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index bf614db8060..d1ef769ec4d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -115,6 +115,39 @@ scan_src_operand(struct tgsi_shader_info *info, { int ind = src->Register.Index; + if (info->processor == PIPE_SHADER_COMPUTE && + src->Register.File == TGSI_FILE_SYSTEM_VALUE) { + unsigned swizzle[4], i, name; + + name = info->system_value_semantic_name[src->Register.Index]; + swizzle[0] = src->Register.SwizzleX; + swizzle[1] = src->Register.SwizzleY; + swizzle[2] = src->Register.SwizzleZ; + swizzle[3] = src->Register.SwizzleW; + + switch (name) { + case TGSI_SEMANTIC_THREAD_ID: + case TGSI_SEMANTIC_BLOCK_ID: + for (i = 0; i < 4; i++) { + if (swizzle[i] <= TGSI_SWIZZLE_Z) { + if (name == TGSI_SEMANTIC_THREAD_ID) + info->uses_thread_id[swizzle[i]] = true; + else + info->uses_block_id[swizzle[i]] = true; + } + } + break; + case TGSI_SEMANTIC_BLOCK_SIZE: + /* The block size is translated to IMM with a fixed block size. */ + if (info->properties[TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH] == 0) + info->uses_block_size = true; + break; + case TGSI_SEMANTIC_GRID_SIZE: + info->uses_grid_size = true; + break; + } + } + /* Mark which inputs are effectively used */ if (src->Register.File == TGSI_FILE_INPUT) { if (src->Register.Indirect) { |