Lines Matching refs:blit_ctx
228 static GLuint blit_build_frag_tex_col(struct vrend_blitter_ctx *blit_ctx, in blit_build_frag_tex_col() argument
241 if (msaa && !blit_ctx->use_gles) in blit_build_frag_tex_col()
247 if (blit_ctx->use_gles) in blit_build_frag_tex_col()
257 snprintf(shader_buf, 4096, blit_ctx->use_gles ? in blit_build_frag_tex_col()
263 vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), in blit_build_frag_tex_col()
266 snprintf(shader_buf, 4096, blit_ctx->use_gles ? in blit_build_frag_tex_col()
272 vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), in blit_build_frag_tex_col()
281 static GLuint blit_build_frag_depth(struct vrend_blitter_ctx *blit_ctx, int tgsi_tex_target, bool m… in blit_build_frag_depth() argument
293 snprintf(shader_buf, 4096, blit_ctx->use_gles ? in blit_build_frag_depth()
296 … vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), retval.ivec, retval.twm); in blit_build_frag_depth()
298 snprintf(shader_buf, 4096, blit_ctx->use_gles ? FS_TEXFETCH_DS_GLES : FS_TEXFETCH_DS_GL, in blit_build_frag_depth()
299 vrend_shader_samplertypeconv(blit_ctx->use_gles, tgsi_tex_target), retval.twm); in blit_build_frag_depth()
304 static GLuint blit_get_frag_tex_writedepth(struct vrend_blitter_ctx *blit_ctx, int pipe_tex_target,… in blit_get_frag_tex_writedepth() argument
308 GLuint *shader = nr_samples > 0 ? &blit_ctx->fs_texfetch_depth_msaa[pipe_tex_target] in blit_get_frag_tex_writedepth()
309 : &blit_ctx->fs_texfetch_depth[pipe_tex_target]; in blit_get_frag_tex_writedepth()
313 *shader = blit_build_frag_depth(blit_ctx, tgsi_tex, nr_samples > 0); in blit_get_frag_tex_writedepth()
318 static GLuint blit_get_frag_tex_col(struct vrend_blitter_ctx *blit_ctx, in blit_get_frag_tex_col() argument
332 shader = &blit_ctx->fs_texfetch_col_swizzle; in blit_get_frag_tex_col()
333 if (*shader && (blit_ctx->fs_texfetch_col_swizzle_has_swizzle != needs_swizzle in blit_get_frag_tex_col()
334 || blit_ctx->fs_texfetch_col_swizzle_nr_samples != nr_samples)) { in blit_get_frag_tex_col()
338 blit_ctx->fs_texfetch_col_swizzle_has_swizzle = needs_swizzle; in blit_get_frag_tex_col()
339 blit_ctx->fs_texfetch_col_swizzle_nr_samples = nr_samples; in blit_get_frag_tex_col()
341 shader = &blit_ctx->fs_texfetch_col[pipe_tex_target]; in blit_get_frag_tex_col()
354 *shader = blit_build_frag_tex_col(blit_ctx, tgsi_tex, tgsi_ret, in blit_get_frag_tex_col()
360 static void vrend_renderer_init_blit_ctx(struct vrend_blitter_ctx *blit_ctx) in vrend_renderer_init_blit_ctx() argument
364 if (blit_ctx->initialised) { in vrend_renderer_init_blit_ctx()
365 vrend_sync_make_current(blit_ctx->gl_context); in vrend_renderer_init_blit_ctx()
369 blit_ctx->initialised = true; in vrend_renderer_init_blit_ctx()
370 blit_ctx->use_gles = epoxy_is_desktop_gl() == 0; in vrend_renderer_init_blit_ctx()
376 blit_ctx->gl_context = vrend_clicbs->create_gl_context(0, &ctx_params); in vrend_renderer_init_blit_ctx()
377 if (blit_ctx->gl_context) in vrend_renderer_init_blit_ctx()
381 vrend_sync_make_current(blit_ctx->gl_context); in vrend_renderer_init_blit_ctx()
382 glGenVertexArrays(1, &blit_ctx->vaoid); in vrend_renderer_init_blit_ctx()
383 glGenFramebuffers(1, &blit_ctx->fb_id); in vrend_renderer_init_blit_ctx()
385 glGenBuffers(1, &blit_ctx->vbo_id); in vrend_renderer_init_blit_ctx()
386 blit_ctx->vs = build_and_check(GL_VERTEX_SHADER, in vrend_renderer_init_blit_ctx()
387 blit_ctx->use_gles ? VS_PASSTHROUGH_GLES : VS_PASSTHROUGH_GL); in vrend_renderer_init_blit_ctx()
390 blit_ctx->vertices[i][0][3] = 1; /*v.w*/ in vrend_renderer_init_blit_ctx()
391 glBindVertexArray(blit_ctx->vaoid); in vrend_renderer_init_blit_ctx()
392 glBindBuffer(GL_ARRAY_BUFFER, blit_ctx->vbo_id); in vrend_renderer_init_blit_ctx()
394 if (!blit_ctx->use_gles) in vrend_renderer_init_blit_ctx()
398 static void blitter_set_rectangle(struct vrend_blitter_ctx *blit_ctx, in blitter_set_rectangle() argument
405 blit_ctx->vertices[0][0][0] = (float)x1 / blit_ctx->dst_width * 2.0f - 1.0f; /*v0.x*/ in blitter_set_rectangle()
406 blit_ctx->vertices[0][0][1] = (float)y1 / blit_ctx->dst_height * 2.0f - 1.0f; /*v0.y*/ in blitter_set_rectangle()
408 blit_ctx->vertices[1][0][0] = (float)x2 / blit_ctx->dst_width * 2.0f - 1.0f; /*v1.x*/ in blitter_set_rectangle()
409 blit_ctx->vertices[1][0][1] = (float)y1 / blit_ctx->dst_height * 2.0f - 1.0f; /*v1.y*/ in blitter_set_rectangle()
411 blit_ctx->vertices[2][0][0] = (float)x2 / blit_ctx->dst_width * 2.0f - 1.0f; /*v2.x*/ in blitter_set_rectangle()
412 blit_ctx->vertices[2][0][1] = (float)y2 / blit_ctx->dst_height * 2.0f - 1.0f; /*v2.y*/ in blitter_set_rectangle()
414 blit_ctx->vertices[3][0][0] = (float)x1 / blit_ctx->dst_width * 2.0f - 1.0f; /*v3.x*/ in blitter_set_rectangle()
415 blit_ctx->vertices[3][0][1] = (float)y2 / blit_ctx->dst_height * 2.0f - 1.0f; /*v3.y*/ in blitter_set_rectangle()
418 blit_ctx->vertices[i][0][2] = depth; /*z*/ in blitter_set_rectangle()
420 glViewport(0, 0, blit_ctx->dst_width, blit_ctx->dst_height); in blitter_set_rectangle()
423 static void get_texcoords(struct vrend_blitter_ctx *blit_ctx, in get_texcoords() argument
429 bool normalized = (src_res->base.target != PIPE_TEXTURE_RECT || blit_ctx->use_gles) && in get_texcoords()
461 static void blitter_set_texcoords(struct vrend_blitter_ctx *blit_ctx, in blitter_set_texcoords() argument
470 get_texcoords(blit_ctx, src_res, level, x1, y1, x2, y2, coord); in blitter_set_texcoords()
478 &blit_ctx->vertices[0][1][0], 8, in blitter_set_texcoords()
481 set_texcoords_in_vertices(coord, &blit_ctx->vertices[0][1][0], 8); in blitter_set_texcoords()
490 blit_ctx->vertices[i][1][2] = r; /*r*/ in blitter_set_texcoords()
496 blit_ctx->vertices[i][1][1] = (float) layer; /*t*/ in blitter_set_texcoords()
501 blit_ctx->vertices[i][1][2] = (float) layer; /*r*/ in blitter_set_texcoords()
502 blit_ctx->vertices[i][1][3] = (float) sample; /*q*/ in blitter_set_texcoords()
507 blit_ctx->vertices[i][1][3] = (float) ((unsigned)layer / 6); /*w*/ in blitter_set_texcoords()
511 blit_ctx->vertices[i][1][3] = (float) sample; /*r*/ in blitter_set_texcoords()
606 static void blitter_set_points(struct vrend_blitter_ctx *blit_ctx, in blitter_set_points() argument
616 blit_ctx->dst_width = u_minify(dst_res->base.width0, info->dst.level); in blitter_set_points()
617 blit_ctx->dst_height = u_minify(dst_res->base.height0, info->dst.level); in blitter_set_points()
637 blitter_set_rectangle(blit_ctx, dst0.x, dst0.y, dst1.x, dst1.y, 0); in blitter_set_points()
704 struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx; in vrend_renderer_blit_gl() local
728 vrend_renderer_init_blit_ctx(blit_ctx); in vrend_renderer_blit_gl()
729 blitter_set_points(blit_ctx, info, src_res, dst_res, &src0, &src1); in vrend_renderer_blit_gl()
732 glAttachShader(prog_id, blit_ctx->vs); in vrend_renderer_blit_gl()
735 fs_id = blit_get_frag_tex_writedepth(blit_ctx, src_res->base.target, in vrend_renderer_blit_gl()
738 fs_id = blit_get_frag_tex_col(blit_ctx, src_res->base.target, in vrend_renderer_blit_gl()
750 glBindFramebuffer(GL_FRAMEBUFFER, blit_ctx->fb_id); in vrend_renderer_blit_gl()
785 glBindFramebuffer(GL_FRAMEBUFFER, blit_ctx->fb_id); in vrend_renderer_blit_gl()
790 blitter_set_texcoords(blit_ctx, src_res, info->src.level, in vrend_renderer_blit_gl()
794 glBufferData(GL_ARRAY_BUFFER, sizeof(blit_ctx->vertices), blit_ctx->vertices, GL_STATIC_DRAW); in vrend_renderer_blit_gl()