diff options
author | bunnei <bunneidev@gmail.com> | 2018-03-19 23:51:43 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2018-03-20 04:14:03 +0100 |
commit | 4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df (patch) | |
tree | 4b44ac0965df8e1488c2931d1269bab459cfacf6 /src/video_core | |
parent | renderer_gl: Port over gl_rasterizer_cache module from Citra. (diff) | |
download | yuzu-4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df.tar yuzu-4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df.tar.gz yuzu-4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df.tar.bz2 yuzu-4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df.tar.lz yuzu-4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df.tar.xz yuzu-4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df.tar.zst yuzu-4bdb46e4c2bbdbb4f0a8480a74ee9887fa1995df.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 58 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.h | 27 |
3 files changed, 87 insertions, 0 deletions
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 92951a7e1..cce29231f 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -16,6 +16,8 @@ add_library(video_core STATIC renderer_opengl/gl_rasterizer_cache.cpp renderer_opengl/gl_rasterizer_cache.h renderer_opengl/gl_resource_manager.h + renderer_opengl/gl_shader_decompiler.cpp + renderer_opengl/gl_shader_decompiler.h renderer_opengl/gl_shader_util.cpp renderer_opengl/gl_shader_util.h renderer_opengl/gl_state.cpp diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp new file mode 100644 index 000000000..0e0ef18cc --- /dev/null +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -0,0 +1,58 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <string> +#include <queue> +#include "common/assert.h" +#include "common/common_types.h" +#include "video_core/renderer_opengl/gl_shader_decompiler.h" + +namespace Maxwell3D { +namespace Shader { +namespace Decompiler { + +constexpr u32 PROGRAM_END = MAX_PROGRAM_CODE_LENGTH; + +class Impl { +public: + Impl(const std::array<u32, MAX_PROGRAM_CODE_LENGTH>& program_code, + const std::array<u32, MAX_SWIZZLE_DATA_LENGTH>& swizzle_data, u32 main_offset, + const std::function<std::string(u32)>& inputreg_getter, + const std::function<std::string(u32)>& outputreg_getter, bool sanitize_mul, + const std::string& emit_cb, const std::string& setemit_cb) + : program_code(program_code), swizzle_data(swizzle_data), main_offset(main_offset), + inputreg_getter(inputreg_getter), outputreg_getter(outputreg_getter), + sanitize_mul(sanitize_mul), emit_cb(emit_cb), setemit_cb(setemit_cb) {} + + std::string Decompile() { + UNIMPLEMENTED(); + return {}; + } + +private: + const std::array<u32, MAX_PROGRAM_CODE_LENGTH>& program_code; + const std::array<u32, MAX_SWIZZLE_DATA_LENGTH>& swizzle_data; + u32 main_offset; + const std::function<std::string(u32)>& inputreg_getter; + const std::function<std::string(u32)>& outputreg_getter; + bool sanitize_mul; + const std::string& emit_cb; + const std::string& setemit_cb; +}; + +std::string DecompileProgram(const std::array<u32, MAX_PROGRAM_CODE_LENGTH>& program_code, + const std::array<u32, MAX_SWIZZLE_DATA_LENGTH>& swizzle_data, + u32 main_offset, + const std::function<std::string(u32)>& inputreg_getter, + const std::function<std::string(u32)>& outputreg_getter, + bool sanitize_mul, const std::string& emit_cb, + const std::string& setemit_cb) { + Impl impl(program_code, swizzle_data, main_offset, inputreg_getter, outputreg_getter, + sanitize_mul, emit_cb, setemit_cb); + return impl.Decompile(); +} + +} // namespace Decompiler +} // namespace Shader +} // namespace Maxwell3D diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.h b/src/video_core/renderer_opengl/gl_shader_decompiler.h new file mode 100644 index 000000000..02ebfcbe8 --- /dev/null +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.h @@ -0,0 +1,27 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <array> +#include <functional> +#include <string> +#include "common/common_types.h" + +namespace Maxwell3D { +namespace Shader { +namespace Decompiler { + +constexpr size_t MAX_PROGRAM_CODE_LENGTH{0x100000}; +constexpr size_t MAX_SWIZZLE_DATA_LENGTH{0x100000}; + +std::string DecompileProgram(const std::array<u32, MAX_PROGRAM_CODE_LENGTH>& program_code, + const std::array<u32, MAX_SWIZZLE_DATA_LENGTH>& swizzle_data, + u32 main_offset, + const std::function<std::string(u32)>& inputreg_getter, + const std::function<std::string(u32)>& outputreg_getter, + bool sanitize_mul, const std::string& emit_cb = "", + const std::string& setemit_cb = ""); + +} // namespace Decompiler +} // namespace Shader +} // namespace Maxwell3D |