diff options
Diffstat (limited to 'source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl index 63b57d5775c..0fcab6302e4 100644 --- a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl +++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl @@ -1,51 +1,54 @@ uniform vec2 invrendertargetdim; -//texture coordinates for framebuffer read -varying vec4 uvcoordsvar; +in vec2 pos; +in vec2 uvs; + +/* texture coordinates for framebuffer read */ +out vec4 uvcoordsvar; /* color texture coordinates, offset by a small amount */ -varying vec2 color_uv1; -varying vec2 color_uv2; +out vec2 color_uv1; +out vec2 color_uv2; -varying vec2 depth_uv1; -varying vec2 depth_uv2; -varying vec2 depth_uv3; -varying vec2 depth_uv4; +out vec2 depth_uv1; +out vec2 depth_uv2; +out vec2 depth_uv3; +out vec2 depth_uv4; //very simple shader for gull screen FX, just pass values on void vert_generic() { - uvcoordsvar = gl_MultiTexCoord0; - gl_Position = gl_Vertex; + uvcoordsvar = vec4(uvs, 0.0, 0.0); + gl_Position = vec4(pos, 0.0, 1.0); } void vert_dof_first_pass() { /* we offset the texture coordinates by 1.5 pixel, * then we reuse that to sample the surrounding pixels */ - color_uv1 = gl_MultiTexCoord0.xy + vec2(-1.5, -1.5) * invrendertargetdim; - color_uv2 = gl_MultiTexCoord0.xy + vec2(0.5, -1.5) * invrendertargetdim; + color_uv1 = uvs.xy + vec2(-1.5, -1.5) * invrendertargetdim; + color_uv2 = uvs.xy + vec2(0.5, -1.5) * invrendertargetdim; - depth_uv1 = gl_MultiTexCoord0.xy + vec2(-1.5, -1.5) * invrendertargetdim; - depth_uv2 = gl_MultiTexCoord0.xy + vec2(-0.5, -1.5) * invrendertargetdim; - depth_uv3 = gl_MultiTexCoord0.xy + vec2(0.5, -1.5) * invrendertargetdim; - depth_uv4 = gl_MultiTexCoord0.xy + vec2(1.5, -1.5) * invrendertargetdim; + depth_uv1 = uvs.xy + vec2(-1.5, -1.5) * invrendertargetdim; + depth_uv2 = uvs.xy + vec2(-0.5, -1.5) * invrendertargetdim; + depth_uv3 = uvs.xy + vec2(0.5, -1.5) * invrendertargetdim; + depth_uv4 = uvs.xy + vec2(1.5, -1.5) * invrendertargetdim; - gl_Position = gl_Vertex; + gl_Position = vec4(pos, 0.0, 1.0); } void vert_dof_fourth_pass() { vec4 halfpixel = vec4(-0.5, 0.5, -0.5, 0.5); - uvcoordsvar = gl_MultiTexCoord0.xxyy + + uvcoordsvar = uvs.xxyy + halfpixel * vec4(invrendertargetdim.x, invrendertargetdim.x, invrendertargetdim.y, invrendertargetdim.y); - gl_Position = gl_Vertex; + gl_Position = vec4(pos, 0.0, 1.0); } void vert_dof_fifth_pass() @@ -53,8 +56,8 @@ void vert_dof_fifth_pass() vec4 halfpixel = vec4(-0.5, 0.5, -0.5, 0.5); color_uv1 = vec2(0.5, 1.5) * invrendertargetdim; - uvcoordsvar = gl_MultiTexCoord0; - gl_Position = gl_Vertex; + uvcoordsvar = vec4(uvs, 0.0, 0.0); + gl_Position = vec4(pos, 0.0, 1.0); } void main() |