diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 14:46:37 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-01-26 14:46:37 +0300 |
commit | 5b299e5999e2b59e30edd4e770f64aa700e482d6 (patch) | |
tree | 17052358b339e20c44ca942e62b735ef63b23f88 /source/blender/draw/engines/workbench/shaders/workbench_matcap_lib.glsl | |
parent | 9bce134e56c28045aee37080f5c5b6622a07927b (diff) |
D13910: Workbench: Port shaders to use GPUShaderCreateInfo
Also adds a few things to GPUShader for easily create shaders.
Heavy usage of macros to compose the createInfo and avoid
duplications and copy paste bugs.
This makes the link between the shader request functions
(in workbench_shader.cc) and the actual createInfo a bit
obscure since the names are composed and not searchable.
Reviewed By: jbakker
Differential Revision: https://developer.blender.org/D13910
Diffstat (limited to 'source/blender/draw/engines/workbench/shaders/workbench_matcap_lib.glsl')
-rw-r--r-- | source/blender/draw/engines/workbench/shaders/workbench_matcap_lib.glsl | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/draw/engines/workbench/shaders/workbench_matcap_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_matcap_lib.glsl index 2d18cc1b014..a0cec54251d 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_matcap_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_matcap_lib.glsl @@ -1,6 +1,4 @@ -#pragma BLENDER_REQUIRE(workbench_data_lib.glsl) - vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) { /* Quick creation of an orthonormal basis */ @@ -15,16 +13,14 @@ vec2 matcap_uv_compute(vec3 I, vec3 N, bool flipped) return matcap_uv * 0.496 + 0.5; } -uniform sampler2D matcapDiffuseImage; -uniform sampler2D matcapSpecularImage; - -vec3 get_matcap_lighting(vec3 base_color, vec3 N, vec3 I) +vec3 get_matcap_lighting( + sampler2D diffuse_matcap, sampler2D specular_matcap, vec3 base_color, vec3 N, vec3 I) { bool flipped = world_data.matcap_orientation != 0; vec2 uv = matcap_uv_compute(I, N, flipped); - vec3 diffuse = textureLod(matcapDiffuseImage, uv, 0.0).rgb; - vec3 specular = textureLod(matcapSpecularImage, uv, 0.0).rgb; + vec3 diffuse = textureLod(diffuse_matcap, uv, 0.0).rgb; + vec3 specular = textureLod(specular_matcap, uv, 0.0).rgb; return diffuse * base_color + specular * float(world_data.use_specular); } |