[RT64 Fixes-2]

This commit is contained in:
iZePlayz 2024-08-27 16:02:41 +02:00
parent 01896941cb
commit 8fc6dc0ca7
6 changed files with 6 additions and 49 deletions

View file

@ -505,7 +505,7 @@ extern u8 sDanceCutsceneIndexTable[][4];
extern u8 sZoomOutAreaMasks[];
#ifdef GFX_SEPARATE_PROJECTIONS
static void skip_camera_interpolation(void) {
void skip_camera_interpolation(void) {
gLakituState.skipCameraInterpolationTimestamp = gGlobalTimer;
}
#endif

View file

@ -50,6 +50,11 @@ enum {
#define SHADER_OPT_NOISE (1 << 27)
struct CCFeatures {
uint8_t c[2][4];
bool opt_alpha;
bool opt_fog;
bool opt_texture_edge;
bool opt_noise;
bool used_textures[2];
int num_inputs;
bool do_single[4];

View file

@ -1131,7 +1131,6 @@ static void OPTIMIZE_O3 gfx_sp_vertex(size_t n_vertices, size_t dest_index, cons
static void OPTIMIZE_O3 gfx_sp_tri1(uint8_t vtx1_idx, uint8_t vtx2_idx, uint8_t vtx3_idx) {
#ifdef GFX_SEPARATE_PROJECTIONS
uint8_t swap = 0;
switch (rsp.geometry_mode & G_CULL_BOTH) {
// Ignore this call entirely.
case G_CULL_BOTH:

View file

@ -20,9 +20,6 @@ struct GfxRenderingAPI {
uint32_t (*new_texture)(void);
void (*select_texture)(int tile, uint32_t texture_id);
void (*upload_texture)(const uint8_t *rgba32_buf, int width, int height);
#ifdef GFX_UPLOAD_TEXTURE_FILE
void (*upload_texture_file)(const char *file_path, const uint8_t *file_buf, uint64_t file_buf_size);
#endif
void (*set_sampler_parameters)(int sampler, bool linear_filter, uint32_t cms, uint32_t cmt);
void (*set_depth_test)(bool depth_test);
void (*set_depth_mask)(bool z_upd);

View file

@ -12,7 +12,6 @@
# define GFX_OUTPUT_NORMALS_TO_VBO
# define GFX_SEPARATE_PROJECTIONS
# define GFX_SEPARATE_FOG
# define GFX_UPLOAD_TEXTURE_FILE
# define GFX_ENABLE_GRAPH_NODE_MODS
#endif

View file

@ -835,48 +835,6 @@ static void gfx_rt64_rapi_upload_texture(const uint8_t *rgba32_buf, int width, i
RT64.textureUploadQueueMutex.unlock();
}
static void gfx_rt64_rapi_upload_texture_file(const char *file_path, const uint8_t *file_buf, uint64_t file_buf_size) {
uint32_t textureKey = RT64.currentTextureIds[RT64.currentTile];
UploadTexture uploadTexture;
uploadTexture.hash = RT64.textures[textureKey].hash;
uploadTexture.key = textureKey;
RT64_TEXTURE_DESC &texDesc = uploadTexture.desc;
// Use special case for loading DDS directly.
if (strstr(file_path, ".dds") || strstr(file_path, ".DDS")) {
texDesc.byteCount = (int)(file_buf_size);
texDesc.bytes = malloc(texDesc.byteCount);
memcpy(texDesc.bytes, file_buf, texDesc.byteCount);
texDesc.width = texDesc.height = texDesc.rowPitch = -1;
texDesc.format = RT64_TEXTURE_FORMAT_DDS;
RT64.textureUploadQueueMutex.lock();
RT64.textureUploadQueue.push(uploadTexture);
RT64.textureUploadQueueMutex.unlock();
}
// Use stb image to load the file from memory instead if possible.
else {
int width, height;
stbi_uc *data = stbi_load_from_memory(file_buf, file_buf_size, &width, &height, NULL, 4);
if (data != nullptr) {
texDesc.bytes = data;
texDesc.width = width;
texDesc.height = height;
texDesc.rowPitch = texDesc.width * 4;
texDesc.byteCount = texDesc.height * texDesc.rowPitch;
texDesc.format = RT64_TEXTURE_FORMAT_RGBA8;
RT64.textureUploadQueueMutex.lock();
RT64.textureUploadQueue.push(uploadTexture);
RT64.textureUploadQueueMutex.unlock();
}
else {
fprintf(stderr, "stb_image was unable to load the texture file.\n");
}
}
}
static void gfx_rt64_rapi_set_sampler_parameters(int tile, bool linear_filter, uint32_t cms, uint32_t cmt) {
uint32_t textureKey = RT64.currentTextureIds[tile];
auto &recordedTexture = RT64.textures[textureKey];
@ -2214,7 +2172,6 @@ struct GfxRenderingAPI gfx_rt64_rapi = {
gfx_rt64_rapi_new_texture,
gfx_rt64_rapi_select_texture,
gfx_rt64_rapi_upload_texture,
gfx_rt64_rapi_upload_texture_file,
gfx_rt64_rapi_set_sampler_parameters,
gfx_rt64_rapi_set_depth_test,
gfx_rt64_rapi_set_depth_mask,