diff options
Diffstat (limited to 'source/blender/draw/intern/shaders')
3 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/draw/intern/shaders/common_globals_lib.glsl b/source/blender/draw/intern/shaders/common_globals_lib.glsl index 6a3bf150095..cfadb87819c 100644 --- a/source/blender/draw/intern/shaders/common_globals_lib.glsl +++ b/source/blender/draw/intern/shaders/common_globals_lib.glsl @@ -32,6 +32,8 @@ layout(std140) uniform globalsBlock vec4 colorFace; vec4 colorFaceSelect; vec4 colorFaceFreestyle; + vec4 colorGpencilVertex; + vec4 colorGpencilVertexSelect; vec4 colorNormal; vec4 colorVNormal; vec4 colorLNormal; diff --git a/source/blender/draw/intern/shaders/common_smaa_lib.glsl b/source/blender/draw/intern/shaders/common_smaa_lib.glsl index 09b573d4bb5..45d9f54d943 100644 --- a/source/blender/draw/intern/shaders/common_smaa_lib.glsl +++ b/source/blender/draw/intern/shaders/common_smaa_lib.glsl @@ -692,6 +692,10 @@ void SMAANeighborhoodBlendingVS(float2 texcoord, out float4 offset) //----------------------------------------------------------------------------- // Edge Detection Pixel Shaders (First Pass) +# ifndef SMAA_LUMA_WEIGHT +# define SMAA_LUMA_WEIGHT float4(0.2126, 0.7152, 0.0722, 0.0) +# endif + /** * Luma Edge Detection * @@ -716,7 +720,8 @@ float2 SMAALumaEdgeDetectionPS(float2 texcoord, # endif // Calculate lumas: - float4 weights = float4(0.2126 * 0.5, 0.7152 * 0.5, 0.0722 * 0.5, 0.5); + // float4 weights = float4(0.2126, 0.7152, 0.0722, 0.0); + float4 weights = SMAA_LUMA_WEIGHT; float L = dot(SMAASamplePoint(colorTex, texcoord).rgba, weights); float Lleft = dot(SMAASamplePoint(colorTex, offset[0].xy).rgba, weights); @@ -727,9 +732,11 @@ float2 SMAALumaEdgeDetectionPS(float2 texcoord, delta.xy = abs(L - float2(Lleft, Ltop)); float2 edges = step(threshold, delta.xy); +# ifndef SMAA_NO_DISCARD // Then discard if there is no edge: if (dot(edges, float2(1.0, 1.0)) == 0.0) discard; +# endif // Calculate right and bottom deltas: float Lright = dot(SMAASamplePoint(colorTex, offset[1].xy).rgba, weights); @@ -793,9 +800,11 @@ float2 SMAAColorEdgeDetectionPS(float2 texcoord, // We do the usual threshold: float2 edges = step(threshold, delta.xy); +# ifndef SMAA_NO_DISCARD // Then discard if there is no edge: if (dot(edges, float2(1.0, 1.0)) == 0.0) discard; +# endif // Calculate right and bottom deltas: float3 Cright = SMAASamplePoint(colorTex, offset[1].xy).rgb; diff --git a/source/blender/draw/intern/shaders/common_view_lib.glsl b/source/blender/draw/intern/shaders/common_view_lib.glsl index 6605e1165d4..3faefd485bf 100644 --- a/source/blender/draw/intern/shaders/common_view_lib.glsl +++ b/source/blender/draw/intern/shaders/common_view_lib.glsl @@ -60,11 +60,11 @@ vec4 pack_line_data(vec2 frag_co, vec2 edge_start, vec2 edge_pos) vec2 perp = vec2(-edge.y, edge.x); float dist = dot(perp, frag_co - edge_start); /* Add 0.1 to diffenrentiate with cleared pixels. */ - return vec4(perp * 0.5 + 0.5, dist * 0.25 + 0.5 + 0.1, 0.0); + return vec4(perp * 0.5 + 0.5, dist * 0.25 + 0.5 + 0.1, 1.0); } else { /* Default line if the origin is perfectly aligned with a pixel. */ - return vec4(1.0, 0.0, 0.5 + 0.1, 0.0); + return vec4(1.0, 0.0, 0.5 + 0.1, 1.0); } } @@ -89,7 +89,14 @@ uniform int baseInstance; # define instanceId gl_InstanceID # endif -# define resource_id (baseInstance + instanceId) +# ifdef UNIFORM_RESOURCE_ID +/* This is in the case we want to do a special instance drawcall but still want to have the + * right resourceId and all the correct ubo datas. */ +uniform int resourceId; +# define resource_id resourceId +# else +# define resource_id (baseInstance + instanceId) +# endif /* Use this to declare and pass the value if * the fragment shader uses the resource_id. */ |