~ppsspp/ppsspp/ppsspp-sdl-1.2.2

« back to all changes in this revision

Viewing changes to GPU/Software/SoftGpu.h

  • Committer: Sérgio Benjamim
  • Date: 2016-04-25 03:32:37 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20160425033237-776ndjdvs3r5xuzd
1.2.2 source (for SDL).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 2012- PPSSPP Project.
 
2
 
 
3
// This program is free software: you can redistribute it and/or modify
 
4
// it under the terms of the GNU General Public License as published by
 
5
// the Free Software Foundation, version 2.0 or later versions.
 
6
 
 
7
// This program is distributed in the hope that it will be useful,
 
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
// GNU General Public License 2.0 for more details.
 
11
 
 
12
// A copy of the GPL 2.0 should have been included with the program.
 
13
// If not, see http://www.gnu.org/licenses/
 
14
 
 
15
// Official git repository and contact information can be found at
 
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
 
17
 
 
18
#pragma once
 
19
 
 
20
#include "GPU/GPUCommon.h"
 
21
#include "GPU/Common/GPUDebugInterface.h"
 
22
 
 
23
typedef struct {
 
24
        union {
 
25
                u8 *data;
 
26
                u16 *as16;
 
27
                u32 *as32;
 
28
        };
 
29
 
 
30
        inline void Set16(int x, int y, int stride, u16 v) {
 
31
                as16[x + y * stride] = v;
 
32
        }
 
33
 
 
34
        inline void Set32(int x, int y, int stride, u32 v) {
 
35
                as32[x + y * stride] = v;
 
36
        }
 
37
 
 
38
        inline u16 Get16(int x, int y, int stride) {
 
39
                return as16[x + y * stride];
 
40
        }
 
41
 
 
42
        inline u32 Get32(int x, int y, int stride) {
 
43
                return as32[x + y * stride];
 
44
        }
 
45
} FormatBuffer;
 
46
 
 
47
class ShaderManager;
 
48
 
 
49
class SoftGPU : public GPUCommon {
 
50
public:
 
51
        SoftGPU();
 
52
        ~SoftGPU();
 
53
        void InitClear() override {}
 
54
        void ExecuteOp(u32 op, u32 diff) override;
 
55
 
 
56
        void BeginFrame() override {}
 
57
        void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
 
58
        void CopyDisplayToOutput() override;
 
59
        void UpdateStats() override;
 
60
        void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
 
61
        void NotifyVideoUpload(u32 addr, int size, int width, int format) override;
 
62
        bool PerformMemoryCopy(u32 dest, u32 src, int size) override;
 
63
        bool PerformMemorySet(u32 dest, u8 v, int size) override;
 
64
        bool PerformMemoryDownload(u32 dest, int size) override;
 
65
        bool PerformMemoryUpload(u32 dest, int size) override;
 
66
        bool PerformStencilUpload(u32 dest, int size) override;
 
67
        void ClearCacheNextFrame() override {}
 
68
 
 
69
        void DeviceLost() override;
 
70
        void DumpNextFrame() override {}
 
71
 
 
72
        void Resized() override {}
 
73
        void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) override {
 
74
                primaryInfo = "Software";
 
75
                fullInfo = "Software";
 
76
        }
 
77
 
 
78
        bool FramebufferDirty() override;
 
79
 
 
80
        bool FramebufferReallyDirty() override {
 
81
                return !(gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME);
 
82
        }
 
83
 
 
84
        bool GetCurrentFramebuffer(GPUDebugBuffer &buffer) override;
 
85
        bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
 
86
        bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
 
87
        bool GetCurrentTexture(GPUDebugBuffer &buffer, int level) override;
 
88
        bool GetCurrentClut(GPUDebugBuffer &buffer) override;
 
89
        bool GetCurrentSimpleVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) override;
 
90
 
 
91
protected:
 
92
        void FastRunLoop(DisplayList &list) override;
 
93
        void ProcessEvent(GPUEvent ev) override;
 
94
        void CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight);
 
95
 
 
96
private:
 
97
        void CopyDisplayToOutputInternal();
 
98
 
 
99
        bool framebufferDirty_;
 
100
        u32 displayFramebuf_;
 
101
        u32 displayStride_;
 
102
        GEBufferFormat displayFormat_;
 
103
};