forked from ShuriZma/suyu
video_core: Address feedback
This commit is contained in:
parent
59b34b1d76
commit
21aff36459
|
@ -18,6 +18,8 @@ namespace VideoCommon::Shader {
|
||||||
using Tegra::Shader::Instruction;
|
using Tegra::Shader::Instruction;
|
||||||
using Tegra::Shader::OpCode;
|
using Tegra::Shader::OpCode;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
/// Merges exit method of two parallel branches.
|
/// Merges exit method of two parallel branches.
|
||||||
constexpr ExitMethod ParallelExit(ExitMethod a, ExitMethod b) {
|
constexpr ExitMethod ParallelExit(ExitMethod a, ExitMethod b) {
|
||||||
if (a == ExitMethod::Undetermined) {
|
if (a == ExitMethod::Undetermined) {
|
||||||
|
@ -43,6 +45,8 @@ constexpr bool IsSchedInstruction(u32 offset, u32 main_offset) {
|
||||||
return (absolute_offset % SchedPeriod) == 0;
|
return (absolute_offset % SchedPeriod) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void ShaderIR::Decode() {
|
void ShaderIR::Decode() {
|
||||||
std::memcpy(&header, program_code.data(), sizeof(Tegra::Shader::Header));
|
std::memcpy(&header, program_code.data(), sizeof(Tegra::Shader::Header));
|
||||||
|
|
||||||
|
|
|
@ -1354,7 +1354,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetSampler(const Sampler& sampler) const {
|
std::string GetSampler(const Sampler& sampler) const {
|
||||||
return GetDeclarationWithSuffix(sampler.GetIndex(), "sampler");
|
return GetDeclarationWithSuffix(static_cast<u32>(sampler.GetIndex()), "sampler");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetDeclarationWithSuffix(u32 index, const std::string& name) const {
|
std::string GetDeclarationWithSuffix(u32 index, const std::string& name) const {
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetHash() const {
|
u32 GetHash() const {
|
||||||
return (static_cast<u32>(stage) << 16) | GetIndex();
|
return (static_cast<u32>(stage) << 16) | static_cast<u32>(GetIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -196,8 +196,8 @@ public:
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 GetIndex() const {
|
std::size_t GetIndex() const {
|
||||||
return static_cast<u32>(index);
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tegra::Shader::TextureType GetType() const {
|
Tegra::Shader::TextureType GetType() const {
|
||||||
|
@ -478,7 +478,7 @@ private:
|
||||||
/// Global memory node
|
/// Global memory node
|
||||||
class GmemNode final {
|
class GmemNode final {
|
||||||
public:
|
public:
|
||||||
explicit GmemNode(Node address) : address{address} {}
|
explicit constexpr GmemNode(Node address) : address{address} {}
|
||||||
|
|
||||||
Node GetAddress() const {
|
Node GetAddress() const {
|
||||||
return address;
|
return address;
|
||||||
|
@ -498,7 +498,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::string text;
|
std::string text;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ShaderIR final {
|
class ShaderIR final {
|
||||||
|
@ -706,33 +706,32 @@ private:
|
||||||
Node op_c, Node imm_lut);
|
Node op_c, Node imm_lut);
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
inline Node Operation(OperationCode code, const T*... operands) {
|
Node Operation(OperationCode code, const T*... operands) {
|
||||||
return StoreNode(OperationNode(code, operands...));
|
return StoreNode(OperationNode(code, operands...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
inline Node Operation(OperationCode code, Meta&& meta, const T*... operands) {
|
Node Operation(OperationCode code, Meta&& meta, const T*... operands) {
|
||||||
return StoreNode(OperationNode(code, std::move(meta), operands...));
|
return StoreNode(OperationNode(code, std::move(meta), operands...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
inline Node Operation(OperationCode code, std::vector<Node>&& operands) {
|
Node Operation(OperationCode code, std::vector<Node>&& operands) {
|
||||||
return StoreNode(OperationNode(code, std::move(operands)));
|
return StoreNode(OperationNode(code, std::move(operands)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
inline Node Operation(OperationCode code, Meta&& meta, std::vector<Node>&& operands) {
|
Node Operation(OperationCode code, Meta&& meta, std::vector<Node>&& operands) {
|
||||||
return StoreNode(OperationNode(code, std::move(meta), std::move(operands)));
|
return StoreNode(OperationNode(code, std::move(meta), std::move(operands)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
inline Node SignedOperation(OperationCode code, bool is_signed, const T*... operands) {
|
Node SignedOperation(OperationCode code, bool is_signed, const T*... operands) {
|
||||||
return StoreNode(OperationNode(SignedToUnsignedCode(code, is_signed), operands...));
|
return StoreNode(OperationNode(SignedToUnsignedCode(code, is_signed), operands...));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename... T>
|
template <typename... T>
|
||||||
inline Node SignedOperation(OperationCode code, bool is_signed, Meta&& meta,
|
Node SignedOperation(OperationCode code, bool is_signed, Meta&& meta, const T*... operands) {
|
||||||
const T*... operands) {
|
|
||||||
return StoreNode(
|
return StoreNode(
|
||||||
OperationNode(SignedToUnsignedCode(code, is_signed), std::move(meta), operands...));
|
OperationNode(SignedToUnsignedCode(code, is_signed), std::move(meta), operands...));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue