diff options
author | Jakob Bornecrantz <[email protected]> | 2011-04-07 13:20:33 +0100 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-09-22 08:26:36 -0600 |
commit | c8c2fc9a7a029bb61520973e55fb3cec18f13e20 (patch) | |
tree | b1155056648697dd721cbdba7c39230daf11aff2 /src/gallium | |
parent | 379353e16b6666da5833a59cff07785aaca82473 (diff) |
tgsi: Check in scan for fs position and depth reads
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_scan.c | 15 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_scan.h | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index f165f8240e6..60de80d0918 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -108,6 +108,17 @@ tgsi_scan_shader(const struct tgsi_token *tokens, assert(ind < PIPE_MAX_SHADER_INPUTS); info->input_usage_mask[ind] |= usage_mask; } + + if (procType == TGSI_PROCESSOR_FRAGMENT && + src->Register.File == TGSI_FILE_INPUT && + info->reads_position && + src->Register.Index == 0 && + (src->Register.SwizzleX == TGSI_SWIZZLE_Z || + src->Register.SwizzleY == TGSI_SWIZZLE_Z || + src->Register.SwizzleZ == TGSI_SWIZZLE_Z || + src->Register.SwizzleW == TGSI_SWIZZLE_Z)) { + info->reads_z = TRUE; + } } /* check for indirect register reads */ @@ -150,6 +161,10 @@ tgsi_scan_shader(const struct tgsi_token *tokens, info->input_centroid[reg] = (ubyte)fulldecl->Declaration.Centroid; info->input_cylindrical_wrap[reg] = (ubyte)fulldecl->Declaration.CylindricalWrap; info->num_inputs++; + + if (procType == TGSI_PROCESSOR_FRAGMENT && + fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) + info->reads_position = TRUE; } else if (file == TGSI_FILE_SYSTEM_VALUE) { unsigned index = fulldecl->Range.First; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index d6e593b3968..30834b4d000 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -63,6 +63,8 @@ struct tgsi_shader_info uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */ + boolean reads_position; /**< does fragment shader read position? */ + boolean reads_z; /**< does fragment shader read depth? */ boolean writes_z; /**< does fragment shader write Z value? */ boolean writes_stencil; /**< does fragment shader write stencil value? */ boolean writes_edgeflag; /**< vertex shader outputs edgeflag */ |