mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	Manually tweak source formatting and then re-run clang-format
This commit is contained in:
		@@ -30,8 +30,7 @@ public:
 | 
			
		||||
    ClippingEdge(Math::Vec4<float24> coeffs, Math::Vec4<float24> bias = Math::Vec4<float24>(
 | 
			
		||||
                                                 float24::FromFloat32(0), float24::FromFloat32(0),
 | 
			
		||||
                                                 float24::FromFloat32(0), float24::FromFloat32(0)))
 | 
			
		||||
        : coeffs(coeffs), bias(bias) {
 | 
			
		||||
    }
 | 
			
		||||
        : coeffs(coeffs), bias(bias) {}
 | 
			
		||||
 | 
			
		||||
    bool IsInside(const OutputVertex& vertex) const {
 | 
			
		||||
        return Math::Dot(vertex.pos + bias, coeffs) <= float24::FromFloat32(0);
 | 
			
		||||
 
 | 
			
		||||
@@ -44,7 +44,8 @@ static u32 default_attr_write_buffer[3];
 | 
			
		||||
// Expand a 4-bit mask to 4-byte mask, e.g. 0b0101 -> 0x00FF00FF
 | 
			
		||||
static const u32 expand_bits_to_bytes[] = {
 | 
			
		||||
    0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff, 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
 | 
			
		||||
    0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff};
 | 
			
		||||
    0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff, 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
MICROPROFILE_DEFINE(GPU_Drawing, "GPU", "Drawing", MP_RGB(50, 50, 240));
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -155,7 +155,8 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config,
 | 
			
		||||
            {OutputAttributes::TEXCOORD2_V, {OutputRegisterInfo::TEXCOORD2, 2}},
 | 
			
		||||
            {OutputAttributes::VIEW_X, {OutputRegisterInfo::VIEW, 1}},
 | 
			
		||||
            {OutputAttributes::VIEW_Y, {OutputRegisterInfo::VIEW, 2}},
 | 
			
		||||
            {OutputAttributes::VIEW_Z, {OutputRegisterInfo::VIEW, 4}}};
 | 
			
		||||
            {OutputAttributes::VIEW_Z, {OutputRegisterInfo::VIEW, 4}},
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        for (const auto& semantic : std::vector<OutputAttributes::Semantic>{
 | 
			
		||||
                 output_attributes[i].map_x, output_attributes[i].map_y, output_attributes[i].map_z,
 | 
			
		||||
@@ -529,14 +530,16 @@ const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const Texture
 | 
			
		||||
                unsigned table_index =
 | 
			
		||||
                    static_cast<int>((x < 2) ? table_index_1.Value() : table_index_2.Value());
 | 
			
		||||
 | 
			
		||||
                static const std::array<std::array<u8, 2>, 8> etc1_modifier_table = {{{{2, 8}},
 | 
			
		||||
                                                                                      {{5, 17}},
 | 
			
		||||
                                                                                      {{9, 29}},
 | 
			
		||||
                                                                                      {{13, 42}},
 | 
			
		||||
                                                                                      {{18, 60}},
 | 
			
		||||
                                                                                      {{24, 80}},
 | 
			
		||||
                                                                                      {{33, 106}},
 | 
			
		||||
                                                                                      {{47, 183}}}};
 | 
			
		||||
                static const std::array<std::array<u8, 2>, 8> etc1_modifier_table = {{
 | 
			
		||||
                    {{2, 8}},
 | 
			
		||||
                    {{5, 17}},
 | 
			
		||||
                    {{9, 29}},
 | 
			
		||||
                    {{13, 42}},
 | 
			
		||||
                    {{18, 60}},
 | 
			
		||||
                    {{24, 80}},
 | 
			
		||||
                    {{33, 106}},
 | 
			
		||||
                    {{47, 183}},
 | 
			
		||||
                }};
 | 
			
		||||
 | 
			
		||||
                int modifier = etc1_modifier_table.at(table_index).at(GetTableSubIndex(texel));
 | 
			
		||||
                if (GetNegationFlag(texel))
 | 
			
		||||
@@ -713,9 +716,9 @@ static std::string GetTevStageConfigSourceString(const Pica::Regs::TevStageConfi
 | 
			
		||||
    return src_it->second;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static std::string
 | 
			
		||||
GetTevStageConfigColorSourceString(const Pica::Regs::TevStageConfig::Source& source,
 | 
			
		||||
                                   const Pica::Regs::TevStageConfig::ColorModifier modifier) {
 | 
			
		||||
static std::string GetTevStageConfigColorSourceString(
 | 
			
		||||
    const Pica::Regs::TevStageConfig::Source& source,
 | 
			
		||||
    const Pica::Regs::TevStageConfig::ColorModifier modifier) {
 | 
			
		||||
    using ColorModifier = Pica::Regs::TevStageConfig::ColorModifier;
 | 
			
		||||
    static const std::map<ColorModifier, std::string> color_modifier_map = {
 | 
			
		||||
        {ColorModifier::SourceColor, "%source.rgb"},
 | 
			
		||||
@@ -739,9 +742,9 @@ GetTevStageConfigColorSourceString(const Pica::Regs::TevStageConfig::Source& sou
 | 
			
		||||
    return ReplacePattern(modifier_str, "%source", src_str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static std::string
 | 
			
		||||
GetTevStageConfigAlphaSourceString(const Pica::Regs::TevStageConfig::Source& source,
 | 
			
		||||
                                   const Pica::Regs::TevStageConfig::AlphaModifier modifier) {
 | 
			
		||||
static std::string GetTevStageConfigAlphaSourceString(
 | 
			
		||||
    const Pica::Regs::TevStageConfig::Source& source,
 | 
			
		||||
    const Pica::Regs::TevStageConfig::AlphaModifier modifier) {
 | 
			
		||||
    using AlphaModifier = Pica::Regs::TevStageConfig::AlphaModifier;
 | 
			
		||||
    static const std::map<AlphaModifier, std::string> alpha_modifier_map = {
 | 
			
		||||
        {AlphaModifier::SourceAlpha, "%source.a"},
 | 
			
		||||
@@ -763,8 +766,8 @@ GetTevStageConfigAlphaSourceString(const Pica::Regs::TevStageConfig::Source& sou
 | 
			
		||||
    return ReplacePattern(modifier_str, "%source", src_str);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static std::string
 | 
			
		||||
GetTevStageConfigOperationString(const Pica::Regs::TevStageConfig::Operation& operation) {
 | 
			
		||||
static std::string GetTevStageConfigOperationString(
 | 
			
		||||
    const Pica::Regs::TevStageConfig::Operation& operation) {
 | 
			
		||||
    using Operation = Pica::Regs::TevStageConfig::Operation;
 | 
			
		||||
    static const std::map<Operation, std::string> combiner_map = {
 | 
			
		||||
        {Operation::Replace, "%source1"},
 | 
			
		||||
 
 | 
			
		||||
@@ -87,15 +87,13 @@ public:
 | 
			
		||||
         * @param data Optional data pointer (if unused, this is a nullptr)
 | 
			
		||||
         * @note This function will perform nothing unless it is overridden in the child class.
 | 
			
		||||
         */
 | 
			
		||||
        virtual void OnPicaBreakPointHit(Event, void*) {
 | 
			
		||||
        }
 | 
			
		||||
        virtual void OnPicaBreakPointHit(Event, void*) {}
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * Action to perform when emulation is resumed from a breakpoint.
 | 
			
		||||
         * @note This function will perform nothing unless it is overridden in the child class.
 | 
			
		||||
         */
 | 
			
		||||
        virtual void OnPicaResume() {
 | 
			
		||||
        }
 | 
			
		||||
        virtual void OnPicaResume() {}
 | 
			
		||||
 | 
			
		||||
    protected:
 | 
			
		||||
        /**
 | 
			
		||||
 
 | 
			
		||||
@@ -15,8 +15,7 @@ public:
 | 
			
		||||
    // Base class for all objects which need to be notified about GPU events
 | 
			
		||||
    class DebuggerObserver {
 | 
			
		||||
    public:
 | 
			
		||||
        DebuggerObserver() : observed(nullptr) {
 | 
			
		||||
        }
 | 
			
		||||
        DebuggerObserver() : observed(nullptr) {}
 | 
			
		||||
 | 
			
		||||
        virtual ~DebuggerObserver() {
 | 
			
		||||
            if (observed)
 | 
			
		||||
 
 | 
			
		||||
@@ -176,7 +176,10 @@ struct Regs {
 | 
			
		||||
            MirroredRepeat = 3,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        enum TextureFilter : u32 { Nearest = 0, Linear = 1 };
 | 
			
		||||
        enum TextureFilter : u32 {
 | 
			
		||||
            Nearest = 0,
 | 
			
		||||
            Linear = 1,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        union {
 | 
			
		||||
            u32 raw;
 | 
			
		||||
@@ -300,9 +303,11 @@ struct Regs {
 | 
			
		||||
        const TextureFormat format;
 | 
			
		||||
    };
 | 
			
		||||
    const std::array<FullTextureConfig, 3> GetTextures() const {
 | 
			
		||||
        return {{{texture0_enable.ToBool(), texture0, texture0_format},
 | 
			
		||||
                 {texture1_enable.ToBool(), texture1, texture1_format},
 | 
			
		||||
                 {texture2_enable.ToBool(), texture2, texture2_format}}};
 | 
			
		||||
        return {{
 | 
			
		||||
            {texture0_enable.ToBool(), texture0, texture0_format},
 | 
			
		||||
            {texture1_enable.ToBool(), texture1, texture1_format},
 | 
			
		||||
            {texture2_enable.ToBool(), texture2, texture2_format},
 | 
			
		||||
        }};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // 0xc0-0xff: Texture Combiner (akin to glTexEnv)
 | 
			
		||||
@@ -523,7 +528,7 @@ struct Regs {
 | 
			
		||||
        Decrement = 4,
 | 
			
		||||
        Invert = 5,
 | 
			
		||||
        IncrementWrap = 6,
 | 
			
		||||
        DecrementWrap = 7
 | 
			
		||||
        DecrementWrap = 7,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    struct {
 | 
			
		||||
@@ -1173,7 +1178,10 @@ struct Regs {
 | 
			
		||||
 | 
			
		||||
    INSERT_PADDING_WORDS(0x07);
 | 
			
		||||
 | 
			
		||||
    enum class GPUMode : u32 { Drawing = 0, Configuring = 1 };
 | 
			
		||||
    enum class GPUMode : u32 {
 | 
			
		||||
        Drawing = 0,
 | 
			
		||||
        Configuring = 1,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    GPUMode gpu_mode;
 | 
			
		||||
 | 
			
		||||
@@ -1249,7 +1257,10 @@ struct Regs {
 | 
			
		||||
        INSERT_PADDING_WORDS(0x2);
 | 
			
		||||
 | 
			
		||||
        struct {
 | 
			
		||||
            enum Format : u32 { FLOAT24 = 0, FLOAT32 = 1 };
 | 
			
		||||
            enum Format : u32 {
 | 
			
		||||
                FLOAT24 = 0,
 | 
			
		||||
                FLOAT32 = 1,
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            bool IsFloat32() const {
 | 
			
		||||
                return format == FLOAT32;
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,7 @@ namespace Pica {
 | 
			
		||||
 | 
			
		||||
template <typename VertexType>
 | 
			
		||||
PrimitiveAssembler<VertexType>::PrimitiveAssembler(Regs::TriangleTopology topology)
 | 
			
		||||
    : topology(topology), buffer_index(0) {
 | 
			
		||||
}
 | 
			
		||||
    : topology(topology), buffer_index(0) {}
 | 
			
		||||
 | 
			
		||||
template <typename VertexType>
 | 
			
		||||
void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx,
 | 
			
		||||
 
 | 
			
		||||
@@ -268,10 +268,8 @@ static u8 PerformStencilAction(Regs::StencilAction action, u8 old_stencil, u8 re
 | 
			
		||||
 | 
			
		||||
// NOTE: Assuming that rasterizer coordinates are 12.4 fixed-point values
 | 
			
		||||
struct Fix12P4 {
 | 
			
		||||
    Fix12P4() {
 | 
			
		||||
    }
 | 
			
		||||
    Fix12P4(u16 val) : val(val) {
 | 
			
		||||
    }
 | 
			
		||||
    Fix12P4() {}
 | 
			
		||||
    Fix12P4(u16 val) : val(val) {}
 | 
			
		||||
 | 
			
		||||
    static u16 FracMask() {
 | 
			
		||||
        return 0xF;
 | 
			
		||||
@@ -491,7 +489,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader
 | 
			
		||||
                    255),
 | 
			
		||||
                (u8)(
 | 
			
		||||
                    GetInterpolatedAttribute(v0.color.a(), v1.color.a(), v2.color.a()).ToFloat32() *
 | 
			
		||||
                    255)};
 | 
			
		||||
                    255),
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            Math::Vec2<float24> uv[3];
 | 
			
		||||
            uv[0].u() = GetInterpolatedAttribute(v0.tc0.u(), v1.tc0.u(), v2.tc0.u());
 | 
			
		||||
@@ -604,7 +603,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader
 | 
			
		||||
            Math::Vec4<u8> combiner_buffer = {0, 0, 0, 0};
 | 
			
		||||
            Math::Vec4<u8> next_combiner_buffer = {
 | 
			
		||||
                regs.tev_combiner_buffer_color.r, regs.tev_combiner_buffer_color.g,
 | 
			
		||||
                regs.tev_combiner_buffer_color.b, regs.tev_combiner_buffer_color.a};
 | 
			
		||||
                regs.tev_combiner_buffer_color.b, regs.tev_combiner_buffer_color.a,
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            for (unsigned tev_stage_index = 0; tev_stage_index < tev_stages.size();
 | 
			
		||||
                 ++tev_stage_index) {
 | 
			
		||||
@@ -841,18 +841,16 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader
 | 
			
		||||
                Math::Vec3<u8> color_result[3] = {
 | 
			
		||||
                    GetColorModifier(tev_stage.color_modifier1, GetSource(tev_stage.color_source1)),
 | 
			
		||||
                    GetColorModifier(tev_stage.color_modifier2, GetSource(tev_stage.color_source2)),
 | 
			
		||||
                    GetColorModifier(tev_stage.color_modifier3,
 | 
			
		||||
                                     GetSource(tev_stage.color_source3))};
 | 
			
		||||
                    GetColorModifier(tev_stage.color_modifier3, GetSource(tev_stage.color_source3)),
 | 
			
		||||
                };
 | 
			
		||||
                auto color_output = ColorCombine(tev_stage.color_op, color_result);
 | 
			
		||||
 | 
			
		||||
                // alpha combiner
 | 
			
		||||
                std::array<u8, 3> alpha_result = {
 | 
			
		||||
                    {GetAlphaModifier(tev_stage.alpha_modifier1,
 | 
			
		||||
                                      GetSource(tev_stage.alpha_source1)),
 | 
			
		||||
                     GetAlphaModifier(tev_stage.alpha_modifier2,
 | 
			
		||||
                                      GetSource(tev_stage.alpha_source2)),
 | 
			
		||||
                     GetAlphaModifier(tev_stage.alpha_modifier3,
 | 
			
		||||
                                      GetSource(tev_stage.alpha_source3))}};
 | 
			
		||||
                std::array<u8, 3> alpha_result = {{
 | 
			
		||||
                    GetAlphaModifier(tev_stage.alpha_modifier1, GetSource(tev_stage.alpha_source1)),
 | 
			
		||||
                    GetAlphaModifier(tev_stage.alpha_modifier2, GetSource(tev_stage.alpha_source2)),
 | 
			
		||||
                    GetAlphaModifier(tev_stage.alpha_modifier3, GetSource(tev_stage.alpha_source3)),
 | 
			
		||||
                }};
 | 
			
		||||
                auto alpha_output = AlphaCombine(tev_stage.alpha_op, alpha_result);
 | 
			
		||||
 | 
			
		||||
                combiner_output[0] =
 | 
			
		||||
@@ -1083,7 +1081,8 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader
 | 
			
		||||
                        static_cast<u8>(output_merger.blend_const.r),
 | 
			
		||||
                        static_cast<u8>(output_merger.blend_const.g),
 | 
			
		||||
                        static_cast<u8>(output_merger.blend_const.b),
 | 
			
		||||
                        static_cast<u8>(output_merger.blend_const.a)};
 | 
			
		||||
                        static_cast<u8>(output_merger.blend_const.a),
 | 
			
		||||
                    };
 | 
			
		||||
 | 
			
		||||
                    switch (factor) {
 | 
			
		||||
                    case Regs::BlendFactor::Zero:
 | 
			
		||||
@@ -1267,11 +1266,12 @@ static void ProcessTriangleInternal(const Shader::OutputVertex& v0, const Shader
 | 
			
		||||
                                  LogicOp(combiner_output.a(), dest.a(), output_merger.logic_op));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            const Math::Vec4<u8> result = {output_merger.red_enable ? blend_output.r() : dest.r(),
 | 
			
		||||
                                           output_merger.green_enable ? blend_output.g() : dest.g(),
 | 
			
		||||
                                           output_merger.blue_enable ? blend_output.b() : dest.b(),
 | 
			
		||||
                                           output_merger.alpha_enable ? blend_output.a()
 | 
			
		||||
                                                                      : dest.a()};
 | 
			
		||||
            const Math::Vec4<u8> result = {
 | 
			
		||||
                output_merger.red_enable ? blend_output.r() : dest.r(),
 | 
			
		||||
                output_merger.green_enable ? blend_output.g() : dest.g(),
 | 
			
		||||
                output_merger.blue_enable ? blend_output.b() : dest.b(),
 | 
			
		||||
                output_merger.alpha_enable ? blend_output.a() : dest.a(),
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            if (regs.framebuffer.allow_color_write != 0)
 | 
			
		||||
                DrawPixel(x >> 4, y >> 4, result);
 | 
			
		||||
 
 | 
			
		||||
@@ -20,8 +20,7 @@ namespace VideoCore {
 | 
			
		||||
 | 
			
		||||
class RasterizerInterface {
 | 
			
		||||
public:
 | 
			
		||||
    virtual ~RasterizerInterface() {
 | 
			
		||||
    }
 | 
			
		||||
    virtual ~RasterizerInterface() {}
 | 
			
		||||
 | 
			
		||||
    /// Queues the primitive formed by the given vertices for rendering
 | 
			
		||||
    virtual void AddTriangle(const Pica::Shader::OutputVertex& v0,
 | 
			
		||||
 
 | 
			
		||||
@@ -17,8 +17,7 @@ public:
 | 
			
		||||
    /// Used to reference a framebuffer
 | 
			
		||||
    enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture };
 | 
			
		||||
 | 
			
		||||
    virtual ~RendererBase() {
 | 
			
		||||
    }
 | 
			
		||||
    virtual ~RendererBase() {}
 | 
			
		||||
 | 
			
		||||
    /// Swap buffers (render frame)
 | 
			
		||||
    virtual void SwapBuffers() = 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -136,8 +136,7 @@ RasterizerOpenGL::RasterizerOpenGL() : shader_dirty(true) {
 | 
			
		||||
    SyncDepthWriteMask();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
RasterizerOpenGL::~RasterizerOpenGL() {
 | 
			
		||||
}
 | 
			
		||||
RasterizerOpenGL::~RasterizerOpenGL() {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This is a helper function to resolve an issue with opposite quaternions being interpolated by
 | 
			
		||||
@@ -1156,9 +1155,10 @@ void RasterizerOpenGL::SyncBlendColor() {
 | 
			
		||||
 | 
			
		||||
void RasterizerOpenGL::SyncFogColor() {
 | 
			
		||||
    const auto& regs = Pica::g_state.regs;
 | 
			
		||||
    uniform_block_data.data.fog_color = {regs.fog_color.r.Value() / 255.0f,
 | 
			
		||||
                                         regs.fog_color.g.Value() / 255.0f,
 | 
			
		||||
                                         regs.fog_color.b.Value() / 255.0f};
 | 
			
		||||
    uniform_block_data.data.fog_color = {
 | 
			
		||||
        regs.fog_color.r.Value() / 255.0f, regs.fog_color.g.Value() / 255.0f,
 | 
			
		||||
        regs.fog_color.b.Value() / 255.0f,
 | 
			
		||||
    };
 | 
			
		||||
    uniform_block_data.dirty = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -41,12 +41,9 @@ struct ScreenInfo;
 | 
			
		||||
 * two separate shaders sharing the same key.
 | 
			
		||||
 *
 | 
			
		||||
 * We use a union because "implicitly-defined copy/move constructor for a union X copies the object
 | 
			
		||||
 * representation of X."
 | 
			
		||||
 * and "implicitly-defined copy assignment operator for a union X copies the object representation
 | 
			
		||||
 * (3.9) of X."
 | 
			
		||||
 * = Bytewise copy instead of memberwise copy.
 | 
			
		||||
 * This is important because the padding bytes are included in the hash and comparison between
 | 
			
		||||
 * objects.
 | 
			
		||||
 * representation of X." and "implicitly-defined copy assignment operator for a union X copies the
 | 
			
		||||
 * object representation (3.9) of X." = Bytewise copy instead of memberwise copy. This is important
 | 
			
		||||
 * because the padding bytes are included in the hash and comparison between objects.
 | 
			
		||||
 */
 | 
			
		||||
union PicaShaderConfig {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -522,8 +522,8 @@ CachedSurface* RasterizerCacheOpenGL::GetSurfaceRect(const CachedSurface& params
 | 
			
		||||
    return GetSurface(params, match_res_scale, load_if_create);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
CachedSurface*
 | 
			
		||||
RasterizerCacheOpenGL::GetTextureSurface(const Pica::Regs::FullTextureConfig& config) {
 | 
			
		||||
CachedSurface* RasterizerCacheOpenGL::GetTextureSurface(
 | 
			
		||||
    const Pica::Regs::FullTextureConfig& config) {
 | 
			
		||||
    Pica::DebugUtils::TextureInfo info =
 | 
			
		||||
        Pica::DebugUtils::TextureInfo::FromPicaRegister(config.config, config.format);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -212,8 +212,8 @@ public:
 | 
			
		||||
 | 
			
		||||
    /// Gets the color and depth surfaces and rect (resolution scaled) based on the framebuffer
 | 
			
		||||
    /// configuration
 | 
			
		||||
    std::tuple<CachedSurface*, CachedSurface*, MathUtil::Rectangle<int>>
 | 
			
		||||
    GetFramebufferSurfaces(const Pica::Regs::FramebufferConfig& config);
 | 
			
		||||
    std::tuple<CachedSurface*, CachedSurface*, MathUtil::Rectangle<int>> GetFramebufferSurfaces(
 | 
			
		||||
        const Pica::Regs::FramebufferConfig& config);
 | 
			
		||||
 | 
			
		||||
    /// Attempt to get a surface that exactly matches the fill region and format
 | 
			
		||||
    CachedSurface* TryGetFillSurface(const GPU::Regs::MemoryFillConfig& config);
 | 
			
		||||
 
 | 
			
		||||
@@ -293,9 +293,7 @@ static void AppendAlphaTestCondition(std::string& out, Regs::CompareFunc func) {
 | 
			
		||||
    case CompareFunc::LessThanOrEqual:
 | 
			
		||||
    case CompareFunc::GreaterThan:
 | 
			
		||||
    case CompareFunc::GreaterThanOrEqual: {
 | 
			
		||||
        static const char* op[] = {
 | 
			
		||||
            "!=", "==", ">=", ">", "<=", "<",
 | 
			
		||||
        };
 | 
			
		||||
        static const char* op[] = {"!=", "==", ">=", ">", "<=", "<"};
 | 
			
		||||
        unsigned index = (unsigned)func - (unsigned)CompareFunc::Equal;
 | 
			
		||||
        out += "int(last_tex_env_out.a * 255.0f) " + std::string(op[index]) + " alphatest_ref";
 | 
			
		||||
        break;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ namespace PicaToGL {
 | 
			
		||||
inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) {
 | 
			
		||||
    static const GLenum filter_mode_table[] = {
 | 
			
		||||
        GL_NEAREST, // TextureFilter::Nearest
 | 
			
		||||
        GL_LINEAR   // TextureFilter::Linear
 | 
			
		||||
        GL_LINEAR,  // TextureFilter::Linear
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // Range check table for input
 | 
			
		||||
@@ -55,7 +55,7 @@ inline GLenum WrapMode(Pica::Regs::TextureConfig::WrapMode mode) {
 | 
			
		||||
        GL_CLAMP_TO_EDGE,   // WrapMode::ClampToEdge
 | 
			
		||||
        GL_CLAMP_TO_BORDER, // WrapMode::ClampToBorder
 | 
			
		||||
        GL_REPEAT,          // WrapMode::Repeat
 | 
			
		||||
        GL_MIRRORED_REPEAT  // WrapMode::MirroredRepeat
 | 
			
		||||
        GL_MIRRORED_REPEAT, // WrapMode::MirroredRepeat
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // Range check table for input
 | 
			
		||||
@@ -192,7 +192,7 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) {
 | 
			
		||||
        GL_DECR,      // StencilAction::Decrement
 | 
			
		||||
        GL_INVERT,    // StencilAction::Invert
 | 
			
		||||
        GL_INCR_WRAP, // StencilAction::IncrementWrap
 | 
			
		||||
        GL_DECR_WRAP  // StencilAction::DecrementWrap
 | 
			
		||||
        GL_DECR_WRAP, // StencilAction::DecrementWrap
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // Range check table for input
 | 
			
		||||
@@ -207,12 +207,16 @@ inline GLenum StencilOp(Pica::Regs::StencilAction action) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline GLvec4 ColorRGBA8(const u32 color) {
 | 
			
		||||
    return {{(color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f,
 | 
			
		||||
             (color >> 16 & 0xFF) / 255.0f, (color >> 24 & 0xFF) / 255.0f}};
 | 
			
		||||
    return {{
 | 
			
		||||
        (color >> 0 & 0xFF) / 255.0f, (color >> 8 & 0xFF) / 255.0f, (color >> 16 & 0xFF) / 255.0f,
 | 
			
		||||
        (color >> 24 & 0xFF) / 255.0f,
 | 
			
		||||
    }};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline std::array<GLfloat, 3> LightColor(const Pica::Regs::LightColor& color) {
 | 
			
		||||
    return {{color.r / 255.0f, color.g / 255.0f, color.b / 255.0f}};
 | 
			
		||||
    return {{
 | 
			
		||||
        color.r / 255.0f, color.g / 255.0f, color.b / 255.0f,
 | 
			
		||||
    }};
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
} // namespace
 | 
			
		||||
 
 | 
			
		||||
@@ -87,15 +87,13 @@ struct ScreenRectVertex {
 | 
			
		||||
 * by a 3x2 matrix.
 | 
			
		||||
 */
 | 
			
		||||
static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, const float height) {
 | 
			
		||||
    std::array<GLfloat, 3 * 2> matrix;
 | 
			
		||||
    std::array<GLfloat, 3 * 2> matrix; // Laid out in column-major order
 | 
			
		||||
 | 
			
		||||
    matrix[0] = 2.f / width;
 | 
			
		||||
    matrix[2] = 0.f;
 | 
			
		||||
    matrix[4] = -1.f;
 | 
			
		||||
    matrix[1] = 0.f;
 | 
			
		||||
    matrix[3] = -2.f / height;
 | 
			
		||||
    matrix[5] = 1.f;
 | 
			
		||||
    // clang-format off
 | 
			
		||||
    matrix[0] = 2.f / width; matrix[2] = 0.f;           matrix[4] = -1.f;
 | 
			
		||||
    matrix[1] = 0.f;         matrix[3] = -2.f / height; matrix[5] = 1.f;
 | 
			
		||||
    // Last matrix row is implicitly assumed to be [0, 0, 1].
 | 
			
		||||
    // clang-format on
 | 
			
		||||
 | 
			
		||||
    return matrix;
 | 
			
		||||
}
 | 
			
		||||
@@ -107,8 +105,7 @@ RendererOpenGL::RendererOpenGL() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// RendererOpenGL destructor
 | 
			
		||||
RendererOpenGL::~RendererOpenGL() {
 | 
			
		||||
}
 | 
			
		||||
RendererOpenGL::~RendererOpenGL() {}
 | 
			
		||||
 | 
			
		||||
/// Swap buffers (render frame)
 | 
			
		||||
void RendererOpenGL::SwapBuffers() {
 | 
			
		||||
@@ -215,8 +212,7 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram
 | 
			
		||||
 | 
			
		||||
        // Update existing texture
 | 
			
		||||
        // TODO: Test what happens on hardware when you change the framebuffer dimensions so that
 | 
			
		||||
        // they
 | 
			
		||||
        //       differ from the LCD resolution.
 | 
			
		||||
        //       they differ from the LCD resolution.
 | 
			
		||||
        // TODO: Applications could theoretically crash Citra here by specifying too large
 | 
			
		||||
        //       framebuffer sizes. We should make sure that this cannot happen.
 | 
			
		||||
        glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, framebuffer.width, framebuffer.height,
 | 
			
		||||
@@ -231,10 +227,8 @@ void RendererOpenGL::LoadFBToScreenInfo(const GPU::Regs::FramebufferConfig& fram
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Fills active OpenGL texture with the given RGB color.
 | 
			
		||||
 * Since the color is solid, the texture can be 1x1 but will stretch across whatever it's rendered
 | 
			
		||||
 * on.
 | 
			
		||||
 * This has the added benefit of being *really fast*.
 | 
			
		||||
 * Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can
 | 
			
		||||
 * be 1x1 but will stretch across whatever it's rendered on.
 | 
			
		||||
 */
 | 
			
		||||
void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b,
 | 
			
		||||
                                                const TextureInfo& texture) {
 | 
			
		||||
@@ -424,8 +418,7 @@ void RendererOpenGL::DrawScreens() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Updates the framerate
 | 
			
		||||
void RendererOpenGL::UpdateFramerate() {
 | 
			
		||||
}
 | 
			
		||||
void RendererOpenGL::UpdateFramerate() {}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set the emulator window to use for renderer
 | 
			
		||||
@@ -513,5 +506,4 @@ bool RendererOpenGL::Init() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Shutdown the renderer
 | 
			
		||||
void RendererOpenGL::ShutDown() {
 | 
			
		||||
}
 | 
			
		||||
void RendererOpenGL::ShutDown() {}
 | 
			
		||||
 
 | 
			
		||||
@@ -81,11 +81,14 @@ private:
 | 
			
		||||
    OGLVertexArray vertex_array;
 | 
			
		||||
    OGLBuffer vertex_buffer;
 | 
			
		||||
    OGLShader shader;
 | 
			
		||||
    std::array<ScreenInfo, 2>
 | 
			
		||||
        screen_infos; ///< Display information for top and bottom screens respectively
 | 
			
		||||
 | 
			
		||||
    /// Display information for top and bottom screens respectively
 | 
			
		||||
    std::array<ScreenInfo, 2> screen_infos;
 | 
			
		||||
 | 
			
		||||
    // Shader uniform location indices
 | 
			
		||||
    GLuint uniform_modelview_matrix;
 | 
			
		||||
    GLuint uniform_color_texture;
 | 
			
		||||
 | 
			
		||||
    // Shader attribute input indices
 | 
			
		||||
    GLuint attrib_position;
 | 
			
		||||
    GLuint attrib_tex_coord;
 | 
			
		||||
 
 | 
			
		||||
@@ -96,8 +96,8 @@ void ShaderSetup::Setup() {
 | 
			
		||||
#ifdef ARCHITECTURE_x86_64
 | 
			
		||||
    if (VideoCore::g_shader_jit_enabled) {
 | 
			
		||||
        u64 cache_key =
 | 
			
		||||
            (Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^
 | 
			
		||||
             Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data)));
 | 
			
		||||
            Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^
 | 
			
		||||
            Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data));
 | 
			
		||||
 | 
			
		||||
        auto iter = shader_map.find(cache_key);
 | 
			
		||||
        if (iter != shader_map.end()) {
 | 
			
		||||
 
 | 
			
		||||
@@ -358,8 +358,7 @@ struct ShaderSetup {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Performs any shader unit setup that only needs to happen once per shader (as opposed to once
 | 
			
		||||
     * per
 | 
			
		||||
     * vertex, which would happen within the `Run` function).
 | 
			
		||||
     * per vertex, which would happen within the `Run` function).
 | 
			
		||||
     */
 | 
			
		||||
    void Setup();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -80,9 +80,8 @@ void RunInterpreter(const ShaderSetup& setup, UnitState<Debug>& state, unsigned
 | 
			
		||||
        auto call = [&program_counter, &call_stack](UnitState<Debug>& state, u32 offset,
 | 
			
		||||
                                                    u32 num_instructions, u32 return_offset,
 | 
			
		||||
                                                    u8 repeat_count, u8 loop_increment) {
 | 
			
		||||
            program_counter =
 | 
			
		||||
                offset -
 | 
			
		||||
                1; // -1 to make sure when incrementing the PC we end up at the correct offset
 | 
			
		||||
            // -1 to make sure when incrementing the PC we end up at the correct offset
 | 
			
		||||
            program_counter = offset - 1;
 | 
			
		||||
            ASSERT(call_stack.size() < call_stack.capacity());
 | 
			
		||||
            call_stack.push_back(
 | 
			
		||||
                {offset + num_instructions, return_offset, repeat_count, loop_increment, offset});
 | 
			
		||||
 
 | 
			
		||||
@@ -590,8 +590,7 @@ void JitShader::Compile_RSQ(Instruction instr) {
 | 
			
		||||
    Compile_DestEnable(instr, SRC1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void JitShader::Compile_NOP(Instruction instr) {
 | 
			
		||||
}
 | 
			
		||||
void JitShader::Compile_NOP(Instruction instr) {}
 | 
			
		||||
 | 
			
		||||
void JitShader::Compile_END(Instruction instr) {
 | 
			
		||||
    ABI_PopRegistersAndAdjustStack(ABI_ALL_CALLEE_SAVED, 8);
 | 
			
		||||
 
 | 
			
		||||
@@ -19,15 +19,10 @@ namespace VideoCore {
 | 
			
		||||
class SWRasterizer : public RasterizerInterface {
 | 
			
		||||
    void AddTriangle(const Pica::Shader::OutputVertex& v0, const Pica::Shader::OutputVertex& v1,
 | 
			
		||||
                     const Pica::Shader::OutputVertex& v2) override;
 | 
			
		||||
    void DrawTriangles() override {
 | 
			
		||||
    }
 | 
			
		||||
    void NotifyPicaRegisterChanged(u32 id) override {
 | 
			
		||||
    }
 | 
			
		||||
    void FlushAll() override {
 | 
			
		||||
    }
 | 
			
		||||
    void FlushRegion(PAddr addr, u32 size) override {
 | 
			
		||||
    }
 | 
			
		||||
    void FlushAndInvalidateRegion(PAddr addr, u32 size) override {
 | 
			
		||||
    }
 | 
			
		||||
    void DrawTriangles() override {}
 | 
			
		||||
    void NotifyPicaRegisterChanged(u32 id) override {}
 | 
			
		||||
    void FlushAll() override {}
 | 
			
		||||
    void FlushRegion(PAddr addr, u32 size) override {}
 | 
			
		||||
    void FlushAndInvalidateRegion(PAddr addr, u32 size) override {}
 | 
			
		||||
};
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user