summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-21 07:39:46 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:52 +0100
commit21aff36459f73ddb96a7909b6094e4f9c5b9c3fb (patch)
tree35cf1ee84b320a77029c79093f911a975f71c9f9 /src/video_core
parentshader_ir: Fixup file inclusions and clang-format (diff)
downloadyuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar
yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar.gz
yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar.bz2
yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar.lz
yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar.xz
yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar.zst
yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/shader/decode.cpp4
-rw-r--r--src/video_core/shader/glsl_decompiler.cpp2
-rw-r--r--src/video_core/shader/glsl_decompiler.h2
-rw-r--r--src/video_core/shader/shader_ir.h21
4 files changed, 16 insertions, 13 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp
index a07656c7c..722b32ff1 100644
--- a/src/video_core/shader/decode.cpp
+++ b/src/video_core/shader/decode.cpp
@@ -18,6 +18,8 @@ namespace VideoCommon::Shader {
using Tegra::Shader::Instruction;
using Tegra::Shader::OpCode;
+namespace {
+
/// Merges exit method of two parallel branches.
constexpr ExitMethod ParallelExit(ExitMethod a, ExitMethod b) {
if (a == ExitMethod::Undetermined) {
@@ -43,6 +45,8 @@ constexpr bool IsSchedInstruction(u32 offset, u32 main_offset) {
return (absolute_offset % SchedPeriod) == 0;
}
+} // namespace
+
void ShaderIR::Decode() {
std::memcpy(&header, program_code.data(), sizeof(Tegra::Shader::Header));
diff --git a/src/video_core/shader/glsl_decompiler.cpp b/src/video_core/shader/glsl_decompiler.cpp
index 46a48652d..86a29f812 100644
--- a/src/video_core/shader/glsl_decompiler.cpp
+++ b/src/video_core/shader/glsl_decompiler.cpp
@@ -1354,7 +1354,7 @@ private:
}
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 {
diff --git a/src/video_core/shader/glsl_decompiler.h b/src/video_core/shader/glsl_decompiler.h
index 7be461f1b..396a560d8 100644
--- a/src/video_core/shader/glsl_decompiler.h
+++ b/src/video_core/shader/glsl_decompiler.h
@@ -63,7 +63,7 @@ public:
}
u32 GetHash() const {
- return (static_cast<u32>(stage) << 16) | GetIndex();
+ return (static_cast<u32>(stage) << 16) | static_cast<u32>(GetIndex());
}
private:
diff --git a/src/video_core/shader/shader_ir.h b/src/video_core/shader/shader_ir.h
index fc41b7de3..b1083c4a0 100644
--- a/src/video_core/shader/shader_ir.h
+++ b/src/video_core/shader/shader_ir.h
@@ -196,8 +196,8 @@ public:
return offset;
}
- u32 GetIndex() const {
- return static_cast<u32>(index);
+ std::size_t GetIndex() const {
+ return index;
}
Tegra::Shader::TextureType GetType() const {
@@ -478,7 +478,7 @@ private:
/// Global memory node
class GmemNode final {
public:
- explicit GmemNode(Node address) : address{address} {}
+ explicit constexpr GmemNode(Node address) : address{address} {}
Node GetAddress() const {
return address;
@@ -498,7 +498,7 @@ public:
}
private:
- const std::string text;
+ std::string text;
};
class ShaderIR final {
@@ -706,33 +706,32 @@ private:
Node op_c, Node imm_lut);
template <typename... T>
- inline Node Operation(OperationCode code, const T*... operands) {
+ Node Operation(OperationCode code, const T*... operands) {
return StoreNode(OperationNode(code, operands...));
}
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...));
}
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)));
}
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)));
}
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...));
}
template <typename... T>
- inline Node SignedOperation(OperationCode code, bool is_signed, Meta&& meta,
- const T*... operands) {
+ Node SignedOperation(OperationCode code, bool is_signed, Meta&& meta, const T*... operands) {
return StoreNode(
OperationNode(SignedToUnsignedCode(code, is_signed), std::move(meta), operands...));
}