Added an optimization back in

This commit is contained in:
MysterD 2023-04-27 00:54:02 -07:00
parent 0616db8589
commit 21b104c247
3 changed files with 14 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#include "gfx_cc.h"
void gfx_cc_get_features(uint32_t shader_id, struct CCFeatures *cc_features) {
// DO NOT COMMIT: TODO - need to fix this
for (int32_t i = 0; i < 4; i++) {
cc_features->c[0][i] = (shader_id >> (i * 3)) & 7;
cc_features->c[1][i] = (shader_id >> (12 + i * 3)) & 7;

View File

@ -263,7 +263,6 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
bool do_single[4] = { 0 };
bool do_multiply[4] = { 0 };
bool do_mix[4] = { 0 };
bool color_alpha_same[2] = { 0 }; // TODO: gotta compare shader commands
for (int i = 0; i < 16 / 4; i++) {
u8* c = &cc->shader_commands[i * 4];
do_single[i] = (c[2] == 0);
@ -271,6 +270,17 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(struct ColorC
do_mix[i] = (c[1] == c[3]);
}
bool color_alpha_same[2] = { 1, 1 };
for (int i = 0; i < 2; i++) {
u8* cmd = &cc->shader_commands[i * 8];
for (int j = 0; j < 4; j++) {
if (cmd[j] != cmd[j + 4]) {
color_alpha_same[i] = 0;
break;
}
}
}
char vs_buf[1024];
char fs_buf[2048];
size_t vs_len = 0;

View File

@ -2029,8 +2029,8 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, co
gfx_wapi->init(window_title);
gfx_rapi->init();
// DO NOT COMMIT: must update these!
/*
// DO NOT COMMIT: TODO must update these!
// Used in the 120 star TAS
static uint32_t precomp_shaders[] = {
0x01200200,
@ -2062,8 +2062,7 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi, co
};
for (size_t i = 0; i < sizeof(precomp_shaders) / sizeof(uint32_t); i++)
gfx_lookup_or_create_shader_program(precomp_shaders[i]);
*/
gfx_precomp_shaders(precomp_shaders[i]);*/
}
#ifdef EXTERNAL_DATA