diff options
author | Mike Erwin <significant.bit@gmail.com> | 2015-11-23 08:08:09 +0300 |
---|---|---|
committer | Mike Erwin <significant.bit@gmail.com> | 2015-11-23 08:08:09 +0300 |
commit | 076e2ff2aabd3374a6cb29ed543b28d1e9d0525d (patch) | |
tree | 7aaa54b17f9ee56c1fffee06d11ca7dc496f5c62 /source/blender/gpu | |
parent | 05ffe2d174115b9f9fc2322dbafcfb4543d3809d (diff) |
OpenGL: update geometry shaders, fixes T46838
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl | 30 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_geometry.glsl | 10 |
2 files changed, 28 insertions, 12 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl index 7918122a681..25ba91f772d 100644 --- a/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl +++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_geo.glsl @@ -5,23 +5,33 @@ uniform vec2 layerselection; uniform sampler2D cocbuffer; +#if __VERSION__ >= 150 + layout(points) in; + layout(triangle_strip, max_vertices = 4) out; + + #define POS gl_in[0].gl_Position +#else + /* use the EXT_geometry_shader4 way */ + #define POS gl_PositionIn[0] +#endif + /* initial uv coordinate */ -varying in vec2 uvcoord[1]; -varying out vec2 particlecoord; -varying out vec4 color; +in vec2 uvcoord[1]; +out vec2 particlecoord; +out vec4 color; #define M_PI 3.1415926535897932384626433832795 -void main(void) +void main() { - vec4 coc = texture2DLod(cocbuffer, uvcoord[0], 0.0); + vec4 coc = textureLod(cocbuffer, uvcoord[0], 0.0); float offset_val = dot(coc.rg, layerselection); if (offset_val < 1.0) return; - vec4 colortex = texture2DLod(colorbuffer, uvcoord[0], 0.0); + vec4 colortex = textureLod(colorbuffer, uvcoord[0], 0.0); /* find the area the pixel will cover and divide the color by it */ float alpha = 1.0 / (offset_val * offset_val * M_PI); @@ -30,19 +40,19 @@ void main(void) vec2 offset_far = vec2(offset_val * 0.5) / vec2(rendertargetdim.x, rendertargetdim.y); - gl_Position = gl_PositionIn[0] + vec4(-offset_far.x, -offset_far.y, 0.0, 0.0); + gl_Position = POS + vec4(-offset_far.x, -offset_far.y, 0.0, 0.0); color = colortex; particlecoord = vec2(-1.0, -1.0); EmitVertex(); - gl_Position = gl_PositionIn[0] + vec4(-offset_far.x, offset_far.y, 0.0, 0.0); + gl_Position = POS + vec4(-offset_far.x, offset_far.y, 0.0, 0.0); particlecoord = vec2(-1.0, 1.0); color = colortex; EmitVertex(); - gl_Position = gl_PositionIn[0] + vec4(offset_far.x, -offset_far.y, 0.0, 0.0); + gl_Position = POS + vec4(offset_far.x, -offset_far.y, 0.0, 0.0); particlecoord = vec2(1.0, -1.0); color = colortex; EmitVertex(); - gl_Position = gl_PositionIn[0] + vec4(offset_far.x, offset_far.y, 0.0, 0.0); + gl_Position = POS + vec4(offset_far.x, offset_far.y, 0.0, 0.0); particlecoord = vec2(1.0, 1.0); color = colortex; EmitVertex(); diff --git a/source/blender/gpu/shaders/gpu_shader_geometry.glsl b/source/blender/gpu/shaders/gpu_shader_geometry.glsl index a0ae96a1f72..2e4d8f9e8a8 100644 --- a/source/blender/gpu/shaders/gpu_shader_geometry.glsl +++ b/source/blender/gpu/shaders/gpu_shader_geometry.glsl @@ -1,13 +1,19 @@ uniform int PrimitiveIdBase; uniform int osd_active_uv_offset; -varying vec3 varnormal; -varying vec3 varposition; +#if __VERSION__ >= 150 + layout(lines_adjacency) in; + layout(triangle_strip, max_vertices = 4) out; +#endif in block { VertexData v; } inpt[4]; +/* compatibility */ +out vec3 varnormal; +out vec3 varposition; + uniform bool osd_flat_shading; uniform int osd_fvar_count; |