mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-21 10:15:23 +12:00
gpu: Implement basic texcopy
* Improves rendering in FE:A but the screens will still not show because it requires surface validation
This commit is contained in:
parent
297afd20d7
commit
82d9511993
15 changed files with 139 additions and 16 deletions
include/renderer_gl
|
@ -77,9 +77,10 @@ class RendererGL final : public Renderer {
|
|||
void initGraphicsContext(SDL_Window* window) override; // Initialize graphics context
|
||||
void clearBuffer(u32 startAddress, u32 endAddress, u32 value, u32 control) override; // Clear a GPU buffer in VRAM
|
||||
void displayTransfer(u32 inputAddr, u32 outputAddr, u32 inputSize, u32 outputSize, u32 flags) override; // Perform display transfer
|
||||
void textureCopy(u32 inputAddr, u32 outputAddr, u32 totalBytes, u32 inputSize, u32 outputSize, u32 flags) override;
|
||||
void drawVertices(PICA::PrimType primType, std::span<const PICA::Vertex> vertices) override; // Draw the given vertices
|
||||
|
||||
ColourBuffer getColourBuffer(u32 addr, PICA::ColorFmt format, u32 width, u32 height);
|
||||
std::optional<ColourBuffer> getColourBuffer(u32 addr, PICA::ColorFmt format, u32 width, u32 height, bool createIfnotFound = true);
|
||||
|
||||
// Take a screenshot of the screen and store it in a file
|
||||
void screenshot(const std::string& name) override;
|
||||
|
|
|
@ -76,6 +76,16 @@ public:
|
|||
|
||||
size++;
|
||||
|
||||
// Find an existing surface we completely invalidate and overwrite it with the new surface
|
||||
for (auto& e : buffer) {
|
||||
if (e.valid && e.range.lower() >= surface.range.lower() && e.range.upper() <= surface.range.upper()) {
|
||||
e.free();
|
||||
e = surface;
|
||||
e.allocate();
|
||||
return e;
|
||||
}
|
||||
}
|
||||
|
||||
// Find an invalid entry in the cache and overwrite it with the new surface
|
||||
for (auto& e : buffer) {
|
||||
if (!e.valid) {
|
||||
|
|
|
@ -65,7 +65,8 @@ struct ColourBuffer {
|
|||
texture.setMagFilter(OpenGL::Linear);
|
||||
glBindTexture(GL_TEXTURE_2D, prevTexture);
|
||||
|
||||
//Helpers::panic("Creating FBO: %d, %d\n", size.x(), size.y());
|
||||
const auto name = Helpers::format("Surface %dx%d %s from 0x%08X", size.x(), size.y(), PICA::textureFormatToString(format), location);
|
||||
OpenGL::setObjectLabel(GL_TEXTURE, texture.handle(), name.c_str());
|
||||
|
||||
fbo.createWithDrawTexture(texture);
|
||||
fbo.bind(OpenGL::DrawAndReadFramebuffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue