/** * Helper function to set the shader which writes depth. */ static INLINE void set_depth_fragment_shader(struct blit_state *ctx, enum pipe_texture_target pipe_tex) { if (!ctx->fs_depth[pipe_tex]) { unsigned tgsi_tex = util_pipe_tex_to_tgsi_tex(pipe_tex, 0); ctx->fs_depth[pipe_tex] = util_make_fragment_tex_shader_writedepth(ctx->pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR); } cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth[pipe_tex]); }
static INLINE void *blitter_get_fs_texfetch_depth(struct blitter_context_priv *ctx, unsigned tex_target) { struct pipe_context *pipe = ctx->base.pipe; assert(tex_target < PIPE_MAX_TEXTURE_TYPES); /* Create the fragment shader on-demand. */ if (!ctx->fs_texfetch_depth[tex_target]) { unsigned tgsi_tex = pipe_tex_to_tgsi_tex(tex_target); ctx->fs_texfetch_depth[tex_target] = util_make_fragment_tex_shader_writedepth(pipe, tgsi_tex, TGSI_INTERPOLATE_LINEAR); } return ctx->fs_texfetch_depth[tex_target]; }
/** * Helper function to set the fragment shaders. */ static INLINE void set_fragment_shader(struct gen_mipmap_state *ctx, uint type, boolean output_depth) { if (output_depth) { if (!ctx->fs_depth[type]) ctx->fs_depth[type] = util_make_fragment_tex_shader_writedepth(ctx->pipe, type, TGSI_INTERPOLATE_LINEAR); cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth[type]); } else { if (!ctx->fs_color[type]) ctx->fs_color[type] = util_make_fragment_tex_shader(ctx->pipe, type, TGSI_INTERPOLATE_LINEAR); cso_set_fragment_shader_handle(ctx->cso, ctx->fs_color[type]); } }