diff options
| author | 2018-12-20 23:42:02 -0300 | |
|---|---|---|
| committer | 2019-01-15 17:54:50 -0300 | |
| commit | fbc67a05637f3acb47f933066fb2e548f9d35d8c (patch) | |
| tree | f8e100455b0317dd29e4f97dd85506258ecc1978 /src | |
| parent | shader_ir: Add predicate combiner helper (diff) | |
| download | yuzu-fbc67a05637f3acb47f933066fb2e548f9d35d8c.tar.gz yuzu-fbc67a05637f3acb47f933066fb2e548f9d35d8c.tar.xz yuzu-fbc67a05637f3acb47f933066fb2e548f9d35d8c.zip | |
shader_ir: Add condition code helper
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/shader/shader_ir.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/shader/shader_ir.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/video_core/shader/shader_ir.cpp b/src/video_core/shader/shader_ir.cpp index aec1fb36b..3c37c7145 100644 --- a/src/video_core/shader/shader_ir.cpp +++ b/src/video_core/shader/shader_ir.cpp | |||
| @@ -321,6 +321,16 @@ OperationCode ShaderIR::GetPredicateCombiner(PredOperation operation) { | |||
| 321 | return op->second; | 321 | return op->second; |
| 322 | } | 322 | } |
| 323 | 323 | ||
| 324 | Node ShaderIR::GetConditionCode(Tegra::Shader::ConditionCode cc) { | ||
| 325 | switch (cc) { | ||
| 326 | case Tegra::Shader::ConditionCode::NEU: | ||
| 327 | return GetInternalFlag(InternalFlag::Zero, true); | ||
| 328 | default: | ||
| 329 | UNIMPLEMENTED_MSG("Unimplemented condition code: {}", static_cast<u32>(cc)); | ||
| 330 | return GetPredicate(static_cast<u64>(Pred::NeverExecute)); | ||
| 331 | } | ||
| 332 | } | ||
| 333 | |||
| 324 | void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) { | 334 | void ShaderIR::SetRegister(BasicBlock& bb, Register dest, Node src) { |
| 325 | bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src)); | 335 | bb.push_back(Operation(OperationCode::Assign, GetRegister(dest), src)); |
| 326 | } | 336 | } |
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h index f13129ab3..8223ff044 100644 --- a/src/video_core/shader/shader_ir.h +++ b/src/video_core/shader/shader_ir.h | |||
| @@ -672,6 +672,9 @@ private: | |||
| 672 | /// Returns a predicate combiner operation | 672 | /// Returns a predicate combiner operation |
| 673 | OperationCode GetPredicateCombiner(Tegra::Shader::PredOperation operation); | 673 | OperationCode GetPredicateCombiner(Tegra::Shader::PredOperation operation); |
| 674 | 674 | ||
| 675 | /// Returns a condition code evaluated from internal flags | ||
| 676 | Node GetConditionCode(Tegra::Shader::ConditionCode cc); | ||
| 677 | |||
| 675 | template <typename... T> | 678 | template <typename... T> |
| 676 | inline Node Operation(OperationCode code, const T*... operands) { | 679 | inline Node Operation(OperationCode code, const T*... operands) { |
| 677 | return StoreNode(OperationNode(code, operands...)); | 680 | return StoreNode(OperationNode(code, operands...)); |