r600_blit.c revision 7d0418d3dc5b44ce8171cc74359306ce22234b17
1/* 2 * Copyright 2009 Marek Olšák <maraeo@gmail.com> 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * on the rights to use, copy, modify, merge, publish, distribute, sub 8 * license, and/or sell copies of the Software, and to permit persons to whom 9 * the Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice (including the next 12 * paragraph) shall be included in all copies or substantial portions of the 13 * Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21 * USE OR OTHER DEALINGS IN THE SOFTWARE. 22 * 23 * Authors: 24 * Jerome Glisse 25 * Marek Olšák 26 */ 27#include <pipe/p_screen.h> 28#include <util/u_blitter.h> 29#include <util/u_inlines.h> 30#include <util/u_memory.h> 31#include "r600_screen.h" 32#include "r600_context.h" 33 34static void r600_blitter_save_states(struct r600_context *rctx) 35{ 36 util_blitter_save_blend(rctx->blitter, 37 rctx->draw->state[R600_BLEND]); 38 util_blitter_save_depth_stencil_alpha(rctx->blitter, 39 rctx->draw->state[R600_DSA]); 40 util_blitter_save_stencil_ref(rctx->blitter, &rctx->stencil_ref); 41 util_blitter_save_rasterizer(rctx->blitter, 42 rctx->draw->state[R600_RASTERIZER]); 43 util_blitter_save_fragment_shader(rctx->blitter, 44 rctx->ps_shader); 45 util_blitter_save_vertex_shader(rctx->blitter, 46 rctx->vs_shader); 47 util_blitter_save_vertex_elements(rctx->blitter, 48 rctx->vertex_elements); 49 util_blitter_save_viewport(rctx->blitter, 50 &rctx->viewport); 51} 52 53static void r600_clear(struct pipe_context *ctx, unsigned buffers, 54 const float *rgba, double depth, unsigned stencil) 55{ 56 struct r600_context *rctx = r600_context(ctx); 57 struct pipe_framebuffer_state *fb = &rctx->fb_state; 58 59 r600_blitter_save_states(rctx); 60 util_blitter_clear(rctx->blitter, fb->width, fb->height, 61 fb->nr_cbufs, buffers, rgba, depth, 62 stencil); 63} 64 65static void r600_clear_render_target(struct pipe_context *pipe, 66 struct pipe_surface *dst, 67 const float *rgba, 68 unsigned dstx, unsigned dsty, 69 unsigned width, unsigned height) 70{ 71} 72 73static void r600_clear_depth_stencil(struct pipe_context *pipe, 74 struct pipe_surface *dst, 75 unsigned clear_flags, 76 double depth, 77 unsigned stencil, 78 unsigned dstx, unsigned dsty, 79 unsigned width, unsigned height) 80{ 81} 82 83static void r600_resource_copy_region(struct pipe_context *pipe, 84 struct pipe_resource *dst, 85 struct pipe_subresource subdst, 86 unsigned dstx, unsigned dsty, unsigned dstz, 87 struct pipe_resource *src, 88 struct pipe_subresource subsrc, 89 unsigned srcx, unsigned srcy, unsigned srcz, 90 unsigned width, unsigned height) 91{ 92} 93 94void r600_init_blit_functions(struct r600_context *rctx) 95{ 96 rctx->context.clear = r600_clear; 97 rctx->context.clear_render_target = r600_clear_render_target; 98 rctx->context.clear_depth_stencil = r600_clear_depth_stencil; 99 rctx->context.resource_copy_region = r600_resource_copy_region; 100} 101