mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-23 15:45:42 +01:00
shader_ir: Add attribute getters
This commit is contained in:
parent
864e8f55cf
commit
15f431f0cb
@ -88,6 +88,27 @@ Node ShaderIR::GetPredicate(bool immediate) {
|
|||||||
return GetPredicate(static_cast<u64>(immediate ? Pred::UnusedIndex : Pred::NeverExecute));
|
return GetPredicate(static_cast<u64>(immediate ? Pred::UnusedIndex : Pred::NeverExecute));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Node ShaderIR::GetInputAttribute(Attribute::Index index, u64 element,
|
||||||
|
const Tegra::Shader::IpaMode& input_mode, Node buffer) {
|
||||||
|
const auto [entry, is_new] =
|
||||||
|
used_input_attributes.emplace(std::make_pair(index, std::set<Tegra::Shader::IpaMode>{}));
|
||||||
|
entry->second.insert(input_mode);
|
||||||
|
|
||||||
|
return StoreNode(AbufNode(index, static_cast<u32>(element), input_mode, buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
Node ShaderIR::GetOutputAttribute(Attribute::Index index, u64 element, Node buffer) {
|
||||||
|
if (index == Attribute::Index::ClipDistances0123 ||
|
||||||
|
index == Attribute::Index::ClipDistances4567) {
|
||||||
|
const auto clip_index =
|
||||||
|
static_cast<u32>((index == Attribute::Index::ClipDistances4567 ? 1 : 0) + element);
|
||||||
|
used_clip_distances.at(clip_index) = true;
|
||||||
|
}
|
||||||
|
used_output_attributes.insert(index);
|
||||||
|
|
||||||
|
return StoreNode(AbufNode(index, static_cast<u32>(element), buffer));
|
||||||
|
}
|
||||||
|
|
||||||
/*static*/ OperationCode ShaderIR::SignedToUnsignedCode(OperationCode operation_code,
|
/*static*/ OperationCode ShaderIR::SignedToUnsignedCode(OperationCode operation_code,
|
||||||
bool is_signed) {
|
bool is_signed) {
|
||||||
if (is_signed) {
|
if (is_signed) {
|
||||||
|
@ -624,6 +624,11 @@ private:
|
|||||||
Node GetPredicate(u64 pred, bool negated = false);
|
Node GetPredicate(u64 pred, bool negated = false);
|
||||||
/// Generates a predicate node for an immediate true or false value
|
/// Generates a predicate node for an immediate true or false value
|
||||||
Node GetPredicate(bool immediate);
|
Node GetPredicate(bool immediate);
|
||||||
|
/// Generates a node representing an input atttribute. Keeps track of used attributes.
|
||||||
|
Node GetInputAttribute(Tegra::Shader::Attribute::Index index, u64 element,
|
||||||
|
const Tegra::Shader::IpaMode& input_mode, Node buffer = {});
|
||||||
|
/// Generates a node representing an output atttribute. Keeps track of used attributes.
|
||||||
|
Node GetOutputAttribute(Tegra::Shader::Attribute::Index index, u64 element, Node buffer);
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
inline Node Operation(OperationCode code, const T*... operands) {
|
inline Node Operation(OperationCode code, const T*... operands) {
|
||||||
|
Loading…
Reference in New Issue
Block a user