2
0
Эх сурвалжийг харах

TIME constant reverted to a single float, fixes #9123

Juan Linietsky 8 жил өмнө
parent
commit
80929d36be

+ 1 - 3
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);

+ 1 - 1
drivers/gles3/rasterizer_canvas_gles3.h

@@ -39,7 +39,7 @@ public:
 	struct CanvasItemUBO {
 
 		float projection_matrix[16];
-		float time[4];
+		float time;
 	};
 
 	struct Data {

+ 1 - 3
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

+ 1 - 1
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;

+ 1 - 3
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);
-
-
 }
 
 ////////

+ 2 - 2
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;
 };
 
 

+ 1 - 1
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;

+ 2 - 2
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;

+ 1 - 1
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;