diff options
| author | 2018-12-21 03:39:46 -0300 | |
|---|---|---|
| committer | 2019-01-15 17:54:52 -0300 | |
| commit | 21aff36459f73ddb96a7909b6094e4f9c5b9c3fb (patch) | |
| tree | 35cf1ee84b320a77029c79093f911a975f71c9f9 /src | |
| parent | shader_ir: Fixup file inclusions and clang-format (diff) | |
| download | yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar.gz yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.tar.xz yuzu-21aff36459f73ddb96a7909b6094e4f9c5b9c3fb.zip | |
video_core: Address feedback
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/shader/decode.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/shader/glsl_decompiler.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/shader/glsl_decompiler.h | 2 | ||||
| -rw-r--r-- | src/video_core/shader/shader_ir.h | 21 |
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 { | |||
| 18 | using Tegra::Shader::Instruction; | 18 | using Tegra::Shader::Instruction; |
| 19 | using Tegra::Shader::OpCode; | 19 | using Tegra::Shader::OpCode; |
| 20 | 20 | ||
| 21 | namespace { | ||
| 22 | |||
| 21 | /// Merges exit method of two parallel branches. | 23 | /// Merges exit method of two parallel branches. |
| 22 | constexpr ExitMethod ParallelExit(ExitMethod a, ExitMethod b) { | 24 | constexpr ExitMethod ParallelExit(ExitMethod a, ExitMethod b) { |
| 23 | if (a == ExitMethod::Undetermined) { | 25 | if (a == ExitMethod::Undetermined) { |
| @@ -43,6 +45,8 @@ constexpr bool IsSchedInstruction(u32 offset, u32 main_offset) { | |||
| 43 | return (absolute_offset % SchedPeriod) == 0; | 45 | return (absolute_offset % SchedPeriod) == 0; |
| 44 | } | 46 | } |
| 45 | 47 | ||
| 48 | } // namespace | ||
| 49 | |||
| 46 | void ShaderIR::Decode() { | 50 | void ShaderIR::Decode() { |
| 47 | std::memcpy(&header, program_code.data(), sizeof(Tegra::Shader::Header)); | 51 | std::memcpy(&header, program_code.data(), sizeof(Tegra::Shader::Header)); |
| 48 | 52 | ||
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: | |||
| 1354 | } | 1354 | } |
| 1355 | 1355 | ||
| 1356 | std::string GetSampler(const Sampler& sampler) const { | 1356 | std::string GetSampler(const Sampler& sampler) const { |
| 1357 | return GetDeclarationWithSuffix(sampler.GetIndex(), "sampler"); | 1357 | return GetDeclarationWithSuffix(static_cast<u32>(sampler.GetIndex()), "sampler"); |
| 1358 | } | 1358 | } |
| 1359 | 1359 | ||
| 1360 | std::string GetDeclarationWithSuffix(u32 index, const std::string& name) const { | 1360 | 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: | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | u32 GetHash() const { | 65 | u32 GetHash() const { |
| 66 | return (static_cast<u32>(stage) << 16) | GetIndex(); | 66 | return (static_cast<u32>(stage) << 16) | static_cast<u32>(GetIndex()); |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | private: | 69 | 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: | |||
| 196 | return offset; | 196 | return offset; |
| 197 | } | 197 | } |
| 198 | 198 | ||
| 199 | u32 GetIndex() const { | 199 | std::size_t GetIndex() const { |
| 200 | return static_cast<u32>(index); | 200 | return index; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | Tegra::Shader::TextureType GetType() const { | 203 | Tegra::Shader::TextureType GetType() const { |
| @@ -478,7 +478,7 @@ private: | |||
| 478 | /// Global memory node | 478 | /// Global memory node |
| 479 | class GmemNode final { | 479 | class GmemNode final { |
| 480 | public: | 480 | public: |
| 481 | explicit GmemNode(Node address) : address{address} {} | 481 | explicit constexpr GmemNode(Node address) : address{address} {} |
| 482 | 482 | ||
| 483 | Node GetAddress() const { | 483 | Node GetAddress() const { |
| 484 | return address; | 484 | return address; |
| @@ -498,7 +498,7 @@ public: | |||
| 498 | } | 498 | } |
| 499 | 499 | ||
| 500 | private: | 500 | private: |
| 501 | const std::string text; | 501 | std::string text; |
| 502 | }; | 502 | }; |
| 503 | 503 | ||
| 504 | class ShaderIR final { | 504 | class ShaderIR final { |
| @@ -706,33 +706,32 @@ private: | |||
| 706 | Node op_c, Node imm_lut); | 706 | Node op_c, Node imm_lut); |
| 707 | 707 | ||
| 708 | template <typename... T> | 708 | template <typename... T> |
| 709 | inline Node Operation(OperationCode code, const T*... operands) { | 709 | Node Operation(OperationCode code, const T*... operands) { |
| 710 | return StoreNode(OperationNode(code, operands...)); | 710 | return StoreNode(OperationNode(code, operands...)); |
| 711 | } | 711 | } |
| 712 | 712 | ||
| 713 | template <typename... T> | 713 | template <typename... T> |
| 714 | inline Node Operation(OperationCode code, Meta&& meta, const T*... operands) { | 714 | Node Operation(OperationCode code, Meta&& meta, const T*... operands) { |
| 715 | return StoreNode(OperationNode(code, std::move(meta), operands...)); | 715 | return StoreNode(OperationNode(code, std::move(meta), operands...)); |
| 716 | } | 716 | } |
| 717 | 717 | ||
| 718 | template <typename... T> | 718 | template <typename... T> |
| 719 | inline Node Operation(OperationCode code, std::vector<Node>&& operands) { | 719 | Node Operation(OperationCode code, std::vector<Node>&& operands) { |
| 720 | return StoreNode(OperationNode(code, std::move(operands))); | 720 | return StoreNode(OperationNode(code, std::move(operands))); |
| 721 | } | 721 | } |
| 722 | 722 | ||
| 723 | template <typename... T> | 723 | template <typename... T> |
| 724 | inline Node Operation(OperationCode code, Meta&& meta, std::vector<Node>&& operands) { | 724 | Node Operation(OperationCode code, Meta&& meta, std::vector<Node>&& operands) { |
| 725 | return StoreNode(OperationNode(code, std::move(meta), std::move(operands))); | 725 | return StoreNode(OperationNode(code, std::move(meta), std::move(operands))); |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | template <typename... T> | 728 | template <typename... T> |
| 729 | inline Node SignedOperation(OperationCode code, bool is_signed, const T*... operands) { | 729 | Node SignedOperation(OperationCode code, bool is_signed, const T*... operands) { |
| 730 | return StoreNode(OperationNode(SignedToUnsignedCode(code, is_signed), operands...)); | 730 | return StoreNode(OperationNode(SignedToUnsignedCode(code, is_signed), operands...)); |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | template <typename... T> | 733 | template <typename... T> |
| 734 | inline Node SignedOperation(OperationCode code, bool is_signed, Meta&& meta, | 734 | Node SignedOperation(OperationCode code, bool is_signed, Meta&& meta, const T*... operands) { |
| 735 | const T*... operands) { | ||
| 736 | return StoreNode( | 735 | return StoreNode( |
| 737 | OperationNode(SignedToUnsignedCode(code, is_signed), std::move(meta), operands...)); | 736 | OperationNode(SignedToUnsignedCode(code, is_signed), std::move(meta), operands...)); |
| 738 | } | 737 | } |