diff options
author | clayjohn <claynjohn@gmail.com> | 2023-01-05 11:55:59 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2023-01-18 19:52:47 -0800 |
commit | faea9f5c10abfc66284ea208d4f20eb03732a3bd (patch) | |
tree | 81943d5eeb7c19093fb02d2770a0943752333e06 /drivers/gles3 | |
parent | d93b66ad4d6b1dae42cc318c16224d03bd1a1472 (diff) |
Remove SCREEN_TEXTURE, DEPTH_TEXTURE, and NORMAL_ROUGHNESS_TEXTURE
in favour of texture hints
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 8 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 2 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/storage/material_storage.cpp | 14 |
4 files changed, 13 insertions, 15 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index a946a2ceb5..fb338b9849 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -2654,8 +2654,10 @@ RasterizerCanvasGLES3::RasterizerCanvasGLES3() { shader_type canvas_item; +uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; + void fragment() { - vec4 c = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0); + vec4 c = textureLod(screen_texture, SCREEN_UV, 0.0); if (c.a > 0.0001) { c.rgb /= c.a; @@ -2679,8 +2681,10 @@ void fragment() { shader_type canvas_item; +uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest; + void fragment() { - vec4 c = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0); + vec4 c = textureLod(screen_texture, SCREEN_UV, 0.0); COLOR.rgb = c.rgb; } )"); diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index 8c53ab6529..1631c65385 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -277,7 +277,7 @@ flat in uvec4 varying_G; uniform sampler2D atlas_texture; //texunit:-2 uniform sampler2D shadow_atlas_texture; //texunit:-3 #endif // DISABLE_LIGHTING -uniform sampler2D screen_texture; //texunit:-4 +uniform sampler2D color_buffer; //texunit:-4 uniform sampler2D sdf_texture; //texunit:-5 uniform sampler2D normal_texture; //texunit:-6 uniform sampler2D specular_texture; //texunit:-7 diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 1b922fa726..951155e287 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -564,10 +564,10 @@ uniform highp samplerCubeShadow positional_shadow; // texunit:-4 #ifdef USE_MULTIVIEW uniform highp sampler2DArray depth_buffer; // texunit:-6 -uniform highp sampler2DArray screen_texture; // texunit:-5 +uniform highp sampler2DArray color_buffer; // texunit:-5 #else uniform highp sampler2D depth_buffer; // texunit:-6 -uniform highp sampler2D screen_texture; // texunit:-5 +uniform highp sampler2D color_buffer; // texunit:-5 #endif uniform highp mat4 world_transform; diff --git a/drivers/gles3/storage/material_storage.cpp b/drivers/gles3/storage/material_storage.cpp index 2d81771898..50e5c868d3 100644 --- a/drivers/gles3/storage/material_storage.cpp +++ b/drivers/gles3/storage/material_storage.cpp @@ -1515,7 +1515,6 @@ MaterialStorage::MaterialStorage() { actions.renames["SPECULAR_SHININESS_TEXTURE"] = "specular_texture"; actions.renames["SPECULAR_SHININESS"] = "specular_shininess"; actions.renames["SCREEN_UV"] = "screen_uv"; - actions.renames["SCREEN_TEXTURE"] = "screen_texture"; actions.renames["SCREEN_PIXEL_SIZE"] = "screen_pixel_size"; actions.renames["FRAGCOORD"] = "gl_FragCoord"; actions.renames["POINT_COORD"] = "gl_PointCoord"; @@ -1536,7 +1535,6 @@ MaterialStorage::MaterialStorage() { actions.renames["screen_uv_to_sdf"] = "screen_uv_to_sdf"; actions.usage_defines["COLOR"] = "#define COLOR_USED\n"; - actions.usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n"; actions.usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n"; actions.usage_defines["SCREEN_PIXEL_SIZE"] = "@SCREEN_UV"; actions.usage_defines["NORMAL"] = "#define NORMAL_USED\n"; @@ -1617,9 +1615,6 @@ MaterialStorage::MaterialStorage() { actions.renames["POINT_COORD"] = "gl_PointCoord"; actions.renames["INSTANCE_CUSTOM"] = "instance_custom"; actions.renames["SCREEN_UV"] = "screen_uv"; - //actions.renames["SCREEN_TEXTURE"] = "color_buffer"; //Not implemented in 3D yet. - //actions.renames["DEPTH_TEXTURE"] = "depth_buffer"; // Not implemented in 3D yet. - //actions.renames["NORMAL_ROUGHNESS_TEXTURE"] = "normal_roughness_buffer"; // Not implemented in 3D yet actions.renames["DEPTH"] = "gl_FragDepth"; actions.renames["OUTPUT_IS_SRGB"] = "true"; actions.renames["FOG"] = "fog"; @@ -1684,7 +1679,6 @@ MaterialStorage::MaterialStorage() { actions.usage_defines["SSS_STRENGTH"] = "#define ENABLE_SSS\n"; actions.usage_defines["SSS_TRANSMITTANCE_DEPTH"] = "#define ENABLE_TRANSMITTANCE\n"; actions.usage_defines["BACKLIGHT"] = "#define LIGHT_BACKLIGHT_USED\n"; - actions.usage_defines["SCREEN_TEXTURE"] = "#define SCREEN_TEXTURE_USED\n"; actions.usage_defines["SCREEN_UV"] = "#define SCREEN_UV_USED\n"; actions.usage_defines["DIFFUSE_LIGHT"] = "#define USE_LIGHT_SHADER_CODE\n"; @@ -2960,7 +2954,6 @@ void CanvasShaderData::set_code(const String &p_code) { actions.render_mode_values["blend_premul_alpha"] = Pair<int *, int>(&blend_modei, BLEND_MODE_PMALPHA); actions.render_mode_values["blend_disabled"] = Pair<int *, int>(&blend_modei, BLEND_MODE_DISABLED); - actions.usage_flag_pointers["SCREEN_TEXTURE"] = &uses_screen_texture; actions.usage_flag_pointers["texture_sdf"] = &uses_sdf; actions.usage_flag_pointers["TIME"] = &uses_time; @@ -2974,6 +2967,7 @@ void CanvasShaderData::set_code(const String &p_code) { blend_mode = BlendMode(blend_modei); uses_screen_texture_mipmaps = gen_code.uses_screen_texture_mipmaps; + uses_screen_texture = gen_code.uses_screen_texture; #if 0 print_line("**compiling shader:"); @@ -3309,9 +3303,6 @@ void SceneShaderData::set_code(const String &p_code) { actions.usage_flag_pointers["SSS_STRENGTH"] = &uses_sss; actions.usage_flag_pointers["SSS_TRANSMITTANCE_DEPTH"] = &uses_transmittance; - actions.usage_flag_pointers["SCREEN_TEXTURE"] = &uses_screen_texture; - actions.usage_flag_pointers["DEPTH_TEXTURE"] = &uses_depth_texture; - actions.usage_flag_pointers["NORMAL_TEXTURE"] = &uses_normal_texture; actions.usage_flag_pointers["DISCARD"] = &uses_discard; actions.usage_flag_pointers["TIME"] = &uses_time; actions.usage_flag_pointers["ROUGHNESS"] = &uses_roughness; @@ -3364,6 +3355,9 @@ void SceneShaderData::set_code(const String &p_code) { vertex_input_mask |= uses_bones << 9; vertex_input_mask |= uses_weights << 10; uses_screen_texture_mipmaps = gen_code.uses_screen_texture_mipmaps; + uses_screen_texture = gen_code.uses_screen_texture; + uses_depth_texture = gen_code.uses_depth_texture; + uses_normal_texture = gen_code.uses_normal_roughness_texture; uses_vertex_time = gen_code.uses_vertex_time; uses_fragment_time = gen_code.uses_fragment_time; |