diff options
Diffstat (limited to '')
23 files changed, 138 insertions, 31 deletions
diff --git a/src/video_core/engines/shader_bytecode.h b/src/video_core/engines/shader_bytecode.h index 67194b0e3..a36df65f9 100644 --- a/src/video_core/engines/shader_bytecode.h +++ b/src/video_core/engines/shader_bytecode.h @@ -280,6 +280,19 @@ union Instruction { BitField<56, 1, u64> invert_b; } lop32i; + union { + BitField<28, 8, u64> imm_lut28; + BitField<48, 8, u64> imm_lut48; + + u32 GetImmLut28() const { + return static_cast<u32>(imm_lut28); + } + + u32 GetImmLut48() const { + return static_cast<u32>(imm_lut48); + } + } lop3; + u32 GetImm20_19() const { u32 imm{static_cast<u32>(imm20_19)}; imm <<= 12; @@ -650,6 +663,9 @@ public: LOP_R, LOP_IMM, LOP32I, + LOP3_C, + LOP3_R, + LOP3_IMM, MOV_C, MOV_R, MOV_IMM, @@ -872,6 +888,9 @@ private: INST("0101110001000---", Id::LOP_R, Type::ArithmeticInteger, "LOP_R"), INST("0011100001000---", Id::LOP_IMM, Type::ArithmeticInteger, "LOP_IMM"), INST("000001----------", Id::LOP32I, Type::ArithmeticIntegerImmediate, "LOP32I"), + INST("0000001---------", Id::LOP3_C, Type::ArithmeticInteger, "LOP3_C"), + INST("0101101111100---", Id::LOP3_R, Type::ArithmeticInteger, "LOP3_R"), + INST("0011110---------", Id::LOP3_IMM, Type::ArithmeticInteger, "LOP3_IMM"), INST("0100110001001---", Id::SHL_C, Type::Shift, "SHL_C"), INST("0101110001001---", Id::SHL_R, Type::Shift, "SHL_R"), INST("0011100-01001---", Id::SHL_IMM, Type::Shift, "SHL_IMM"), diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 3e5142bb1..516e1b50f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -25,6 +25,8 @@ #include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/video_core.h" +namespace OpenGL { + using Maxwell = Tegra::Engines::Maxwell3D::Regs; using PixelFormat = SurfaceParams::PixelFormat; using SurfaceType = SurfaceParams::SurfaceType; @@ -874,3 +876,5 @@ void RasterizerOpenGL::SyncLogicOpState() { state.logic_op.operation = MaxwellToGL::LogicOp(regs.logic_op.operation); } + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index f40e70bf4..59b727de0 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -22,12 +22,14 @@ #include "video_core/renderer_opengl/gl_state.h" #include "video_core/renderer_opengl/gl_stream_buffer.h" -struct ScreenInfo; - namespace Core::Frontend { class EmuWindow; } +namespace OpenGL { + +struct ScreenInfo; + class RasterizerOpenGL : public VideoCore::RasterizerInterface { public: explicit RasterizerOpenGL(Core::Frontend::EmuWindow& renderer, ScreenInfo& info); @@ -184,3 +186,5 @@ private: enum class AccelDraw { Disabled, Arrays, Indexed }; AccelDraw accelerate_draw = AccelDraw::Disabled; }; + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 817fa07a8..b1769c99b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp @@ -19,6 +19,8 @@ #include "video_core/textures/decoders.h" #include "video_core/utils.h" +namespace OpenGL { + using SurfaceType = SurfaceParams::SurfaceType; using PixelFormat = SurfaceParams::PixelFormat; using ComponentType = SurfaceParams::ComponentType; @@ -967,3 +969,5 @@ void RasterizerCacheOpenGL::UpdatePagesCachedCount(Tegra::GPUVAddr addr, u64 siz if (delta < 0) cached_pages.add({pages_interval, delta}); } + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h index 907e7d606..f273152a2 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h @@ -16,6 +16,8 @@ #include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/textures/texture.h" +namespace OpenGL { + class CachedSurface; using Surface = std::shared_ptr<CachedSurface>; using SurfaceSurfaceRect_Tuple = std::tuple<Surface, Surface, MathUtil::Rectangle<u32>>; @@ -759,3 +761,5 @@ private: OGLFramebuffer read_framebuffer; OGLFramebuffer draw_framebuffer; }; + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_resource_manager.h b/src/video_core/renderer_opengl/gl_resource_manager.h index 0fed93ca5..3bc1b83b5 100644 --- a/src/video_core/renderer_opengl/gl_resource_manager.h +++ b/src/video_core/renderer_opengl/gl_resource_manager.h @@ -10,6 +10,8 @@ #include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/gl_state.h" +namespace OpenGL { + class OGLTexture : private NonCopyable { public: OGLTexture() = default; @@ -331,3 +333,5 @@ public: GLuint handle = 0; }; + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index 5b976b636..94e318966 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -15,7 +15,7 @@ #include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_shader_decompiler.h" -namespace GLShader::Decompiler { +namespace OpenGL::GLShader::Decompiler { using Tegra::Shader::Attribute; using Tegra::Shader::Instruction; @@ -849,6 +849,33 @@ private: } } + void WriteLop3Instruction(Register dest, const std::string& op_a, const std::string& op_b, + const std::string& op_c, const std::string& imm_lut) { + if (dest == Tegra::Shader::Register::ZeroIndex) { + return; + } + + static constexpr std::array<const char*, 32> shift_amounts = { + "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", + "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", + "22", "23", "24", "25", "26", "27", "28", "29", "30", "31"}; + + std::string result; + result += '('; + + for (size_t i = 0; i < shift_amounts.size(); ++i) { + if (i) + result += '|'; + result += "(((" + imm_lut + " >> (((" + op_c + " >> " + shift_amounts[i] + + ") & 1) | ((" + op_b + " >> " + shift_amounts[i] + ") & 1) << 1 | ((" + op_a + + " >> " + shift_amounts[i] + ") & 1) << 2)) & 1) << " + shift_amounts[i] + ")"; + } + + result += ')'; + + regs.SetRegisterToInteger(dest, true, 0, result, 1, 1); + } + void WriteTexsInstruction(const Instruction& instr, const std::string& coord, const std::string& texture) { // Add an extra scope and declare the texture coords inside to prevent @@ -1297,6 +1324,20 @@ private: instr.alu.lop.pred_result_mode, instr.alu.lop.pred48); break; } + case OpCode::Id::LOP3_C: + case OpCode::Id::LOP3_R: + case OpCode::Id::LOP3_IMM: { + std::string op_c = regs.GetRegisterAsInteger(instr.gpr39); + std::string lut; + if (opcode->GetId() == OpCode::Id::LOP3_R) { + lut = '(' + std::to_string(instr.alu.lop3.GetImmLut28()) + ')'; + } else { + lut = '(' + std::to_string(instr.alu.lop3.GetImmLut48()) + ')'; + } + + WriteLop3Instruction(instr.gpr0, op_a, op_b, op_c, lut); + break; + } case OpCode::Id::IMNMX_C: case OpCode::Id::IMNMX_R: case OpCode::Id::IMNMX_IMM: { @@ -2176,4 +2217,4 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code, return boost::none; } -} // namespace GLShader::Decompiler +} // namespace OpenGL::GLShader::Decompiler diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.h b/src/video_core/renderer_opengl/gl_shader_decompiler.h index df6769462..b20cc4bfa 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.h +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.h @@ -12,7 +12,7 @@ #include "video_core/engines/maxwell_3d.h" #include "video_core/renderer_opengl/gl_shader_gen.h" -namespace GLShader::Decompiler { +namespace OpenGL::GLShader::Decompiler { using Tegra::Engines::Maxwell3D; @@ -22,4 +22,4 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code, Maxwell3D::Regs::ShaderStage stage, const std::string& suffix); -} // namespace GLShader::Decompiler +} // namespace OpenGL::GLShader::Decompiler diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 01c7b9720..0677317bc 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp @@ -7,7 +7,7 @@ #include "video_core/renderer_opengl/gl_shader_decompiler.h" #include "video_core/renderer_opengl/gl_shader_gen.h" -namespace GLShader { +namespace OpenGL::GLShader { using Tegra::Engines::Maxwell3D; @@ -103,4 +103,4 @@ void main() { return {out, program.second}; } -} // namespace GLShader +} // namespace OpenGL::GLShader diff --git a/src/video_core/renderer_opengl/gl_shader_gen.h b/src/video_core/renderer_opengl/gl_shader_gen.h index 4663411ac..4e5a6f130 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.h +++ b/src/video_core/renderer_opengl/gl_shader_gen.h @@ -13,7 +13,7 @@ #include "common/common_types.h" #include "common/hash.h" -namespace GLShader { +namespace OpenGL::GLShader { constexpr size_t MAX_PROGRAM_CODE_LENGTH{0x1000}; using ProgramCode = std::vector<u64>; @@ -196,20 +196,20 @@ ProgramResult GenerateVertexShader(const ShaderSetup& setup, const MaxwellVSConf */ ProgramResult GenerateFragmentShader(const ShaderSetup& setup, const MaxwellFSConfig& config); -} // namespace GLShader +} // namespace OpenGL::GLShader namespace std { template <> -struct hash<GLShader::MaxwellVSConfig> { - size_t operator()(const GLShader::MaxwellVSConfig& k) const { +struct hash<OpenGL::GLShader::MaxwellVSConfig> { + size_t operator()(const OpenGL::GLShader::MaxwellVSConfig& k) const { return k.Hash(); } }; template <> -struct hash<GLShader::MaxwellFSConfig> { - size_t operator()(const GLShader::MaxwellFSConfig& k) const { +struct hash<OpenGL::GLShader::MaxwellFSConfig> { + size_t operator()(const OpenGL::GLShader::MaxwellFSConfig& k) const { return k.Hash(); } }; diff --git a/src/video_core/renderer_opengl/gl_shader_manager.cpp b/src/video_core/renderer_opengl/gl_shader_manager.cpp index f0886caac..8960afef5 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.cpp +++ b/src/video_core/renderer_opengl/gl_shader_manager.cpp @@ -7,7 +7,7 @@ #include "video_core/engines/maxwell_3d.h" #include "video_core/renderer_opengl/gl_shader_manager.h" -namespace GLShader { +namespace OpenGL::GLShader { namespace Impl { static void SetShaderUniformBlockBinding(GLuint shader, const char* name, @@ -49,4 +49,4 @@ void MaxwellUniformData::SetFromRegs(const Maxwell3D::State::ShaderStageInfo& sh instance_id[0] = state.current_instance; } -} // namespace GLShader +} // namespace OpenGL::GLShader diff --git a/src/video_core/renderer_opengl/gl_shader_manager.h b/src/video_core/renderer_opengl/gl_shader_manager.h index 75fa73605..0e7085776 100644 --- a/src/video_core/renderer_opengl/gl_shader_manager.h +++ b/src/video_core/renderer_opengl/gl_shader_manager.h @@ -12,7 +12,7 @@ #include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/maxwell_to_gl.h" -namespace GLShader { +namespace OpenGL::GLShader { /// Number of OpenGL texture samplers that can be used in the fragment shader static constexpr size_t NumTextureSamplers = 32; @@ -171,4 +171,4 @@ private: OGLPipeline pipeline; }; -} // namespace GLShader +} // namespace OpenGL::GLShader diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp index 3c087d638..5781d9d16 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.cpp +++ b/src/video_core/renderer_opengl/gl_shader_util.cpp @@ -8,7 +8,7 @@ #include "common/logging/log.h" #include "video_core/renderer_opengl/gl_shader_util.h" -namespace GLShader { +namespace OpenGL::GLShader { GLuint LoadShader(const char* source, GLenum type) { const char* debug_type; @@ -47,4 +47,4 @@ GLuint LoadShader(const char* source, GLenum type) { return shader_id; } -} // namespace GLShader +} // namespace OpenGL::GLShader diff --git a/src/video_core/renderer_opengl/gl_shader_util.h b/src/video_core/renderer_opengl/gl_shader_util.h index 0e4d782e2..285594f50 100644 --- a/src/video_core/renderer_opengl/gl_shader_util.h +++ b/src/video_core/renderer_opengl/gl_shader_util.h @@ -10,7 +10,7 @@ #include "common/assert.h" #include "common/logging/log.h" -namespace GLShader { +namespace OpenGL::GLShader { /** * Utility function to log the source code of a list of shaders. @@ -89,4 +89,4 @@ GLuint LoadProgram(bool separable_program, T... shaders) { return program_id; } -} // namespace GLShader +} // namespace OpenGL::GLShader diff --git a/src/video_core/renderer_opengl/gl_state.cpp b/src/video_core/renderer_opengl/gl_state.cpp index 13399ceb8..e1a887d67 100644 --- a/src/video_core/renderer_opengl/gl_state.cpp +++ b/src/video_core/renderer_opengl/gl_state.cpp @@ -7,6 +7,8 @@ #include "common/logging/log.h" #include "video_core/renderer_opengl/gl_state.h" +namespace OpenGL { + OpenGLState OpenGLState::cur_state; OpenGLState::OpenGLState() { @@ -338,3 +340,5 @@ OpenGLState& OpenGLState::ResetFramebuffer(GLuint handle) { } return *this; } + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_state.h b/src/video_core/renderer_opengl/gl_state.h index 219b65a8a..22b0b1e41 100644 --- a/src/video_core/renderer_opengl/gl_state.h +++ b/src/video_core/renderer_opengl/gl_state.h @@ -9,6 +9,8 @@ #include "video_core/engines/maxwell_3d.h" +namespace OpenGL { + using Regs = Tegra::Engines::Maxwell3D::Regs; namespace TextureUnits { @@ -163,3 +165,5 @@ public: private: static OpenGLState cur_state; }; + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_stream_buffer.cpp b/src/video_core/renderer_opengl/gl_stream_buffer.cpp index 03a8ed8b7..e565afcee 100644 --- a/src/video_core/renderer_opengl/gl_stream_buffer.cpp +++ b/src/video_core/renderer_opengl/gl_stream_buffer.cpp @@ -9,6 +9,8 @@ #include "video_core/renderer_opengl/gl_state.h" #include "video_core/renderer_opengl/gl_stream_buffer.h" +namespace OpenGL { + OGLStreamBuffer::OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent) : gl_target(target), buffer_size(size) { gl_buffer.Create(); @@ -97,3 +99,5 @@ void OGLStreamBuffer::Unmap(GLsizeiptr size) { buffer_pos += size; } + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_stream_buffer.h b/src/video_core/renderer_opengl/gl_stream_buffer.h index 3b0cdf6bc..ae7961bd7 100644 --- a/src/video_core/renderer_opengl/gl_stream_buffer.h +++ b/src/video_core/renderer_opengl/gl_stream_buffer.h @@ -9,6 +9,8 @@ #include "common/common_types.h" #include "video_core/renderer_opengl/gl_resource_manager.h" +namespace OpenGL { + class OGLStreamBuffer : private NonCopyable { public: explicit OGLStreamBuffer(GLenum target, GLsizeiptr size, bool prefer_coherent = false); @@ -42,3 +44,5 @@ private: GLsizeiptr mapped_size = 0; u8* mapped_ptr = nullptr; }; + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 0d55b3e17..0343759a6 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -10,6 +10,8 @@ #include "common/logging/log.h" #include "video_core/engines/maxwell_3d.h" +namespace OpenGL { + using GLvec2 = std::array<GLfloat, 2>; using GLvec3 = std::array<GLfloat, 3>; using GLvec4 = std::array<GLfloat, 4>; @@ -360,3 +362,4 @@ inline GLenum LogicOp(Maxwell::LogicOperation operation) { } } // namespace MaxwellToGL +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index eef13dddc..73d6419b4 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -20,6 +20,8 @@ #include "video_core/renderer_opengl/renderer_opengl.h" #include "video_core/utils.h" +namespace OpenGL { + static const char vertex_shader[] = R"( #version 150 core @@ -476,3 +478,5 @@ bool RendererOpenGL::Init() { /// Shutdown the renderer void RendererOpenGL::ShutDown() {} + +} // namespace OpenGL diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 7ae103f04..961467a62 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h @@ -16,6 +16,8 @@ namespace Core::Frontend { class EmuWindow; } +namespace OpenGL { + /// Structure used for storing information about the textures for the Switch screen struct TextureInfo { OGLTexture resource; @@ -98,3 +100,5 @@ private: Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags; MathUtil::Rectangle<int> framebuffer_crop_rect; }; + +} // namespace OpenGL diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 6780d1c16..07e3a7d24 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -10,7 +10,7 @@ namespace VideoCore { std::unique_ptr<RendererBase> CreateRenderer(Core::Frontend::EmuWindow& emu_window) { - return std::make_unique<RendererOpenGL>(emu_window); + return std::make_unique<OpenGL::RendererOpenGL>(emu_window); } } // namespace VideoCore diff --git a/src/yuzu/configuration/configure_input.ui b/src/yuzu/configuration/configure_input.ui index 377b79c77..8b9c44b8b 100644 --- a/src/yuzu/configuration/configure_input.ui +++ b/src/yuzu/configuration/configure_input.ui @@ -29,16 +29,16 @@ </property> <layout class="QGridLayout" name="gridLayout_6"> <item row="0" column="0"> - <layout class="QVBoxLayout" name="buttonMiscPlusVerticalLayout"> + <layout class="QVBoxLayout" name="buttonMiscMinusVerticalLayout"> <item> - <widget class="QLabel" name="labelPlus"> + <widget class="QLabel" name="labelMinus"> <property name="text"> - <string>Plus:</string> + <string>Minus:</string> </property> </widget> </item> <item> - <widget class="QPushButton" name="buttonPlus"> + <widget class="QPushButton" name="buttonMinus"> <property name="text"> <string/> </property> @@ -47,16 +47,16 @@ </layout> </item> <item row="0" column="1"> - <layout class="QVBoxLayout" name="buttonMiscMinusVerticalLayout"> + <layout class="QVBoxLayout" name="buttonMiscPlusVerticalLayout"> <item> - <widget class="QLabel" name="labelMinus"> + <widget class="QLabel" name="labelPlus"> <property name="text"> - <string>Minus:</string> + <string>Plus:</string> </property> </widget> </item> <item> - <widget class="QPushButton" name="buttonMinus"> + <widget class="QPushButton" name="buttonPlus"> <property name="text"> <string/> </property> |