yuzu-emu
/
yuzu
Archived
1
0
Fork 0

VideoCore: Split regs.h inclusions

This commit is contained in:
Yuri Kunde Schlesner 2017-01-28 15:12:09 -08:00
parent f241bb72f5
commit 60fc0b086f
14 changed files with 47 additions and 25 deletions

View File

@ -17,7 +17,8 @@
#include "core/hw/gpu.h" #include "core/hw/gpu.h"
#include "core/memory.h" #include "core/memory.h"
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/regs.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_texturing.h"
#include "video_core/texture/texture_decode.h" #include "video_core/texture/texture_decode.h"
#include "video_core/utils.h" #include "video_core/utils.h"

View File

@ -15,7 +15,6 @@
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/pica_types.h" #include "video_core/pica_types.h"
#include "video_core/rasterizer.h" #include "video_core/rasterizer.h"
#include "video_core/regs.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
using Pica::Rasterizer::Vertex; using Pica::Rasterizer::Vertex;

View File

@ -21,6 +21,8 @@
#include "video_core/primitive_assembly.h" #include "video_core/primitive_assembly.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/regs.h" #include "video_core/regs.h"
#include "video_core/regs_pipeline.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
#include "video_core/vertex_loader.h" #include "video_core/vertex_loader.h"

View File

@ -32,7 +32,9 @@
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/pica_types.h" #include "video_core/pica_types.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/regs.h" #include "video_core/regs_rasterizer.h"
#include "video_core/regs_shader.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_base.h" #include "video_core/renderer_base.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
#include "video_core/texture/texture_decode.h" #include "video_core/texture/texture_decode.h"

View File

