diff options
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_canvas_gles3.h | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_scene_gles3.h | 2 | ||||
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/particles.glsl | 2 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 4 | ||||
-rw-r--r-- | servers/visual/shader_types.cpp | 2 |
9 files changed, 11 insertions, 17 deletions
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp index e88687eb28..aad132a92d 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.cpp +++ b/drivers/gles3/rasterizer_canvas_gles3.cpp @@ -1265,9 +1265,7 @@ void RasterizerCanvasGLES3::reset_canvas() { state.vp = canvas_transform; store_transform(canvas_transform, state.canvas_item_ubo_data.projection_matrix); - for (int i = 0; i < 4; i++) { - state.canvas_item_ubo_data.time[i] = storage->frame.time[i]; - } + state.canvas_item_ubo_data.time = storage->frame.time[0]; glBindBuffer(GL_UNIFORM_BUFFER, state.canvas_item_ubo); glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(CanvasItemUBO), &state.canvas_item_ubo_data); diff --git a/drivers/gles3/rasterizer_canvas_gles3.h b/drivers/gles3/rasterizer_canvas_gles3.h index 2da0cc0afd..b4f491285d 100644 --- a/drivers/gles3/rasterizer_canvas_gles3.h +++ b/drivers/gles3/rasterizer_canvas_gles3.h @@ -39,7 +39,7 @@ public: struct CanvasItemUBO { float projection_matrix[16]; - float time[4]; + float time; }; struct Data { diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 197ed47392..f7253c6b5b 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -2314,9 +2314,7 @@ void RasterizerSceneGLES3::_setup_environment(Environment *env, const CameraMatr store_transform(p_cam_transform.affine_inverse(), state.ubo_data.camera_inverse_matrix); //time global variables - for (int i = 0; i < 4; i++) { - state.ubo_data.time[i] = storage->frame.time[i]; - } + state.ubo_data.time = storage->frame.time[0]; state.ubo_data.z_far = p_cam_projection.get_z_far(); //bg and ambient diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 4faea0b2c6..3e15da52ab 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -111,7 +111,6 @@ public: float projection_matrix[16]; float camera_inverse_matrix[16]; float camera_matrix[16]; - float time[4]; float ambient_light_color[4]; float bg_color[4]; float fog_color_enabled[4]; @@ -127,6 +126,7 @@ public: float shadow_atlas_pixel_size[2]; float shadow_directional_pixel_size[2]; + float time; float z_far; float reflection_multiplier; float subsurface_scatter_width; diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ff483a0fde..ac2cbcbd54 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -5381,7 +5381,7 @@ void RasterizerStorageGLES3::update_particles() { shaders.particles.bind(); shaders.particles.set_uniform(ParticlesShaderGLES3::TOTAL_PARTICLES, particles->amount); - shaders.particles.set_uniform(ParticlesShaderGLES3::TIME, Color(frame.time[0], frame.time[1], frame.time[2], frame.time[3])); + shaders.particles.set_uniform(ParticlesShaderGLES3::TIME, frame.time[0]); shaders.particles.set_uniform(ParticlesShaderGLES3::EXPLOSIVENESS, particles->explosiveness); shaders.particles.set_uniform(ParticlesShaderGLES3::LIFETIME, particles->lifetime); shaders.particles.set_uniform(ParticlesShaderGLES3::ATTRACTOR_COUNT, 0); @@ -5447,8 +5447,6 @@ void RasterizerStorageGLES3::update_particles() { } glDisable(GL_RASTERIZER_DISCARD); - - } //////// diff --git a/drivers/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index de4dbf6e6f..68660b657f 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -20,7 +20,7 @@ layout(location=4) in highp vec2 uv_attrib; layout(std140) uniform CanvasItemData { //ubo:0 highp mat4 projection_matrix; - highp vec4 time; + highp float time; }; uniform highp mat4 modelview_matrix; @@ -158,7 +158,7 @@ uniform sampler2D screen_texture; // texunit:-3 layout(std140) uniform CanvasItemData { highp mat4 projection_matrix; - highp vec4 time; + highp float time; }; diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl index c1356bb110..7e7b083f73 100644 --- a/drivers/gles3/shaders/particles.glsl +++ b/drivers/gles3/shaders/particles.glsl @@ -28,7 +28,7 @@ uniform float prev_system_phase; uniform int total_particles; uniform float explosiveness; uniform float randomness; -uniform vec4 time; +uniform float time; uniform float delta; uniform int attractor_count; diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 9a2cd577ef..fc38346baa 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -63,7 +63,6 @@ layout(std140) uniform SceneData { //ubo:0 highp mat4 projection_matrix; highp mat4 camera_inverse_matrix; highp mat4 camera_matrix; - highp vec4 time; highp vec4 ambient_light_color; highp vec4 bg_color; @@ -83,6 +82,7 @@ layout(std140) uniform SceneData { //ubo:0 vec2 shadow_atlas_pixel_size; vec2 directional_shadow_pixel_size; + float time; float z_far; float reflection_multiplier; float subsurface_scatter_width; @@ -435,7 +435,6 @@ layout(std140) uniform SceneData { highp mat4 projection_matrix; highp mat4 camera_inverse_matrix; highp mat4 camera_matrix; - highp vec4 time; highp vec4 ambient_light_color; highp vec4 bg_color; @@ -455,6 +454,7 @@ layout(std140) uniform SceneData { vec2 shadow_atlas_pixel_size; vec2 directional_shadow_pixel_size; + float time; float z_far; float reflection_multiplier; float subsurface_scatter_width; diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index 44aaf85581..81139ecc1c 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -206,7 +206,7 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["RESTART"] = ShaderLanguage::TYPE_BOOL; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["CUSTOM"] = ShaderLanguage::TYPE_VEC4; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TRANSFORM"] = ShaderLanguage::TYPE_MAT4; - shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TIME"] = ShaderLanguage::TYPE_VEC4; + shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["TIME"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["LIFETIME"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["DELTA"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["NUMBER"] = ShaderLanguage::TYPE_UINT; |