mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-23 08:25:47 +01:00
GPU: Refactor "VertexShader" namespace to "Shader".
- Also renames "vertex_shader.*" to "shader_interpreter.*"
This commit is contained in:
parent
cebf245504
commit
642b9b5030
@ -8,7 +8,7 @@
|
||||
#include <QBoxLayout>
|
||||
#include <QTreeView>
|
||||
|
||||
#include "video_core/vertex_shader.h"
|
||||
#include "video_core/shader_interpreter.h"
|
||||
|
||||
#include "graphics_vertex_shader.h"
|
||||
|
||||
|
@ -11,8 +11,8 @@ set(SRCS
|
||||
pica.cpp
|
||||
primitive_assembly.cpp
|
||||
rasterizer.cpp
|
||||
shader_interpreter.cpp
|
||||
utils.cpp
|
||||
vertex_shader.cpp
|
||||
video_core.cpp
|
||||
)
|
||||
|
||||
@ -35,8 +35,8 @@ set(HEADERS
|
||||
primitive_assembly.h
|
||||
rasterizer.h
|
||||
renderer_base.h
|
||||
shader_interpreter.h
|
||||
utils.h
|
||||
vertex_shader.h
|
||||
video_core.h
|
||||
)
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "clipper.h"
|
||||
#include "pica.h"
|
||||
#include "rasterizer.h"
|
||||
#include "vertex_shader.h"
|
||||
#include "shader_interpreter.h"
|
||||
|
||||
namespace Pica {
|
||||
|
||||
|
@ -6,13 +6,13 @@
|
||||
|
||||
namespace Pica {
|
||||
|
||||
namespace VertexShader {
|
||||
namespace Shader {
|
||||
struct OutputVertex;
|
||||
}
|
||||
|
||||
namespace Clipper {
|
||||
|
||||
using VertexShader::OutputVertex;
|
||||
using Shader::OutputVertex;
|
||||
|
||||
void ProcessTriangle(OutputVertex& v0, OutputVertex& v1, OutputVertex& v2);
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "pica.h"
|
||||
#include "primitive_assembly.h"
|
||||
#include "renderer_base.h"
|
||||
#include "vertex_shader.h"
|
||||
#include "shader_interpreter.h"
|
||||
#include "video_core.h"
|
||||
|
||||
namespace Pica {
|
||||
@ -165,7 +165,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
||||
DebugUtils::GeometryDumper geometry_dumper;
|
||||
PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex> dumping_primitive_assembler(regs.triangle_topology.Value());
|
||||
#endif
|
||||
PrimitiveAssembler<VertexShader::OutputVertex> primitive_assembler(regs.triangle_topology.Value());
|
||||
PrimitiveAssembler<Shader::OutputVertex> primitive_assembler(regs.triangle_topology.Value());
|
||||
|
||||
if (g_debug_context) {
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
@ -210,7 +210,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
||||
// The size has been tuned for optimal balance between hit-rate and the cost of lookup
|
||||
const size_t VERTEX_CACHE_SIZE = 32;
|
||||
std::array<u16, VERTEX_CACHE_SIZE> vertex_cache_ids;
|
||||
std::array<VertexShader::OutputVertex, VERTEX_CACHE_SIZE> vertex_cache;
|
||||
std::array<Shader::OutputVertex, VERTEX_CACHE_SIZE> vertex_cache;
|
||||
|
||||
unsigned int vertex_cache_pos = 0;
|
||||
vertex_cache_ids.fill(-1);
|
||||
@ -224,7 +224,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
||||
ASSERT(vertex != -1);
|
||||
|
||||
bool vertex_cache_hit = false;
|
||||
VertexShader::OutputVertex output;
|
||||
Shader::OutputVertex output;
|
||||
|
||||
if (is_indexed) {
|
||||
if (g_debug_context && Pica::g_debug_context->recorder) {
|
||||
@ -243,7 +243,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
||||
|
||||
if (!vertex_cache_hit) {
|
||||
// Initialize data for the current vertex
|
||||
VertexShader::InputVertex input;
|
||||
Shader::InputVertex input;
|
||||
|
||||
for (int i = 0; i < attribute_config.GetNumTotalAttributes(); ++i) {
|
||||
if (vertex_attribute_elements[i] != 0) {
|
||||
@ -306,9 +306,8 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
||||
std::bind(&DebugUtils::GeometryDumper::AddTriangle,
|
||||
&geometry_dumper, _1, _2, _3));
|
||||
#endif
|
||||
|
||||
// Send to vertex shader
|
||||
output = VertexShader::RunShader(input, attribute_config.GetNumTotalAttributes(), g_state.regs.vs, g_state.vs);
|
||||
output = Shader::RunShader(input, attribute_config.GetNumTotalAttributes(), g_state.regs.vs, g_state.vs);
|
||||
|
||||
if (is_indexed) {
|
||||
vertex_cache[vertex_cache_pos] = output;
|
||||
@ -319,9 +318,9 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
|
||||
|
||||
if (Settings::values.use_hw_renderer) {
|
||||
// Send to hardware renderer
|
||||
static auto AddHWTriangle = [](const Pica::VertexShader::OutputVertex& v0,
|
||||
const Pica::VertexShader::OutputVertex& v1,
|
||||
const Pica::VertexShader::OutputVertex& v2) {
|
||||
static auto AddHWTriangle = [](const Pica::Shader::OutputVertex& v0,
|
||||
const Pica::Shader::OutputVertex& v1,
|
||||
const Pica::Shader::OutputVertex& v2) {
|
||||
VideoCore::g_renderer->hw_rasterizer->AddTriangle(v0, v1, v2);
|
||||
};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "common/common_types.h"
|
||||
|
||||
namespace Pica {
|
||||
namespace VertexShader {
|
||||
namespace Shader {
|
||||
struct OutputVertex;
|
||||
}
|
||||
}
|
||||
@ -24,9 +24,9 @@ public:
|
||||
virtual void Reset() = 0;
|
||||
|
||||
/// Queues the primitive formed by the given vertices for rendering
|
||||
virtual void AddTriangle(const Pica::VertexShader::OutputVertex& v0,
|
||||
const Pica::VertexShader::OutputVertex& v1,
|
||||
const Pica::VertexShader::OutputVertex& v2) = 0;
|
||||
virtual void AddTriangle(const Pica::Shader::OutputVertex& v0,
|
||||
const Pica::Shader::OutputVertex& v1,
|
||||
const Pica::Shader::OutputVertex& v2) = 0;
|
||||
|
||||
/// Draw the current batch of triangles
|
||||
virtual void DrawTriangles() = 0;
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "pica.h"
|
||||
#include "primitive_assembly.h"
|
||||
#include "vertex_shader.h"
|
||||
#include "shader_interpreter.h"
|
||||
|
||||
#include "common/logging/log.h"
|
||||
#include "video_core/debug_utils/debug_utils.h"
|
||||
@ -56,7 +56,7 @@ void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx, TriangleHandl
|
||||
|
||||
// explicitly instantiate use cases
|
||||
template
|
||||
struct PrimitiveAssembler<VertexShader::OutputVertex>;
|
||||
struct PrimitiveAssembler<Shader::OutputVertex>;
|
||||
template
|
||||
struct PrimitiveAssembler<DebugUtils::GeometryDumper::Vertex>;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "video_core/pica.h"
|
||||
|
||||
#include "video_core/vertex_shader.h"
|
||||
#include "video_core/shader_interpreter.h"
|
||||
|
||||
namespace Pica {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "math.h"
|
||||
#include "pica.h"
|
||||
#include "rasterizer.h"
|
||||
#include "vertex_shader.h"
|
||||
#include "shader_interpreter.h"
|
||||
#include "video_core/utils.h"
|
||||
|
||||
namespace Pica {
|
||||
@ -272,9 +272,9 @@ static Common::Profiling::TimingCategory rasterization_category("Rasterization")
|
||||
* Helper function for ProcessTriangle with the "reversed" flag to allow for implementing
|
||||
* culling via recursion.
|
||||
*/
|
||||
static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
|
||||
const VertexShader::OutputVertex& v1,
|
||||
const VertexShader::OutputVertex& v2,
|
||||
static void ProcessTriangleInternal(const Shader::OutputVertex& v0,
|
||||
const Shader::OutputVertex& v1,
|
||||
const Shader::OutputVertex& v2,
|
||||
bool reversed = false)
|
||||
{
|
||||
const auto& regs = g_state.regs;
|
||||
@ -1107,9 +1107,9 @@ static void ProcessTriangleInternal(const VertexShader::OutputVertex& v0,
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
||||
const VertexShader::OutputVertex& v1,
|
||||
const VertexShader::OutputVertex& v2) {
|
||||
void ProcessTriangle(const Shader::OutputVertex& v0,
|
||||
const Shader::OutputVertex& v1,
|
||||
const Shader::OutputVertex& v2) {
|
||||
ProcessTriangleInternal(v0, v1, v2);
|
||||
}
|
||||
|
||||
|
@ -6,15 +6,15 @@
|
||||
|
||||
namespace Pica {
|
||||
|
||||
namespace VertexShader {
|
||||
namespace Shader {
|
||||
struct OutputVertex;
|
||||
}
|
||||
|
||||
namespace Rasterizer {
|
||||
|
||||
void ProcessTriangle(const VertexShader::OutputVertex& v0,
|
||||
const VertexShader::OutputVertex& v1,
|
||||
const VertexShader::OutputVertex& v2);
|
||||
void ProcessTriangle(const Shader::OutputVertex& v0,
|
||||
const Shader::OutputVertex& v1,
|
||||
const Shader::OutputVertex& v2);
|
||||
|
||||
} // namespace Rasterizer
|
||||
|
||||
|
@ -202,9 +202,9 @@ void RasterizerOpenGL::Reset() {
|
||||
res_cache.FullFlush();
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::AddTriangle(const Pica::VertexShader::OutputVertex& v0,
|
||||
const Pica::VertexShader::OutputVertex& v1,
|
||||
const Pica::VertexShader::OutputVertex& v2) {
|
||||
void RasterizerOpenGL::AddTriangle(const Pica::Shader::OutputVertex& v0,
|
||||
const Pica::Shader::OutputVertex& v1,
|
||||
const Pica::Shader::OutputVertex& v2) {
|
||||
vertex_batch.push_back(HardwareVertex(v0));
|
||||
vertex_batch.push_back(HardwareVertex(v1));
|
||||
vertex_batch.push_back(HardwareVertex(v2));
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "common/common_types.h"
|
||||
|
||||
#include "video_core/hwrasterizer_base.h"
|
||||
#include "video_core/vertex_shader.h"
|
||||
#include "video_core/shader_interpreter.h"
|
||||
|
||||
#include "gl_state.h"
|
||||
#include "gl_rasterizer_cache.h"
|
||||
@ -27,9 +27,9 @@ public:
|
||||
void Reset() override;
|
||||
|
||||
/// Queues the primitive formed by the given vertices for rendering
|
||||
void AddTriangle(const Pica::VertexShader::OutputVertex& v0,
|
||||
const Pica::VertexShader::OutputVertex& v1,
|
||||
const Pica::VertexShader::OutputVertex& v2) override;
|
||||
void AddTriangle(const Pica::Shader::OutputVertex& v0,
|
||||
const Pica::Shader::OutputVertex& v1,
|
||||
const Pica::Shader::OutputVertex& v2) override;
|
||||
|
||||
/// Draw the current batch of triangles
|
||||
void DrawTriangles() override;
|
||||
@ -82,7 +82,7 @@ private:
|
||||
|
||||
/// Structure that the hardware rendered vertices are composed of
|
||||
struct HardwareVertex {
|
||||
HardwareVertex(const Pica::VertexShader::OutputVertex& v) {
|
||||
HardwareVertex(const Pica::Shader::OutputVertex& v) {
|
||||
position[0] = v.pos.x.ToFloat32();
|
||||
position[1] = v.pos.y.ToFloat32();
|
||||
position[2] = v.pos.z.ToFloat32();
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "common/profiler.h"
|
||||
|
||||
#include "pica.h"
|
||||
#include "vertex_shader.h"
|
||||
#include "shader_interpreter.h"
|
||||
#include "debug_utils/debug_utils.h"
|
||||
|
||||
using nihstro::OpCode;
|
||||
@ -23,9 +23,9 @@ using nihstro::SwizzlePattern;
|
||||
|
||||
namespace Pica {
|
||||
|
||||
namespace VertexShader {
|
||||
namespace Shader {
|
||||
|
||||
struct VertexShaderState {
|
||||
struct ShaderState {
|
||||
u32 program_counter;
|
||||
|
||||
const float24* input_register_table[16];
|
||||
@ -60,7 +60,7 @@ struct VertexShaderState {
|
||||
} debug;
|
||||
};
|
||||
|
||||
static void ProcessShaderCode(VertexShaderState& state) {
|
||||
static void ProcessShaderCode(ShaderState& state) {
|
||||
const auto& uniforms = g_state.vs.uniforms;
|
||||
const auto& swizzle_data = g_state.vs.swizzle_data;
|
||||
const auto& program_code = g_state.vs.program_code;
|
||||
@ -90,7 +90,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
|
||||
const Instruction instr = { program_code[state.program_counter] };
|
||||
const SwizzlePattern swizzle = { swizzle_data[instr.common.operand_desc_id] };
|
||||
|
||||
static auto call = [](VertexShaderState& state, u32 offset, u32 num_instructions,
|
||||
static auto call = [](ShaderState& state, u32 offset, u32 num_instructions,
|
||||
u32 return_offset, u8 repeat_count, u8 loop_increment) {
|
||||
state.program_counter = offset - 1; // -1 to make sure when incrementing the PC we end up at the correct offset
|
||||
ASSERT(state.call_stack.size() < state.call_stack.capacity());
|
||||
@ -413,7 +413,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
|
||||
|
||||
default:
|
||||
{
|
||||
static auto evaluate_condition = [](const VertexShaderState& state, bool refx, bool refy, Instruction::FlowControlType flow_control) {
|
||||
static auto evaluate_condition = [](const ShaderState& state, bool refx, bool refy, Instruction::FlowControlType flow_control) {
|
||||
bool results[2] = { refx == state.conditional_code[0],
|
||||
refy == state.conditional_code[1] };
|
||||
|
||||
@ -547,7 +547,7 @@ static Common::Profiling::TimingCategory shader_category("Vertex Shader");
|
||||
OutputVertex RunShader(const InputVertex& input, int num_attributes, const Regs::ShaderConfig& config, const State::ShaderSetup& setup) {
|
||||
Common::Profiling::ScopeTimer timer(shader_category);
|
||||
|
||||
VertexShaderState state;
|
||||
ShaderState state;
|
||||
|
||||
state.program_counter = config.main_offset;
|
||||
state.debug.max_offset = 0;
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace Pica {
|
||||
|
||||
namespace VertexShader {
|
||||
namespace Shader {
|
||||
|
||||
struct InputVertex {
|
||||
Math::Vec4<float24> attr[16];
|
||||
@ -70,4 +70,3 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes, const Regs:
|
||||
} // namespace
|
||||
|
||||
} // namespace
|
||||
|
Loading…
Reference in New Issue
Block a user