@ -17,7 +17,9 @@
#include <vector> #include <vector>
#include "common/common_types.h" #include "common/common_types.h"
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/regs.h" #include "video_core/regs_rasterizer.h"
#include "video_core/regs_shader.h"
#include "video_core/regs_texturing.h"
namespace CiTrace { namespace CiTrace {
class Recorder; class Recorder;

View File

@ -5,7 +5,7 @@
#include <cstring> #include <cstring>
#include "video_core/pica.h" #include "video_core/pica.h"
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/regs.h" #include "video_core/regs_pipeline.h"
namespace Pica { namespace Pica {

View File

@ -19,7 +19,9 @@
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/pica_types.h" #include "video_core/pica_types.h"
#include "video_core/rasterizer.h" #include "video_core/rasterizer.h"
#include "video_core/regs.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_rasterizer.h"
#include "video_core/regs_texturing.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
#include "video_core/texture/texture_decode.h" #include "video_core/texture/texture_decode.h"
#include "video_core/utils.h" #include "video_core/utils.h"

View File

@ -15,7 +15,9 @@
#include "common/vector_math.h" #include "common/vector_math.h"
#include "core/hw/gpu.h" #include "core/hw/gpu.h"
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/regs.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_rasterizer.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/gl_shader_util.h"

View File

@ -19,7 +19,10 @@
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/pica_types.h" #include "video_core/pica_types.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
#include "video_core/regs.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_lighting.h"
#include "video_core/regs_rasterizer.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_opengl/gl_rasterizer_cache.h" #include "video_core/renderer_opengl/gl_rasterizer_cache.h"
#include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_state.h" #include "video_core/renderer_opengl/gl_state.h"

View File

@ -21,7 +21,8 @@
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hw/gpu.h" #include "core/hw/gpu.h"
#include "video_core/regs.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_opengl/gl_resource_manager.h" #include "video_core/renderer_opengl/gl_resource_manager.h"
namespace MathUtil { namespace MathUtil {

View File

@ -7,15 +7,19 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/bit_field.h" #include "common/bit_field.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "video_core/regs.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_lighting.h"
#include "video_core/regs_rasterizer.h"
#include "video_core/regs_texturing.h"
#include "video_core/renderer_opengl/gl_rasterizer.h" #include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/gl_shader_gen.h" #include "video_core/renderer_opengl/gl_shader_gen.h"
#include "video_core/renderer_opengl/gl_shader_util.h" #include "video_core/renderer_opengl/gl_shader_util.h"
using Pica::Regs; using Pica::FramebufferRegs;
using Pica::RasterizerRegs;
using Pica::LightingRegs; using Pica::LightingRegs;
using TevStageConfig = Pica::TexturingRegs::TevStageConfig; using Pica::RasterizerRegs;
using Pica::TexturingRegs;
using TevStageConfig = TexturingRegs::TevStageConfig;
namespace GLShader { namespace GLShader {
@ -48,10 +52,10 @@ static void AppendSource(std::string& out, const PicaShaderConfig& config,
case Source::Texture0: case Source::Texture0:
// Only unit 0 respects the texturing type (according to 3DBrew) // Only unit 0 respects the texturing type (according to 3DBrew)
switch (state.texture0_type) { switch (state.texture0_type) {
case Pica::TexturingRegs::TextureConfig::Texture2D: case TexturingRegs::TextureConfig::Texture2D:
out += "texture(tex[0], texcoord[0])"; out += "texture(tex[0], texcoord[0])";
break; break;
case Pica::TexturingRegs::TextureConfig::Projection2D: case TexturingRegs::TextureConfig::Projection2D:
out += "textureProj(tex[0], vec3(texcoord[0], texcoord0_w))"; out += "textureProj(tex[0], vec3(texcoord[0], texcoord0_w))";
break; break;
default: default:
@ -278,8 +282,8 @@ static void AppendAlphaCombiner(std::string& out, TevStageConfig::Operation oper
} }
/// Writes the if-statement condition used to evaluate alpha testing /// Writes the if-statement condition used to evaluate alpha testing
static void AppendAlphaTestCondition(std::string& out, Pica::FramebufferRegs::CompareFunc func) { static void AppendAlphaTestCondition(std::string& out, FramebufferRegs::CompareFunc func) {
using CompareFunc = Pica::FramebufferRegs::CompareFunc; using CompareFunc = FramebufferRegs::CompareFunc;
switch (func) { switch (func) {
case CompareFunc::Never: case CompareFunc::Never:
out += "true"; out += "true";
@ -309,7 +313,7 @@ static void AppendAlphaTestCondition(std::string& out, Pica::FramebufferRegs::Co
/// Writes the code to emulate the specified TEV stage /// Writes the code to emulate the specified TEV stage
static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsigned index) { static void WriteTevStage(std::string& out, const PicaShaderConfig& config, unsigned index) {
const auto stage = const auto stage =
static_cast<const Pica::TexturingRegs::TevStageConfig>(config.state.tev_stages[index]); static_cast<const TexturingRegs::TevStageConfig>(config.state.tev_stages[index]);
if (!IsPassThroughTevStage(stage)) { if (!IsPassThroughTevStage(stage)) {
std::string index_name = std::to_string(index); std::string index_name = std::to_string(index);
@ -642,7 +646,7 @@ vec4 secondary_fragment_color = vec4(0.0);
)"; )";
// Do not do any sort of processing if it's obvious we're not going to pass the alpha test // Do not do any sort of processing if it's obvious we're not going to pass the alpha test
if (state.alpha_test_func == Pica::FramebufferRegs::CompareFunc::Never) { if (state.alpha_test_func == FramebufferRegs::CompareFunc::Never) {
out += "discard; }"; out += "discard; }";
return out; return out;
} }
@ -661,7 +665,7 @@ vec4 secondary_fragment_color = vec4(0.0);
out += "float z_over_w = 1.0 - gl_FragCoord.z * 2.0;\n"; out += "float z_over_w = 1.0 - gl_FragCoord.z * 2.0;\n";
out += "float depth = z_over_w * depth_scale + depth_offset;\n"; out += "float depth = z_over_w * depth_scale + depth_offset;\n";
if (state.depthmap_enable == Pica::RasterizerRegs::DepthBuffering::WBuffering) { if (state.depthmap_enable == RasterizerRegs::DepthBuffering::WBuffering) {
out += "depth /= gl_FragCoord.w;\n"; out += "depth /= gl_FragCoord.w;\n";
} }
@ -675,14 +679,14 @@ vec4 secondary_fragment_color = vec4(0.0);
for (size_t index = 0; index < state.tev_stages.size(); ++index) for (size_t index = 0; index < state.tev_stages.size(); ++index)
WriteTevStage(out, config, (unsigned)index); WriteTevStage(out, config, (unsigned)index);
if (state.alpha_test_func != Pica::FramebufferRegs::CompareFunc::Always) { if (state.alpha_test_func != FramebufferRegs::CompareFunc::Always) {
out += "if ("; out += "if (";
AppendAlphaTestCondition(out, state.alpha_test_func); AppendAlphaTestCondition(out, state.alpha_test_func);
out += ") discard;\n"; out += ") discard;\n";
} }
// Append fog combiner // Append fog combiner
if (state.fog_mode == Pica::TexturingRegs::FogMode::Fog) { if (state.fog_mode == TexturingRegs::FogMode::Fog) {
// Get index into fog LUT // Get index into fog LUT
if (state.fog_flip) { if (state.fog_flip) {
out += "float fog_index = (1.0 - depth) * 128.0;\n"; out += "float fog_index = (1.0 - depth) * 128.0;\n";

View File

@ -12,7 +12,9 @@
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "video_core/regs.h" #include "video_core/regs_framebuffer.h"
#include "video_core/regs_lighting.h"
#include "video_core/regs_texturing.h"
using GLvec2 = std::array<GLfloat, 2>; using GLvec2 = std::array<GLfloat, 2>;
using GLvec3 = std::array<GLfloat, 3>; using GLvec3 = std::array<GLfloat, 3>;

View File

@ -8,7 +8,8 @@
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/microprofile.h" #include "common/microprofile.h"
#include "video_core/pica_state.h" #include "video_core/pica_state.h"
#include "video_core/regs.h" #include "video_core/regs_rasterizer.h"
#include "video_core/regs_shader.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
#include "video_core/shader/shader_interpreter.h" #include "video_core/shader/shader_interpreter.h"
#ifdef ARCHITECTURE_x86_64 #ifdef ARCHITECTURE_x86_64

View File

@ -13,7 +13,8 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "common/vector_math.h" #include "common/vector_math.h"
#include "video_core/pica_types.h" #include "video_core/pica_types.h"
#include "video_core/regs.h" #include "video_core/regs_rasterizer.h"
#include "video_core/regs_shader.h"
using nihstro::RegisterType; using nihstro::RegisterType;
using nihstro::SourceRegister; using nihstro::SourceRegister;