mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-09-08 21:50:52 +02:00
fsaa: refsw support; rwdc support for modechange and scale; disable mblur; config changes
This commit is contained in:
11
vendor/emu/refsw/refsw_lists.cpp
vendored
11
vendor/emu/refsw/refsw_lists.cpp
vendored
@@ -430,7 +430,7 @@ void RenderCORE() {
|
||||
auto base = (interlace && field) ? FB_W_SOF2 : FB_W_SOF1;
|
||||
|
||||
// very few configurations supported here
|
||||
verify(SCALER_CTL.hscale == 0);
|
||||
size_t xpixels = SCALER_CTL.hscale ? 16 : 32;
|
||||
verify(SCALER_CTL.interlace == 0); // write both SOFs
|
||||
auto vscale = SCALER_CTL.vscalefactor;
|
||||
verify(vscale == 0x401 || vscale == 0x400 || vscale == 0x800);
|
||||
@@ -440,14 +440,14 @@ void RenderCORE() {
|
||||
|
||||
auto src = copy;
|
||||
auto bpp = fb_packmode == 0x1 ? 2 : 4;
|
||||
auto offset_bytes = entry.control.tilex * 32 * bpp + entry.control.tiley * 32 * FB_W_LINESTRIDE.stride * 8;
|
||||
auto offset_bytes = entry.control.tilex * xpixels * bpp + entry.control.tiley * 32 * FB_W_LINESTRIDE.stride * 8;
|
||||
|
||||
for (int y = 0; y < 32; y++)
|
||||
{
|
||||
//auto base = (y&1) ? FB_W_SOF2 : FB_W_SOF1;
|
||||
auto dst = base + offset_bytes + (y)*FB_W_LINESTRIDE.stride * 8;
|
||||
|
||||
for (int x = 0; x < 32; x++)
|
||||
for (int x = 0; x < xpixels; x++)
|
||||
{
|
||||
if (fb_packmode == 0x1) {
|
||||
auto pixel = (((src[0] >> 3) & 0x1F) << 0) | (((src[1] >> 2) & 0x3F) << 5) | (((src[2] >> 3) & 0x1F) << 11);
|
||||
@@ -461,6 +461,11 @@ void RenderCORE() {
|
||||
|
||||
dst += bpp;
|
||||
src += 4; // skip alpha
|
||||
|
||||
// TODO: Actually do AA
|
||||
if (SCALER_CTL.hscale) {
|
||||
src += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
68
vendor/librw/src/dc/rwdc.cpp
vendored
68
vendor/librw/src/dc/rwdc.cpp
vendored
@@ -174,12 +174,11 @@ static pvr_dr_state_t drState;
|
||||
|
||||
#include <kos/dbglog.h>
|
||||
|
||||
float VIDEO_MODE_SCALE_X;
|
||||
|
||||
#if !defined(DC_TEXCONV) && !defined(DC_SIM)
|
||||
#include <kos.h>
|
||||
|
||||
#define VIDEO_MODE_WIDTH vid_mode->width
|
||||
#define VIDEO_MODE_HEIGHT vid_mode->height
|
||||
|
||||
#define mat_trans_nodiv_nomod(x, y, z, x2, y2, z2, w2) do { \
|
||||
register float __x __asm__("fr12") = (x); \
|
||||
register float __y __asm__("fr13") = (y); \
|
||||
@@ -289,8 +288,6 @@ void rw_mat_load_4x4(rw::Matrix* mtx) {
|
||||
}
|
||||
|
||||
#include <dc/matrix.h>
|
||||
#define VIDEO_MODE_WIDTH 640
|
||||
#define VIDEO_MODE_HEIGHT 480
|
||||
#define frsqrt(a) (1.0f/sqrt(a))
|
||||
#define dcache_pref_block(a) __builtin_prefetch(a)
|
||||
|
||||
@@ -554,8 +551,6 @@ void DCE_InitMatrices() {
|
||||
mat_identity();
|
||||
|
||||
mat_store(&DCE_MAT_SCREENVIEW);
|
||||
|
||||
DCE_MatrixViewport(0, 0, VIDEO_MODE_WIDTH, VIDEO_MODE_HEIGHT);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -789,7 +784,7 @@ void beginUpdate(Camera* cam) {
|
||||
proj[14] = -cam->nearPlane*proj[10];
|
||||
memcpy4(&cam->devProj, proj, sizeof(RawMatrix));
|
||||
|
||||
DCE_MatrixViewport(0, 0, cam->frameBuffer->width, cam->frameBuffer->height);
|
||||
DCE_MatrixViewport(0, 0, cam->frameBuffer->width * VIDEO_MODE_SCALE_X, cam->frameBuffer->height);
|
||||
|
||||
mat_load((matrix_t*)&DCE_MAT_SCREENVIEW);
|
||||
mat_apply((matrix_t*)&cam->devProj);
|
||||
@@ -831,7 +826,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
auto doquad = [=](float x, float y, float w, float h, float tx, float ty, float tw, float th) {
|
||||
auto vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX;
|
||||
vtx->x = x;
|
||||
vtx->x = x * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y;
|
||||
vtx->z = 1000000.0f;
|
||||
vtx->u = tx/1024.f;
|
||||
@@ -841,7 +836,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
|
||||
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX;
|
||||
vtx->x = x+w;
|
||||
vtx->x = (x+w) * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y;
|
||||
vtx->z = 1000000.0f;
|
||||
vtx->u = (tx+tw)/1024.f;
|
||||
@@ -851,7 +846,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
|
||||
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX;
|
||||
vtx->x = x;
|
||||
vtx->x = x * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y+h;
|
||||
vtx->z = 1000000.0f;
|
||||
vtx->u = tx/1024.f;
|
||||
@@ -861,7 +856,7 @@ void dcMotionBlur_v1(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
|
||||
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX_EOL;
|
||||
vtx->x = x+w;
|
||||
vtx->x = (x+w) * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y+h;
|
||||
vtx->z = 1000000.0f;
|
||||
vtx->u = (tx+tw)/1024.f;
|
||||
@@ -935,7 +930,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
float umin, float umax, float vmin, float vmax, uint32_t col) {
|
||||
auto vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX;
|
||||
vtx->x = x;
|
||||
vtx->x = x * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y;
|
||||
vtx->z = z;
|
||||
vtx->u = umin;
|
||||
@@ -945,7 +940,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
|
||||
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX;
|
||||
vtx->x = x+w;
|
||||
vtx->x = (x+w) * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y;
|
||||
vtx->z = z;
|
||||
vtx->u = umax;
|
||||
@@ -955,7 +950,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
|
||||
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX;
|
||||
vtx->x = x;
|
||||
vtx->x = x * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y+h;
|
||||
vtx->z = z;
|
||||
vtx->u = umin;
|
||||
@@ -965,7 +960,7 @@ void dcMotionBlur_v3(uint8_t a, uint8_t r, uint8_t g, uint8_t b) {
|
||||
|
||||
vtx = reinterpret_cast<pvr_vertex_t *>(pvr_dr_target(drState));
|
||||
vtx->flags = PVR_CMD_VERTEX_EOL;
|
||||
vtx->x = x+w;
|
||||
vtx->x = (x+w) * VIDEO_MODE_SCALE_X;
|
||||
vtx->y = y+h;
|
||||
vtx->z = z;
|
||||
vtx->u = umax;
|
||||
@@ -1508,7 +1503,7 @@ void im2DRenderPrimitive(PrimitiveType primType, void *vertices, int32_t numVert
|
||||
{
|
||||
auto *pvrVert = pvr_dr_target(drState);
|
||||
pvrVert->flags = flags;
|
||||
pvrVert->x = gtaVert.x;
|
||||
pvrVert->x = gtaVert.x * VIDEO_MODE_SCALE_X;
|
||||
pvrVert->y = gtaVert.y;
|
||||
pvrVert->z = MATH_Fast_Invert(gtaVert.w); // this is perfect for almost every case...
|
||||
pvrVert->u = gtaVert.u;
|
||||
@@ -4581,6 +4576,14 @@ rasterToImage(Raster*)
|
||||
return nil;
|
||||
}
|
||||
|
||||
static pvr_init_params_t pvr_params = {
|
||||
.opb_sizes = {
|
||||
PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_8, PVR_BINSIZE_0,
|
||||
PVR_BINSIZE_8
|
||||
},
|
||||
.autosort_disabled = true
|
||||
};
|
||||
|
||||
int
|
||||
deviceSystem(DeviceReq req, void *arg0, int32 n)
|
||||
{
|
||||
@@ -4616,15 +4619,22 @@ deviceSystem(DeviceReq req, void *arg0, int32 n)
|
||||
rwmode->flags = VIDEOMODEEXCLUSIVE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
case DEVICEGETMAXMULTISAMPLINGLEVELS:
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 2;
|
||||
case DEVICEGETMULTISAMPLINGLEVELS:
|
||||
return 1;
|
||||
return 1 << pvr_params.fsaa_enabled;
|
||||
case DEVICESETMULTISAMPLINGLEVELS:
|
||||
if (n == 1) {
|
||||
VIDEO_MODE_SCALE_X = 1;
|
||||
pvr_params.fsaa_enabled = 0;
|
||||
pvr_params.vertex_buf_size = (1024 + 1024) * 1024;
|
||||
pvr_params.opb_overflow_count = 7; // 268800 bytes
|
||||
} else {
|
||||
VIDEO_MODE_SCALE_X = 2;
|
||||
pvr_params.fsaa_enabled = 1;
|
||||
pvr_params.vertex_buf_size = (1024 + 768) * 1024;
|
||||
pvr_params.opb_overflow_count = 4; // 307200 bytes
|
||||
}
|
||||
return 1;
|
||||
case DEVICESETSUBSYSTEM:
|
||||
return 1;
|
||||
@@ -4661,16 +4671,6 @@ Device renderdevice = {
|
||||
deviceSystem
|
||||
};
|
||||
|
||||
static pvr_init_params_t pvr_params = {
|
||||
.opb_sizes = {
|
||||
PVR_BINSIZE_16, PVR_BINSIZE_0, PVR_BINSIZE_8, PVR_BINSIZE_0,
|
||||
PVR_BINSIZE_8
|
||||
},
|
||||
.vertex_buf_size = (1024 + 1024) * 1024,
|
||||
.autosort_disabled = true,
|
||||
.opb_overflow_count = 7 // 268800 bytes
|
||||
};
|
||||
|
||||
void defaultInstance(ObjPipeline *pipe, Atomic *atomic) {
|
||||
#if defined(DC_TEXCONV)
|
||||
processGeom(atomic->geometry);
|
||||
@@ -4758,6 +4758,8 @@ driverClose(void *o, int32, int32)
|
||||
{
|
||||
pvr_mem_free(fake_tex);
|
||||
|
||||
pvr_shutdown();
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user