diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-01-17 18:05:19 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-01-17 18:29:20 +0300 |
commit | 6eaf51ef3e5b7d37170473449bcda60bad025e67 (patch) | |
tree | 4dff167f66b8d2befe0303fff168573ad943379c /source/blender/draw/intern/draw_cache.c | |
parent | 9410e5dc97c4f21e19865ca8a9e1e185fcf5a1d4 (diff) |
DRW: Use USHORT for vertex color and upload them in linear color to the GPU
This way we remove the need for the srgb boolean uniform and a lot of code complexity. However, mesh update is going to be a bit slower.
I did not benchmark the performance impact.
This also fix a typo in draw_cache_impl_particles.c and fix hair not using vertex color in workbench.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D6610
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 4d10e781e79..a0e4af8fc8d 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -826,25 +826,11 @@ GPUBatch *DRW_cache_object_surface_get(Object *ob) GPUBatch **DRW_cache_object_surface_material_get(struct Object *ob, struct GPUMaterial **gpumat_array, - uint gpumat_array_len, - char **auto_layer_names, - int **auto_layer_is_srgb, - int *auto_layer_count) + uint gpumat_array_len) { - if (auto_layer_names != NULL) { - *auto_layer_names = NULL; - *auto_layer_is_srgb = NULL; - *auto_layer_count = 0; - } - switch (ob->type) { case OB_MESH: - return DRW_cache_mesh_surface_shaded_get(ob, - gpumat_array, - gpumat_array_len, - auto_layer_names, - auto_layer_is_srgb, - auto_layer_count); + return DRW_cache_mesh_surface_shaded_get(ob, gpumat_array, gpumat_array_len); case OB_CURVE: return DRW_cache_curve_surface_shaded_get(ob, gpumat_array, gpumat_array_len); case OB_SURF: @@ -2733,18 +2719,10 @@ GPUBatch *DRW_cache_mesh_surface_edges_get(Object *ob) /* Return list of batches with length equal to max(1, totcol). */ GPUBatch **DRW_cache_mesh_surface_shaded_get(Object *ob, struct GPUMaterial **gpumat_array, - uint gpumat_array_len, - char **auto_layer_names, - int **auto_layer_is_srgb, - int *auto_layer_count) + uint gpumat_array_len) { BLI_assert(ob->type == OB_MESH); - return DRW_mesh_batch_cache_get_surface_shaded(ob->data, - gpumat_array, - gpumat_array_len, - auto_layer_names, - auto_layer_is_srgb, - auto_layer_count); + return DRW_mesh_batch_cache_get_surface_shaded(ob->data, gpumat_array, gpumat_array_len); } /* Return list of batches with length equal to max(1, totcol). */ @@ -2895,8 +2873,7 @@ GPUBatch **DRW_cache_curve_surface_shaded_get(Object *ob, struct Curve *cu = ob->data; struct Mesh *mesh_eval = ob->runtime.mesh_eval; if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_surface_shaded( - mesh_eval, gpumat_array, gpumat_array_len, NULL, NULL, NULL); + return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); } else { return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); @@ -3036,8 +3013,7 @@ GPUBatch **DRW_cache_text_surface_shaded_get(Object *ob, return NULL; } if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_surface_shaded( - mesh_eval, gpumat_array, gpumat_array_len, NULL, NULL, NULL); + return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); } else { return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); @@ -3131,8 +3107,7 @@ GPUBatch **DRW_cache_surf_surface_shaded_get(Object *ob, struct Curve *cu = ob->data; struct Mesh *mesh_eval = ob->runtime.mesh_eval; if (mesh_eval != NULL) { - return DRW_mesh_batch_cache_get_surface_shaded( - mesh_eval, gpumat_array, gpumat_array_len, NULL, NULL, NULL); + return DRW_mesh_batch_cache_get_surface_shaded(mesh_eval, gpumat_array, gpumat_array_len); } else { return DRW_curve_batch_cache_get_surface_shaded(cu, gpumat_array, gpumat_array_len); |