summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/fx_renderer/gles2/shaders/quad_grad.frag9
-rw-r--r--render/fx_renderer/gles2/shaders/quad_grad_round.frag13
-rw-r--r--render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag9
-rw-r--r--render/fx_renderer/shaders.c6
4 files changed, 29 insertions, 8 deletions
diff --git a/render/fx_renderer/gles2/shaders/quad_grad.frag b/render/fx_renderer/gles2/shaders/quad_grad.frag
index d259942..a73975b 100644
--- a/render/fx_renderer/gles2/shaders/quad_grad.frag
+++ b/render/fx_renderer/gles2/shaders/quad_grad.frag
@@ -39,12 +39,17 @@ vec4 gradient(){
step = uv.x;
}
+ if(!blend){
+ float smooth = 1.0/float(count);
+ int ind = int(step/smooth);
+
+ return colors[ind];
+ }
+
float smooth = 1.0/float(count - 1);
int ind = int(step/smooth);
float at = float(ind)*smooth;
- if(!blend) return colors[ind];
-
vec4 color = colors[ind];
if(ind > 0) color = mix(colors[ind - 1], color, smoothstep(at - smooth, at, step));
if(ind <= count - 1) color = mix(color, colors[ind + 1], smoothstep(at, at + smooth, step));
diff --git a/render/fx_renderer/gles2/shaders/quad_grad_round.frag b/render/fx_renderer/gles2/shaders/quad_grad_round.frag
index 58cdb53..66a54a6 100644
--- a/render/fx_renderer/gles2/shaders/quad_grad_round.frag
+++ b/render/fx_renderer/gles2/shaders/quad_grad_round.frag
@@ -28,7 +28,7 @@ uniform int count;
vec4 gradient(){
float step;
- vec2 normal = (gl_FragCoord.xy - grad_box)/grad_size;
+ vec2 normal = (gl_FragCoord.xy - grad_box)/size;
vec2 uv = normal - origin;
float rad = radians(degree);
@@ -48,13 +48,18 @@ vec4 gradient(){
step = uv.x;
}
+ if(!blend){
+ float smooth = 1.0/float(count);
+ int ind = int(step/smooth);
+
+ return colors[ind];
+ }
+
float smooth = 1.0/float(count - 1);
int ind = int(step/smooth);
float at = float(ind)*smooth;
- if(!blend) return colors[ind];
-
- vec4 color = colors[ind];
+ vec4 color = colors[ind];
if(ind > 0) color = mix(colors[ind - 1], color, smoothstep(at - smooth, at, step));
if(ind <= count - 1) color = mix(color, colors[ind + 1], smoothstep(at, at + smooth, step));
diff --git a/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag b/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag
index ef36f06..85a6f79 100644
--- a/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag
+++ b/render/fx_renderer/gles2/shaders/rounded_grad_border_corner.frag
@@ -44,12 +44,17 @@ vec4 gradient(){
step = uv.x;
}
+ if(!blend){
+ float smooth = 1.0/float(count);
+ int ind = int(step/smooth);
+
+ return colors[ind];
+ }
+
float smooth = 1.0/float(count - 1);
int ind = int(step/smooth);
float at = float(ind)*smooth;
- if(!blend) return colors[ind];
-
vec4 color = colors[ind];
if(ind > 0) color = mix(colors[ind - 1], color, smoothstep(at - smooth, at, step));
if(ind <= count - 1) color = mix(color, colors[ind + 1], smoothstep(at, at + smooth, step));
diff --git a/render/fx_renderer/shaders.c b/render/fx_renderer/shaders.c
index 0e2c43b..21cd522 100644
--- a/render/fx_renderer/shaders.c
+++ b/render/fx_renderer/shaders.c
@@ -29,6 +29,12 @@ GLuint compile_shader(GLuint type, const GLchar *src) {
glGetShaderiv(shader, GL_COMPILE_STATUS, &ok);
if (ok == GL_FALSE) {
wlr_log(WLR_ERROR, "Failed to compile shader");
+ GLint maxLength = 0;
+ glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);
+
+ char a[maxLength];
+ glGetShaderInfoLog(shader, maxLength, &maxLength, a);
+ printf("%s\n", a);
glDeleteShader(shader);
shader = 0;
}