tgsi/scan: set which color components are read by a fragment shader
This will be used by radeonsi. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
parent
18ec76730a
commit
ff7e77724e
|
@ -187,14 +187,28 @@ tgsi_scan_shader(const struct tgsi_token *tokens,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (procType == TGSI_PROCESSOR_FRAGMENT &&
|
if (procType == TGSI_PROCESSOR_FRAGMENT &&
|
||||||
!src->Register.Indirect &&
|
!src->Register.Indirect) {
|
||||||
info->input_semantic_name[src->Register.Index] ==
|
unsigned name =
|
||||||
TGSI_SEMANTIC_POSITION &&
|
info->input_semantic_name[src->Register.Index];
|
||||||
(src->Register.SwizzleX == TGSI_SWIZZLE_Z ||
|
unsigned index =
|
||||||
src->Register.SwizzleY == TGSI_SWIZZLE_Z ||
|
info->input_semantic_index[src->Register.Index];
|
||||||
src->Register.SwizzleZ == TGSI_SWIZZLE_Z ||
|
|
||||||
src->Register.SwizzleW == TGSI_SWIZZLE_Z)) {
|
if (name == TGSI_SEMANTIC_POSITION &&
|
||||||
info->reads_z = TRUE;
|
(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;
|
||||||
|
|
||||||
|
if (name == TGSI_SEMANTIC_COLOR) {
|
||||||
|
unsigned mask =
|
||||||
|
(1 << src->Register.SwizzleX) |
|
||||||
|
(1 << src->Register.SwizzleY) |
|
||||||
|
(1 << src->Register.SwizzleZ) |
|
||||||
|
(1 << src->Register.SwizzleW);
|
||||||
|
|
||||||
|
info->colors_read |= mask << (index * 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@ struct tgsi_shader_info
|
||||||
|
|
||||||
uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */
|
uint opcode_count[TGSI_OPCODE_LAST]; /**< opcode histogram */
|
||||||
|
|
||||||
|
ubyte colors_read; /**< which color components are read by the FS */
|
||||||
ubyte colors_written;
|
ubyte colors_written;
|
||||||
boolean reads_position; /**< does fragment shader read position? */
|
boolean reads_position; /**< does fragment shader read position? */
|
||||||
boolean reads_z; /**< does fragment shader read depth? */
|
boolean reads_z; /**< does fragment shader read depth? */
|
||||||
|
|
Loading…
Reference in New Issue