Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/intern/gpu_framebuffer.c
| Show First 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | for (int j = 1; j < 4; ++j) { | ||||
| VertexBuffer_set_attrib(&vbo, pos, i++, fullscreencos[j]); | VertexBuffer_set_attrib(&vbo, pos, i++, fullscreencos[j]); | ||||
| } | } | ||||
| Batch_init(&batch, GL_TRIANGLES, &vbo, NULL); | Batch_init(&batch, GL_TRIANGLES, &vbo, NULL); | ||||
| } | } | ||||
| glDisable(GL_DEPTH_TEST); | glDisable(GL_DEPTH_TEST); | ||||
| /* Load fresh matrices */ | |||||
| gpuMatrixBegin3D(); /* TODO: finish 2D API */ | |||||
| /* Blurring horizontally */ | /* Blurring horizontally */ | ||||
| /* We do the bind ourselves rather than using GPU_framebuffer_texture_bind() to avoid | /* We do the bind ourselves rather than using GPU_framebuffer_texture_bind() to avoid | ||||
| * pushing unnecessary matrices onto the OpenGL stack. */ | * pushing unnecessary matrices onto the OpenGL stack. */ | ||||
| glBindFramebuffer(GL_FRAMEBUFFER, blurfb->object); | glBindFramebuffer(GL_FRAMEBUFFER, blurfb->object); | ||||
| glDrawBuffer(GL_COLOR_ATTACHMENT0); | glDrawBuffer(GL_COLOR_ATTACHMENT0); | ||||
| /* avoid warnings from texture binding */ | /* avoid warnings from texture binding */ | ||||
| GG.currentfb = blurfb->object; | GG.currentfb = blurfb->object; | ||||
| Show All 17 Lines | void GPU_framebuffer_blur( | ||||
| GPU_texture_bind(blurtex, 0); | GPU_texture_bind(blurtex, 0); | ||||
| /* Hack to make the following uniform stick */ | /* Hack to make the following uniform stick */ | ||||
| Batch_set_builtin_program(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR); | Batch_set_builtin_program(&batch, GPU_SHADER_SEP_GAUSSIAN_BLUR); | ||||
| Batch_Uniform2f(&batch, "ScaleU", scalev[0], scalev[1]); | Batch_Uniform2f(&batch, "ScaleU", scalev[0], scalev[1]); | ||||
| Batch_Uniform1i(&batch, "textureSource", GL_TEXTURE0); | Batch_Uniform1i(&batch, "textureSource", GL_TEXTURE0); | ||||
| Batch_draw(&batch); | Batch_draw(&batch); | ||||
| gpuMatrixEnd(); | |||||
| } | } | ||||
| void GPU_framebuffer_blit(GPUFrameBuffer *fb_read, int read_slot, GPUFrameBuffer *fb_write, int write_slot, bool use_depth) | void GPU_framebuffer_blit(GPUFrameBuffer *fb_read, int read_slot, GPUFrameBuffer *fb_write, int write_slot, bool use_depth) | ||||
| { | { | ||||
| GPUTexture *read_tex = (use_depth) ? fb_read->depthtex : fb_read->colortex[read_slot]; | GPUTexture *read_tex = (use_depth) ? fb_read->depthtex : fb_read->colortex[read_slot]; | ||||
| GPUTexture *write_tex = (use_depth) ? fb_write->depthtex : fb_write->colortex[write_slot]; | GPUTexture *write_tex = (use_depth) ? fb_write->depthtex : fb_write->colortex[write_slot]; | ||||
| int read_attach = (use_depth) ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0 + GPU_texture_framebuffer_attachment(read_tex); | int read_attach = (use_depth) ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0 + GPU_texture_framebuffer_attachment(read_tex); | ||||
| int write_attach = (use_depth) ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0 + GPU_texture_framebuffer_attachment(write_tex); | int write_attach = (use_depth) ? GL_DEPTH_ATTACHMENT : GL_COLOR_ATTACHMENT0 + GPU_texture_framebuffer_attachment(write_tex); | ||||
| ▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines | |||||