diff --git a/res/ft_shaders.farc b/res/ft_shaders.farc index c7459f1..9b4793d 100644 Binary files a/res/ft_shaders.farc and b/res/ft_shaders.farc differ diff --git a/src/DivaGL/DivaGL.vcxproj b/src/DivaGL/DivaGL.vcxproj index 7ea7ceb..f09aa4c 100644 --- a/src/DivaGL/DivaGL.vcxproj +++ b/src/DivaGL/DivaGL.vcxproj @@ -107,7 +107,7 @@ del "$(SolutionDir)bin\$(TargetName).lib" $(IntDir)/%(RelativeDir) - Size + Speed false diff --git a/src/DivaGL/Glitter/render_scene.cpp b/src/DivaGL/Glitter/render_scene.cpp index 2c6054f..0201d94 100644 --- a/src/DivaGL/Glitter/render_scene.cpp +++ b/src/DivaGL/Glitter/render_scene.cpp @@ -165,13 +165,13 @@ namespace Glitter { case PARTICLE_QUAD: switch (rend_group->fog_type) { default: - uniform->arr[U_FOG_HEIGHT] = 0; + uniform->arr[U_FOG_STAGE] = 0; break; case Glitter::FOG_DEPTH: - uniform->arr[U_FOG_HEIGHT] = 1; + uniform->arr[U_FOG_STAGE] = 1; break; case Glitter::FOG_HEIGHT: - uniform->arr[U_FOG_HEIGHT] = 2; + uniform->arr[U_FOG_STAGE] = 2; break; } @@ -194,7 +194,7 @@ namespace Glitter { gl_state_disable_cull_face(); break; case PARTICLE_LINE: - uniform->arr[U_FOG_HEIGHT] = 0; + uniform->arr[U_FOG_STAGE] = 0; uniform->arr[U_ALPHA_BLEND] = 2; gl_state_enable_depth_test(); @@ -203,7 +203,7 @@ namespace Glitter { gl_state_set_cull_face_mode(GL_BACK); break; case PARTICLE_LOCUS: - uniform->arr[U_FOG_HEIGHT] = 0; + uniform->arr[U_FOG_STAGE] = 0; uniform->arr[U_ALPHA_BLEND] = 2; gl_state_enable_depth_test(); @@ -212,9 +212,13 @@ namespace Glitter { break; } + rctx->obj_shader.set_shader_flags(uniform->arr); + rctx->obj_shader_ubo.WriteMemory(rctx->obj_shader); + shaders_ft.set(SHADER_FT_GLITTER_PT); - rctx->obj_scene_ubo.Bind(0); - rctx->glitter_batch_ubo.Bind(2); + rctx->obj_shader_ubo.Bind(0); + rctx->obj_scene_ubo.Bind(1); + rctx->glitter_batch_ubo.Bind(3); switch (rend_group->type) { case PARTICLE_QUAD: gl_state_bind_vertex_array(rend_group->vao); @@ -2006,13 +2010,13 @@ namespace Glitter { switch (rend_group->fog_type) { default: - uniform->arr[U_FOG_HEIGHT] = 0; + uniform->arr[U_FOG_STAGE] = 0; break; case Glitter::FOG_DEPTH: - uniform->arr[U_FOG_HEIGHT] = 1; + uniform->arr[U_FOG_STAGE] = 1; break; case Glitter::FOG_HEIGHT: - uniform->arr[U_FOG_HEIGHT] = 2; + uniform->arr[U_FOG_STAGE] = 2; break; } @@ -2038,9 +2042,13 @@ namespace Glitter { else gl_state_disable_cull_face(); + rctx->obj_shader.set_shader_flags(uniform->arr); + rctx->obj_shader_ubo.WriteMemory(rctx->obj_shader); + shaders_ft.set(SHADER_FT_GLITTER_PT); - rctx->obj_scene_ubo.Bind(0); - rctx->glitter_batch_ubo.Bind(2); + rctx->obj_shader_ubo.Bind(0); + rctx->obj_scene_ubo.Bind(1); + rctx->glitter_batch_ubo.Bind(3); switch (rend_group->type) { case PARTICLE_QUAD: gl_state_bind_vertex_array(rend_group->vao); diff --git a/src/DivaGL/effect.cpp b/src/DivaGL/effect.cpp index ecec72e..ba8e819 100644 --- a/src/DivaGL/effect.cpp +++ b/src/DivaGL/effect.cpp @@ -1958,7 +1958,7 @@ void water_particle::draw(mat4* mat) { shaders_ft.set(SHADER_FT_W_PTCL); gl_state_bind_vertex_array(rctx->common_vao); - water_particle_scene_ubo.Bind(4); + water_particle_scene_ubo.Bind(5); ssbo.Bind(0); texture* tex = texture_manager_get_texture(splash_tex_id); if (tex) diff --git a/src/DivaGL/mdl/disp_manager.cpp b/src/DivaGL/mdl/disp_manager.cpp index d6feff2..eea2844 100644 --- a/src/DivaGL/mdl/disp_manager.cpp +++ b/src/DivaGL/mdl/disp_manager.cpp @@ -1989,9 +1989,10 @@ namespace mdl { uniform_value_reset(); gl_state_get(); - rctx->obj_scene_ubo.Bind(0); - rctx->obj_batch_ubo.Bind(1); - rctx->obj_skinning_ubo.Bind(3); + rctx->obj_shader_ubo.Bind(0); + rctx->obj_scene_ubo.Bind(1); + rctx->obj_batch_ubo.Bind(2); + rctx->obj_skinning_ubo.Bind(4); switch (type) { case OBJ_TYPE_TRANSLUCENT: @@ -2148,9 +2149,10 @@ namespace mdl { uniform_value_reset(); gl_state_get(); - rctx->obj_scene_ubo.Bind(0); - rctx->obj_batch_ubo.Bind(1); - rctx->obj_skinning_ubo.Bind(3); + rctx->obj_shader_ubo.Bind(0); + rctx->obj_scene_ubo.Bind(1); + rctx->obj_batch_ubo.Bind(2); + rctx->obj_skinning_ubo.Bind(4); switch (type) { case OBJ_TYPE_TRANSLUCENT_ALPHA_ORDER_1: diff --git a/src/DivaGL/mdl/draw_object.cpp b/src/DivaGL/mdl/draw_object.cpp index 105d631..a937acf 100644 --- a/src/DivaGL/mdl/draw_object.cpp +++ b/src/DivaGL/mdl/draw_object.cpp @@ -52,7 +52,10 @@ namespace mdl { GL_UNSIGNED_INT, }; + rctx->obj_shader.set_shader_flags(uniform->arr); + rctx->obj_shader_ubo.WriteMemory(rctx->obj_shader); rctx->obj_batch_ubo.WriteMemory(rctx->obj_batch); + if (primitive_type == OBJ_PRIMITIVE_TRIANGLE_STRIP && index_format == OBJ_INDEX_U16) shaders_ft.draw_range_elements(GL_TRIANGLE_STRIP, start, end, count, GL_UNSIGNED_SHORT, (void*)indices); @@ -419,7 +422,6 @@ namespace mdl { draw_object_material_set_uniform(material, false); if (material->material.attrib.m.alpha_texture) uniform->arr[U_TEXTURE_COUNT] = 0; - rctx->obj_batch.g_texture_blend = { (float_t)uniform->arr[U_TEXTURE_BLEND], 0.0f, 0.0f, 0.0f }; shaders_ft.set(draw_state.shader_index); } @@ -604,11 +606,10 @@ static bool draw_object_blend_set( static bool draw_object_blend_set_check_use_default_blend(int32_t index) { bool use_default_blend[] = { false, false, true, false, true, false, false, true, true, true, false, false, - false, true, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, - false, false, false + false, }; if (index >= 0 && index < SHADER_FT_MAX) @@ -629,11 +630,8 @@ static void draw_object_chara_color_fog_set(const mdl::ObjSubMeshArgs* args, boo obj_material_attrib_member attrib = args->material->material.attrib.m; if (!attrib.no_fog && !disable_fog) { - if (attrib.has_fog_height) - uniform->arr[U_FOG_HEIGHT] = 2 + attrib.fog_height; - else - uniform->arr[U_FOG_HEIGHT] = 1; - uniform->arr[U_FOG] = draw_state.fog_height ? 2 : 1; + uniform->arr[U_FOG_STAGE] = attrib.has_fog_height ? (attrib.fog_height ? 3 : 2) : 1; + uniform->arr[U_FOG_CHARA] = draw_state.fog_height ? 2 : 1; } } @@ -660,17 +658,17 @@ static void draw_object_material_set_default(const mdl::ObjSubMeshArgs* args, bo material->material.shader_info.get_lighting_type(); bool disable_fog = draw_object_blend_set(args, lighting_type); draw_object_material_set_uniform(material, false); - if (!draw_state.light) - uniform->arr[U_LIGHT_0] = 0; + if (!draw_state.shadow) + uniform->arr[U_STAGE_SHADOW] = 0; else if (args->self_shadow) - uniform->arr[U_LIGHT_0] = 1; + uniform->arr[U_STAGE_SHADOW] = 1; else - uniform->arr[U_LIGHT_0] = args->sub_mesh->attrib.m.recieve_shadow ? 1 : 0; - uniform->arr[U_SHADOW] = 0; - uniform->arr[U_SELF_SHADOW] = draw_state.self_shadow ? 1 : 0; + uniform->arr[U_STAGE_SHADOW] = args->sub_mesh->attrib.m.recieve_shadow ? 1 : 0; + uniform->arr[U_CHARA_SHADOW2] = 0; + uniform->arr[U_CHARA_SHADOW] = draw_state.self_shadow ? 1 : 0; const obj_material_texture_data* texdata = material->material.texdata; - uniform->arr[U_SHADOW] = args->shadow > SHADOW_CHARA; + uniform->arr[U_CHARA_SHADOW2] = args->shadow > SHADOW_CHARA; for (int32_t i = 0, j = 0; i < 8; i++, texdata++) { if (texdata->tex_index == -1) continue; @@ -815,10 +813,9 @@ static void draw_object_material_set_default(const mdl::ObjSubMeshArgs* args, bo else shaders_ft.set(SHADER_FT_CONSTANT); - rctx->obj_batch.g_texture_blend = { (float_t)uniform->arr[U_TEXTURE_BLEND], 0.0f, 0.0f, 0.0f }; if (lighting_type != OBJ_MATERIAL_SHADER_LIGHTING_CONSTANT) { float_t material_shininess; - if (material->material.shader.index == SHADER_FT_GLASEYE/*SHADER_FT_EYEBALL*/) + if (material->material.shader.index == SHADER_FT_GLASEYE) material_shininess = 10.0f; else { material_shininess = (material->material.color.shininess - 16.0f) * (float_t)(1.0 / 112.0); @@ -965,7 +962,6 @@ static void draw_object_material_set_reflect(const mdl::ObjSubMeshArgs* args) { } draw_object_material_set_uniform(material, true); - rctx->obj_batch.g_texture_blend = { (float_t)uniform->arr[U_TEXTURE_BLEND], 0.0f, 0.0f, 0.0f }; shaders_ft.set(draw_state.shader_index); rctx->obj_batch.g_material_state_ambient = ambient; rctx->obj_batch.g_material_state_diffuse = diffuse; diff --git a/src/DivaGL/render.cpp b/src/DivaGL/render.cpp index d66b7b7..0826f1f 100644 --- a/src/DivaGL/render.cpp +++ b/src/DivaGL/render.cpp @@ -34,7 +34,7 @@ namespace rndr { spot_weight = 0.0f; } - void Render::apply_post_process() { + void Render::apply_post_process(texture* light_proj_tex, int32_t npr_param) { for (int32_t i = 0; i < 8; i++) gl_state_bind_sampler(i, 0); @@ -51,7 +51,7 @@ namespace rndr { get_blur(); calc_exposure(); - apply_tone_map(); + apply_tone_map(light_proj_tex, npr_param); apply_mlaa(taa_texture_selector, 2, mlaa); @@ -1191,47 +1191,18 @@ namespace rndr { } } - void Render::apply_tone_map() { + void Render::apply_tone_map(texture* light_proj_tex, int32_t npr_param) { if (!this) return; - + gl_state_begin_event("PostProcess::tone_map"); update_tone_map_lut(); uniform->arr[U_TONE_MAP] = (int32_t)tone_map; uniform->arr[U_FLARE] = 0; - uniform->arr[U_SCENE_FADE] = scene_fade_alpha[scene_fade_index] > 0.01f ? 1 : 0; uniform->arr[U_AET_BACK] = 0; uniform->arr[U_LIGHT_PROJ] = 0; - //uniform->arr[U25] = 0; - - gl_state_active_bind_texture_2d(0, rend_texture[0].GetColorTex()); - gl_state_active_bind_texture_2d(1, reduce_tex_draw); - gl_state_active_bind_texture_2d(2, tonemap_lut_texture); - gl_state_active_bind_texture_2d(3, exposure_tex); - gl_state_active_bind_texture_2d(4, rctx->empty_texture_2d); - gl_state_active_bind_texture_2d(5, rctx->empty_texture_2d); - gl_state_active_bind_texture_2d(6, rctx->empty_texture_2d); - gl_state_bind_sampler(0, rctx->render_samplers[1]); - gl_state_bind_sampler(1, rctx->render_samplers[2]); - gl_state_bind_sampler(2, rctx->render_samplers[0]); - gl_state_bind_sampler(3, rctx->render_samplers[3]); - gl_state_bind_sampler(4, rctx->render_samplers[2]); - gl_state_bind_sampler(5, rctx->render_samplers[2]); - gl_state_bind_sampler(6, rctx->render_samplers[2]); - - if (aet_back) { - gl_state_active_bind_texture_2d(6, aet_back_tex->glid); - uniform->arr[U_AET_BACK] = 1; - } - - static texture* (FASTCALL * litproj_texture_get)() = (texture * (FASTCALL*)())0x0000000140350600; - texture* light_proj_tex = litproj_texture_get(); - if (light_proj_tex) { - gl_state_active_bind_texture_2d(6, light_proj_tex->glid); - uniform->arr[U_LIGHT_PROJ] = 1; - } int32_t scene_fade_blend_func = this->scene_fade_blend_func[scene_fade_index]; @@ -1258,14 +1229,26 @@ namespace rndr { shader_data.g_texcoord_transforms[2] = { 1.0f, 0.0f, 0.0f, 0.0f }; shader_data.g_texcoord_transforms[3] = { 0.0f, 1.0f, 0.0f, 0.0f }; - if (lens_flare_texture) { - static const vec4 border_color = 0.0f; + gl_state_active_bind_texture_2d(0, rend_texture[0].GetColorTex()); + gl_state_bind_sampler(0, rctx->render_samplers[1]); + gl_state_active_bind_texture_2d(1, reduce_tex_draw); + gl_state_bind_sampler(1, rctx->render_samplers[2]); + if (tone_map == TONE_MAP_YCC_EXPONENT) { + gl_state_active_bind_texture_2d(2, tonemap_lut_texture); + gl_state_bind_sampler(2, rctx->render_samplers[0]); + } + + gl_state_active_bind_texture_2d(3, exposure_tex); + gl_state_bind_sampler(3, rctx->render_samplers[3]); + + if (lens_flare_texture) { const float_t aspect = (float_t)height / (float_t)width; uniform->arr[U_FLARE] = 1; gl_state_active_bind_texture_2d(4, lens_flare_texture); gl_state_bind_sampler(4, rctx->render_samplers[2]); + mat4 mat; mat4_translate(0.5f, 0.5f, 0.0f, &mat); mat4_scale_rot(&mat, 0.75f, 0.75f, 1.0f, &mat); @@ -1282,6 +1265,7 @@ namespace rndr { uniform->arr[U_FLARE] = 2; gl_state_active_bind_texture_2d(5, lens_shaft_texture); gl_state_bind_sampler(5, rctx->render_samplers[2]); + mat4_translate(0.5f, 0.5f, 0.0f, &mat); mat4_scale_rot(&mat, lens_shaft_scale, lens_shaft_scale, 1.0f, &mat); mat4_mul_rotate_z(&mat, (lens_flare_pos.x / (float_t)width) @@ -1294,31 +1278,47 @@ namespace rndr { shader_data.g_texcoord_transforms[7] = mat.row1; } else { + gl_state_active_bind_texture_2d(5, rctx->empty_texture_2d); + gl_state_bind_sampler(5, rctx->render_samplers[2]); + shader_data.g_texcoord_transforms[6] = { 1.0f, 0.0f, 0.0f, 0.0f }; shader_data.g_texcoord_transforms[7] = { 0.0f, 1.0f, 0.0f, 0.0f }; } } else { + gl_state_active_bind_texture_2d(4, rctx->empty_texture_2d); + gl_state_bind_sampler(4, rctx->render_samplers[2]); + gl_state_active_bind_texture_2d(5, rctx->empty_texture_2d); + gl_state_bind_sampler(5, rctx->render_samplers[2]); + shader_data.g_texcoord_transforms[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; shader_data.g_texcoord_transforms[5] = { 0.0f, 1.0f, 0.0f, 0.0f }; shader_data.g_texcoord_transforms[6] = { 1.0f, 0.0f, 0.0f, 0.0f }; shader_data.g_texcoord_transforms[7] = { 0.0f, 1.0f, 0.0f, 0.0f }; } - if (render_manager->npr_param == 1) { - gl_state_active_bind_texture_2d(14, rend_texture[0].GetDepthTex()); - /*gl_state_active_bind_texture_2d(16, sss_contour_texture->GetColorTex()); - gl_state_active_bind_texture_2d(17, sss_contour_texture->GetDepthTex());*/ - } - else { - gl_state_active_bind_texture_2d(14, rctx->empty_texture_2d); - /*gl_state_active_bind_texture_2d(16, rctx->empty_texture_2d); - gl_state_active_bind_texture_2d(17, rctx->empty_texture_2d);*/ + if (aet_back) { + gl_state_active_bind_texture_2d(6, aet_back_tex->glid); + gl_state_bind_sampler(6, rctx->render_samplers[2]); + uniform->arr[U_AET_BACK] = 1; } - gl_state_bind_sampler(14, rctx->render_samplers[1]); - /*gl_state_bind_sampler(16, rctx->render_samplers[1]); - gl_state_bind_sampler(17, rctx->render_samplers[1]);*/ + if (light_proj_tex) { + uniform->arr[U_LIGHT_PROJ] = 1; + gl_state_active_bind_texture_2d(7, light_proj_tex->glid); + gl_state_bind_sampler(7, rctx->render_samplers[2]); + + shader_data.g_flare_coef.z = 1.0f; + } + else { + gl_state_active_bind_texture_2d(7, rctx->empty_texture_2d); + gl_state_bind_sampler(7, rctx->render_samplers[2]); + } + + if (aet_back && npr_param == 1) { + gl_state_active_bind_texture_2d(14, rend_texture[0].GetDepthTex()); + gl_state_bind_sampler(14, rctx->render_samplers[1]); + } rctx->tone_map_ubo.WriteMemory(shader_data); diff --git a/src/DivaGL/render.hpp b/src/DivaGL/render.hpp index 0ed3f5b..d6ff429 100644 --- a/src/DivaGL/render.hpp +++ b/src/DivaGL/render.hpp @@ -173,7 +173,7 @@ namespace rndr { int32_t update; FrameTexture frame_texture[6]; - void apply_post_process(); + void apply_post_process(texture* light_proj_tex, int32_t npr_param); void bind_render_texture(bool aet_back = false); void calc_exposure_chara_data(); void calc_projection_matrix(mat4* mat, float_t fov, float_t aspect, float_t z_near, float_t z_far, @@ -199,7 +199,7 @@ namespace rndr { private: void apply_mlaa(int32_t destination, int32_t source, int32_t mlaa); - void apply_tone_map(); + void apply_tone_map(texture* light_proj_tex, int32_t npr_param); void calc_exposure(); void calc_gaussian_blur(float_t start, float_t step, int32_t kernel_size, float_t radius_scale, float_t intensity_scale); diff --git a/src/DivaGL/render_context.cpp b/src/DivaGL/render_context.cpp index 5362803..212987a 100644 --- a/src/DivaGL/render_context.cpp +++ b/src/DivaGL/render_context.cpp @@ -5,6 +5,7 @@ #include "render_context.hpp" #include "render_manager.hpp" +#include "uniform.hpp" draw_state_struct& draw_state = *(draw_state_struct*)0x00000001411A32B0; @@ -51,6 +52,81 @@ void draw_state_struct::set_fog_height(bool value) { fog_height = value; } +void obj_shader_shader_data::set_shader_flags(int32_t* shader_flags) { + g_shader_flags.x.m.alpha_mask = shader_flags[U_ALPHA_MASK]; + g_shader_flags.x.m.alpha_test = shader_flags[U_ALPHA_TEST]; + g_shader_flags.x.m.aniso = shader_flags[U_ANISO]; + g_shader_flags.x.m.aet_back = shader_flags[U_AET_BACK]; + g_shader_flags.x.m.texture_blend = shader_flags[U_TEXTURE_BLEND]; + g_shader_flags.x.m.unk = 0; //shader_flags[U_UNK_NEW_IN_MM_IDK_WHAT_TO_DO_WITH_IT]; + g_shader_flags.x.m.chara_color = shader_flags[U_CHARA_COLOR]; + g_shader_flags.x.m.clip_plane = shader_flags[U_CLIP_PLANE]; + g_shader_flags.x.m.u08 = shader_flags[U08]; + g_shader_flags.x.m.depth_peel = shader_flags[U_DEPTH_PEEL]; + g_shader_flags.x.m.depth = shader_flags[U_DEPTH]; + g_shader_flags.x.m.u0b = shader_flags[U0B]; + g_shader_flags.x.m.alpha_blend = shader_flags[U_ALPHA_BLEND]; + g_shader_flags.x.m.ripple_emit = shader_flags[U_RIPPLE_EMIT]; + g_shader_flags.x.m.esm_filter = shader_flags[U_ESM_FILTER]; + g_shader_flags.x.m.exposure = shader_flags[U_EXPOSURE]; + g_shader_flags.x.m.scene_fade = shader_flags[U_SCENE_FADE]; + g_shader_flags.x.m.fade = shader_flags[U_FADE]; + g_shader_flags.x.m.stage_ambient = shader_flags[U_STAGE_AMBIENT]; + g_shader_flags.x.m.flare = shader_flags[U_FLARE]; + g_shader_flags.y.m.fog_stage = shader_flags[U_FOG_STAGE]; + g_shader_flags.y.m.fog_chara = shader_flags[U_FOG_CHARA]; + g_shader_flags.y.m.u16 = shader_flags[U16]; + g_shader_flags.y.m.gauss = shader_flags[U_GAUSS]; + g_shader_flags.y.m.eyeball = shader_flags[U_EYEBALL]; + g_shader_flags.y.m.image_filter = shader_flags[U_IMAGE_FILTER]; + g_shader_flags.y.m.instance = shader_flags[U_INSTANCE]; + g_shader_flags.y.m.tone_curve = shader_flags[U_TONE_CURVE]; + g_shader_flags.y.m.light_proj = shader_flags[U_LIGHT_PROJ]; + g_shader_flags.y.m.magnify = shader_flags[U_MAGNIFY]; + g_shader_flags.y.m.membrane = shader_flags[U_MEMBRANE]; + g_shader_flags.y.m.mlaa = shader_flags[U_MLAA]; + g_shader_flags.y.m.mlaa_search = shader_flags[U_MLAA_SEARCH]; + g_shader_flags.y.m.morph_color = shader_flags[U_MORPH_COLOR]; + g_shader_flags.y.m.morph = shader_flags[U_MORPH]; + g_shader_flags.y.m.movie = shader_flags[U_MOVIE]; + g_shader_flags.y.m.u24 = shader_flags[U24]; + g_shader_flags.y.m.u25 = shader_flags[U25]; + g_shader_flags.y.m.npr_normal = shader_flags[U_NPR_NORMAL]; + g_shader_flags.z.m.npr = shader_flags[U_NPR]; + g_shader_flags.z.m.stage_shadow2 = shader_flags[U_STAGE_SHADOW2]; + g_shader_flags.z.m.reflect = shader_flags[U_REFLECT]; + g_shader_flags.z.m.reduce = shader_flags[U_REDUCE]; + g_shader_flags.z.m.chara_shadow = shader_flags[U_CHARA_SHADOW]; + g_shader_flags.z.m.chara_shadow2 = shader_flags[U_CHARA_SHADOW2]; + g_shader_flags.z.m.u2d = shader_flags[U2D]; + g_shader_flags.z.m.u2e = shader_flags[U2E]; + g_shader_flags.z.m.show_vector = shader_flags[U_SHOW_VECTOR]; + g_shader_flags.z.m.skinning = shader_flags[U_SKINNING]; + g_shader_flags.z.m.snow_particle = shader_flags[U_SNOW_PARTICLE]; + g_shader_flags.z.m.specular_ibl = shader_flags[U_SPECULAR_IBL]; + g_shader_flags.z.m.combiner = shader_flags[U_COMBINER]; + g_shader_flags.z.m.tex_0_type = shader_flags[U_TEX_0_TYPE]; + g_shader_flags.z.m.tex_1_type = shader_flags[U_TEX_1_TYPE]; + g_shader_flags.z.m.sss_filter = shader_flags[U_SSS_FILTER]; + g_shader_flags.w.m.sss_chara = shader_flags[U_SSS_CHARA]; + g_shader_flags.w.m.star = shader_flags[U_STAR]; + g_shader_flags.w.m.texture_count = shader_flags[U_TEXTURE_COUNT]; + g_shader_flags.w.m.env_map = shader_flags[U_ENV_MAP]; + g_shader_flags.w.m.ripple = shader_flags[U_RIPPLE]; + g_shader_flags.w.m.translucency = shader_flags[U_TRANSLUCENCY]; + g_shader_flags.w.m.normal = shader_flags[U_NORMAL]; + g_shader_flags.w.m.transparency = shader_flags[U_TRANSPARENCY]; + g_shader_flags.w.m.water_reflect = shader_flags[U_WATER_REFLECT]; + g_shader_flags.w.m.u40 = shader_flags[U40]; + g_shader_flags.w.m.u41 = shader_flags[U41]; + g_shader_flags.w.m.stage_shadow = shader_flags[U_STAGE_SHADOW]; + g_shader_flags.w.m.specular = shader_flags[U_SPECULAR]; + g_shader_flags.w.m.tone_map = shader_flags[U_TONE_MAP]; + g_shader_flags.w.m.u45 = shader_flags[U45]; + g_shader_flags.w.m.dof = 0; //shader_flags[U_DOF]; // Added + g_shader_flags.w.m.dof_stage = 0; //shader_flags[U_DOF_STAGE]; // Added +} + void obj_scene_shader_data::set_g_irradiance_r_transforms(const mat4& mat) { mat4 temp; mat4_transpose(&mat, &temp); @@ -267,9 +343,11 @@ samplers(), render_samplers(), sprite_samplers(), screen_width(), screen_height( sun_quad_ubo.Create(sizeof(sun_quad_shader_data)); tone_map_ubo.Create(sizeof(tone_map_shader_data)); + obj_shader = {}; obj_scene = {}; obj_batch = {}; obj_skinning = {}; + obj_shader_ubo.Create(sizeof(obj_shader_shader_data)); obj_scene_ubo.Create(sizeof(obj_scene_shader_data)); obj_batch_ubo.Create(sizeof(obj_batch_shader_data)); obj_skinning_ubo.Create(sizeof(obj_skinning_shader_data)); @@ -403,6 +481,7 @@ render_context::~render_context() { obj_skinning_ubo.Destroy(); obj_batch_ubo.Destroy(); obj_scene_ubo.Destroy(); + obj_shader_ubo.Destroy(); tone_map_ubo.Destroy(); transparency_batch_ubo.Destroy(); diff --git a/src/DivaGL/render_context.hpp b/src/DivaGL/render_context.hpp index ba1063d..7a7b694 100644 --- a/src/DivaGL/render_context.hpp +++ b/src/DivaGL/render_context.hpp @@ -54,7 +54,7 @@ struct draw_state_struct { bool vertex_buffer; bool wireframe; bool wireframe_overlay; - bool light; + bool shadow; bool self_shadow; bool shader_debug_flag; bool use_global_material; @@ -139,6 +139,105 @@ struct glitter_batch_shader_data { vec4 g_state_material_emission; }; +struct obj_shader_shader_data { + struct { + union { + struct { + uint32_t alpha_mask : 1; // bit 0 + uint32_t alpha_test : 1; // bit 1 + uint32_t aniso : 2; // bit 2:3 + uint32_t aet_back : 1; // bit 4 + uint32_t texture_blend : 3; // bit 5:7 + uint32_t unk : 2; // bit 8:9 + uint32_t chara_color : 1; // bit 10 + uint32_t clip_plane : 1; // bit 11 + uint32_t u08 : 1; // bit 12 + uint32_t depth_peel : 1; // bit 13 + uint32_t depth : 1; // bit 14 + uint32_t u0b : 1; // bit 15 + uint32_t alpha_blend : 3; // bit 16:18 + uint32_t ripple_emit : 1; // bit 19 + uint32_t esm_filter : 2; // bit 20:21 + uint32_t exposure : 2; // bit 22:23 + uint32_t scene_fade : 1; // bit 24 + uint32_t fade : 3; // bit 25:27 + uint32_t stage_ambient : 1; // bit 28 + uint32_t flare : 2; // bit 29:30 + } m; + uint32_t w; + } x; + union { + struct { + uint32_t fog_stage : 2; // bit 32+0:1 + uint32_t fog_chara : 2; // bit 32+2:3 + uint32_t u16 : 1; // bit 32+4 + uint32_t gauss : 2; // bit 32+5:6 + uint32_t eyeball : 1; // bit 32+7 + uint32_t image_filter : 3; // bit 32+8:10 + uint32_t instance : 1; // bit 32+11 + uint32_t tone_curve : 1; // bit 32+12 + uint32_t light_proj : 1; // bit 32+13 + uint32_t magnify : 4; // bit 32+14:17 + uint32_t membrane : 2; // bit 32+18:19 + uint32_t mlaa : 2; // bit 32+20:21 + uint32_t mlaa_search : 2; // bit 32+22:23 + uint32_t morph_color : 1; // bit 32+24 + uint32_t morph : 1; // bit 32+25 + uint32_t movie : 2; // bit 32+26:27 + uint32_t u24 : 2; // bit 32+28:29 + uint32_t u25 : 1; // bit 32+30 + uint32_t npr_normal : 1; // bit 32+31 + } m; + uint32_t w; + } y; + union { + struct { + uint32_t npr : 1; // bit 64+0 + uint32_t stage_shadow2 : 2; // bit 64+1:2 + uint32_t reflect : 2; // bit 64+3:4 + uint32_t reduce : 4; // bit 64+5:8 + uint32_t chara_shadow : 1; // bit 64+9 + uint32_t chara_shadow2 : 2; // bit 64+10:11 + uint32_t u2d : 3; // bit 64+12:14 + uint32_t u2e : 2; // bit 64+15:16 + uint32_t show_vector : 2; // bit 64+17:18 + uint32_t skinning : 1; // bit 64+19 + uint32_t snow_particle : 2; // bit 64+20:21 + uint32_t specular_ibl : 2; // bit 64+22:23 + uint32_t combiner : 1; // bit 64+24 + uint32_t tex_0_type : 2; // bit 64+25:26 + uint32_t tex_1_type : 2; // bit 64+27:28 + uint32_t sss_filter : 2; // bit 64+29:30 + } m; + uint32_t w; + } z; + union { + struct { + uint32_t sss_chara : 1; // bit 96+0 + uint32_t star : 1; // bit 96+1 + uint32_t texture_count : 2; // bit 96+2:3 + uint32_t env_map : 1; // bit 96+4 + uint32_t ripple : 2; // bit 96+5:6 + uint32_t translucency : 1; // bit 96+7 + uint32_t normal : 1; // bit 96+8 + uint32_t transparency : 1; // bit 96+9 + uint32_t water_reflect : 1; // bit 96+10 + uint32_t u40 : 1; // bit 96+11 + uint32_t u41 : 1; // bit 96+12 + uint32_t stage_shadow : 1; // bit 96+13 + uint32_t specular : 1; // bit 96+14 + uint32_t tone_map : 2; // bit 96+15 + uint32_t u45 : 1; // bit 96+16 + uint32_t dof : 1; // bit 96+17 // Added + uint32_t dof_stage : 3; // bit 96+18 // Added + } m; + uint32_t w; + } w; + } g_shader_flags; + + void set_shader_flags(int32_t* shader_flags); +}; + struct obj_scene_shader_data { vec4 g_irradiance_r_transforms[4]; vec4 g_irradiance_g_transforms[4]; @@ -226,7 +325,6 @@ struct obj_batch_shader_data { vec4 g_bump_depth; vec4 g_intensity; vec4 g_reflect_uv_scale; - vec4 g_texture_blend; void set_g_joint(const mat4& mat); void set_g_texcoord_transforms(int32_t index, const mat4& mat); @@ -262,7 +360,7 @@ struct sun_quad_shader_data { struct tone_map_shader_data { vec4 g_exposure; - vec4 g_flare_coef; + vec4 g_flare_coef; //xy=flare_coef, z=light_proj vec4 g_fade_color; vec4 g_tone_scale; //xyz=tone_scale, w=fade_func vec4 g_tone_offset; //xyz=tone_offset, w=inv_tone @@ -305,9 +403,11 @@ struct render_context { GLUniformBuffer transparency_batch_ubo; GLUniformBuffer tone_map_ubo; + obj_shader_shader_data obj_shader; obj_scene_shader_data obj_scene; obj_batch_shader_data obj_batch; obj_skinning_shader_data obj_skinning; + GLUniformBuffer obj_shader_ubo; GLUniformBuffer obj_scene_ubo; GLUniformBuffer obj_batch_ubo; GLUniformBuffer obj_skinning_ubo; diff --git a/src/DivaGL/render_manager.cpp b/src/DivaGL/render_manager.cpp index e95c19b..f7279fc 100644 --- a/src/DivaGL/render_manager.cpp +++ b/src/DivaGL/render_manager.cpp @@ -961,7 +961,9 @@ namespace rndr { void RenderManager::pass_post_process() { gl_state_begin_event("pass_post_process"); - render->apply_post_process(); + + static texture* (FASTCALL * litproj_texture_get)() = (texture * (FASTCALL*)())0x0000000140350600; + render->apply_post_process(litproj_texture_get(), npr_param); gl_state_end_event(); } @@ -1286,7 +1288,7 @@ static void draw_pass_shadow_end_make_shadowmap(Shadow* shad, int32_t index, int gl_state_disable_scissor_test(); draw_state.shader_index = -1; - if (a3 == shad->num_light - 1) { + if (a3 == shad->num_shadow - 1) { draw_pass_shadow_filter(&shad->render_textures[3], &shad->render_textures[4], shad->curr_render_textures[0], shad->field_2DC, shad->field_2E0 / (shad->field_208 * 2.0f), false); @@ -1721,11 +1723,11 @@ static void draw_pass_3d_shadow_reset() { rctx->obj_scene.set_g_self_shadow_receivers(0, mat4_identity); rctx->obj_scene.set_g_self_shadow_receivers(1, mat4_identity); draw_state.self_shadow = false; - draw_state.light = false; + draw_state.shadow = false; } static void draw_pass_3d_shadow_set(Shadow* shad) { - if (shad->self_shadow && shad->num_light > 0) { + if (shad->self_shadow && shad->num_shadow > 0) { gl_state_active_bind_texture_2d(19, shad->render_textures[3].GetColorTex()); gl_state_active_bind_texture_2d(20, shad->render_textures[5].GetColorTex()); gl_state_active_texture(0); @@ -1743,9 +1745,9 @@ static void draw_pass_3d_shadow_set(Shadow* shad) { gl_state_bind_sampler(19, rctx->render_samplers[0]); gl_state_bind_sampler(20, rctx->render_samplers[0]); - if (shad->num_light > 0) { - draw_state.light = true; - uniform->arr[U_LIGHT_1] = shad->num_light > 1 ? 1 : 0; + if (shad->num_shadow > 0) { + draw_state.shadow = true; + uniform->arr[U_STAGE_SHADOW2] = shad->num_shadow > 1 ? 1 : 0; float_t shadow_range = shad->get_shadow_range(); for (int32_t i = 0; i < 2; i++) { @@ -1782,7 +1784,7 @@ static void draw_pass_3d_shadow_set(Shadow* shad) { int32_t j = 0; for (int32_t i = 0; i < 2; i++) - if (shad->light_enable[i]) { + if (shad->shadow_enable[i]) { gl_state_active_bind_texture_2d(6 + j, shad->curr_render_textures[1 + i]->GetColorTex()); glTexParameterfDLL(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16.0f); j++; @@ -1805,7 +1807,7 @@ static void draw_pass_3d_shadow_set(Shadow* shad) { rctx->obj_scene.g_shadow_ambient1 = { 1.0f - ambient.x, 1.0f - ambient.y, 1.0f - ambient.z, 0.0f }; } else { - draw_state.light = false; + draw_state.shadow = false; for (int32_t i = 0; i < 2; i++) gl_state_active_bind_texture_2d(6 + i, shad->curr_render_textures[1 + i]->GetColorTex()); diff --git a/src/DivaGL/shader.cpp b/src/DivaGL/shader.cpp index e1ba067..e2cec5f 100644 --- a/src/DivaGL/shader.cpp +++ b/src/DivaGL/shader.cpp @@ -10,7 +10,6 @@ #include "../KKdLib/str_utils.hpp" #include "gl_state.hpp" #include "print.hpp" -#include "uniform.hpp" #include "wrap.hpp" #include @@ -21,13 +20,6 @@ struct program_binary { uint64_t hash; }; -struct program_spv { - size_t size; - size_t spv; -}; - -extern bool vulkan_render; - static GLuint shader_compile_shader(GLenum type, const char* data, const char* file); static GLuint shader_compile(const char* vert, const char* frag, const char* vp, const char* fp); static GLuint shader_compile_binary(const char* vert, const char* frag, const char* vp, const char* fp, @@ -36,7 +28,7 @@ static bool shader_load_binary_shader(program_binary* bin, GLuint* program, cons static void shader_update_data(shader_set_data* set); int32_t shader::bind(shader_set_data* set, uint32_t sub_index) { - set->curr_shader = 0; + set->curr_program = 0; if (num_sub < 1) return -1; @@ -50,33 +42,23 @@ int32_t shader::bind(shader_set_data* set, uint32_t sub_index) { int32_t unival_shad_curr = 1; int32_t unival_shad = 0; - int32_t uniform_val[SHADER_MAX_UNIFORM_VALUES] = {}; if (num_uniform > 0) { const int32_t* vp_unival_max = sub_shader->vp_unival_max; const int32_t* fp_unival_max = sub_shader->fp_unival_max; int32_t i = 0; - for (i = 0; i < num_uniform && i < sizeof(uniform_val) / sizeof(int32_t); i++) { - const int32_t unival = uniform->arr[use_uniform[i].first]; - const int32_t unival_max = use_uniform[i].second - ? max_def(vp_unival_max[i], fp_unival_max[i]) : 0; + for (i = 0; i < num_uniform; i++) { + const int32_t unival = uniform->arr[use_uniform[i]]; + const int32_t unival_max = max_def(vp_unival_max[i], fp_unival_max[i]); unival_shad += unival_shad_curr * min_def(unival, unival_max); unival_shad_curr *= unival_max + 1; - - int32_t unival_max_glsl = max_def(vp_unival_max[i], fp_unival_max[i]); - uniform_val[i] = min_def(unival, unival_max_glsl); } } - shader_sub_shader* shader = &sub_shader->shaders[unival_shad]; - set->curr_shader = shader; + GLuint program = sub_shader->programs[unival_shad]; + set->curr_program = program; - gl_state_use_program(shader->program); - if (shader->has_uniform_val - && memcmp(shader->uniform_val, uniform_val, sizeof(uniform_val))) { - memcpy(shader->uniform_val, uniform_val, sizeof(uniform_val)); - shader->uniform_val_update = true; - } + gl_state_use_program(program); return 0; } @@ -296,7 +278,7 @@ void shader::unbind() { gl_state_use_program(0); } -shader_set_data::shader_set_data() : size(), shaders(), curr_shader(), +shader_set_data::shader_set_data() : size(), shaders(), curr_program(), primitive_restart(), primitive_restart_index(), get_index_by_name_func() { } @@ -494,13 +476,12 @@ void shader_set_data::load(farc* f, bool ignore_cache, uint32_t uniform_vert_flags = 0; uint32_t uniform_frag_flags = 0; - for (int32_t k = 0; k < shader->num_uniform; k++) - if (shader->use_uniform[k].second) { - if (sub_table->vp_unival_max[k] > 0) - uniform_vert_flags |= 1 << k; - if (sub_table->fp_unival_max[k] > 0) - uniform_frag_flags |= 1 << k; - } + for (int32_t k = 0; k < shader->num_uniform; k++) { + if (sub_table->vp_unival_max[k] > 0) + uniform_vert_flags |= 1 << k; + if (sub_table->fp_unival_max[k] > 0) + uniform_frag_flags |= 1 << k; + } char uniform_vert_flags_buf[9]; char uniform_frag_flags_buf[9]; @@ -565,17 +546,16 @@ 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 (int32_t k = 0; k < num_uniform; k++) { - const int32_t unival_max = shader->use_uniform[k].second - ? max_def(vp_unival_max[k], fp_unival_max[k]) : 0; + const int32_t unival_max = max_def(vp_unival_max[k], fp_unival_max[k]); unival_shad_count += unival_shad_curr * unival_max; unival_shad_curr *= unival_max + 1; } if (!ignore_cache) program_data_binary.reserve(unival_shad_count); - shader_sub_shader* shaders = force_malloc(unival_shad_count); - sub->shaders = shaders; - if (shaders) { + GLuint* programs = force_malloc(unival_shad_count); + sub->programs = programs; + if (programs) { strcpy_s(vert_buf, sizeof(vert_buf), sub_table->vp); size_t vert_buf_pos = utf8_length(vert_buf); vert_buf[vert_buf_pos++] = '.'; @@ -594,38 +574,36 @@ void shader_set_data::load(farc* f, bool ignore_cache, for (int32_t k = 0; k < unival_shad_count; k++) { for (int32_t l = 0, m = k; l < num_uniform; l++) { - int32_t unival_max = (shader->use_uniform[l].second - ? max_def(vp_unival_max[l], fp_unival_max[l]) : 0) + 1; + int32_t unival_max = max_def(vp_unival_max[l], fp_unival_max[l]) + 1; vec_vert_data[l] = min_def(m % unival_max, vp_unival_max[l]); m /= unival_max; vert_buf[vert_buf_pos + l] = (char)('0' + vec_vert_data[l]); } for (int32_t l = 0, m = k; l < num_uniform; l++) { - int32_t unival_max = (shader->use_uniform[l].second - ? max_def(vp_unival_max[l], fp_unival_max[l]) : 0) + 1; + int32_t unival_max = max_def(vp_unival_max[l], fp_unival_max[l]) + 1; vec_frag_data[l] = min_def(m % unival_max, fp_unival_max[l]); m /= unival_max; frag_buf[frag_buf_pos + l] = (char)('0' + vec_frag_data[l]); } if (!bin || !bin->binary_format || !bin->length - || !shader_load_binary_shader(bin, &shaders[k].program, vert_buf, frag_buf)) { + || !shader_load_binary_shader(bin, &programs[k], vert_buf, frag_buf)) { bool vert_succ = shader::parse_define(vert_data, num_uniform, vec_vert_data, &temp_vert, &temp_vert_size); bool frag_succ = shader::parse_define(frag_data, num_uniform, vec_frag_data, &temp_frag, &temp_frag_size); if (ignore_cache) - shaders[k].program = shader_compile(vert_succ ? temp_vert : 0, + programs[k] = shader_compile(vert_succ ? temp_vert : 0, frag_succ ? temp_frag : 0, vert_buf, frag_buf); else { program_data_binary.push_back({}); - shaders[k].program = shader_compile_binary(vert_succ ? temp_vert : 0, + programs[k] = shader_compile_binary(vert_succ ? temp_vert : 0, frag_succ ? temp_frag : 0, vert_buf, frag_buf, &program_data_binary.back(), &buffer_size, &binary); } - shader_cache_changed |= shaders[k].program ? true : false; + shader_cache_changed |= programs[k] ? true : false; } else { program_data_binary.push_back({}); @@ -636,10 +614,6 @@ void shader_set_data::load(farc* f, bool ignore_cache, memcpy((void*)b->binary, (void*)((size_t)bin + bin->binary), bin->length); } - shaders[k].has_uniform_val = false; - if (shaders[k].program) - shaders[k].has_uniform_val = glGetUniformLocation(shaders[k].program, "uniform_val") >= 0; - if (!ignore_cache && bin) bin++; } @@ -647,29 +621,29 @@ void shader_set_data::load(farc* f, bool ignore_cache, } else { program_data_binary.reserve(1); - shader_sub_shader* shaders = force_malloc(); - sub->shaders = shaders; - if (shaders) { + GLuint* programs = force_malloc(); + sub->programs = programs; + if (programs) { strcpy_s(vert_buf, sizeof(vert_buf), sub_table->vp); strcpy_s(frag_buf, sizeof(vert_buf), sub_table->fp); strcat_s(vert_buf, sizeof(vert_buf), "..vert"); strcat_s(frag_buf, sizeof(vert_buf), "..frag"); if (!bin || !bin->binary_format || !bin->length - || !shader_load_binary_shader(bin, &shaders[0].program, vert_buf, frag_buf)) { + || !shader_load_binary_shader(bin, &programs[0], vert_buf, frag_buf)) { bool vert_succ = shader::parse_define(vert_data, &temp_vert, &temp_vert_size); bool frag_succ = shader::parse_define(frag_data, &temp_frag, &temp_frag_size); if (ignore_cache) - shaders[0].program = shader_compile(vert_succ ? temp_vert : 0, + programs[0] = shader_compile(vert_succ ? temp_vert : 0, frag_succ ? temp_frag : 0, vert_buf, frag_buf); else { program_data_binary.push_back({}); - shaders[0].program = shader_compile_binary(vert_succ ? temp_vert : 0, + programs[0] = shader_compile_binary(vert_succ ? temp_vert : 0, frag_succ ? temp_frag : 0, vert_buf, frag_buf, &program_data_binary.back(), &buffer_size, &binary); } - shader_cache_changed |= shaders[0].program ? true : false; + shader_cache_changed |= programs[0] ? true : false; } else { program_data_binary.push_back({}); @@ -680,10 +654,6 @@ void shader_set_data::load(farc* f, bool ignore_cache, memcpy((void*)b->binary, (void*)((size_t)bin + bin->binary), bin->length); } - shaders[0].has_uniform_val = false; - if (shaders[0].program) - shaders[0].has_uniform_val = glGetUniformLocation(shaders[0].program, "uniform_val") >= 0; - if (!ignore_cache && bin) bin++; } @@ -779,19 +749,18 @@ 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 (int32_t k = 0; k < num_uniform; k++) { - const int32_t unival_max = shader->use_uniform[k].second - ? max_def(vp_unival_max[k], fp_unival_max[k]) : 0; + const int32_t unival_max = max_def(vp_unival_max[k], fp_unival_max[k]); unival_shad_count += unival_shad_curr * unival_max; unival_shad_curr *= unival_max + 1; } } - if (sub->shaders) { - shader_sub_shader* shaders = sub->shaders; + if (sub->programs) { + GLuint* programs = sub->programs; for (int32_t k = 0; k < unival_shad_count; k++) - glDeleteProgram(shaders[k].program); - free(shaders); - sub->shaders = 0; + glDeleteProgram(programs[k]); + free(programs); + sub->programs = 0; } } free(shader->sub); @@ -887,7 +856,7 @@ static GLuint shader_compile(const char* vert, const char* frag, const char* vp, wchar_t temp_buf[MAX_PATH]; if (SUCCEEDED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA, 0, 0, temp_buf))) { - wcscat_s(temp_buf, sizeof(temp_buf) / sizeof(wchar_t), L"\\ReDIVA"); + wcscat_s(temp_buf, sizeof(temp_buf) / sizeof(wchar_t), L"\\PDAFT"); temp_buf[sizeof(temp_buf) / sizeof(wchar_t) - 1] = 0; path_create_directory(temp_buf); @@ -961,7 +930,7 @@ static GLuint shader_compile_binary(const char* vert, const char* frag, const ch wchar_t temp_buf[MAX_PATH]; if (SUCCEEDED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA, 0, 0, temp_buf))) { - wcscat_s(temp_buf, sizeof(temp_buf) / sizeof(wchar_t), L"\\ReDIVA"); + wcscat_s(temp_buf, sizeof(temp_buf) / sizeof(wchar_t), L"\\PDAFT"); temp_buf[sizeof(temp_buf) / sizeof(wchar_t) - 1] = 0; path_create_directory(temp_buf); @@ -1045,14 +1014,6 @@ static void shader_update_data(shader_set_data* set) { if (!set) return; - if (set->curr_shader) { - shader_sub_shader* shader = set->curr_shader; - if (shader->has_uniform_val && shader->uniform_val_update) { - glUniform1iv(0, SHADER_MAX_UNIFORM_VALUES, (GLint*)shader->uniform_val); - shader->uniform_val_update = false; - } - } - if (set->primitive_restart) { gl_state_enable_primitive_restart(); gl_state_set_primitive_restart_index(set->primitive_restart_index); diff --git a/src/DivaGL/shader.hpp b/src/DivaGL/shader.hpp index a6c275b..cf2cae2 100644 --- a/src/DivaGL/shader.hpp +++ b/src/DivaGL/shader.hpp @@ -30,7 +30,7 @@ struct shader_table { int32_t num_sub; const shader_sub_table* sub; int32_t num_uniform; - const std::pair* use_uniform; + const uniform_name* use_uniform; }; struct shader; @@ -45,18 +45,11 @@ struct shader_bind_func { PFNSHADERBINDFUNCPROC bind_func; }; -struct shader_sub_shader { - GLuint program; - bool has_uniform_val; - int32_t uniform_val[SHADER_MAX_UNIFORM_VALUES]; - bool uniform_val_update; -}; - struct shader_sub { uint32_t sub_index; const int32_t* vp_unival_max; const int32_t* fp_unival_max; - shader_sub_shader* shaders; + GLuint* programs; }; struct shader { @@ -65,7 +58,7 @@ struct shader { int32_t num_sub; shader_sub* sub; int32_t num_uniform; - const std::pair* use_uniform; + const uniform_name* use_uniform; PFNSHADERBINDFUNCPROC bind_func; int32_t bind(shader_set_data* set, uint32_t sub_index); @@ -80,7 +73,7 @@ struct shader { struct shader_set_data { size_t size; shader* shaders; - shader_sub_shader* curr_shader; + GLuint curr_program; GLboolean primitive_restart; GLuint primitive_restart_index; diff --git a/src/DivaGL/shader_ft.cpp b/src/DivaGL/shader_ft.cpp index ed9d865..0abcad9 100644 --- a/src/DivaGL/shader_ft.cpp +++ b/src/DivaGL/shader_ft.cpp @@ -17,26 +17,18 @@ enum shader_ft_sub_enum { SHADER_FT_SUB_STAGE_BLINN, SHADER_FT_SUB_SKIN_DEFAULT, SHADER_FT_SUB_SSS_SKIN, - //SHADER_FT_SUB_SSS_FILTER, SHADER_FT_SUB_SSS_FILTER_MIN, SHADER_FT_SUB_SSS_FILTER_MIN_NPR, SHADER_FT_SUB_SSS_FILTER_GAUSS_2D, SHADER_FT_SUB_HAIR_DEFAULT, - //SHADER_FT_SUB_HAIR_ANISO, SHADER_FT_SUB_HAIR_NPR1, SHADER_FT_SUB_CLOTH_DEFAULT, SHADER_FT_SUB_CLOTH_ANISO, SHADER_FT_SUB_CLOTH_NPR1, SHADER_FT_SUB_TIGHTS, SHADER_FT_SUB_SKY_DEFAULT, - //SHADER_FT_SUB_EYE_BALL, - //SHADER_FT_SUB_EYE_LENS, SHADER_FT_SUB_GLASS_EYE, - //SHADER_FT_SUB_MEMBRANE, - //SHADER_FT_SUB_SHADOWMAP, - //SHADER_FT_SUB_ESM, SHADER_FT_SUB_ESM_GAUSS, - //SHADER_FT_SUB_ESM_FILTER, SHADER_FT_SUB_ESM_FILTER_MIN, SHADER_FT_SUB_ESM_FILTER_EROSION, SHADER_FT_SUB_LIT_PROJ, @@ -44,10 +36,8 @@ enum shader_ft_sub_enum { SHADER_FT_SUB_SILHOUETTE, SHADER_FT_SUB_LAMBERT, SHADER_FT_SUB_CONSTANT, - //SHADER_FT_SUB_PEEL, SHADER_FT_SUB_TONEMAP, SHADER_FT_SUB_TONEMAP_NPR1, - //SHADER_FT_SUB_REDUCE_TEX, SHADER_FT_SUB_GHOST, SHADER_FT_SUB_REDUCE_TEX_REDUCE_2, SHADER_FT_SUB_REDUCE_TEX_REDUCE_2_ALPHAMASK, @@ -56,58 +46,42 @@ enum shader_ft_sub_enum { SHADER_FT_SUB_REDUCE_TEX_REDUCE_COMPOSITE_2, SHADER_FT_SUB_REDUCE_TEX_REDUCE_COMPOSITE_BLUR, SHADER_FT_SUB_REDUCE_TEX_REDUCE_COMPOSITE_4, - //SHADER_FT_SUB_MAGNIFY, SHADER_FT_SUB_MAGNIFY_CONE, SHADER_FT_SUB_MAGNIFY_CONE2, SHADER_FT_SUB_MAGNIFY_DIFF, SHADER_FT_SUB_MAGNIFY_DIFF2, SHADER_FT_SUB_MAGNIFY_LINEAR, - //SHADER_FT_SUB_MLAA, SHADER_FT_SUB_MLAA_EDGE, SHADER_FT_SUB_MLAA_AREA, SHADER_FT_SUB_MLAA_BLEND, SHADER_FT_SUB_CONTOUR, SHADER_FT_SUB_CONTOUR_NPR, - //SHADER_FT_SUB_EXPOSURE, SHADER_FT_SUB_EXPOSURE_MINIFY, SHADER_FT_SUB_EXPOSURE_MEASURE, SHADER_FT_SUB_EXPOSURE_AVERAGE, - //SHADER_FT_SUB_PP_GAUSS, SHADER_FT_SUB_PP_GAUSS_USUAL, SHADER_FT_SUB_PP_GAUSS_CONE, SHADER_FT_SUB_SUN, SHADER_FT_SUB_SUN_NO_TEXTURED, - //SHADER_FT_SUB_FADE, SHADER_FT_SUB_WATER01, - //SHADER_FT_SUB_WATER02, - //SHADER_FT_SUB_WATER_RING, SHADER_FT_SUB_WATER_PARTICLE, - //SHADER_FT_SUB_SNOW_PARTICLE, SHADER_FT_SUB_SNOW_PARTICLE, SHADER_FT_SUB_SNOW_PARTICLE_CPU, SHADER_FT_SUB_LEAF_PARTICLE, SHADER_FT_SUB_STAR, SHADER_FT_SUB_STAR_MILKY_WAY, - //SHADER_FT_SUB_SNOW_RING, - //SHADER_FT_SUB_SNOW_FOOTPRINT, - //SHADER_FT_SUB_SNOW_TEX_SPACE_LIGHT, - //SHADER_FT_SUB_SNOW_CALC_NORMAL, SHADER_FT_SUB_FLOOR, SHADER_FT_SUB_PUDDLE, SHADER_FT_SUB_SIMPLE_REFLECT, SHADER_FT_SUB_SIMPLE_REFRACT, SHADER_FT_SUB_RIPPLE_EMIT, SHADER_FT_SUB_RAIN, - //SHADER_FT_SUB_VOLUME_LIGHT, - //SHADER_FT_SUB_FENCE_ALPHA, SHADER_FT_SUB_RIPPLE, SHADER_FT_SUB_FOG_PTCL, SHADER_FT_SUB_PARTICLE, SHADER_FT_SUB_GLITTER_PARTICLE, - //SHADER_FT_SUB_SHOW_VECTOR, SHADER_FT_SUB_FONT, SHADER_FT_SUB_MOVIE, - //SHADER_FT_SUB_IMGFILTER, SHADER_FT_SUB_BOX4, SHADER_FT_SUB_BOX8, SHADER_FT_SUB_COPY, @@ -116,517 +90,343 @@ enum shader_ft_sub_enum { }; static const int32_t blinn_vert_vpt_unival_max[] = { - //1, 1, 0, 1, 0, 0, 0, 3, 1, 1, 0, 0, // 11th added - 1, 0, 1, 0, 0, 0, 3, 1, 1, 0, 0, // 0th removed, 11th added -}; - -static const int32_t blinn_vert_fpt_unival_max[] = { - //0, 0, 2, 1, 0, 1, 1, 3, 0, 0, 1, 1, // 11th added - 0, 2, 1, 0, 1, 1, 3, 0, 0, 1, 1, // 0th removed, 11th added -}; - -static const int32_t blinn_frag_vpt_unival_max[] = { - //1, 1, 0, 1, 0, 0, 0, 3, 1, 1, 0, 0, // 11th added - 1, 0, 1, 0, 0, 0, 3, 1, 1, 0, 0, // 0th removed, 11th added -}; - -static const int32_t blinn_frag_fpt_unival_max[] = { - //0, 0, 2, 1, 1, 1, 1, 3, 0, 0, 1, 1, // 11th added - 0, 2, 1, 1, 1, 1, 3, 0, 0, 1, 1, // 0th removed, 11th added -}; - -static const int32_t item_blinn_vpt_unival_max[] = { - //1, 1, 1, 0, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, - 1, 1, 0, 0, 1, 0, 0, 0, 2, 0, 1, 0, 0, // 0th removed -}; - -static const int32_t item_blinn_fpt_unival_max[] = { - //1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, // 0th removed -}; - -static const int32_t stage_blinn_vpt_unival_max[] = { - //1, 1, 1, 1, 0, 0, 1, 0, 3, 0, 0, 0, // 11th added - 1, 1, 1, 0, 0, 1, 0, 3, 0, 0, 0, // 0th removed, 11th added -}; - -static const int32_t stage_blinn_fpt_unival_max[] = { - //0, 0, 0, 0, 2, 1, 1, 1, 3, 1, 1, 1, // 11th added - 0, 0, 0, 2, 1, 1, 1, 3, 1, 1, 1, // 0th removed, 11th added -}; - -static const int32_t skin_default_vpt_unival_max[] = { - //1, 1, 1, 0, 2, 0, 1, 0, 0, 0, - 1, 1, 0, 2, 0, 1, 0, 0, 0, // 0th removed -}; - -static const int32_t skin_default_fpt_unival_max[] = { - //1, 0, 1, 1, 0, 1, 0, 1, 1, 1, - 0, 1, 1, 0, 1, 0, 1, 1, 1, // 0th removed -}; - -static const int32_t sss_skin_vpt_unival_max[] = { - //1, 1, 0, 0, 0, 1, 0, 0, - 1, 0, 0, 0, 1, 0, 0, // 0th removed -}; - -static const int32_t sss_skin_fpt_unival_max[] = { - //1, 0, 1, 1, 1, 0, 1, 1, - 0, 1, 1, 1, 0, 1, 1, // 0th removed -}; - -/*static const int32_t sss_filter_vpt_unival_max[] = { - //0, 3, 0, - 3, 0, // 0th removed -}; - -static const int32_t sss_filter_fpt_unival_max[] = { - //1, 3, 1, - 3, 1, // 0th removed -};*/ - -static const int32_t sss_filter_min_vpt_unival_max[] = { - //0, 0, 0, - 0, 0, // 0th removed -}; - -static const int32_t sss_filter_min_fpt_unival_max[] = { - //0, 0, 0, - 0, 0, // 0th removed -}; - -static const int32_t sss_filter_min_npr_vpt_unival_max[] = { - //0, 0, 0, - 0, 0, // 0th removed -}; - -static const int32_t sss_filter_min_npr_fpt_unival_max[] = { - //0, 0, 0, - 0, 0, // 0th removed -}; - -static const int32_t sss_filter_gauss_2d_vpt_unival_max[] = { - //0, 0, 0, - 0, 0, // 0th removed -}; - -static const int32_t sss_filter_gauss_2d_fpt_unival_max[] = { - //1, 0, 0, - 0, 0, // 0th removed -}; - -/*static const int32_t hair_default_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 14th added - 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 0th removed, 14th added -}; - -static const int32_t hair_default_fpt_unival_max[] = { - //1, 0, 2, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, // 14th added - 0, 2, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, // 0th removed, 14th added -}; - -static const int32_t hair_aniso_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 14th added - 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 0th removed, 14th added -}; - -static const int32_t hair_aniso_fpt_unival_max[] = { - //1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, // 14th added - 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, // 0th removed, 14th added -};*/ - -static const int32_t hair_default_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 14th added - 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 0th removed, 14th added -}; - -static const int32_t hair_default_fpt_unival_max[] = { - //1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, // 14th added - 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 1, 1, // 0th removed, 14th added -}; - -static const int32_t hair_npr1_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 14th added - 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 0, 0, // 0th removed, 14th added -}; - -static const int32_t hair_npr1_fpt_unival_max[] = { - //1, 0, 0, 0, 0, 1, 0, 3, 1, 0, 0, 0, 0, 0, 1, // 14th added - 0, 0, 0, 0, 1, 0, 3, 1, 0, 0, 0, 0, 0, 1, // 0th removed, 14th added -}; - -static const int32_t cloth_default_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, - 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, // 0th removed -}; - -static const int32_t cloth_default_fpt_unival_max[] = { - //1, 0, 2, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, - 0, 2, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 1, // 0th removed -}; - -static const int32_t cloth_aniso_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, - 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, // 0th removed -}; - -static const int32_t cloth_aniso_fpt_unival_max[] = { - //1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 3, 0, 0, 1, 1, - 0, 0, 1, 0, 1, 1, 1, 0, 1, 3, 0, 0, 1, 1, // 0th removed -}; - -static const int32_t cloth_npr1_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, - 1, 0, 0, 1, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0, // 0th removed -}; - -static const int32_t cloth_npr1_fpt_unival_max[] = { - //1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, // 0th removed -}; - -static const int32_t tights_vpt_unival_max[] = { - //1, 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 2, 0, 1, 0, 0, 0, // 0th removed -}; - -static const int32_t tights_fpt_unival_max[] = { - //1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, - 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, // 0th removed -}; - -static const int32_t sky_default_vpt_unival_max[] = { - 0, 0, 0, 1, 1, 3, 0, // 6th added -}; - -static const int32_t sky_default_fpt_unival_max[] = { - 3, 3, 2, 0, 0, 3, 1, // 6th added -}; - -/*static const int32_t eye_ball_vpt_unival_max[] = { - 1, 0, -}; - -static const int32_t eye_ball_fpt_unival_max[] = { - 0, 1, -};*/ - -/*static const int32_t eye_lens_vpt_unival_max[] = { - 1, 0, 0, -}; - -static const int32_t eye_lens_fpt_unival_max[] = { - 0, 1, 1, -};*/ - -static const int32_t glass_eye_vpt_unival_max[] = { - //1, 1, 0, 2, 0, 1, 0, 0, - 1, 0, 2, 0, 1, 0, 0, // 0th removed -}; - -static const int32_t glass_eye_fpt_unival_max[] = { - //1, 1, 1, 0, 1, 0, 1, 1, - 1, 1, 0, 1, 0, 1, 1, // 0th removed -}; - -/*static const int32_t membrane_vpt_unival_max[] = { 1, 1, 0, }; -static const int32_t membrane_fpt_unival_max[] = { - 0, 1, 3, -};*/ - -/*static const int32_t shadowmap_vpt_unival_max[] = { - 1, 2, 1, 0, 0, +static const int32_t blinn_vert_fpt_unival_max[] = { + 0, 0, 1, }; -static const int32_t shadowmap_fpt_unival_max[] = { - 0, 2, 1, 1, 5, -};*/ - -/*static const int32_t esm_vpt_unival_max[] = { - //1, 1, 2, 1, - 1, 2, 1, // 0th removed +static const int32_t blinn_frag_vpt_unival_max[] = { + 1, 1, 0, }; -static const int32_t esm_fpt_unival_max[] = { - //0, 0, 2, 1, - 0, 2, 1, // 0th removed -};*/ - -static const int32_t esm_gauss_vpt_unival_max[] = { - 0, +static const int32_t blinn_frag_fpt_unival_max[] = { + 0, 0, 1, }; -static const int32_t esm_gauss_fpt_unival_max[] = { - 1, +static const int32_t item_blinn_vpt_unival_max[] = { + 1, 1, 0, }; -/*static const int32_t esm_filter_vpt_unival_max[] = { - 0, +static const int32_t item_blinn_fpt_unival_max[] = { + 0, 0, 1, }; -static const int32_t esm_filter_fpt_unival_max[] = { - 1, -};*/ - -static const int32_t esm_filter_min_vpt_unival_max[] = { - 0, +static const int32_t stage_blinn_vpt_unival_max[] = { + 1, 1, 0, }; -static const int32_t esm_filter_min_fpt_unival_max[] = { - 0, +static const int32_t stage_blinn_fpt_unival_max[] = { + 0, 0, 1, }; -static const int32_t esm_filter_erosion_vpt_unival_max[] = { - 0, +static const int32_t skin_default_vpt_unival_max[] = { + 1, 0, }; -static const int32_t esm_filter_erosion_fpt_unival_max[] = { - 0, -}; - -static const int32_t lit_proj_vpt_unival_max[] = { - //1, 1, 0, 1, 0, 0, 0, // 6th added - 1, 0, 1, 0, 0, 0, // 0th removed, 6th added -}; - -static const int32_t lit_proj_fpt_unival_max[] = { - //0, 0, 1, 1, 2, 1, 1, // 6th added - 0, 1, 1, 2, 1, 1, // 0th removed, 6th added -}; - -static const int32_t simple_vpt_unival_max[] = { - //1, 1, 0, 0, 1, 0, - 1, 0, // 0th removed, 3rd removed, 4th removed, 5th removed -}; - -static const int32_t simple_fpt_unival_max[] = { - //0, 0, 2, 0, 0, 3, - 0, 2, // 0th removed, 3rd removed, 4th removed, 5th removed -}; - -static const int32_t silhouette_vpt_unival_max[] = { - //1, 1, 1, 2, 1, 1, 0, 0, // 7th added - 1, 1, 2, 1, 1, 0, 0, // 0th removed, 7th added -}; - -static const int32_t silhouette_fpt_unival_max[] = { - //0, 0, 1, 0, 0, 0, 1, 1, // 7th added - 0, 1, 0, 0, 0, 1, 1, // 0th removed, 7th added -}; - -static const int32_t lambert_vpt_unival_max[] = { - //1, 1, 0, 1, 3, 1, 1, 0, 0, // 8th added - 1, 0, 1, 3, 1, 1, 0, 0, // 0th removed, 8th added -}; - -static const int32_t lambert_fpt_unival_max[] = { - //0, 0, 2, 1, 3, 0, 0, 1, 1, // 8th added - 0, 2, 1, 3, 0, 0, 1, 1, // 0th removed, 8th added -}; - -static const int32_t constant_vpt_unival_max[] = { - //1, 1, 0, 3, 1, 1, 0, // 6th added - 1, 0, 3, 1, 1, 0, // 0th removed, 6th added -}; - -static const int32_t constant_fpt_unival_max[] = { - //0, 0, 2, 3, 0, 0, 1, // 6th added - 0, 2, 3, 0, 0, 1, // 0th removed, 6th added -}; - -/*static const int32_t peel_vpt_unival_max[] = { +static const int32_t skin_default_fpt_unival_max[] = { 0, 1, }; -static const int32_t peel_fpt_unival_max[] = { +static const int32_t sss_skin_vpt_unival_max[] = { 1, 0, -};*/ +}; + +static const int32_t sss_skin_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t sss_filter_min_vpt_unival_max[] = { + -1, +}; + +static const int32_t sss_filter_min_fpt_unival_max[] = { + -1, +}; + +static const int32_t sss_filter_min_npr_vpt_unival_max[] = { + -1, +}; + +static const int32_t sss_filter_min_npr_fpt_unival_max[] = { + -1, +}; + +static const int32_t sss_filter_gauss_2d_vpt_unival_max[] = { + -1, +}; + +static const int32_t sss_filter_gauss_2d_fpt_unival_max[] = { + -1, +}; + +static const int32_t hair_default_vpt_unival_max[] = { + 1, 0, +}; + +static const int32_t hair_default_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t hair_npr1_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t cloth_default_vpt_unival_max[] = { + 1, 0, +}; + +static const int32_t cloth_default_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t cloth_aniso_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t cloth_npr1_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t tights_vpt_unival_max[] = { + 1, 0, +}; + +static const int32_t tights_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t sky_default_vpt_unival_max[] = { + 1, 0, +}; + +static const int32_t sky_default_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t glass_eye_vpt_unival_max[] = { + 1, +}; + +static const int32_t glass_eye_fpt_unival_max[] = { + 0, +}; + +static const int32_t esm_gauss_vpt_unival_max[] = { + -1, +}; + +static const int32_t esm_gauss_fpt_unival_max[] = { + -1, +}; + +static const int32_t esm_filter_min_vpt_unival_max[] = { + -1, +}; + +static const int32_t esm_filter_min_fpt_unival_max[] = { + -1, +}; + +static const int32_t esm_filter_erosion_vpt_unival_max[] = { + -1, +}; + +static const int32_t esm_filter_erosion_fpt_unival_max[] = { + -1, +}; + +static const int32_t lit_proj_vpt_unival_max[] = { + 1, 0, +}; + +static const int32_t lit_proj_fpt_unival_max[] = { + 0, 1, +}; + +static const int32_t simple_vpt_unival_max[] = { + 1, +}; + +static const int32_t simple_fpt_unival_max[] = { + 0, +}; + +static const int32_t silhouette_vpt_unival_max[] = { + 1, 1, +}; + +static const int32_t silhouette_fpt_unival_max[] = { + 0, 0, +}; + +static const int32_t lambert_vpt_unival_max[] = { + 1, 1, 0, +}; + +static const int32_t lambert_fpt_unival_max[] = { + 0, 0, 1, +}; + +static const int32_t constant_vpt_unival_max[] = { + 1, 1, 0, +}; + +static const int32_t constant_fpt_unival_max[] = { + 0, 0, 1, +}; static const int32_t tone_map_vpt_unival_max[] = { - //0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 1, 0, 0, // 0th, 7th removed + 0, 1, }; static const int32_t tone_map_fpt_unival_max[] = { - //0, 2, 2, 1, 1, 1, 0, 0, - 2, 2, 1, 1, 1, 0, // 0th, 7th removed + 2, 1, }; static const int32_t tone_map_npr1_vpt_unival_max[] = { - //0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 1, 0, 0, // 0th, 7th removed + 0, 1, }; static const int32_t tone_map_npr1_fpt_unival_max[] = { - //1, 0, 0, 1, 1, 0, 0, 1, - 0, 0, 1, 1, 0, 0, // 0th, 7th removed + 0, 1, }; -/*static const int32_t reduce_tex_vpt_unival_max[] = { - 8, 1, -}; - -static const int32_t reduce_tex_fpt_unival_max[] = { - 8, 1, -};*/ - static const int32_t reduce_tex_reduce_2_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_2_fpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_2_alphamask_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_2_alphamask_fpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_4_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_4_fpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_4_extract_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_4_extract_fpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t ghost_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t ghost_fpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_composite_2_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_composite_2_fpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_composite_blur_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_composite_blur_fpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_composite_4_vpt_unival_max[] = { - 0, 0, + -1, }; static const int32_t reduce_tex_reduce_composite_4_fpt_unival_max[] = { - 0, 0, + -1, }; -/*static const int32_t magnify_vpt_unival_max[] = { - 7, -}; - -static const int32_t magnify_fpt_unival_max[] = { - 7, -};*/ - static const int32_t magnify_linear_vpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_linear_fpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_diff_vpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_diff_fpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_diff2_vpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_diff2_fpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_cone_vpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_cone_fpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_cone2_vpt_unival_max[] = { - 0, + -1, }; static const int32_t magnify_cone2_fpt_unival_max[] = { - 0, + -1, }; -/*static const int32_t mlaa_vpt_unival_max[] = { - //0, 0, 2, 0, - 0, 2, 0, // 0th removed -}; - -static const int32_t mlaa_fpt_unival_max[] = { - //1, 1, 2, 2, - 1, 2, 2, // 0th removed -};*/ - static const int32_t mlaa_edge_vpt_unival_max[] = { - 0, 0, 0, + 0, 0, }; static const int32_t mlaa_edge_fpt_unival_max[] = { - 1, 0, 0, + 1, 0, }; static const int32_t mlaa_area_vpt_unival_max[] = { - 0, 0, 0, + 0, 0, }; static const int32_t mlaa_area_fpt_unival_max[] = { - 0, 0, 2, + 0, 2, }; static const int32_t mlaa_blend_vpt_unival_max[] = { - 0, 0, 0, + 0, 0, }; static const int32_t mlaa_blend_fpt_unival_max[] = { - 1, 0, 0, + 1, 0, }; static const int32_t contour_vpt_unival_max[] = { - //0, 1, - 1, // 0th removed + -1, }; static const int32_t contour_fpt_unival_max[] = { - //1, 1, - 1, // 0th removed + -1, }; static const int32_t contour_npr_vpt_unival_max[] = { @@ -637,60 +437,44 @@ static const int32_t contour_npr_fpt_unival_max[] = { -1, }; -/*static const int32_t exposure_vpt_unival_max[] = { - 2, -}; - -static const int32_t exposure_fpt_unival_max[] = { - 2, -};*/ - static const int32_t exposure_minify_vpt_unival_max[] = { - 0, + -1, }; static const int32_t exposure_minify_fpt_unival_max[] = { - 0, + -1, }; static const int32_t exposure_measure_vpt_unival_max[] = { - 0, + -1, }; static const int32_t exposure_measure_fpt_unival_max[] = { - 0, + -1, }; static const int32_t exposure_average_vpt_unival_max[] = { - 0, + -1, }; static const int32_t exposure_average_fpt_unival_max[] = { - 0, + -1, }; -/*static const int32_t pp_gauss_vpt_unival_max[] = { - 1, -}; - -static const int32_t pp_gauss_fpt_unival_max[] = { - 1, -};*/ - static const int32_t pp_gauss_usual_vpt_unival_max[] = { - 0, + -1, }; static const int32_t pp_gauss_usual_fpt_unival_max[] = { - 0, + -1, }; static const int32_t pp_gauss_cone_vpt_unival_max[] = { - 0, + -1, }; static const int32_t pp_gauss_cone_fpt_unival_max[] = { - 0, + -1, }; static const int32_t sun_vpt_unival_max[] = { @@ -709,38 +493,14 @@ static const int32_t sun_no_textured_fpt_unival_max[] = { -1, }; -/*static const int32_t fade_vpt_unival_max[] = { - 5, -}; - -static const int32_t fade_fpt_unival_max[] = { - 5, -};*/ - static const int32_t water01_vpt_unival_max[] = { - 1, 1, 0, 0, 0, 0, 0, 1, + 1, }; static const int32_t water01_fpt_unival_max[] = { - 0, 0, 2, 1, 1, 1, 1, 1, + 0, }; -/*static const int32_t water02_vpt_unival_max[] = { - -1, -}; - -static const int32_t water02_fpt_unival_max[] = { - -1, -};*/ - -/*static const int32_t water_ring_vpt_unival_max[] = { - 1, 0, -}; - -static const int32_t water_ring_fpt_unival_max[] = { - 1, 1, -};*/ - static const int32_t water_particle_vpt_unival_max[] = { -1, }; @@ -749,28 +509,20 @@ static const int32_t water_particle_fpt_unival_max[] = { -1, }; -/*static const int32_t snow_particle_vpt_unival_max[] = { - 1, -}; - -static const int32_t snow_particle_fpt_unival_max[] = { - 1, -};*/ - static const int32_t snow_particle_vpt_unival_max[] = { - 0, + -1, }; static const int32_t snow_particle_fpt_unival_max[] = { - 0, + -1, }; static const int32_t snow_particle_cpu_vpt_unival_max[] = { - 0, + -1, }; static const int32_t snow_particle_cpu_fpt_unival_max[] = { - 0, + -1, }; static const int32_t leaf_particle_vpt_unival_max[] = { @@ -781,94 +533,52 @@ static const int32_t leaf_particle_fpt_unival_max[] = { -1, }; -/*static const int32_t star_vpt_unival_max[] = { - 1, -}; - -static const int32_t star_fpt_unival_max[] = { - 1, -};*/ - static const int32_t star_vpt_unival_max[] = { - 0, + -1, }; static const int32_t star_fpt_unival_max[] = { - 0, + -1, }; static const int32_t star_milky_way_vpt_unival_max[] = { - 0, + -1, }; static const int32_t star_milky_way_fpt_unival_max[] = { - 0, -}; - -static const int32_t snow_ring_vpt_unival_max[] = { - 0, 0, 0, 1, 0, -}; - -static const int32_t snow_ring_fpt_unival_max[] = { - 2, 1, 1, 1, 1, -}; - -static const int32_t snow_footprint_vpt_unival_max[] = { - -1, -}; - -static const int32_t snow_footprint_fpt_unival_max[] = { - -1, -}; - -static const int32_t snow_tex_space_light_vpt_unival_max[] = { - -1, -}; - -static const int32_t snow_tex_space_light_fpt_unival_max[] = { - -1, -}; - -static const int32_t snow_calc_normal_vpt_unival_max[] = { - -1, -}; - -static const int32_t snow_calc_normal_fpt_unival_max[] = { -1, }; static const int32_t floor_vpt_unival_max[] = { - 0, 0, 1, 0, 3, 1, 1, 0, + 0, 0, }; static const int32_t floor_fpt_unival_max[] = { - 2, 1, 1, 1, 3, 0, 0, 1, // 7th added + 1, 1, }; static const int32_t puddle_vpt_unival_max[] = { - 0, 1, 0, 3, + -1, }; static const int32_t puddle_fpt_unival_max[] = { - 1, 1, 1, 3, + -1, }; static const int32_t simple_reflect_vpt_unival_max[] = { - //1, 1, 2, 1, 1, 0, 0, 0, 0, 0, - 1, 2, 1, 1, 0, 0, 0, 0, 0, // 0th removed + 1, 1, 0, }; static const int32_t simple_reflect_fpt_unival_max[] = { - //0, 0, 2, 0, 0, 1, 1, 2, 1, 1, - 0, 2, 0, 0, 1, 1, 2, 1, 1, // 0th removed + 0, 0, 1, }; static const int32_t simple_refract_vpt_unival_max[] = { - 1, 0, + 1, }; static const int32_t simple_refract_fpt_unival_max[] = { - 0, 1, + 0, }; static const int32_t ripple_emit_vpt_unival_max[] = { @@ -887,22 +597,6 @@ static const int32_t rain_fpt_unival_max[] = { -1, }; -/*static const int32_t volume_light_vpt_unival_max[] = { - -1, -}; - -static const int32_t volume_light_fpt_unival_max[] = { - -1, -};*/ - -/*static const int32_t fence_alpha_vpt_unival_max[] = { - 1, 3, -}; - -static const int32_t fence_alpha_fpt_unival_max[] = { - 0, 3, -};*/ - static const int32_t ripple_vpt_unival_max[] = { 0, }; @@ -928,31 +622,19 @@ static const int32_t particle_fpt_unival_max[] = { }; static const int32_t glitter_particle_vpt_unival_max[] = { - 2, 0, 3, 0, + -1, }; static const int32_t glitter_particle_fpt_unival_max[] = { - 2, 3, 3, 3, + -1, }; -/*static const int32_t show_vector_vpt_unival_max[] = { - //1, 1, 3, - 1, 3, // 0th removed -}; - -static const int32_t show_vector_fpt_unival_max[] = { - //0, 0, 0, - 0, 0, // 0th removed -};*/ - static const int32_t font_vpt_unival_max[] = { - //0, - -1, // 0th removed, 1st added + -1, }; static const int32_t font_fpt_unival_max[] = { - //1, - -1, // 0th removed, 1st added + -1, }; static const int32_t movie_vpt_unival_max[] = { @@ -963,37 +645,30 @@ static const int32_t movie_fpt_unival_max[] = { 1, }; -/*static const int32_t imgfilter_vpt_unival_max[] = { - 0, -}; - -static const int32_t imgfilter_fpt_unival_max[] = { - 5, -};*/ - static const int32_t box4_vpt_unival_max[] = { - 0, + -1, }; static const int32_t box4_fpt_unival_max[] = { - 0, + -1, }; static const int32_t box8_vpt_unival_max[] = { - 0, + -1, }; static const int32_t box8_fpt_unival_max[] = { - 0, + -1, }; static const int32_t copy_vpt_unival_max[] = { - 0, + -1, }; static const int32_t copy_fpt_unival_max[] = { - 0, + -1, }; + static const int32_t sprite_vpt_unival_max[] = { 0, 0, 0, }; @@ -1059,16 +734,6 @@ static const shader_sub_table SSS_SKIN_table[] = { }, }; -/*static const shader_sub_table SSS_FILT_table[] = { - { - SHADER_FT_SUB_SSS_FILTER, - sss_filter_vpt_unival_max, - sss_filter_fpt_unival_max, - "sss_filter", - "sss_filter", - }, -};*/ - static const shader_sub_table SSS_FILT_table[] = { { SHADER_FT_SUB_SSS_FILTER_MIN, @@ -1093,30 +758,6 @@ static const shader_sub_table SSS_FILT_table[] = { }, }; -/*static const shader_sub_table HAIR_table[] = { - { - SHADER_FT_SUB_HAIR_DEFAULT, - hair_default_vpt_unival_max, - hair_default_fpt_unival_max, - "hair_default", - "hair_default", - }, - { - SHADER_FT_SUB_HAIR_ANISO, - hair_aniso_vpt_unival_max, - hair_aniso_fpt_unival_max, - "hair_default", - "hair_aniso", - }, - { - SHADER_FT_SUB_HAIR_NPR1, - hair_npr1_vpt_unival_max, - hair_npr1_fpt_unival_max, - "hair_default", - "hair_npr1", - }, -};*/ - static const shader_sub_table HAIR_table[] = { { SHADER_FT_SUB_HAIR_DEFAULT, @@ -1127,7 +768,7 @@ static const shader_sub_table HAIR_table[] = { }, { SHADER_FT_SUB_HAIR_NPR1, - hair_npr1_vpt_unival_max, + hair_default_vpt_unival_max, hair_npr1_fpt_unival_max, "hair_default", "hair_npr1", @@ -1144,14 +785,14 @@ static const shader_sub_table CLOTH_table[] = { }, { SHADER_FT_SUB_CLOTH_ANISO, - cloth_aniso_vpt_unival_max, + cloth_default_vpt_unival_max, cloth_aniso_fpt_unival_max, "cloth_default", "cloth_aniso", }, { SHADER_FT_SUB_CLOTH_NPR1, - cloth_npr1_vpt_unival_max, + cloth_default_vpt_unival_max, cloth_npr1_fpt_unival_max, "cloth_default", "cloth_npr1", @@ -1178,26 +819,6 @@ static const shader_sub_table SKY_table[] = { }, }; -/*static const shader_sub_table EYEBALL_table[] = { - { - SHADER_FT_SUB_EYE_BALL, - eye_ball_vpt_unival_max, - eye_ball_fpt_unival_max, - "eye_ball", - "eye_ball", - }, -};*/ - -/*static const shader_sub_table EYELENS_table[] = { - { - SHADER_FT_SUB_EYE_LENS, - eye_lens_vpt_unival_max, - eye_lens_fpt_unival_max, - "eye_lens", - "eye_lens", - }, -};*/ - static const shader_sub_table GLASEYE_table[] = { { SHADER_FT_SUB_GLASS_EYE, @@ -1208,36 +829,6 @@ static const shader_sub_table GLASEYE_table[] = { }, }; -/*static const shader_sub_table MEMBRAN_table[] = { - { - SHADER_FT_SUB_MEMBRANE, - membrane_vpt_unival_max, - membrane_fpt_unival_max, - "membrane", - "membrane", - }, -};*/ - -/*static const shader_sub_table SHDMAP_table[] = { - { - SHADER_FT_SUB_SHADOWMAP, - shadowmap_vpt_unival_max, - shadowmap_fpt_unival_max, - "shadowmap", - "shadowmap", - }, -};*/ - -/*static const shader_sub_table ESM_table[] = { - { - SHADER_FT_SUB_ESM, - esm_vpt_unival_max, - esm_fpt_unival_max, - "esm", - "esm", - }, -};*/ - static const shader_sub_table ESMGAUSS_table[] = { { SHADER_FT_SUB_ESM_GAUSS, @@ -1248,16 +839,6 @@ static const shader_sub_table ESMGAUSS_table[] = { }, }; -/*static const shader_sub_table ESMFILT_table[] = { - { - SHADER_FT_SUB_ESM_FILTER, - esm_filter_vpt_unival_max, - esm_filter_fpt_unival_max, - "esm_filter", - "esm_filter", - }, -};*/ - static const shader_sub_table ESMFILT_table[] = { { SHADER_FT_SUB_ESM_FILTER_MIN, @@ -1325,16 +906,6 @@ static const shader_sub_table CONSTANT_table[] = { }, }; -/*static const shader_sub_table PEEL_table[] = { - { - SHADER_FT_SUB_PEEL, - peel_vpt_unival_max, - peel_fpt_unival_max, - "depth_peel", - "depth_peel", - }, -};*/ - static const shader_sub_table TONEMAP_table[] = { { SHADER_FT_SUB_TONEMAP, @@ -1352,16 +923,6 @@ static const shader_sub_table TONEMAP_table[] = { }, }; -/*static const shader_sub_table REDUCE_table[] = { - { - SHADER_FT_SUB_REDUCE_TEX, - reduce_tex_vpt_unival_max, - reduce_tex_fpt_unival_max, - "reduce_tex", - "reduce_tex", - }, -};*/ - static const shader_sub_table REDUCE_table[] = { { SHADER_FT_SUB_REDUCE_TEX_REDUCE_2, @@ -1421,16 +982,6 @@ static const shader_sub_table REDUCE_table[] = { }, }; -/*static const shader_sub_table MAGNIFY_table[] = { - { - SHADER_FT_SUB_MAGNIFY, - magnify_vpt_unival_max, - magnify_fpt_unival_max, - "magnify", - "magnify", - }, -};*/ - static const shader_sub_table MAGNIFY_table[] = { { SHADER_FT_SUB_MAGNIFY_LINEAR, @@ -1469,16 +1020,6 @@ static const shader_sub_table MAGNIFY_table[] = { }, }; -/*static const shader_sub_table MLAA_table[] = { - { - SHADER_FT_SUB_MLAA, - mlaa_vpt_unival_max, - mlaa_fpt_unival_max, - "mlaa", - "mlaa", - }, -};*/ - static const shader_sub_table MLAA_table[] = { { SHADER_FT_SUB_MLAA_EDGE, @@ -1523,16 +1064,6 @@ static const shader_sub_table CONTOUR_NPR_table[] = { }, }; -/*static const shader_sub_table EXPOSURE_table[] = { - { - SHADER_FT_SUB_EXPOSURE, - exposure_vpt_unival_max, - exposure_fpt_unival_max, - "exposure", - "exposure", - }, -};*/ - static const shader_sub_table EXPOSURE_table[] = { { SHADER_FT_SUB_EXPOSURE_MINIFY, @@ -1557,16 +1088,6 @@ static const shader_sub_table EXPOSURE_table[] = { }, }; -/*static const shader_sub_table GAUSS_table[] = { - { - SHADER_FT_SUB_PP_GAUSS, - pp_gauss_vpt_unival_max, - pp_gauss_fpt_unival_max, - "pp_gauss", - "pp_gauss", - }, -};*/ - static const shader_sub_table GAUSS_table[] = { { SHADER_FT_SUB_PP_GAUSS_USUAL, @@ -1604,16 +1125,6 @@ static const shader_sub_table SUN_NO_TEXTURED_table[] = { }, }; -/*static const shader_sub_table FADE_table[] = { - { - SHADER_FT_SUB_FADE, - fade_vpt_unival_max, - fade_fpt_unival_max, - "fade", - "fade", - }, -};*/ - static const shader_sub_table WATER01_table[] = { { SHADER_FT_SUB_WATER01, @@ -1624,26 +1135,6 @@ static const shader_sub_table WATER01_table[] = { }, }; -/*static const shader_sub_table WATER02_table[] = { - { - SHADER_FT_SUB_WATER02, - water02_vpt_unival_max, - water02_fpt_unival_max, - "water02", - "water02", - }, -};*/ - -/*static const shader_sub_table WATRING_table[] = { - { - SHADER_FT_SUB_WATER_RING, - water_ring_vpt_unival_max, - water_ring_fpt_unival_max, - "water_ring", - "water_ring", - }, -};*/ - static const shader_sub_table W_PTCL_table[] = { { SHADER_FT_SUB_WATER_PARTICLE, @@ -1654,16 +1145,6 @@ static const shader_sub_table W_PTCL_table[] = { }, }; -/*static const shader_sub_table SNOW_PT_table[] = { - { - SHADER_FT_SUB_SNOW_PARTICLE, - snow_particle_vpt_unival_max, - snow_particle_fpt_unival_max, - "snow_particle", - "snow_particle", - }, -};*/ - static const shader_sub_table SNOW_PT_table[] = { { SHADER_FT_SUB_SNOW_PARTICLE, @@ -1708,46 +1189,6 @@ static const shader_sub_table STAR_table[] = { }, }; -/*static const shader_sub_table SNORING_table[] = { - { - SHADER_FT_SUB_SNOW_RING, - snow_ring_vpt_unival_max, - snow_ring_fpt_unival_max, - "snow_ring", - "snow_ring", - }, -}; - -static const shader_sub_table SN_FOOT_table[] = { - { - SHADER_FT_SUB_SNOW_FOOTPRINT, - snow_footprint_vpt_unival_max, - snow_footprint_fpt_unival_max, - "snow_footprint", - "snow_footprint", - }, -}; - -static const shader_sub_table SN_TSL_table[] = { - { - SHADER_FT_SUB_SNOW_TEX_SPACE_LIGHT, - snow_tex_space_light_vpt_unival_max, - snow_tex_space_light_fpt_unival_max, - "snow_tex_space_light", - "snow_tex_space_light", - }, -}; - -static const shader_sub_table SN_NRM_table[] = { - { - SHADER_FT_SUB_SNOW_CALC_NORMAL, - snow_calc_normal_vpt_unival_max, - snow_calc_normal_fpt_unival_max, - "snow_calc_normal", - "snow_calc_normal", - }, -};*/ - static const shader_sub_table FLOOR_table[] = { { SHADER_FT_SUB_FLOOR, @@ -1808,26 +1249,6 @@ static const shader_sub_table RAIN_table[] = { }, }; -/*static const shader_sub_table VOLLIT_table[] = { - { - SHADER_FT_SUB_VOLUME_LIGHT, - volume_light_vpt_unival_max, - volume_light_fpt_unival_max, - "volume_light", - "volume_light", - }, -};*/ - -/*static const shader_sub_table FENCE_table[] = { - { - SHADER_FT_SUB_FENCE_ALPHA, - fence_alpha_vpt_unival_max, - fence_alpha_fpt_unival_max, - "fence_alpha", - "fence_alpha", - }, -};*/ - static const shader_sub_table RIPPLE_table[] = { { SHADER_FT_SUB_RIPPLE, @@ -1868,16 +1289,6 @@ static const shader_sub_table GLITTER_PT_table[] = { }, }; -/*static const shader_sub_table SHOW_VEC_table[] = { - { - SHADER_FT_SUB_SHOW_VECTOR, - show_vector_vpt_unival_max, - show_vector_fpt_unival_max, - "show_vector", - "show_vector", - }, -};*/ - static const shader_sub_table FONT_table[] = { { SHADER_FT_SUB_FONT, @@ -1898,16 +1309,6 @@ static const shader_sub_table MOVIE_table[] = { }, }; -/*static const shader_sub_table IMGFILT_table[] = { - { - SHADER_FT_SUB_IMGFILTER, - imgfilter_vpt_unival_max, - imgfilter_fpt_unival_max, - "imgfilter", - "imgfilter", - }, -};*/ - static const shader_sub_table IMGFILT_table[] = { { SHADER_FT_SUB_BOX4, @@ -1942,459 +1343,218 @@ static const shader_sub_table SPRITE_table[] = { }, }; -static const std::pair BLINN_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_TEXTURE_COUNT, false }, - { U_LIGHT_0 , 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 BLINN_uniform[] = { + U_SKINNING, + U_MORPH, + U_ALPHA_TEST, }; -static const std::pair ITEM_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , 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 , true }, - { U_FOG , false }, - { U_ALPHA_TEST , true }, - { U_SHADOW , false }, - { U_CHARA_COLOR , false }, - { U_TONE_CURVE , false }, +static const uniform_name ITEM_uniform[] = { + U_SKINNING, + U_MORPH, + U_ALPHA_TEST, }; -static const std::pair STAGE_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_MORPH , true }, - { U_MORPH_COLOR , true }, - { U_TEXTURE_COUNT, false }, - { U_ENV_MAP , false }, - { U_LIGHT_0 , false }, - { U_NORMAL , false }, - { U_FOG_HEIGHT , false }, - { U_LIGHT_1 , false }, - { U_STAGE_AMBIENT, false }, - { U_ALPHA_TEST , true }, // 11th added +static const uniform_name STAGE_uniform[] = { + U_SKINNING, + U_MORPH, + U_ALPHA_TEST, }; -static const std::pair SKIN_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_NORMAL , false }, - { U_SELF_SHADOW , true }, - { 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 SKIN_uniform[] = { + U_SKINNING, + U_ALPHA_TEST, }; -static const std::pair SSS_SKIN_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_SSS_CHARA , true }, - { U_ALPHA_TEST , true }, - { U_SELF_SHADOW , true }, - { U_SHADOW , false }, - { U_NPR , true }, - { U_NPR_NORMAL , false }, +static const uniform_name SSS_SKIN_uniform[] = { + U_SKINNING, + U_ALPHA_TEST, }; -static const std::pair SSS_FILT_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SSS_FILTER , true }, - { U_NPR , true }, +static const uniform_name SSS_FILT_uniform[] = { + U_INVALID, }; -static const std::pair HAIR_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_SPECULAR_IBL , false }, - { U_SPECULAR , false }, - { U_NORMAL , false }, - { U_TRANSPARENCY , false }, - { U_TRANSLUCENCY , false }, - { U_ANISO , false }, - { U_SELF_SHADOW , true }, - { 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 HAIR_uniform[] = { + U_SKINNING, + U_ALPHA_TEST, }; -static const std::pair CLOTH_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_SPECULAR_IBL , false }, - { U_SPECULAR , false }, - { U_NORMAL , false }, - { U_TRANSPARENCY , false }, - { U_ENV_MAP , false }, - { U_SELF_SHADOW , true }, - { 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 CLOTH_uniform[] = { + U_SKINNING, + U_ALPHA_TEST, }; -static const std::pair TIGHTS_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_SPECULAR , false }, - { U_ENV_MAP , false }, - { U_SELF_SHADOW , true }, - { 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 TIGHTS_uniform[] = { + U_SKINNING, + U_ALPHA_TEST, }; -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 SKY_uniform[] = { + U_MORPH, + U_ALPHA_TEST, }; -/*static const std::pair EYEBALL_uniform[] = { - { U_SKINNING , true }, - { U_ENV_MAP , false }, -};*/ - -/*static const std::pair EYELENS_uniform[] = { - { U_SKINNING , true }, - { U_SPECULAR , false }, - { U_ENV_MAP , false }, -};*/ - -static const std::pair GLASEYE_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_SELF_SHADOW , true }, - { U_FOG , false }, - { U_EYEBALL , false }, - { U_SHADOW , false }, - { U_CHARA_COLOR , false }, - { U_TONE_CURVE , false }, +static const uniform_name GLASEYE_uniform[] = { + U_SKINNING, }; -/*static const std::pair MEMBRAN_uniform[] = { - { U_SKINNING , true }, - { U_NORMAL , false }, - { U_MEMBRANE , false }, -};*/ - -/*static const std::pair SHDMAP_uniform[] = { - { U_SKINNING , true }, - { U_TEXTURE_COUNT, false }, - { U_TRANSPARENCY , false }, - { U_LIGHT_1 , false }, - { U2D , true }, -};*/ - -/*static const std::pair ESM_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_TEXTURE_COUNT, false }, - { U_TRANSPARENCY , false }, -};*/ - -static const std::pair ESMGAUSS_uniform[] = { - { U_LIGHT_PROJ , true }, +static const uniform_name ESMGAUSS_uniform[] = { + U_INVALID, }; -static const std::pair ESMFILT_uniform[] = { - { U_ESM_FILTER , true }, +static const uniform_name ESMFILT_uniform[] = { + U_INVALID, }; -static const std::pair LITPROJ_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_SPECULAR , false }, - { U_NORMAL , false }, - { U_TEXTURE_COUNT, false }, - { U_TRANSPARENCY , false }, - { U_ALPHA_TEST , true }, // 6th added +static const uniform_name LITPROJ_uniform[] = { + U_SKINNING, + U_ALPHA_TEST, }; -static const std::pair SIMPLE_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_TEXTURE_COUNT, false }, - //{ U_NORMAL , false }, // 3rd removed - //{ U_INSTANCE , false }, // 4th removed - //{ U2E , false }, // 5th removed +static const uniform_name SIMPLE_uniform[] = { + U_SKINNING, }; -static const std::pair SIL_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_TRANSPARENCY , false }, - { U_TEXTURE_COUNT, false }, - { U_MORPH , true }, - { U_MORPH_COLOR , true }, - { U_DEPTH , true }, - { U_ALPHA_TEST , true }, // 7th added +static const uniform_name SIL_uniform[] = { + U_SKINNING, + U_MORPH, }; -static const std::pair LAMBERT_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_TEXTURE_COUNT, false }, - { U_LIGHT_0 , 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 LAMBERT_uniform[] = { + U_SKINNING, + U_MORPH, + U_ALPHA_TEST, }; -static const std::pair CONSTANT_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , 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 CONSTANT_uniform[] = { + U_SKINNING, + U_MORPH, + U_ALPHA_TEST, }; -/*static const std::pair PEEL_uniform[] = { - { U_DEPTH_PEEL , false }, - { U_SKINNING , true }, -};*/ - -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 TONEMAP_uniform[] = { + U_TONE_MAP, + U_AET_BACK, }; -static const std::pair REDUCE_uniform[] = { - { U_REDUCE , true }, - { U_ALPHA_MASK , true }, +static const uniform_name REDUCE_uniform[] = { + U_INVALID, }; -static const std::pair MAGNIFY_uniform[] = { - { U_MAGNIFY , true }, +static const uniform_name MAGNIFY_uniform[] = { + U_INVALID, }; -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 MLAA_uniform[] = { + U_ALPHA_MASK, + U_MLAA_SEARCH, }; -static const std::pair CONTOUR_uniform[] = { - //{ U16 , true }, // 0th removed - { U24 , false }, +static const uniform_name CONTOUR_uniform[] = { + U_INVALID, }; -static const std::pair CONTOUR_NPR_uniform[] = { - { U_INVALID , false }, +static const uniform_name CONTOUR_NPR_uniform[] = { + U_INVALID, }; -static const std::pair EXPOSURE_uniform[] = { - { U_EXPOSURE , true }, +static const uniform_name EXPOSURE_uniform[] = { + U_INVALID, }; -static const std::pair GAUSS_uniform[] = { - { U_GAUSS , true }, +static const uniform_name GAUSS_uniform[] = { + U_INVALID, }; -static const std::pair SUN_uniform[] = { - { U_INVALID , false }, +static const uniform_name SUN_uniform[] = { + U_INVALID, }; -static const std::pair SUN_NO_TEXTURED_uniform[] = { - { U_INVALID , false }, +static const uniform_name SUN_NO_TEXTURED_uniform[] = { + U_INVALID, }; -/*static const std::pair FADE_uniform[] = { - { U_FADE , false }, -};*/ - -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 WATER01_uniform[] = { + U_MORPH, }; -/*static const std::pair WATER02_uniform[] = { - { U_INVALID , false }, -};*/ - -/*static const std::pair WATRING_uniform[] = { - { U_LIGHT_0 , false }, - { U_LIGHT_1 , false }, -};*/ - -static const std::pair W_PTCL_uniform[] = { - { U_INVALID , false }, +static const uniform_name W_PTCL_uniform[] = { + U_INVALID, }; -static const std::pair SNOW_PT_uniform[] = { - { U_SNOW_PARTICLE, false }, +static const uniform_name SNOW_PT_uniform[] = { + U_INVALID, }; -static const std::pair LEAF_PT_uniform[] = { - { U_INVALID , false }, +static const uniform_name LEAF_PT_uniform[] = { + U_INVALID, }; -static const std::pair STAR_uniform[] = { - { U_STAR , false }, +static const uniform_name STAR_uniform[] = { + U_INVALID, }; -/*static const std::pair SNORING_uniform[] = { - { U_TEXTURE_COUNT, false }, - { U_NORMAL , false }, - { U_SPECULAR , false }, - { U_LIGHT_0 , false }, - { U_LIGHT_1 , false }, +static const uniform_name FLOOR_uniform[] = { + U_MORPH, + U_ALPHA_TEST, }; -static const std::pair SN_FOOT_uniform[] = { - { U_INVALID , false }, +static const uniform_name PUDDLE_uniform[] = { + U_INVALID, }; -static const std::pair SN_TSL_uniform[] = { - { U_INVALID , false }, +static const uniform_name S_REFL_uniform[] = { + U_SKINNING, + U_MORPH, + U_ALPHA_TEST, }; -static const std::pair SN_NRM_uniform[] = { - { U_INVALID , false }, -};*/ - -static const std::pair FLOOR_uniform[] = { - { U_TEXTURE_COUNT, false }, - { U_NORMAL , false }, - { U_LIGHT_0 , 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 S_REFR_uniform[] = { + U_SKINNING, }; -static const std::pair PUDDLE_uniform[] = { - { U_NORMAL , false }, - { U_LIGHT_0 , false }, - { U_LIGHT_1 , false }, - { U_FOG_HEIGHT , false }, +static const uniform_name RIPEMIT_uniform[] = { + U_RIPPLE, + U_RIPPLE_EMIT, }; -static const std::pair S_REFL_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , 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 RAIN_uniform[] = { + U_INVALID, }; -static const std::pair S_REFR_uniform[] = { - { U_SKINNING , true }, - { U_TRANSPARENCY , false }, +static const uniform_name RIPPLE_uniform[] = { + U_RIPPLE, }; -static const std::pair RIPEMIT_uniform[] = { - { U_RIPPLE , true }, - { U_RIPPLE_EMIT , true }, +static const uniform_name FOGPTCL_uniform[] = { + U_INVALID, }; -static const std::pair RAIN_uniform[] = { - { U_INVALID , false }, +static const uniform_name PARTICL_uniform[] = { + U_INVALID, }; -/*static const std::pair VOLLIT_uniform[] = { - { U_INVALID , false }, -};*/ - -/*static const std::pair FENCE_uniform[] = { - { U_INSTANCE , false }, - { U_FOG_HEIGHT , false }, -};*/ - -static const std::pair RIPPLE_uniform[] = { - { U_RIPPLE , true }, +static const uniform_name GLITTER_PT_uniform[] = { + U_INVALID, }; -static const std::pair FOGPTCL_uniform[] = { - { U_INVALID , false }, +static const uniform_name FONT_uniform[] = { + U_INVALID, }; -static const std::pair PARTICL_uniform[] = { - { U_INVALID , false }, +static const uniform_name MOVIE_uniform[] = { + U_MOVIE, }; -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 IMGFILT_uniform[] = { + U_INVALID, }; -/*static const std::pair SHOW_VEC_uniform[] = { - //{ U16 , true }, // 0th removed - { U_SKINNING , true }, - { U_SHOW_VECTOR , false }, -};*/ - -static const std::pair FONT_uniform[] = { - //{ U16 , true }, // 0th removed - { U_INVALID , false }, // 1st added -}; - -static const std::pair MOVIE_uniform[] = { - { U_MOVIE , true }, -}; - -static const std::pair IMGFILT_uniform[] = { - { U_IMAGE_FILTER , false }, -}; - -static const std::pair SPRITE_uniform[] = { - { U_TEX_0_TYPE , false }, - { U_TEX_1_TYPE , false }, - { U_COMBINER , false }, +static const uniform_name SPRITE_uniform[] = { + U_TEX_0_TYPE, + U_TEX_1_TYPE, + U_COMBINER, }; struct glass_eye_struct { @@ -2432,7 +1592,7 @@ struct glass_eye_struct { SHADER_FT_##n, \ sizeof(n##_table) / sizeof(shader_sub_table), \ n##_table, \ - sizeof(n##_uniform) / sizeof(std::pair), \ + n##_uniform[0] > 0 ? sizeof(n##_uniform) / sizeof(uniform_name) : 0, \ n##_uniform, \ } @@ -2455,12 +1615,7 @@ const shader_table shader_ft_table[] = { shader_table_struct(CLOTH), shader_table_struct(TIGHTS), shader_table_struct(SKY), - //shader_table_struct(EYEBALL), - //shader_table_struct(EYELENS), shader_table_struct(GLASEYE), - //shader_table_struct(MEMBRAN), - //shader_table_struct(SHDMAP), - //shader_table_struct(ESM), shader_table_struct(ESMGAUSS), shader_table_struct(ESMFILT), shader_table_struct(LITPROJ), @@ -2468,7 +1623,6 @@ const shader_table shader_ft_table[] = { shader_table_struct(SIL), shader_table_struct(LAMBERT), shader_table_struct(CONSTANT), - //shader_table_struct(PEEL), shader_table_struct(TONEMAP), shader_table_struct(REDUCE), shader_table_struct(MAGNIFY), @@ -2479,31 +1633,21 @@ const shader_table shader_ft_table[] = { shader_table_struct(GAUSS), shader_table_struct(SUN), shader_table_struct(SUN_NO_TEXTURED), - //shader_table_struct(FADE), shader_table_struct(WATER01), - //shader_table_struct(WATER02), - //shader_table_struct(WATRING), shader_table_struct(W_PTCL), shader_table_struct(SNOW_PT), shader_table_struct(LEAF_PT), shader_table_struct(STAR), - /*shader_table_struct(SNORING), - shader_table_struct(SN_FOOT), - shader_table_struct(SN_TSL), - shader_table_struct(SN_NRM),*/ shader_table_struct(FLOOR), shader_table_struct(PUDDLE), shader_table_struct(S_REFL), shader_table_struct(S_REFR), shader_table_struct(RIPEMIT), shader_table_struct(RAIN), - //shader_table_struct(VOLLIT), - //shader_table_struct(FENCE), shader_table_struct(RIPPLE), shader_table_struct(FOGPTCL), shader_table_struct(PARTICL), shader_table_struct(GLITTER_PT), - //shader_table_struct(SHOW_VEC), shader_table_struct(FONT), shader_table_struct(MOVIE), shader_table_struct(IMGFILT), @@ -2520,18 +1664,18 @@ static void glass_eye_set(glass_eye_struct* glass_eye); static void shader_bind_blinn(shader_set_data* set, shader* shad); static void shader_bind_cloth(shader_set_data* set, shader* shad); static void shader_bind_hair(shader_set_data* set, shader* shad); -static void shader_bind_eye_ball(shader_set_data* set, shader* shad); +static void shader_bind_glass_eye(shader_set_data* set, shader* shad); static void shader_bind_tone_map(shader_set_data* set, shader* shad); -static void shader_bind_sss_filter(shader_set_data* set, shader* shad); // Added -static void shader_bind_esm_filter(shader_set_data* set, shader* shad); // Added -static void shader_bind_reduce_tex(shader_set_data* set, shader* shad); // Added -static void shader_bind_magnify(shader_set_data* set, shader* shad); // Added -static void shader_bind_mlaa(shader_set_data* set, shader* shad); // Added -static void shader_bind_exposure(shader_set_data* set, shader* shad); // Added -static void shader_bind_gauss(shader_set_data* set, shader* shad); // Added -static void shader_bind_snow_particle(shader_set_data* set, shader* shad); // Added -static void shader_bind_star(shader_set_data* set, shader* shad); // Added -static void shader_bind_imgfilter(shader_set_data* set, shader* shad); // Added +static void shader_bind_sss_filter(shader_set_data* set, shader* shad); +static void shader_bind_esm_filter(shader_set_data* set, shader* shad); +static void shader_bind_reduce_tex(shader_set_data* set, shader* shad); +static void shader_bind_magnify(shader_set_data* set, shader* shad); +static void shader_bind_mlaa(shader_set_data* set, shader* shad); +static void shader_bind_exposure(shader_set_data* set, shader* shad); +static void shader_bind_gauss(shader_set_data* set, shader* shad); +static void shader_bind_snow_particle(shader_set_data* set, shader* shad); +static void shader_bind_star(shader_set_data* set, shader* shad); +static void shader_bind_imgfilter(shader_set_data* set, shader* shad); const shader_bind_func shader_ft_bind_func_table[] = { { @@ -2547,51 +1691,50 @@ const shader_bind_func shader_ft_bind_func_table[] = { shader_bind_hair, }, { - //SHADER_FT_EYEBALL, SHADER_FT_GLASEYE, - shader_bind_eye_ball, + shader_bind_glass_eye, }, { SHADER_FT_TONEMAP, shader_bind_tone_map, }, - { // Added + { SHADER_FT_SSS_FILT, shader_bind_sss_filter, }, - { // Added + { SHADER_FT_ESMFILT, shader_bind_esm_filter, }, - { // Added + { SHADER_FT_REDUCE, shader_bind_reduce_tex, }, - { // Added + { SHADER_FT_MAGNIFY, shader_bind_magnify, }, - { // Added + { SHADER_FT_MLAA, shader_bind_mlaa, }, - { // Added + { SHADER_FT_EXPOSURE, shader_bind_exposure, }, - { // Added + { SHADER_FT_GAUSS, shader_bind_gauss, }, - { // Added + { SHADER_FT_SNOW_PT, shader_bind_snow_particle, }, - { // Added + { SHADER_FT_STAR, shader_bind_star, }, - { // Added + { SHADER_FT_IMGFILT, shader_bind_imgfilter, }, @@ -2725,7 +1868,7 @@ static void glass_eye_set(glass_eye_struct* glass_eye) { glass_eye_batch.g_tex_scale = temp; rctx->glass_eye_batch_ubo.WriteMemory(glass_eye_batch); - rctx->glass_eye_batch_ubo.Bind(4); + rctx->glass_eye_batch_ubo.Bind(5); } static void shader_bind_blinn(shader_set_data* set, shader* shad) { @@ -2742,7 +1885,7 @@ static void shader_bind_hair(shader_set_data* set, shader* shad) { shad->bind(set, uniform->arr[U_NPR] ? SHADER_FT_SUB_HAIR_NPR1 : SHADER_FT_SUB_HAIR_DEFAULT); } -static void shader_bind_eye_ball(shader_set_data* set, shader* shad) { +static void shader_bind_glass_eye(shader_set_data* set, shader* shad) { uniform->arr[U_EYEBALL] = 0; if (set->shaders[SHADER_FT_GLASEYE].bind(set, SHADER_FT_SUB_GLASS_EYE) >= 0) { glass_eye_calc(&glass_eye); @@ -2755,7 +1898,7 @@ static void shader_bind_tone_map(shader_set_data* set, shader* shad) { ? SHADER_FT_SUB_TONEMAP_NPR1 : SHADER_FT_SUB_TONEMAP); } -static void shader_bind_sss_filter(shader_set_data* set, shader* shad) { // Added +static void shader_bind_sss_filter(shader_set_data* set, shader* shad) { switch (uniform->arr[U_SSS_FILTER]) { case 0: shad->bind(set, uniform->arr[U_NPR] @@ -2767,7 +1910,7 @@ static void shader_bind_sss_filter(shader_set_data* set, shader* shad) { // Adde } } -static void shader_bind_esm_filter(shader_set_data* set, shader* shad) { // Added +static void shader_bind_esm_filter(shader_set_data* set, shader* shad) { switch (uniform->arr[U_ESM_FILTER]) { case 0: shad->bind(set, SHADER_FT_SUB_ESM_FILTER_MIN); @@ -2778,7 +1921,7 @@ static void shader_bind_esm_filter(shader_set_data* set, shader* shad) { // Adde } } -static void shader_bind_reduce_tex(shader_set_data* set, shader* shad) { // Added +static void shader_bind_reduce_tex(shader_set_data* set, shader* shad) { switch (uniform->arr[U_REDUCE]) { case 0: switch (uniform->arr[U_ALPHA_MASK]) { @@ -2835,7 +1978,7 @@ static void shader_bind_reduce_tex(shader_set_data* set, shader* shad) { // Adde } } -static void shader_bind_magnify(shader_set_data* set, shader* shad) { // Added +static void shader_bind_magnify(shader_set_data* set, shader* shad) { switch (uniform->arr[U_MAGNIFY]) { case 0: shad->bind(set, SHADER_FT_SUB_MAGNIFY_LINEAR); @@ -2855,7 +1998,7 @@ static void shader_bind_magnify(shader_set_data* set, shader* shad) { // Added } } -static void shader_bind_mlaa(shader_set_data* set, shader* shad) { // Added +static void shader_bind_mlaa(shader_set_data* set, shader* shad) { switch (uniform->arr[U_MLAA]) { case 0: shad->bind(set, SHADER_FT_SUB_MLAA_EDGE); @@ -2869,7 +2012,7 @@ static void shader_bind_mlaa(shader_set_data* set, shader* shad) { // Added } } -static void shader_bind_exposure(shader_set_data* set, shader* shad) { // Added +static void shader_bind_exposure(shader_set_data* set, shader* shad) { switch (uniform->arr[U_EXPOSURE]) { case 0: shad->bind(set, SHADER_FT_SUB_EXPOSURE_MINIFY); @@ -2883,7 +2026,7 @@ static void shader_bind_exposure(shader_set_data* set, shader* shad) { // Added } } -static void shader_bind_gauss(shader_set_data* set, shader* shad) { // Added +static void shader_bind_gauss(shader_set_data* set, shader* shad) { switch (uniform->arr[U_GAUSS]) { case 0: shad->bind(set, SHADER_FT_SUB_PP_GAUSS_USUAL); @@ -2894,7 +2037,7 @@ static void shader_bind_gauss(shader_set_data* set, shader* shad) { // Added } } -static void shader_bind_snow_particle(shader_set_data* set, shader* shad) { // Added +static void shader_bind_snow_particle(shader_set_data* set, shader* shad) { switch (uniform->arr[U_SNOW_PARTICLE]) { case 0: shad->bind(set, SHADER_FT_SUB_SNOW_PARTICLE_CPU); @@ -2905,7 +2048,7 @@ static void shader_bind_snow_particle(shader_set_data* set, shader* shad) { // A } } -static void shader_bind_star(shader_set_data* set, shader* shad) { // Added +static void shader_bind_star(shader_set_data* set, shader* shad) { switch (uniform->arr[U_STAR]) { case 0: shad->bind(set, SHADER_FT_SUB_STAR); diff --git a/src/DivaGL/shader_ft.hpp b/src/DivaGL/shader_ft.hpp index 4b4c41e..dd6592e 100644 --- a/src/DivaGL/shader_ft.hpp +++ b/src/DivaGL/shader_ft.hpp @@ -20,12 +20,7 @@ enum shader_ft_enum { SHADER_FT_CLOTH, SHADER_FT_TIGHTS, SHADER_FT_SKY, - //SHADER_FT_EYEBALL, - //SHADER_FT_EYELENS, SHADER_FT_GLASEYE, - //SHADER_FT_MEMBRAN, - //SHADER_FT_SHDMAP, - //SHADER_FT_ESM, SHADER_FT_ESMGAUSS, SHADER_FT_ESMFILT, SHADER_FT_LITPROJ, @@ -33,7 +28,6 @@ enum shader_ft_enum { SHADER_FT_SIL, SHADER_FT_LAMBERT, SHADER_FT_CONSTANT, - //SHADER_FT_PEEL, SHADER_FT_TONEMAP, SHADER_FT_REDUCE, SHADER_FT_MAGNIFY, @@ -44,31 +38,21 @@ enum shader_ft_enum { SHADER_FT_GAUSS, SHADER_FT_SUN, SHADER_FT_SUN_NO_TEXTURED, - //SHADER_FT_FADE, SHADER_FT_WATER01, - //SHADER_FT_WATER02, - //SHADER_FT_WATRING, SHADER_FT_W_PTCL, SHADER_FT_SNOW_PT, SHADER_FT_LEAF_PT, SHADER_FT_STAR, - //SHADER_FT_SNORING, - //SHADER_FT_SN_FOOT, - //SHADER_FT_SN_TSL, - //SHADER_FT_SN_NRM, SHADER_FT_FLOOR, SHADER_FT_PUDDLE, SHADER_FT_S_REFL, SHADER_FT_S_REFR, SHADER_FT_RIPEMIT, SHADER_FT_RAIN, - //SHADER_FT_VOLLIT, - //SHADER_FT_FENCE, SHADER_FT_RIPPLE, SHADER_FT_FOGPTCL, SHADER_FT_PARTICL, SHADER_FT_GLITTER_PT, - //SHADER_FT_SHOW_VEC, SHADER_FT_FONT, SHADER_FT_MOVIE, SHADER_FT_IMGFILT, diff --git a/src/DivaGL/shadow.cpp b/src/DivaGL/shadow.cpp index bfe96a1..ba1af5b 100644 --- a/src/DivaGL/shadow.cpp +++ b/src/DivaGL/shadow.cpp @@ -17,7 +17,7 @@ void(FASTCALL* shadow_ptr_init)() = (void(FASTCALL*)())0x00000001405E8890; void Shadow::ctrl() { for (int32_t i = 0; i < 2; i++) - light_enable[i] = false; + shadow_enable[i] = false; if (render_manager->shadow) { view_mat[0] = camera_data->view; @@ -35,24 +35,24 @@ void Shadow::ctrl() { for (int32_t i = 0; i < 2; i++) if (disp_manager->get_obj_count((mdl::ObjType)(mdl::OBJ_TYPE_SHADOW_CHARA + i))) - light_enable[i] = true; + shadow_enable[i] = true; } int32_t count = 0; - num_light = 0; + num_shadow = 0; for (int32_t i = 0; i < 2; i++) - if (light_enable[i] && field_1D0[i].size() > 0) { - num_light++; + if (shadow_enable[i] && field_1D0[i].size() > 0) { + num_shadow++; count += (int32_t)field_1D0[i].size(); } else - light_enable[i] = false; + shadow_enable[i] = false; if (count < 3) { for (int32_t i = 0; i < 2; i++) { field_1A8[i] = 0.0f; field_1C8[i] = 0.0f; - if (!light_enable[i] || field_1D0[i].size() < 1) + if (!shadow_enable[i] || field_1D0[i].size() < 1) continue; vec3 v7 = 0.0f; @@ -79,11 +79,11 @@ void Shadow::ctrl() { field_1C8[i] = v15; } - if (num_light > 0) { + if (num_shadow > 0) { vec3 view_point = 0.0f; vec3 interest = 0.0f; for (int32_t i = 0; i < 2; i++) { - if (!light_enable[i]) + if (!shadow_enable[i]) continue; vec3 v11 = field_1A8[i] - direction * field_208; @@ -98,8 +98,8 @@ void Shadow::ctrl() { interest += this->interest[i]; } - view_point_shared = view_point * (1.0f / (float_t)num_light); - interest_shared = interest * (1.0f / (float_t)num_light); + view_point_shared = view_point * (1.0f / (float_t)num_shadow); + interest_shared = interest * (1.0f / (float_t)num_shadow); } float_t v2 = max_def(field_1C8[0], field_1C8[1]); @@ -107,7 +107,7 @@ void Shadow::ctrl() { shadow_range = v2 + 1.2f; field_200[0] = 0; field_200[1] = 1; - if (num_light >= 2) { + if (num_shadow >= 2) { vec3 v12 = field_1A8[0] - interest_shared; vec3 v14 = field_1A8[1] - interest_shared; @@ -146,7 +146,7 @@ void Shadow::ctrl() { for (int32_t i = 0; i < 2; i++) { field_1A8[i] = 0.0f; field_1C8[i] = 0.0; - if (!light_enable[i] || field_1D0[i].size() < 1) + if (!shadow_enable[i] || field_1D0[i].size() < 1) continue; vec3 v22 = 0.0f; @@ -173,9 +173,9 @@ void Shadow::ctrl() { field_1C8[i] = v30; } - if (num_light > 0) { + if (num_shadow > 0) { for (int32_t i = 0; i < 2; i++) { - if (!light_enable[i]) + if (!shadow_enable[i]) continue; vec3 v53 = field_1A8[i] - direction * field_208; @@ -207,12 +207,12 @@ void Shadow::ctrl() { shadow_range = v67 + 1.2f; field_200[0] = 0; field_200[1] = 1; - if (num_light >= 2) { + if (num_shadow >= 2) { float_t v68 = 0.0f; float_t v69 = 0.0f; float_t v70 = 0.0f; for (int32_t i = 0; i < 2; i++) { - if (!light_enable[i]) + if (!shadow_enable[i]) continue; for (vec3& j : field_1D0[i]) { @@ -335,7 +335,7 @@ void Shadow::reset() { field_2DC = 2.0f; field_2E0 = 0.05f; shadow_ambient = 0.4f; - num_light = 0; + num_shadow = 0; direction = vec3(0.0f, -1.0f, -1.0f) * (1.0f / sqrtf(2.0f)); show_texture = false; self_shadow = true; diff --git a/src/DivaGL/shadow.hpp b/src/DivaGL/shadow.hpp index aceb786..e5e93ca 100644 --- a/src/DivaGL/shadow.hpp +++ b/src/DivaGL/shadow.hpp @@ -51,8 +51,8 @@ struct Shadow { float_t field_2E0; float_t shadow_ambient; bool show_texture; - int32_t num_light; - bool light_enable[2]; + int32_t num_shadow; + bool shadow_enable[2]; bool self_shadow; bool blur_filter_enable[2]; bool separate; diff --git a/src/DivaGL/uniform.hpp b/src/DivaGL/uniform.hpp index 5b1ccae..33f80bf 100644 --- a/src/DivaGL/uniform.hpp +++ b/src/DivaGL/uniform.hpp @@ -28,8 +28,8 @@ enum uniform_name { U_FADE = 0x11, U_STAGE_AMBIENT = 0x12, U_FLARE = 0x13, - U_FOG_HEIGHT = 0x14, - U_FOG = 0x15, + U_FOG_STAGE = 0x14, + U_FOG_CHARA = 0x15, U16 = 0x16, U_GAUSS = 0x17, U_EYEBALL = 0x18, @@ -48,11 +48,11 @@ enum uniform_name { U25 = 0x25, U_NPR_NORMAL = 0x26, U_NPR = 0x27, - U_LIGHT_1 = 0x28, + U_STAGE_SHADOW2 = 0x28, U_REFLECT = 0x29, U_REDUCE = 0x2A, - U_SELF_SHADOW = 0x2B, - U_SHADOW = 0x2C, + U_CHARA_SHADOW = 0x2B, + U_CHARA_SHADOW2 = 0x2C, U2D = 0x2D, U2E = 0x2E, U_SHOW_VECTOR = 0x2F, @@ -74,7 +74,7 @@ enum uniform_name { U_WATER_REFLECT = 0x3F, U40 = 0x40, U41 = 0x41, - U_LIGHT_0 = 0x42, + U_STAGE_SHADOW = 0x42, U_SPECULAR = 0x43, U_TONE_MAP = 0x44, U45 = 0x45,