start botching shit

This commit is contained in:
Arisotura 2020-11-01 20:36:13 +01:00
parent fbca47381b
commit 254105adf7
3 changed files with 56 additions and 2 deletions

View File

@ -447,6 +447,7 @@ void Reset();
void SetRenderSettings(RenderSettings& settings); void SetRenderSettings(RenderSettings& settings);
void DoCapture(u32 capcnt);
void RenderFrame(); void RenderFrame();
void BindOutputTexture(); void BindOutputTexture();

View File

@ -928,6 +928,16 @@ void GPU2D::DrawScanline(u32 line)
void GPU2D::VBlank() void GPU2D::VBlank()
{ {
#ifdef OGLRENDERER_ENABLED
if (Accelerated)
{
if ((Num == 0) && (CaptureCnt & (1<<31)))
{
GPU::GLCompositor::DoCapture(CaptureCnt);
}
}
#endif
CaptureCnt &= ~(1<<31); CaptureCnt &= ~(1<<31);
DispFIFOReadPtr = 0; DispFIFOReadPtr = 0;
@ -950,13 +960,13 @@ void GPU2D::VBlankEnd()
//OBJMosaicYCount = 0; //OBJMosaicYCount = 0;
#ifdef OGLRENDERER_ENABLED #ifdef OGLRENDERER_ENABLED
if (Accelerated) /*if (Accelerated)
{ {
if ((Num == 0) && (CaptureCnt & (1<<31)) && (((CaptureCnt >> 29) & 0x3) != 1)) if ((Num == 0) && (CaptureCnt & (1<<31)) && (((CaptureCnt >> 29) & 0x3) != 1))
{ {
GPU3D::GLRenderer::PrepareCaptureFrame(); GPU3D::GLRenderer::PrepareCaptureFrame();
} }
} }*/
#endif #endif
} }

View File

@ -45,6 +45,9 @@ GLuint CompScreenInputTex;
GLuint CompScreenOutputTex; GLuint CompScreenOutputTex;
GLuint CompScreenOutputFB; GLuint CompScreenOutputFB;
GLuint CaptureTex[2][4];
GLuint CaptureFB[2][4];
bool Init() bool Init()
{ {
@ -121,6 +124,17 @@ bool Init()
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glGenFramebuffers(8, &CaptureFB[0][0]);
glGenTextures(8, &CaptureTex[0][0]);
for (int i = 0; i < 8; i++)
{
glBindTexture(GL_TEXTURE_2D, CaptureTex[i>>2][i&0x3]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
}
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
return true; return true;
@ -128,6 +142,9 @@ bool Init()
void DeInit() void DeInit()
{ {
glDeleteFramebuffers(8, &CaptureFB[0][0]);
glDeleteTextures(8, &CaptureTex[0][0]);
glDeleteFramebuffers(1, &CompScreenOutputFB); glDeleteFramebuffers(1, &CompScreenOutputFB);
glDeleteTextures(1, &CompScreenInputTex); glDeleteTextures(1, &CompScreenInputTex);
glDeleteTextures(1, &CompScreenOutputTex); glDeleteTextures(1, &CompScreenOutputTex);
@ -160,10 +177,36 @@ void SetRenderSettings(RenderSettings& settings)
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, CompScreenOutputTex, 0); glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, CompScreenOutputTex, 0);
glDrawBuffers(1, fbassign); glDrawBuffers(1, fbassign);
for (int i = 0; i < 8; i++)
{
glBindTexture(GL_TEXTURE_2D, CaptureTex[i>>2][i&0x3]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ScreenW, ScreenW, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glBindFramebuffer(GL_FRAMEBUFFER, CaptureFB[i>>2][i&0x3]);
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, CaptureTex[i>>2][i&0x3], 0);
}
glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindFramebuffer(GL_FRAMEBUFFER, 0);
} }
void DoCapture(u32 capcnt)
{
u32 dstvram = (capcnt >> 16) & 0x3;
// TODO: blank out destination buffer?
if (!(GPU::VRAMMap_LCDC & (1<<dstvram)))
return;
if ((capcnt & 0xEF000000) != 0x80000000)
{
printf("GLCompositor: capture type %08X no good, can't accelerate\n", capcnt);
return;
}
// COMPLETE ME!
}
void RenderFrame() void RenderFrame()
{ {
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);