Duckstation/src/core/gpu_sw.h

63 lines
2.2 KiB
C
Raw Normal View History

2019-10-26 02:57:35 +00:00
#pragma once
#include "common/heap_array.h"
2019-10-26 02:57:35 +00:00
#include "gpu.h"
#include "gpu_sw_backend.h"
#include "host_display.h"
2019-10-26 02:57:35 +00:00
#include <array>
#include <memory>
#include <vector>
namespace Threading
{
class Thread;
}
class HostDisplayTexture;
2019-10-26 02:57:35 +00:00
class GPU_SW final : public GPU
{
public:
GPU_SW();
~GPU_SW() override;
ALWAYS_INLINE const GPU_SW_Backend& GetBackend() const { return m_backend; }
GPURenderer GetRendererType() const override;
bool Initialize() override;
2021-01-23 16:52:52 +00:00
bool DoState(StateWrapper& sw, HostDisplayTexture** host_texture, bool update_display) override;
void Reset(bool clear_vram) override;
void UpdateSettings() override;
2019-10-26 02:57:35 +00:00
protected:
void ReadVRAM(u32 x, u32 y, u32 width, u32 height) override;
void FillVRAM(u32 x, u32 y, u32 width, u32 height, u32 color) override;
void UpdateVRAM(u32 x, u32 y, u32 width, u32 height, const void* data, bool set_mask, bool check_mask) override;
void CopyVRAM(u32 src_x, u32 src_y, u32 dst_x, u32 dst_y, u32 width, u32 height) override;
template<HostDisplayPixelFormat display_format>
void CopyOut15Bit(u32 src_x, u32 src_y, u32 width, u32 height, u32 field, bool interlaced, bool interleaved);
void CopyOut15Bit(HostDisplayPixelFormat display_format, u32 src_x, u32 src_y, u32 width, u32 height, u32 field,
bool interlaced, bool interleaved);
template<HostDisplayPixelFormat display_format>
void CopyOut24Bit(u32 src_x, u32 src_y, u32 skip_x, u32 width, u32 height, u32 field, bool interlaced,
bool interleaved);
void CopyOut24Bit(HostDisplayPixelFormat display_format, u32 src_x, u32 src_y, u32 skip_x, u32 width, u32 height,
u32 field, bool interlaced, bool interleaved);
void ClearDisplay() override;
2019-10-26 02:57:35 +00:00
void UpdateDisplay() override;
void DispatchRenderCommand() override;
2019-10-26 02:57:35 +00:00
void FillBackendCommandParameters(GPUBackendCommand* cmd) const;
void FillDrawCommand(GPUBackendDrawCommand* cmd, GPURenderCommand rc) const;
HeapArray<u8, GPU_MAX_DISPLAY_WIDTH * GPU_MAX_DISPLAY_HEIGHT * sizeof(u32)> m_display_texture_buffer;
HostDisplayPixelFormat m_16bit_display_format = HostDisplayPixelFormat::RGB565;
HostDisplayPixelFormat m_24bit_display_format = HostDisplayPixelFormat::RGBA8;
GPU_SW_Backend m_backend;
2019-10-26 02:57:35 +00:00
};