diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2017-10-08 16:49:25 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2017-10-08 16:49:25 +0300 |
commit | f7db1a4366e8391aea87cc39a5e7bfd6141dd283 (patch) | |
tree | 12e7f4c46e06ca0ea56ee9aeb4bf272c9d413d9e /source/blender/draw | |
parent | adfbf276a15346c38cc6b7652191c005b9a3ae9b (diff) |
Gawain: Make common uniforms become builtins
This improves eevee's cache performance by 13% in my test.
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 1c83b813355..38a767b7e34 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -641,23 +641,23 @@ static DRWInterface *DRW_interface_create(GPUShader *shader) { DRWInterface *interface = MEM_mallocN(sizeof(DRWInterface), "DRWInterface"); - interface->model = GPU_shader_get_uniform(shader, "ModelMatrix"); - interface->modelinverse = GPU_shader_get_uniform(shader, "ModelMatrixInverse"); - interface->modelview = GPU_shader_get_uniform(shader, "ModelViewMatrix"); - interface->modelviewinverse = GPU_shader_get_uniform(shader, "ModelViewMatrixInverse"); - interface->projection = GPU_shader_get_uniform(shader, "ProjectionMatrix"); - interface->projectioninverse = GPU_shader_get_uniform(shader, "ProjectionMatrixInverse"); - interface->view = GPU_shader_get_uniform(shader, "ViewMatrix"); - interface->viewinverse = GPU_shader_get_uniform(shader, "ViewMatrixInverse"); - interface->viewprojection = GPU_shader_get_uniform(shader, "ViewProjectionMatrix"); - interface->viewprojectioninverse = GPU_shader_get_uniform(shader, "ViewProjectionMatrixInverse"); - interface->modelviewprojection = GPU_shader_get_uniform(shader, "ModelViewProjectionMatrix"); - interface->normal = GPU_shader_get_uniform(shader, "NormalMatrix"); - interface->worldnormal = GPU_shader_get_uniform(shader, "WorldNormalMatrix"); - interface->camtexfac = GPU_shader_get_uniform(shader, "CameraTexCoFactors"); - interface->orcotexfac = GPU_shader_get_uniform(shader, "OrcoTexCoFactors[0]"); - interface->eye = GPU_shader_get_uniform(shader, "eye"); - interface->clipplanes = GPU_shader_get_uniform(shader, "ClipPlanes[0]"); + interface->model = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_MODEL); + interface->modelinverse = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_MODEL_INV); + interface->modelview = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_MODELVIEW); + interface->modelviewinverse = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_MODELVIEW_INV); + interface->projection = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_PROJECTION); + interface->projectioninverse = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_PROJECTION_INV); + interface->view = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_VIEW); + interface->viewinverse = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_VIEW_INV); + interface->viewprojection = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_VIEWPROJECTION); + interface->viewprojectioninverse = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_VIEWPROJECTION_INV); + interface->modelviewprojection = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_MVP); + interface->normal = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_NORMAL); + interface->worldnormal = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_WORLDNORMAL); + interface->camtexfac = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_CAMERATEXCO); + interface->orcotexfac = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_ORCO); + interface->clipplanes = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_CLIPPLANES); + interface->eye = GPU_shader_get_builtin_uniform(shader, GWN_UNIFORM_EYE); interface->instance_count = 0; interface->attribs_count = 0; interface->attribs_stride = 0; |