Reduced memory transfer of OpenGL gradient uniform upload. Rearranged gradient uniforms on OpenGL side to be more performant.

This commit is contained in:
shan 2022-10-05 16:07:43 -07:00
parent f7ce7244d0
commit 1eb8d972ba
7 changed files with 83 additions and 128 deletions

View file

@ -70,11 +70,10 @@ impl Pipeline {
unsafe {
gl.use_program(Some(program));
let matrix: [f32; 16] = Transformation::identity().into();
gl.uniform_matrix_4_f32_slice(
Some(&transform_location),
false,
&matrix,
Transformation::identity().as_ref(),
);
gl.uniform_1_f32(Some(&scale_location), 1.0);
@ -139,11 +138,10 @@ impl Pipeline {
if transformation != self.current_transform {
unsafe {
let matrix: [f32; 16] = transformation.into();
gl.uniform_matrix_4_f32_slice(
Some(&self.transform_location),
false,
&matrix,
transformation.as_ref(),
);
self.current_transform = transformation;

View file

@ -65,11 +65,10 @@ impl Pipeline {
unsafe {
gl.use_program(Some(program));
let matrix: [f32; 16] = Transformation::identity().into();
gl.uniform_matrix_4_f32_slice(
Some(&transform_location),
false,
&matrix,
Transformation::identity().as_ref(),
);
gl.uniform_1_f32(Some(&scale_location), 1.0);
@ -119,11 +118,10 @@ impl Pipeline {
if transformation != self.current_transform {
unsafe {
let matrix: [f32; 16] = transformation.into();
gl.uniform_matrix_4_f32_slice(
Some(&self.transform_location),
false,
&matrix,
transformation.as_ref(),
);
self.current_transform = transformation;