Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/gpu/shaders/gpu_shader_text_frag.glsl
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_text_frag.glsl')
-rw-r--r--source/blender/gpu/shaders/gpu_shader_text_frag.glsl110
1 files changed, 59 insertions, 51 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
index fbfa4cfcc9d..4a6ce4fd3ac 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
@@ -7,68 +7,76 @@ out vec4 fragColor;
uniform sampler2D glyph;
const vec2 offsets4[4] = vec2[4](
- vec2(-0.5, 0.5), vec2( 0.5, 0.5),
- vec2(-0.5, -0.5), vec2(-0.5, -0.5)
-);
+ vec2(-0.5, 0.5), vec2(0.5, 0.5), vec2(-0.5, -0.5), vec2(-0.5, -0.5));
-const vec2 offsets16[16] = vec2[16](
- vec2(-1.5, 1.5), vec2(-0.5, 1.5), vec2( 0.5, 1.5), vec2( 1.5, 1.5),
- vec2(-1.5, 0.5), vec2(-0.5, 0.5), vec2( 0.5, 0.5), vec2( 1.5, 0.5),
- vec2(-1.5, -0.5), vec2(-0.5, -0.5), vec2( 0.5, -0.5), vec2( 1.5, -0.5),
- vec2(-1.5, -1.5), vec2(-0.5, -1.5), vec2( 0.5, -1.5), vec2( 1.5, -1.5)
-);
+const vec2 offsets16[16] = vec2[16](vec2(-1.5, 1.5),
+ vec2(-0.5, 1.5),
+ vec2(0.5, 1.5),
+ vec2(1.5, 1.5),
+ vec2(-1.5, 0.5),
+ vec2(-0.5, 0.5),
+ vec2(0.5, 0.5),
+ vec2(1.5, 0.5),
+ vec2(-1.5, -0.5),
+ vec2(-0.5, -0.5),
+ vec2(0.5, -0.5),
+ vec2(1.5, -0.5),
+ vec2(-1.5, -1.5),
+ vec2(-0.5, -1.5),
+ vec2(0.5, -1.5),
+ vec2(1.5, -1.5));
#define sample_glyph_offset(texco, texel, ofs) texture(glyph, texco + ofs * texel).r
void main()
{
- // input color replaces texture color
- fragColor.rgb = color_flat.rgb;
+ // input color replaces texture color
+ fragColor.rgb = color_flat.rgb;
- vec2 texel = 1.0 / vec2(textureSize(glyph, 0));
- vec2 texco = mix(abs(texCoord_rect.xy), abs(texCoord_rect.zw), texCoord_interp);
+ vec2 texel = 1.0 / vec2(textureSize(glyph, 0));
+ vec2 texco = mix(abs(texCoord_rect.xy), abs(texCoord_rect.zw), texCoord_interp);
- // modulate input alpha & texture alpha
- if (texCoord_rect.x > 0) {
- fragColor.a = texture(glyph, texco).r;
- }
- else {
- fragColor.a = 0.0;
+ // modulate input alpha & texture alpha
+ if (texCoord_rect.x > 0) {
+ fragColor.a = texture(glyph, texco).r;
+ }
+ else {
+ fragColor.a = 0.0;
- if (texCoord_rect.w > 0) {
- /* 3x3 blur */
- /* Manual unroll for perf. (stupid glsl compiler) */
- fragColor.a += sample_glyph_offset(texco, texel, offsets4[0]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets4[1]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets4[2]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets4[3]);
- fragColor.a *= (1.0 / 4.0);
- }
- else {
- /* 5x5 blur */
- /* Manual unroll for perf. (stupid glsl compiler) */
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 0]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 1]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 2]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 3]);
+ if (texCoord_rect.w > 0) {
+ /* 3x3 blur */
+ /* Manual unroll for perf. (stupid glsl compiler) */
+ fragColor.a += sample_glyph_offset(texco, texel, offsets4[0]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets4[1]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets4[2]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets4[3]);
+ fragColor.a *= (1.0 / 4.0);
+ }
+ else {
+ /* 5x5 blur */
+ /* Manual unroll for perf. (stupid glsl compiler) */
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[0]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[1]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[2]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[3]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 4]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 5]) * 2.0;
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 6]) * 2.0;
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 7]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[4]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[5]) * 2.0;
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[6]) * 2.0;
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[7]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 8]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[ 9]) * 2.0;
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[10]) * 2.0;
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[11]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[8]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[9]) * 2.0;
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[10]) * 2.0;
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[11]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[12]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[13]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[14]);
- fragColor.a += sample_glyph_offset(texco, texel, offsets16[15]);
- fragColor.a *= (1.0 / 20.0);
- }
- }
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[12]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[13]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[14]);
+ fragColor.a += sample_glyph_offset(texco, texel, offsets16[15]);
+ fragColor.a *= (1.0 / 20.0);
+ }
+ }
- fragColor.a *= color_flat.a;
+ fragColor.a *= color_flat.a;
}