mirror of
https://git.h3cjp.net/H3cJP/yuzu.git
synced 2024-11-15 20:43:09 +00:00
node: Eliminate variable shadowing
This commit is contained in:
parent
88089c8754
commit
7cf34c3637
|
@ -284,24 +284,26 @@ using TrackSampler = std::shared_ptr<TrackSamplerData>;
|
||||||
|
|
||||||
struct Sampler {
|
struct Sampler {
|
||||||
/// Bound samplers constructor
|
/// Bound samplers constructor
|
||||||
constexpr explicit Sampler(u32 index, u32 offset, Tegra::Shader::TextureType type,
|
constexpr explicit Sampler(u32 index_, u32 offset_, Tegra::Shader::TextureType type_,
|
||||||
bool is_array, bool is_shadow, bool is_buffer, bool is_indexed)
|
bool is_array_, bool is_shadow_, bool is_buffer_, bool is_indexed_)
|
||||||
: index{index}, offset{offset}, type{type}, is_array{is_array}, is_shadow{is_shadow},
|
: index{index_}, offset{offset_}, type{type_}, is_array{is_array_}, is_shadow{is_shadow_},
|
||||||
is_buffer{is_buffer}, is_indexed{is_indexed} {}
|
is_buffer{is_buffer_}, is_indexed{is_indexed_} {}
|
||||||
|
|
||||||
/// Separate sampler constructor
|
/// Separate sampler constructor
|
||||||
constexpr explicit Sampler(u32 index, std::pair<u32, u32> offsets, std::pair<u32, u32> buffers,
|
constexpr explicit Sampler(u32 index_, std::pair<u32, u32> offsets, std::pair<u32, u32> buffers,
|
||||||
Tegra::Shader::TextureType type, bool is_array, bool is_shadow,
|
Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_,
|
||||||
bool is_buffer)
|
bool is_buffer_)
|
||||||
: index{index}, offset{offsets.first}, secondary_offset{offsets.second},
|
: index{index_}, offset{offsets.first}, secondary_offset{offsets.second},
|
||||||
buffer{buffers.first}, secondary_buffer{buffers.second}, type{type}, is_array{is_array},
|
buffer{buffers.first}, secondary_buffer{buffers.second}, type{type}, is_array{is_array_},
|
||||||
is_shadow{is_shadow}, is_buffer{is_buffer}, is_separated{true} {}
|
is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_separated{true} {}
|
||||||
|
|
||||||
/// Bindless samplers constructor
|
/// Bindless samplers constructor
|
||||||
constexpr explicit Sampler(u32 index, u32 offset, u32 buffer, Tegra::Shader::TextureType type,
|
constexpr explicit Sampler(u32 index_, u32 offset_, u32 buffer_,
|
||||||
bool is_array, bool is_shadow, bool is_buffer, bool is_indexed)
|
Tegra::Shader::TextureType type, bool is_array_, bool is_shadow_,
|
||||||
: index{index}, offset{offset}, buffer{buffer}, type{type}, is_array{is_array},
|
bool is_buffer_, bool is_indexed_)
|
||||||
is_shadow{is_shadow}, is_buffer{is_buffer}, is_bindless{true}, is_indexed{is_indexed} {}
|
: index{index_}, offset{offset_}, buffer{buffer_}, type{type}, is_array{is_array_},
|
||||||
|
is_shadow{is_shadow_}, is_buffer{is_buffer_}, is_bindless{true}, is_indexed{is_indexed_} {
|
||||||
|
}
|
||||||
|
|
||||||
u32 index = 0; ///< Emulated index given for the this sampler.
|
u32 index = 0; ///< Emulated index given for the this sampler.
|
||||||
u32 offset = 0; ///< Offset in the const buffer from where the sampler is being read.
|
u32 offset = 0; ///< Offset in the const buffer from where the sampler is being read.
|
||||||
|
@ -341,12 +343,12 @@ struct BindlessSamplerNode {
|
||||||
struct Image {
|
struct Image {
|
||||||
public:
|
public:
|
||||||
/// Bound images constructor
|
/// Bound images constructor
|
||||||
constexpr explicit Image(u32 index, u32 offset, Tegra::Shader::ImageType type)
|
constexpr explicit Image(u32 index_, u32 offset_, Tegra::Shader::ImageType type_)
|
||||||
: index{index}, offset{offset}, type{type} {}
|
: index{index_}, offset{offset_}, type{type_} {}
|
||||||
|
|
||||||
/// Bindless samplers constructor
|
/// Bindless samplers constructor
|
||||||
constexpr explicit Image(u32 index, u32 offset, u32 buffer, Tegra::Shader::ImageType type)
|
constexpr explicit Image(u32 index_, u32 offset_, u32 buffer_, Tegra::Shader::ImageType type_)
|
||||||
: index{index}, offset{offset}, buffer{buffer}, type{type}, is_bindless{true} {}
|
: index{index_}, offset{offset_}, buffer{buffer_}, type{type_}, is_bindless{true} {}
|
||||||
|
|
||||||
void MarkWrite() {
|
void MarkWrite() {
|
||||||
is_written = true;
|
is_written = true;
|
||||||
|
@ -437,20 +439,20 @@ private:
|
||||||
/// Holds any kind of operation that can be done in the IR
|
/// Holds any kind of operation that can be done in the IR
|
||||||
class OperationNode final : public AmendNode {
|
class OperationNode final : public AmendNode {
|
||||||
public:
|
public:
|
||||||
explicit OperationNode(OperationCode code) : OperationNode(code, Meta{}) {}
|
explicit OperationNode(OperationCode code_) : OperationNode(code_, Meta{}) {}
|
||||||
|
|
||||||
explicit OperationNode(OperationCode code, Meta meta)
|
explicit OperationNode(OperationCode code_, Meta meta_)
|
||||||
: OperationNode(code, std::move(meta), std::vector<Node>{}) {}
|
: OperationNode(code_, std::move(meta_), std::vector<Node>{}) {}
|
||||||
|
|
||||||
explicit OperationNode(OperationCode code, std::vector<Node> operands)
|
explicit OperationNode(OperationCode code_, std::vector<Node> operands_)
|
||||||
: OperationNode(code, Meta{}, std::move(operands)) {}
|
: OperationNode(code_, Meta{}, std::move(operands_)) {}
|
||||||
|
|
||||||
explicit OperationNode(OperationCode code, Meta meta, std::vector<Node> operands)
|
explicit OperationNode(OperationCode code_, Meta meta_, std::vector<Node> operands_)
|
||||||
: code{code}, meta{std::move(meta)}, operands{std::move(operands)} {}
|
: code{code_}, meta{std::move(meta_)}, operands{std::move(operands_)} {}
|
||||||
|
|
||||||
template <typename... Args>
|
template <typename... Args>
|
||||||
explicit OperationNode(OperationCode code, Meta meta, Args&&... operands)
|
explicit OperationNode(OperationCode code_, Meta meta_, Args&&... operands_)
|
||||||
: code{code}, meta{std::move(meta)}, operands{operands...} {}
|
: code{code_}, meta{std::move(meta_)}, operands{operands_...} {}
|
||||||
|
|
||||||
OperationCode GetCode() const {
|
OperationCode GetCode() const {
|
||||||
return code;
|
return code;
|
||||||
|
@ -477,8 +479,8 @@ private:
|
||||||
/// Encloses inside any kind of node that returns a boolean conditionally-executed code
|
/// Encloses inside any kind of node that returns a boolean conditionally-executed code
|
||||||
class ConditionalNode final : public AmendNode {
|
class ConditionalNode final : public AmendNode {
|
||||||
public:
|
public:
|
||||||
explicit ConditionalNode(Node condition, std::vector<Node>&& code)
|
explicit ConditionalNode(Node condition_, std::vector<Node>&& code_)
|
||||||
: condition{std::move(condition)}, code{std::move(code)} {}
|
: condition{std::move(condition_)}, code{std::move(code_)} {}
|
||||||
|
|
||||||
const Node& GetCondition() const {
|
const Node& GetCondition() const {
|
||||||
return condition;
|
return condition;
|
||||||
|
@ -496,7 +498,7 @@ private:
|
||||||
/// A general purpose register
|
/// A general purpose register
|
||||||
class GprNode final {
|
class GprNode final {
|
||||||
public:
|
public:
|
||||||
explicit constexpr GprNode(Tegra::Shader::Register index) : index{index} {}
|
explicit constexpr GprNode(Tegra::Shader::Register index_) : index{index_} {}
|
||||||
|
|
||||||
u32 GetIndex() const {
|
u32 GetIndex() const {
|
||||||
return static_cast<u32>(index);
|
return static_cast<u32>(index);
|
||||||
|
@ -509,7 +511,7 @@ private:
|
||||||
/// A custom variable
|
/// A custom variable
|
||||||
class CustomVarNode final {
|
class CustomVarNode final {
|
||||||
public:
|
public:
|
||||||
explicit constexpr CustomVarNode(u32 index) : index{index} {}
|
explicit constexpr CustomVarNode(u32 index_) : index{index_} {}
|
||||||
|
|
||||||
constexpr u32 GetIndex() const {
|
constexpr u32 GetIndex() const {
|
||||||
return index;
|
return index;
|
||||||
|
@ -522,7 +524,7 @@ private:
|
||||||
/// A 32-bits value that represents an immediate value
|
/// A 32-bits value that represents an immediate value
|
||||||
class ImmediateNode final {
|
class ImmediateNode final {
|
||||||
public:
|
public:
|
||||||
explicit constexpr ImmediateNode(u32 value) : value{value} {}
|
explicit constexpr ImmediateNode(u32 value_) : value{value_} {}
|
||||||
|
|
||||||
u32 GetValue() const {
|
u32 GetValue() const {
|
||||||
return value;
|
return value;
|
||||||
|
@ -535,7 +537,7 @@ private:
|
||||||
/// One of Maxwell's internal flags
|
/// One of Maxwell's internal flags
|
||||||
class InternalFlagNode final {
|
class InternalFlagNode final {
|
||||||
public:
|
public:
|
||||||
explicit constexpr InternalFlagNode(InternalFlag flag) : flag{flag} {}
|
explicit constexpr InternalFlagNode(InternalFlag flag_) : flag{flag_} {}
|
||||||
|
|
||||||
InternalFlag GetFlag() const {
|
InternalFlag GetFlag() const {
|
||||||
return flag;
|
return flag;
|
||||||
|
@ -548,8 +550,8 @@ private:
|
||||||
/// A predicate register, it can be negated without additional nodes
|
/// A predicate register, it can be negated without additional nodes
|
||||||
class PredicateNode final {
|
class PredicateNode final {
|
||||||
public:
|
public:
|
||||||
explicit constexpr PredicateNode(Tegra::Shader::Pred index, bool negated)
|
explicit constexpr PredicateNode(Tegra::Shader::Pred index_, bool negated_)
|
||||||
: index{index}, negated{negated} {}
|
: index{index_}, negated{negated_} {}
|
||||||
|
|
||||||
Tegra::Shader::Pred GetIndex() const {
|
Tegra::Shader::Pred GetIndex() const {
|
||||||
return index;
|
return index;
|
||||||
|
@ -568,12 +570,12 @@ private:
|
||||||
class AbufNode final {
|
class AbufNode final {
|
||||||
public:
|
public:
|
||||||
// Initialize for standard attributes (index is explicit).
|
// Initialize for standard attributes (index is explicit).
|
||||||
explicit AbufNode(Tegra::Shader::Attribute::Index index, u32 element, Node buffer = {})
|
explicit AbufNode(Tegra::Shader::Attribute::Index index_, u32 element_, Node buffer_ = {})
|
||||||
: buffer{std::move(buffer)}, index{index}, element{element} {}
|
: buffer{std::move(buffer_)}, index{index_}, element{element_} {}
|
||||||
|
|
||||||
// Initialize for physical attributes (index is a variable value).
|
// Initialize for physical attributes (index is a variable value).
|
||||||
explicit AbufNode(Node physical_address, Node buffer = {})
|
explicit AbufNode(Node physical_address_, Node buffer_ = {})
|
||||||
: physical_address{std::move(physical_address)}, buffer{std::move(buffer)} {}
|
: physical_address{std::move(physical_address_)}, buffer{std::move(buffer_)} {}
|
||||||
|
|
||||||
Tegra::Shader::Attribute::Index GetIndex() const {
|
Tegra::Shader::Attribute::Index GetIndex() const {
|
||||||
return index;
|
return index;
|
||||||
|
@ -605,7 +607,7 @@ private:
|
||||||
/// Patch memory (used to communicate tessellation stages).
|
/// Patch memory (used to communicate tessellation stages).
|
||||||
class PatchNode final {
|
class PatchNode final {
|
||||||
public:
|
public:
|
||||||
explicit PatchNode(u32 offset) : offset{offset} {}
|
explicit PatchNode(u32 offset_) : offset{offset_} {}
|
||||||
|
|
||||||
u32 GetOffset() const {
|
u32 GetOffset() const {
|
||||||
return offset;
|
return offset;
|
||||||
|
@ -618,7 +620,7 @@ private:
|
||||||
/// Constant buffer node, usually mapped to uniform buffers in GLSL
|
/// Constant buffer node, usually mapped to uniform buffers in GLSL
|
||||||
class CbufNode final {
|
class CbufNode final {
|
||||||
public:
|
public:
|
||||||
explicit CbufNode(u32 index, Node offset) : index{index}, offset{std::move(offset)} {}
|
explicit CbufNode(u32 index_, Node offset_) : index{index_}, offset{std::move(offset_)} {}
|
||||||
|
|
||||||
u32 GetIndex() const {
|
u32 GetIndex() const {
|
||||||
return index;
|
return index;
|
||||||
|
@ -636,7 +638,7 @@ private:
|
||||||
/// Local memory node
|
/// Local memory node
|
||||||
class LmemNode final {
|
class LmemNode final {
|
||||||
public:
|
public:
|
||||||
explicit LmemNode(Node address) : address{std::move(address)} {}
|
explicit LmemNode(Node address_) : address{std::move(address_)} {}
|
||||||
|
|
||||||
const Node& GetAddress() const {
|
const Node& GetAddress() const {
|
||||||
return address;
|
return address;
|
||||||
|
@ -649,7 +651,7 @@ private:
|
||||||
/// Shared memory node
|
/// Shared memory node
|
||||||
class SmemNode final {
|
class SmemNode final {
|
||||||
public:
|
public:
|
||||||
explicit SmemNode(Node address) : address{std::move(address)} {}
|
explicit SmemNode(Node address_) : address{std::move(address_)} {}
|
||||||
|
|
||||||
const Node& GetAddress() const {
|
const Node& GetAddress() const {
|
||||||
return address;
|
return address;
|
||||||
|
@ -662,9 +664,9 @@ private:
|
||||||
/// Global memory node
|
/// Global memory node
|
||||||
class GmemNode final {
|
class GmemNode final {
|
||||||
public:
|
public:
|
||||||
explicit GmemNode(Node real_address, Node base_address, const GlobalMemoryBase& descriptor)
|
explicit GmemNode(Node real_address_, Node base_address_, const GlobalMemoryBase& descriptor_)
|
||||||
: real_address{std::move(real_address)}, base_address{std::move(base_address)},
|
: real_address{std::move(real_address_)}, base_address{std::move(base_address_)},
|
||||||
descriptor{descriptor} {}
|
descriptor{descriptor_} {}
|
||||||
|
|
||||||
const Node& GetRealAddress() const {
|
const Node& GetRealAddress() const {
|
||||||
return real_address;
|
return real_address;
|
||||||
|
@ -687,7 +689,7 @@ private:
|
||||||
/// Commentary, can be dropped
|
/// Commentary, can be dropped
|
||||||
class CommentNode final {
|
class CommentNode final {
|
||||||
public:
|
public:
|
||||||
explicit CommentNode(std::string text) : text{std::move(text)} {}
|
explicit CommentNode(std::string text_) : text{std::move(text_)} {}
|
||||||
|
|
||||||
const std::string& GetText() const {
|
const std::string& GetText() const {
|
||||||
return text;
|
return text;
|
||||||
|
|
Loading…
Reference in a new issue