diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-07-19 18:10:13 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-07-19 18:10:13 +0300 |
commit | 28e06bbe6117da80e86e9be78a25a9d2a83d7543 (patch) | |
tree | 49b713ddbe6790f1bf013a01fcdc71befe5a7c44 /source/blender/editors/space_view3d | |
parent | e7855556e18757e912cea986fc309eb1bd1460e5 (diff) |
Handle replacement of the shader cache for strands outside the creation function.
This makes it easier to run preparation code outside the gpu module conditionally.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r-- | source/blender/editors/space_view3d/drawstrands.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/drawstrands.c b/source/blender/editors/space_view3d/drawstrands.c index 4c2f56dc99c..78ca1137b0c 100644 --- a/source/blender/editors/space_view3d/drawstrands.c +++ b/source/blender/editors/space_view3d/drawstrands.c @@ -139,12 +139,16 @@ void draw_strands(Scene *scene, View3D *UNUSED(v3d), RegionView3D *rv3d, smd->gpu_buffer = GPU_strands_buffer_create(converter); GPUDrawStrands *buffer = smd->gpu_buffer; - GPUStrandsShaderParams shader_params; - shader_params.fiber_primitive = fiber_primitive; - shader_params.effects = get_effects(smd->effects); - shader_params.use_geomshader = use_geomshader; - shader_params.shader_model = get_shader_model(smd->shader_model); - GPUStrandsShader *shader = GPU_strand_shader_get(strands, &shader_params); + if (!strands->gpu_shader) { + GPUStrandsShaderParams shader_params; + shader_params.fiber_primitive = fiber_primitive; + shader_params.effects = get_effects(smd->effects); + shader_params.use_geomshader = use_geomshader; + shader_params.shader_model = get_shader_model(smd->shader_model); + + strands->gpu_shader = GPU_strand_shader_create(&shader_params); + } + GPUStrandsShader *shader = strands->gpu_shader; if (show_controls) { GPU_strands_setup_edges(buffer, converter); |