Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1460 from mar753/mar753/render-to-texture-with-op…
Browse files Browse the repository at this point in the history
…tions

Multipass render to texture with options - implemented
  • Loading branch information
baka0815 authored Feb 19, 2019
2 parents 6e7bb35 + d370fd6 commit 41907bc
Show file tree
Hide file tree
Showing 18 changed files with 783 additions and 178 deletions.
5 changes: 3 additions & 2 deletions core/hw/pvr/ta_ctx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,15 @@ bool QueueRender(TA_context* ctx)

bool too_fast = (cycle_span / time_span) > (SH4_MAIN_CLOCK * 1.2);

if (rqueue && too_fast && settings.pvr.SynchronousRender) {
if ((rqueue && too_fast && settings.pvr.SynchronousRender) ||
(settings.dreamcast.rttOption != 0 && rqueue && ctx->rend.isRTT)) {
//wait for a frame if
// we have another one queue'd and
// sh4 run at > 120% on the last slice
// and SynchronousRendering is enabled
frame_finished.Wait();
verify(!rqueue);
}
}

if (rqueue) {
tactx_Recycle(ctx);
Expand Down
2 changes: 2 additions & 0 deletions core/nullDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ void LoadSettings()
settings.dreamcast.RTC = cfgLoadInt("config", "Dreamcast.RTC", GetRTC_now());
settings.dreamcast.region = cfgLoadInt("config", "Dreamcast.Region", 3);
settings.dreamcast.broadcast = cfgLoadInt("config", "Dreamcast.Broadcast", 4);
settings.dreamcast.rttOption = cfgLoadInt("config", "Dreamcast.Rtt", 0);
settings.aica.LimitFPS = cfgLoadInt("config", "aica.LimitFPS", 1);
settings.aica.NoBatch = cfgLoadInt("config", "aica.NoBatch", 0);
settings.aica.NoSound = cfgLoadInt("config", "aica.NoSound", 0);
Expand Down Expand Up @@ -390,4 +391,5 @@ void SaveSettings()
cfgSaveInt("config","Dreamcast.RTC", settings.dreamcast.RTC);
cfgSaveInt("config","Dreamcast.Region", settings.dreamcast.region);
cfgSaveInt("config","Dreamcast.Broadcast", settings.dreamcast.broadcast);
cfgSaveInt("config","Dreamcast.Rtt", settings.dreamcast.rttOption);
}
38 changes: 24 additions & 14 deletions core/rend/gles/gldraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,18 @@ s32 SetTileClip(u32 val, bool set)
return 0;

if (set && clip_mode) {
csy = 480 - csy;
cey = 480 - cey;
float dc2s_scale_h = screen_height / 480.0f;
float ds2s_offs_x = (screen_width - dc2s_scale_h * 640) / 2;
csx = csx * dc2s_scale_h + ds2s_offs_x;
cex = cex * dc2s_scale_h + ds2s_offs_x;
csy = csy * dc2s_scale_h;
cey = cey * dc2s_scale_h;
glUniform4f(CurrentShader->pp_ClipTest, csx, cey, cex, csy);
if (!pvrrc.isRTT) {
float t = cey;
cey = 480 - csy;
csy = 480 - t;
float dc2s_scale_h = screen_height / 480.0f;
float ds2s_offs_x = (screen_width - dc2s_scale_h * 640) / 2;
csx = csx * dc2s_scale_h + ds2s_offs_x;
cex = cex * dc2s_scale_h + ds2s_offs_x;
csy = csy * dc2s_scale_h;
cey = cey * dc2s_scale_h;
}
glUniform4f(CurrentShader->pp_ClipTest, csx, csy, cex, cey);
}

return clip_mode;
Expand Down Expand Up @@ -1172,11 +1175,18 @@ void fullscreenQuadPrepareFramebuffer(float xScale, float yScale) {

// Reduce width to keep 4:3 aspect ratio (640x480)
u32 reducedWidth = 4 * screen_height / 3;
u32 reducedWidthOffset = (screen_width - reducedWidth) / 2;
glScissor(reducedWidthOffset, 0, reducedWidth, screen_height);
if (settings.rend.WideScreen &&
(pvrrc.fb_X_CLIP.min==0) && ((pvrrc.fb_X_CLIP.max+1)/xScale==640) &&
(pvrrc.fb_Y_CLIP.min==0) && ((pvrrc.fb_Y_CLIP.max+1)/yScale==480 ))

// handle odd/even screen width
if (screen_width % 2 == 0) {
u32 reducedWidthOffset = (screen_width - reducedWidth) / 2;
glScissor(reducedWidthOffset, 0, reducedWidth, screen_height);
}
else {
u32 reducedWidthOffset = (screen_width + 1 - reducedWidth) / 2;
glScissor(reducedWidthOffset, 0, reducedWidth, screen_height);
}

if (settings.rend.WideScreen)
{
glDisable(GL_SCISSOR_TEST);
}
Expand Down
Loading

0 comments on commit 41907bc

Please sign in to comment.