From 4d85baf7eaf07939ee29af369f5db837c6534e9c Mon Sep 17 00:00:00 2001 From: korenkonder Date: Mon, 1 Jan 2024 21:14:33 +0300 Subject: [PATCH] Small shader update --- src/CRE/shader.cpp | 63 ++- src/CRE/shader.hpp | 6 +- src/CRE/shader_dev.cpp | 12 +- src/CRE/shader_ft.cpp | 1130 ++++++++++++---------------------------- 4 files changed, 378 insertions(+), 833 deletions(-) diff --git a/src/CRE/shader.cpp b/src/CRE/shader.cpp index 787d1e21..70d745b7 100644 --- a/src/CRE/shader.cpp +++ b/src/CRE/shader.cpp @@ -53,8 +53,8 @@ int32_t shader::bind(shader_set_data* set, uint32_t sub_index) { int32_t i = 0; for (i = 0; i < num_uniform && i < sizeof(uniform_val) / sizeof(int32_t); i++) { - const int32_t unival = uniform_value[use_uniform[i]]; - const int32_t unival_max = use_permut[i] + const int32_t unival = uniform_value[use_uniform[i].first]; + const int32_t unival_max = use_uniform[i].second ? max_def(vp_unival_max[i], fp_unival_max[i]) : 0; unival_shad += unival_shad_curr * min_def(unival, unival_max); unival_shad_curr *= unival_max + 1; @@ -454,7 +454,6 @@ void shader_set_data::load(farc* f, bool ignore_cache, shader->sub = force_malloc(shader->num_sub); shader->num_uniform = shaders_table[i].num_uniform; shader->use_uniform = shaders_table[i].use_uniform; - shader->use_permut = shaders_table[i].use_permut; int32_t num_sub = shader->num_sub; const shader_sub_table* sub_table = shaders_table[i].sub; @@ -500,15 +499,28 @@ void shader_set_data::load(farc* f, bool ignore_cache, continue; } - uint64_t vert_file_name_cache = hash_utf8_fnv1a64m(vert_file_buf); - uint64_t frag_file_name_cache = hash_utf8_fnv1a64m(frag_file_buf); - for (int32_t i = 0; i < 64; i += 8) - if (((vert_file_name_cache >> i) & 0xFF) == 0) - vert_file_name_cache |= 0xFFULL << i; + uint32_t uniform_flags = 0; + for (int32_t k = 0; k < shader->num_uniform; k++) + if (shader->use_uniform[k].second) + uniform_flags |= 1 << k; - for (int32_t i = 0; i < 64; i += 8) - if (((frag_file_name_cache >> i) & 0xFF) == 0) - frag_file_name_cache |= 0xFFULL << i; + char uniform_flags_buf[9]; + for (int32_t k = 0, l = 7; k < 32; k += 4, l--) { + int32_t digit = (uniform_flags >> k) & 0xF; + if (digit >= 0x00 && digit <= 0x09) + uniform_flags_buf[l] = (char)('0' + digit); + else + uniform_flags_buf[l] = (char)('A' + (digit - 0x0A)); + } + uniform_flags_buf[8] = 0; + + strcat_s(vert_file_buf, sizeof(vert_file_buf), "."); + strcat_s(frag_file_buf, sizeof(frag_file_buf), "."); + strcat_s(vert_file_buf, sizeof(vert_file_buf), uniform_flags_buf); + strcat_s(frag_file_buf, sizeof(frag_file_buf), uniform_flags_buf); + + uint64_t vert_file_name_hash = hash_utf8_fnv1a64m(vert_file_buf); + uint64_t frag_file_name_hash = hash_utf8_fnv1a64m(frag_file_buf); char shader_cache_file_name[MAX_PATH]; strcpy_s(shader_cache_file_name, sizeof(shader_cache_file_name), sub_table->vp); @@ -528,11 +540,14 @@ void shader_set_data::load(farc* f, bool ignore_cache, if (!ignore_cache) { if (!shader_cache_file || !shader_cache_file->data) printf_debug("Shader not compiled: %s %s\n", vert_file_buf, frag_file_buf); - else if (vert_data_hash != ((uint64_t*)shader_cache_file->data)[0] - || frag_data_hash != ((uint64_t*)shader_cache_file->data)[1]) + else if (vert_file_name_hash != ((uint64_t*)shader_cache_file->data)[0] + || frag_file_name_hash != ((uint64_t*)shader_cache_file->data)[1]) + printf_debug("Shader flags not equal: %s %s\n", vert_file_buf, frag_file_buf); + else if (vert_data_hash != ((uint64_t*)shader_cache_file->data)[2] + || frag_data_hash != ((uint64_t*)shader_cache_file->data)[3]) printf_debug("Shader hash not equal: %s %s\n", vert_file_buf, frag_file_buf); else - bin = (program_binary*)&((uint64_t*)shader_cache_file->data)[2]; + bin = (program_binary*)&((uint64_t*)shader_cache_file->data)[4]; } if (shader->num_uniform > 0 @@ -543,7 +558,7 @@ void shader_set_data::load(farc* f, bool ignore_cache, const int32_t* vp_unival_max = sub_table->vp_unival_max; const int32_t* fp_unival_max = sub_table->fp_unival_max; for (size_t k = 0; k < num_uniform; k++) { - const int32_t unival_max = shader->use_permut[k] + const int32_t unival_max = shader->use_uniform[k].second ? max_def(vp_unival_max[k], fp_unival_max[k]) : 0; unival_shad_count += unival_shad_curr * unival_max; unival_shad_curr *= unival_max + 1; @@ -572,7 +587,7 @@ void shader_set_data::load(farc* f, bool ignore_cache, for (size_t k = 0; k < unival_shad_count; k++) { for (size_t l = 0, m = k; l < num_uniform; l++) { - size_t unival_max = (size_t)(shader->use_permut[l] + size_t unival_max = (size_t)(shader->use_uniform[l].second ? max_def(vp_unival_max[l], fp_unival_max[l]) : 0) + 1; vec_vert_data[l] = (uint32_t)(min_def(m % unival_max, vp_unival_max[l])); m /= unival_max; @@ -580,7 +595,7 @@ void shader_set_data::load(farc* f, bool ignore_cache, } for (size_t l = 0, m = k; l < num_uniform; l++) { - size_t unival_max = (size_t)(shader->use_permut[l] + size_t unival_max = (size_t)(shader->use_uniform[l].second ? max_def(vp_unival_max[l], fp_unival_max[l]) : 0) + 1; vec_frag_data[l] = (uint32_t)(min_def(m % unival_max, fp_unival_max[l])); m /= unival_max; @@ -674,7 +689,7 @@ void shader_set_data::load(farc* f, bool ignore_cache, free_def(shader_cache_file->data); size_t bin_count = program_data_binary.size(); - size_t bin_size = sizeof(uint64_t) * 2 + bin_count * sizeof(program_binary); + size_t bin_size = sizeof(uint64_t) * 4 + bin_count * sizeof(program_binary); for (program_binary& k : program_data_binary) bin_size += align_val(k.length, 0x04); shader_cache_file->data = force_malloc(bin_size); @@ -682,10 +697,12 @@ void shader_set_data::load(farc* f, bool ignore_cache, shader_cache_file->compressed = true; shader_cache_file->data_changed = true; - ((uint64_t*)shader_cache_file->data)[0] = vert_data_hash; - ((uint64_t*)shader_cache_file->data)[1] = frag_data_hash; - bin = (program_binary*)&((uint64_t*)shader_cache_file->data)[2]; - size_t bin_data_base = (size_t)shader_cache_file->data + sizeof(uint64_t) * 2; + ((uint64_t*)shader_cache_file->data)[0] = vert_file_name_hash; + ((uint64_t*)shader_cache_file->data)[1] = frag_file_name_hash; + ((uint64_t*)shader_cache_file->data)[2] = vert_data_hash; + ((uint64_t*)shader_cache_file->data)[3] = frag_data_hash; + bin = (program_binary*)&((uint64_t*)shader_cache_file->data)[4]; + size_t bin_data_base = (size_t)shader_cache_file->data + sizeof(uint64_t) * 4; size_t bin_data = bin_data_base + bin_count * sizeof(program_binary); for (program_binary& k : program_data_binary) { bin->length = k.length; @@ -755,7 +772,7 @@ void shader_set_data::unload() { const int32_t* vp_unival_max = sub->vp_unival_max; const int32_t* fp_unival_max = sub->fp_unival_max; for (size_t k = 0; k < num_uniform; k++) { - const int32_t unival_max = shader->use_permut[k] + const int32_t unival_max = shader->use_uniform[k].second ? max_def(vp_unival_max[k], fp_unival_max[k]) : 0; unival_shad_count += unival_shad_curr * unival_max; unival_shad_curr *= unival_max + 1; diff --git a/src/CRE/shader.hpp b/src/CRE/shader.hpp index e08f8e25..323e0e56 100644 --- a/src/CRE/shader.hpp +++ b/src/CRE/shader.hpp @@ -37,8 +37,7 @@ struct shader_table { int32_t num_sub; const shader_sub_table* sub; int32_t num_uniform; - const uniform_name* use_uniform; - const bool* use_permut; + const std::pair* use_uniform; }; struct shader; @@ -74,8 +73,7 @@ struct shader { int32_t num_sub; shader_sub* sub; int32_t num_uniform; - const uniform_name* use_uniform; - const bool* use_permut; + const std::pair* use_uniform; PFNSHADERBINDFUNCPROC bind_func; int32_t bind(shader_set_data* set, uint32_t sub_index); diff --git a/src/CRE/shader_dev.cpp b/src/CRE/shader_dev.cpp index eaa36eef..f84ae83c 100644 --- a/src/CRE/shader_dev.cpp +++ b/src/CRE/shader_dev.cpp @@ -25,12 +25,8 @@ static const int32_t glitter_particle_wireframe_fpt_unival_max[] = { -1, }; -static const uniform_name GLITTER_PT_WIREFRAME_uniform[] = { - U_INVALID, -}; - -static const bool GLITTER_PT_WIREFRAME_permut[] = { - false, +static const std::pair GLITTER_PT_WIREFRAME_uniform[] = { + { U_INVALID , false,} }; static const shader_sub_table GLITTER_PT_WIREFRAME_table[] = { @@ -49,9 +45,8 @@ static const shader_sub_table GLITTER_PT_WIREFRAME_table[] = { SHADER_DEV_##n, \ sizeof(n##_table) / sizeof(shader_sub_table), \ n##_table, \ - sizeof(n##_uniform) / sizeof(uniform_name), \ + sizeof(n##_uniform) / sizeof(std::pair), \ n##_uniform, \ - n##_permut, \ } const shader_table shader_dev_table[] = { @@ -62,7 +57,6 @@ const shader_table shader_dev_table[] = { 0, 0, 0, - 0, }, shader_table_struct(GLITTER_PT_WIREFRAME), }; diff --git a/src/CRE/shader_ft.cpp b/src/CRE/shader_ft.cpp index 5bbfb9c4..6b9ad45f 100644 --- a/src/CRE/shader_ft.cpp +++ b/src/CRE/shader_ft.cpp @@ -2044,934 +2044,472 @@ static const shader_sub_table TRANSPARENCY_table[] = { // Added }, }; -static const uniform_name BLINN_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_TEXTURE_COUNT, - U_LIGHT_0, - U_NORMAL, - U_SPECULAR, - U_ENV_MAP, - U_FOG_HEIGHT, - U_MORPH, - U_MORPH_COLOR, - U_LIGHT_1, - U_ALPHA_TEST, // 11th added +static const std::pair BLINN_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_TEXTURE_COUNT, false }, + { U_LIGHT_1 , false }, + { U_NORMAL , false }, + { U_SPECULAR , false }, + { U_ENV_MAP , false }, + { U_FOG_HEIGHT , false }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_LIGHT_1 , false }, + { U_ALPHA_TEST , true }, // 11th added }; -static const uniform_name ITEM_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_MORPH, - U_SPECULAR_IBL, - U_SPECULAR, - U_NORMAL, - U_TEXTURE_COUNT, - U_ENV_MAP, - U_SELF_SHADOW, - U_FOG, - U_ALPHA_TEST, - U_SHADOW, - U_CHARA_COLOR, - U_TONE_CURVE, +static const std::pair ITEM_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_MORPH , true }, + { U_SPECULAR_IBL , false }, + { U_SPECULAR , false }, + { U_NORMAL , false }, + { U_TEXTURE_COUNT, false }, + { U_ENV_MAP , false }, + { U_SELF_SHADOW , false }, + { U_FOG , false }, + { U_ALPHA_TEST , true }, + { U_SHADOW , false }, + { U_CHARA_COLOR , false }, + { U_TONE_CURVE , false }, }; -static const uniform_name STAGE_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_MORPH, - U_MORPH_COLOR, - U_TEXTURE_COUNT, - U_ENV_MAP, - U_LIGHT_0, - U_NORMAL, - U_FOG_HEIGHT, - U_LIGHT_1, - U12, - U_ALPHA_TEST, // 11th added +static const std::pair STAGE_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_TEXTURE_COUNT, false }, + { U_ENV_MAP , false }, + { U_LIGHT_1 , false }, + { U_NORMAL , false }, + { U_FOG_HEIGHT , false }, + { U_LIGHT_1 , false }, + { U12 , false }, + { U_ALPHA_TEST , true }, // 11th added }; -static const uniform_name SKIN_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_NORMAL, - U_SELF_SHADOW, - U_FOG, - U_ALPHA_TEST, - U_SHADOW, - U_NPR, - U_CHARA_COLOR, - U_TONE_CURVE, +static const std::pair SKIN_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_NORMAL , false }, + { U_SELF_SHADOW , false }, + { U_FOG , false }, + { U_ALPHA_TEST , true }, + { U_SHADOW , false }, + { U_NPR , true }, + { U_CHARA_COLOR , false }, + { U_TONE_CURVE , false }, }; -static const uniform_name SSS_SKIN_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U37, - U_ALPHA_TEST, - U_SELF_SHADOW, - U_SHADOW, - U_NPR, - U26, +static const std::pair SSS_SKIN_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U37 , false }, + { U_ALPHA_TEST , true }, + { U_SELF_SHADOW , false }, + { U_SHADOW , false }, + { U_NPR , true }, + { U26 , false }, }; -static const uniform_name SSS_FILT_uniform[] = { - //U16, // 0th removed - U_SSS_FILTER, - U_NPR, +static const std::pair SSS_FILT_uniform[] = { + //{ U16 , true }, // 0th removed + { U_SSS_FILTER , true }, + { U_NPR , true }, }; -static const uniform_name HAIR_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_SPECULAR_IBL, - U_SPECULAR, - U_NORMAL, - U_TRANSPARENCY, - U_TRANSLUCENCY, - U_ANISO, - U_SELF_SHADOW, - U_FOG, - U_SHADOW, - U_NPR, - U_CHARA_COLOR, - U_TONE_CURVE, - U_ALPHA_TEST, // 14th added +static const std::pair HAIR_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_SPECULAR_IBL , false }, + { U_SPECULAR , false }, + { U_NORMAL , false }, + { U_TRANSPARENCY , false }, + { U_TRANSLUCENCY , false }, + { U_ANISO , false }, + { U_SELF_SHADOW , false }, + { U_FOG , false }, + { U_SHADOW , false }, + { U_NPR , false }, + { U_CHARA_COLOR , false }, + { U_TONE_CURVE , false }, + { U_ALPHA_TEST , true }, // 14th added }; -static const uniform_name CLOTH_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_SPECULAR_IBL, - U_SPECULAR, - U_NORMAL, - U_TRANSPARENCY, - U_ENV_MAP, - U_SELF_SHADOW, - U_FOG, - U_ALPHA_TEST, - U_ANISO, - U_SHADOW, - U_NPR, - U_CHARA_COLOR, - U_TONE_CURVE, +static const std::pair CLOTH_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_SPECULAR_IBL , false }, + { U_SPECULAR , false }, + { U_NORMAL , false }, + { U_TRANSPARENCY , false }, + { U_ENV_MAP , false }, + { U_SELF_SHADOW , false }, + { U_FOG , false }, + { U_ALPHA_TEST , true }, + { U_ANISO , false }, + { U_SHADOW , false }, + { U_NPR , false }, + { U_CHARA_COLOR , false }, + { U_TONE_CURVE , false }, }; -static const uniform_name TIGHTS_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_SPECULAR, - U_ENV_MAP, - U_SELF_SHADOW, - U_FOG, - U_ALPHA_TEST, - U_SHADOW, - U_NPR, - U_CHARA_COLOR, - U_TONE_CURVE, +static const std::pair TIGHTS_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_SPECULAR , false }, + { U_ENV_MAP , false }, + { U_SELF_SHADOW , false }, + { U_FOG , false }, + { U_ALPHA_TEST , true }, + { U_SHADOW , false }, + { U_NPR , false }, + { U_CHARA_COLOR , false }, + { U_TONE_CURVE , false }, }; -static const uniform_name SKY_uniform[] = { - U_TEX_0_TYPE, - U_TEX_1_TYPE, - U_TEXTURE_COUNT, - U_MORPH, - U_MORPH_COLOR, - U_FOG_HEIGHT, - U_ALPHA_TEST, // 6th added +static const std::pair SKY_uniform[] = { + { U_TEX_0_TYPE , false }, + { U_TEX_1_TYPE , false }, + { U_TEXTURE_COUNT, false }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_FOG_HEIGHT , false }, + { U_ALPHA_TEST , true }, // 6th added }; -/*static const uniform_name EYEBALL_uniform[] = { - U_BONE_MAT, - U_ENV_MAP, +/*static const std::pair EYEBALL_uniform[] = { + { U_BONE_MAT , true }, + { U_ENV_MAP , false }, };*/ -/*static const uniform_name EYELENS_uniform[] = { - U_BONE_MAT, - U_SPECULAR, - U_ENV_MAP, +/*static const std::pair EYELENS_uniform[] = { + { U_BONE_MAT , true }, + { U_SPECULAR , false }, + { U_ENV_MAP , false }, };*/ -static const uniform_name GLASEYE_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_SELF_SHADOW, - U_FOG, - U18, - U_SHADOW, - U_CHARA_COLOR, - U_TONE_CURVE, +static const std::pair GLASEYE_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_SELF_SHADOW , false }, + { U_FOG , false }, + { U18 , false }, + { U_SHADOW , false }, + { U_CHARA_COLOR , false }, + { U_TONE_CURVE , false }, }; -/*static const uniform_name MEMBRAN_uniform[] = { - U_BONE_MAT, - U_NORMAL, - U_MEMBRANE, +/*static const std::pair MEMBRAN_uniform[] = { + { U_BONE_MAT , true }, + { U_NORMAL , false }, + { U_MEMBRANE , false }, };*/ -/*static const uniform_name SHDMAP_uniform[] = { - U_BONE_MAT, - U_TEXTURE_COUNT, - U_TRANSPARENCY, - U_LIGHT_1, - U2D, +/*static const std::pair SHDMAP_uniform[] = { + { U_BONE_MAT , true }, + { U_TEXTURE_COUNT, false }, + { U_TRANSPARENCY , false }, + { U_LIGHT_1 , false }, + { U2D , true }, };*/ -/*static const uniform_name ESM_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_TEXTURE_COUNT, - U_TRANSPARENCY, +/*static const std::pair ESM_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_TEXTURE_COUNT, false }, + { U_TRANSPARENCY , false }, };*/ -static const uniform_name ESMGAUSS_uniform[] = { - U_LIGHT_PROJ, +static const std::pair ESMGAUSS_uniform[] = { + { U_LIGHT_PROJ , true }, }; -static const uniform_name ESMFILT_uniform[] = { - U_ESM_FILTER, +static const std::pair ESMFILT_uniform[] = { + { U_ESM_FILTER , true }, }; -static const uniform_name LITPROJ_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_SPECULAR, - U_NORMAL, - U_TEXTURE_COUNT, - U_TRANSPARENCY, +static const std::pair LITPROJ_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_SPECULAR , false }, + { U_NORMAL , false }, + { U_TEXTURE_COUNT, false }, + { U_TRANSPARENCY , false }, }; -static const uniform_name SIMPLE_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_TEXTURE_COUNT, - //U_NORMAL, // 3rd removed - //U_INSTANCE, // 4th removed - //U2E, // 5th removed +static const std::pair SIMPLE_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_TEXTURE_COUNT, false }, + //{ U_NORMAL , false }, // 3rd removed + //{ U_INSTANCE , false }, // 4th removed + //{ U2E , false }, // 5th removed }; -static const uniform_name SIL_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_TRANSPARENCY, - U_TEXTURE_COUNT, - U_MORPH, - U_MORPH_COLOR, - U0A, - U_ALPHA_TEST, // 7th added +static const std::pair SIL_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_TRANSPARENCY , false }, + { U_TEXTURE_COUNT, false }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U0A , false }, + { U_ALPHA_TEST , true }, // 7th added }; -static const uniform_name LAMBERT_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_TEXTURE_COUNT, - U_LIGHT_0, - U_FOG_HEIGHT, - U_MORPH, - U_MORPH_COLOR, - U_LIGHT_1, - U_ALPHA_TEST, // 8th added +static const std::pair LAMBERT_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_TEXTURE_COUNT, false }, + { U_LIGHT_1 , false }, + { U_FOG_HEIGHT , false }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_LIGHT_1 , false }, + { U_ALPHA_TEST , true }, // 8th added }; -static const uniform_name CONSTANT_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_TEXTURE_COUNT, - U_FOG_HEIGHT, - U_MORPH, - U_MORPH_COLOR, - U_ALPHA_TEST, // 6th added +static const std::pair CONSTANT_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_TEXTURE_COUNT, false }, + { U_FOG_HEIGHT , false }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_ALPHA_TEST , true }, // 6th added }; -/*static const uniform_name PEEL_uniform[] = { - U_DEPTH_PEEL, - U_BONE_MAT, +/*static const std::pair PEEL_uniform[] = { + { U_DEPTH_PEEL , false }, + { U_BONE_MAT , true }, };*/ -static const uniform_name TONEMAP_uniform[] = { - //U16, // 0th removed - U_TONE_MAP, - U_FLARE, - U_SCENE_FADE, - U_AET_BACK, - U_LIGHT_PROJ, - U_NPR, - //U25, 7th removed +static const std::pair TONEMAP_uniform[] = { + //{ U16 , true }, // 0th removed + { U_TONE_MAP , false }, + { U_FLARE , false }, + { U_SCENE_FADE , false }, + { U_AET_BACK , false }, + { U_LIGHT_PROJ , false }, + { U_NPR , false }, + //{ U25 , false }, 7th removed }; -static const uniform_name REDUCE_uniform[] = { - U_REDUCE, - U_ALPHA_MASK, +static const std::pair REDUCE_uniform[] = { + { U_REDUCE , true }, + { U_ALPHA_MASK , true }, }; -static const uniform_name MAGNIFY_uniform[] = { - U_MAGNIFY, +static const std::pair MAGNIFY_uniform[] = { + { U_MAGNIFY , true }, }; -static const uniform_name MLAA_uniform[] = { - //U16, // 0th removed - U_ALPHA_MASK, - U_MLAA, - U_MLAA_SEARCH, +static const std::pair MLAA_uniform[] = { + //{ U16 , true }, // 0th removed + { U_ALPHA_MASK , true }, + { U_MLAA , true }, + { U_MLAA_SEARCH , true }, }; -static const uniform_name CONTOUR_uniform[] = { - //U16, // 0th removed - U24, +static const std::pair CONTOUR_uniform[] = { + //{ U16 , true }, // 0th removed + { U24 , false }, }; -static const uniform_name CONTOUR_NPR_uniform[] = { - U_INVALID, +static const std::pair CONTOUR_NPR_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name EXPOSURE_uniform[] = { - U_EXPOSURE, +static const std::pair EXPOSURE_uniform[] = { + { U_EXPOSURE , true }, }; -static const uniform_name GAUSS_uniform[] = { - U_GAUSS, +static const std::pair GAUSS_uniform[] = { + { U_GAUSS , true }, }; -static const uniform_name SUN_uniform[] = { - U_INVALID, +static const std::pair SUN_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name SUN_NO_TEXTURED_uniform[] = { - U_INVALID, +static const std::pair SUN_NO_TEXTURED_uniform[] = { + { U_INVALID , false }, }; -/*static const uniform_name FADE_uniform[] = { - U_FADE, +/*static const std::pair FADE_uniform[] = { + { U_FADE , false }, };*/ -static const uniform_name WATER01_uniform[] = { - U_MORPH, - U_MORPH_COLOR, - U_TEXTURE_COUNT, - U_NORMAL, - U_WATER_REFLECT, - U_ENV_MAP, - U_SPECULAR, - U_FOG_HEIGHT, +static const std::pair WATER01_uniform[] = { + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_TEXTURE_COUNT, false }, + { U_NORMAL , false }, + { U_WATER_REFLECT, false }, + { U_ENV_MAP , false }, + { U_SPECULAR , false }, + { U_FOG_HEIGHT , false }, }; -/*static const uniform_name WATER02_uniform[] = { - U_INVALID, +/*static const std::pair WATER02_uniform[] = { + { U_INVALID , false }, };*/ -/*static const uniform_name WATRING_uniform[] = { - U_LIGHT_0, - U_LIGHT_1, +/*static const std::pair WATRING_uniform[] = { + { U_LIGHT_1 , false }, + { U_LIGHT_1 , false }, };*/ -static const uniform_name W_PTCL_uniform[] = { - U_INVALID, +static const std::pair W_PTCL_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name SNOW_PT_uniform[] = { - U_SNOW_PARTICLE, +static const std::pair SNOW_PT_uniform[] = { + { U_SNOW_PARTICLE, false }, }; -static const uniform_name LEAF_PT_uniform[] = { - U_INVALID, +static const std::pair LEAF_PT_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name STAR_uniform[] = { - U_STAR, +static const std::pair STAR_uniform[] = { + { U_STAR , false }, }; -/*static const uniform_name SNORING_uniform[] = { - U_TEXTURE_COUNT, - U_NORMAL, - U_SPECULAR, - U_LIGHT_0, - U_LIGHT_1, +/*static const std::pair SNORING_uniform[] = { + { U_TEXTURE_COUNT, false }, + { U_NORMAL , false }, + { U_SPECULAR , false }, + { U_LIGHT_1 , false }, + { U_LIGHT_1 , false }, }; -static const uniform_name SN_FOOT_uniform[] = { - U_INVALID, +static const std::pair SN_FOOT_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name SN_TSL_uniform[] = { - U_INVALID, +static const std::pair SN_TSL_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name SN_NRM_uniform[] = { - U_INVALID, +static const std::pair SN_NRM_uniform[] = { + { U_INVALID , false }, };*/ -static const uniform_name FLOOR_uniform[] = { - U_TEXTURE_COUNT, - U_NORMAL, - U_LIGHT_0, - U_LIGHT_1, - U_FOG_HEIGHT, - U_MORPH, - U_MORPH_COLOR, - U_ALPHA_TEST, // 7th added +static const std::pair FLOOR_uniform[] = { + { U_TEXTURE_COUNT, false }, + { U_NORMAL , false }, + { U_LIGHT_1 , false }, + { U_LIGHT_1 , false }, + { U_FOG_HEIGHT , false }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_ALPHA_TEST , true }, // 7th added }; -static const uniform_name PUDDLE_uniform[] = { - U_NORMAL, - U_LIGHT_0, - U_LIGHT_1, - U_FOG_HEIGHT, +static const std::pair PUDDLE_uniform[] = { + { U_NORMAL , false }, + { U_LIGHT_1 , false }, + { U_LIGHT_1 , false }, + { U_FOG_HEIGHT , false }, }; -static const uniform_name S_REFL_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_REFLECT, - U_MORPH, - U_MORPH_COLOR, - U_ALPHA_TEST, - U_CLIP_PLANE, - U_TEXTURE_COUNT, - U_TONE_CURVE, - U_CHARA_COLOR, +static const std::pair S_REFL_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_REFLECT , true }, + { U_MORPH , true }, + { U_MORPH_COLOR , true }, + { U_ALPHA_TEST , true }, + { U_CLIP_PLANE , false }, + { U_TEXTURE_COUNT, false }, + { U_TONE_CURVE , false }, + { U_CHARA_COLOR , false }, }; -static const uniform_name S_REFR_uniform[] = { - U_BONE_MAT, - U_TRANSPARENCY, +static const std::pair S_REFR_uniform[] = { + { U_BONE_MAT , true }, + { U_TRANSPARENCY , false }, }; -static const uniform_name RIPEMIT_uniform[] = { - U_RIPPLE, - U_RIPPLE_EMIT, +static const std::pair RIPEMIT_uniform[] = { + { U_RIPPLE , true }, + { U_RIPPLE_EMIT , true }, }; -static const uniform_name RAIN_uniform[] = { - U_INVALID, +static const std::pair RAIN_uniform[] = { + { U_INVALID , false }, }; -/*static const uniform_name VOLLIT_uniform[] = { - U_INVALID, +/*static const std::pair VOLLIT_uniform[] = { + { U_INVALID , false }, };*/ -/*static const uniform_name FENCE_uniform[] = { - U_INSTANCE, - U_FOG_HEIGHT, +/*static const std::pair FENCE_uniform[] = { + { U_INSTANCE , false }, + { U_FOG_HEIGHT , false }, };*/ -static const uniform_name RIPPLE_uniform[] = { - U_RIPPLE, +static const std::pair RIPPLE_uniform[] = { + { U_RIPPLE , true }, }; -static const uniform_name FOGPTCL_uniform[] = { - U_INVALID, +static const std::pair FOGPTCL_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name PARTICL_uniform[] = { - U_INVALID, +static const std::pair PARTICL_uniform[] = { + { U_INVALID , false }, }; -static const uniform_name GLITTER_PT_uniform[] = { - U_TEXTURE_COUNT, - U_TEXTURE_BLEND, - U_FOG_HEIGHT, - U_ALPHA_BLEND, +static const std::pair GLITTER_PT_uniform[] = { + { U_TEXTURE_COUNT, false }, + { U_TEXTURE_BLEND, false }, + { U_FOG_HEIGHT , false }, + { U_ALPHA_BLEND , false }, }; -/*static const uniform_name SHOW_VEC_uniform[] = { - //U16, // 0th removed - U_BONE_MAT, - U_SHOW_VECTOR, +/*static const std::pair SHOW_VEC_uniform[] = { + //{ U16 , true }, // 0th removed + { U_BONE_MAT , true }, + { U_SHOW_VECTOR , false }, };*/ -static const uniform_name FONT_uniform[] = { - //U16, // 0th removed - U_INVALID, // 0th removed, 1st added +static const std::pair FONT_uniform[] = { + //{ U16 , true }, // 0th removed + { U_INVALID , false }, // 1st added }; -static const uniform_name MOVIE_uniform[] = { - U_MOVIE, +static const std::pair MOVIE_uniform[] = { + { U_MOVIE , true }, }; -static const uniform_name IMGFILT_uniform[] = { - U_IMAGE_FILTER, +static const std::pair IMGFILT_uniform[] = { + { U_IMAGE_FILTER , false }, }; -static const uniform_name SPRITE_uniform[] = { - U_TEX_0_TYPE, - U_TEX_1_TYPE, - U_COMBINER, +static const std::pair SPRITE_uniform[] = { + { U_TEX_0_TYPE , false }, + { U_TEX_1_TYPE , false }, + { U_COMBINER , false }, }; -static const uniform_name DOF_uniform[] = { // Added - U_DOF, +static const std::pair DOF_uniform[] = { // Added + { U_DOF , false }, }; -static const uniform_name GRID_uniform[] = { // Added - U_INVALID, -}; - -static const uniform_name TRANSPARENCY_uniform[] = { // Added - U_INVALID, -}; - -static const bool BLINN_permut[] = { - // true, // 0th removed - true, - false, - false, - false, - false, - false, - false, - true, - true, - false, - true, // 11th added -}; - -static const bool ITEM_permut[] = { - //true, // 0th removed - true, - true, - false, - false, - false, - false, - false, - false, - false, - true, - false, - false, - false, -}; - -static const bool STAGE_permut[] = { - //true, // 0th removed - true, - true, - true, - false, - false, - false, - false, - false, - false, - false, - true, // 11th added -}; - -static const bool SKIN_permut[] = { - //true, // 0th removed - true, - false, - false, - false, - true, - false, - false, - false, - false, -}; - -static const bool SSS_SKIN_permut[] = { - //true, // 0th removed - true, - false, - true, - false, - false, - false, - false, -}; - -static const bool SSS_FILT_permut[] = { - //true, // 0th removed - true, - true, -}; - -static const bool HAIR_permut[] = { - //true, // 0th removed - true, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, // 14th added -}; - -static const bool CLOTH_permut[] = { - //true, // 0th removed - true, - false, - false, - false, - false, - false, - false, - false, - true, - false, - false, - false, - false, - false, -}; - -static const bool TIGHTS_permut[] = { - //true, // 0th removed - true, - false, - false, - false, - false, - true, - false, - false, - false, - false, -}; - -static const bool SKY_permut[] = { - false, - false, - false, - true, - true, - false, - true, // 6th added -}; - -/*static const bool EYEBALL_permut[] = { - true, - false, -};*/ - -/*static const bool EYELENS_permut[] = { - true, - false, - false, -};*/ - -static const bool GLASEYE_permut[] = { - //true, // 0th removed - true, - false, - false, - false, - false, - false, - false, -}; - -/*static const bool MEMBRAN_permut[] = { - true, - false, - false, -};*/ - -/*static const bool SHDMAP_permut[] = { - true, - false, - false, - false, - true, -};*/ - -/*static const bool ESM_permut[] = { - //true, // 0th removed - true, - false, - false, -};*/ - -static const bool ESMGAUSS_permut[] = { - true, -}; - -static const bool ESMFILT_permut[] = { - true, -}; - -static const bool LITPROJ_permut[] = { - //true, // 0th removed - true, - false, - false, - false, - false, -}; - -static const bool SIMPLE_permut[] = { - //true, // 0th removed - true, - false, - //false, // 3rd removed - //false, // 4th removed - //false, // 5th removed -}; - -static const bool SIL_permut[] = { - //true, // 0th removed - true, - false, - false, - true, - false, - false, - true, // 7th added -}; - -static const bool LAMBERT_permut[] = { - //true, // 0th removed - true, - false, - false, - false, - true, - true, - false, - true, // 8th added -}; - -static const bool CONSTANT_permut[] = { - //true, // 0th removed - true, - false, - false, - true, - true, - true, // 6th added -}; - -/*static const bool PEEL_permut[] = { - false, - true, -};*/ - -static const bool TONEMAP_permut[] = { - //true, // 0th removed - false, - false, - false, - false, - false, - false, - false, -}; - -static const bool REDUCE_permut[] = { - true, - true, -}; - -static const bool MAGNIFY_permut[] = { - true, -}; - -static const bool MLAA_permut[] = { - //true, // 0th removed - true, - true, - true, -}; - -static const bool CONTOUR_permut[] = { - //true, // 0th removed - false, -}; - -static const bool CONTOUR_NPR_permut[] = { - false, -}; - -static const bool EXPOSURE_permut[] = { - true, -}; - -static const bool GAUSS_permut[] = { - true, -}; - -static const bool SUN_permut[] = { - false, -}; - -static const bool SUN_NO_TEXTURED_permut[] = { - false, -}; - -/*static const bool FADE_permut[] = { - false, -};*/ - -static const bool WATER01_permut[] = { - true, - true, - false, - false, - false, - false, - false, - false, -}; - -static const bool WATER02_permut[] = { - false, -}; - -/*static const bool WATRING_permut[] = { - false, - false, -};*/ - -static const bool W_PTCL_permut[] = { - false, -}; - -static const bool SNOW_PT_permut[] = { - false, -}; - -static const bool LEAF_PT_permut[] = { - false, -}; - -static const bool STAR_permut[] = { - false, -}; - -/*static const bool SNORING_permut[] = { - false, - false, - false, - false, - false, -}; - -static const bool SN_FOOT_permut[] = { - false, -}; - -static const bool SN_TSL_permut[] = { - false, -}; - -static const bool SN_NRM_permut[] = { - false, -};*/ - -static const bool FLOOR_permut[] = { - false, - false, - false, - false, - false, - true, - true, - true, // 7th added -}; - -static const bool PUDDLE_permut[] = { - false, - false, - false, - false, -}; - -static const bool S_REFL_permut[] = { - //true, // 0th removed - true, - true, - true, - true, - true, - false, - false, - false, - false, -}; - -static const bool S_REFR_permut[] = { - true, - false, -}; - -static const bool RIPEMIT_permut[] = { - true, - true, -}; - -static const bool RAIN_permut[] = { - false, -}; - -/*static const bool VOLLIT_permut[] = { - false, -};*/ - -/*static const bool FENCE_permut[] = { - false, - false, -};*/ - -static const bool RIPPLE_permut[] = { - true, -}; - -static const bool FOGPTCL_permut[] = { - false, -}; - -static const bool PARTICL_permut[] = { - false, -}; - -static const bool GLITTER_PT_permut[] = { - false, - false, - false, - false, -}; - -/*static const bool SHOW_VEC_permut[] = { - //true, // 0th removed - false, - false, -};*/ - -static const bool FONT_permut[] = { - //true, // 0th removed - false, // 0th removed, 1st added -}; - -static const bool MOVIE_permut[] = { - true, -}; - -static const bool IMGFILT_permut[] = { - false, -}; - -static const bool SPRITE_permut[] = { - false, - false, - false, +static const std::pair TRANSPARENCY_uniform[] = { // Added + { U_INVALID , false }, }; static const bool DOF_permut[] = { // Added true, }; -static const bool GRID_permut[] = { // Added - false, -}; - static const bool TRANSPARENCY_permut[] = { // Added false, }; @@ -3011,9 +2549,8 @@ struct glass_eye_struct { SHADER_FT_##n, \ sizeof(n##_table) / sizeof(shader_sub_table), \ n##_table, \ - sizeof(n##_uniform) / sizeof(uniform_name), \ + sizeof(n##_uniform) / sizeof(std::pair), \ n##_uniform, \ - n##_permut, \ } const shader_table shader_ft_table[] = { @@ -3024,7 +2561,6 @@ const shader_table shader_ft_table[] = { 0, 0, 0, - 0, }, shader_table_struct(BLINN), shader_table_struct(ITEM),