14b87d37e90b6d2d9562a192540833b599bda5a35Brian/**************************************************************************
24b87d37e90b6d2d9562a192540833b599bda5a35Brian *
34b87d37e90b6d2d9562a192540833b599bda5a35Brian * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
44b87d37e90b6d2d9562a192540833b599bda5a35Brian * All Rights Reserved.
54b87d37e90b6d2d9562a192540833b599bda5a35Brian *
64b87d37e90b6d2d9562a192540833b599bda5a35Brian * Permission is hereby granted, free of charge, to any person obtaining a
74b87d37e90b6d2d9562a192540833b599bda5a35Brian * copy of this software and associated documentation files (the
84b87d37e90b6d2d9562a192540833b599bda5a35Brian * "Software"), to deal in the Software without restriction, including
94b87d37e90b6d2d9562a192540833b599bda5a35Brian * without limitation the rights to use, copy, modify, merge, publish,
104b87d37e90b6d2d9562a192540833b599bda5a35Brian * distribute, sub license, and/or sell copies of the Software, and to
114b87d37e90b6d2d9562a192540833b599bda5a35Brian * permit persons to whom the Software is furnished to do so, subject to
124b87d37e90b6d2d9562a192540833b599bda5a35Brian * the following conditions:
134b87d37e90b6d2d9562a192540833b599bda5a35Brian *
144b87d37e90b6d2d9562a192540833b599bda5a35Brian * The above copyright notice and this permission notice (including the
154b87d37e90b6d2d9562a192540833b599bda5a35Brian * next paragraph) shall be included in all copies or substantial portions
164b87d37e90b6d2d9562a192540833b599bda5a35Brian * of the Software.
174b87d37e90b6d2d9562a192540833b599bda5a35Brian *
184b87d37e90b6d2d9562a192540833b599bda5a35Brian * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
194b87d37e90b6d2d9562a192540833b599bda5a35Brian * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
204b87d37e90b6d2d9562a192540833b599bda5a35Brian * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
214b87d37e90b6d2d9562a192540833b599bda5a35Brian * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
224b87d37e90b6d2d9562a192540833b599bda5a35Brian * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
234b87d37e90b6d2d9562a192540833b599bda5a35Brian * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
244b87d37e90b6d2d9562a192540833b599bda5a35Brian * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
254b87d37e90b6d2d9562a192540833b599bda5a35Brian *
264b87d37e90b6d2d9562a192540833b599bda5a35Brian **************************************************************************/
274b87d37e90b6d2d9562a192540833b599bda5a35Brian
284b87d37e90b6d2d9562a192540833b599bda5a35Brian
294b87d37e90b6d2d9562a192540833b599bda5a35Brian#ifndef ST_CB_FBO_H
304b87d37e90b6d2d9562a192540833b599bda5a35Brian#define ST_CB_FBO_H
314b87d37e90b6d2d9562a192540833b599bda5a35Brian
322e85117b5f8909b8737e0c0e479360640e405192Vinson Lee#include "main/compiler.h"
332e85117b5f8909b8737e0c0e479360640e405192Vinson Lee#include "main/glheader.h"
342e85117b5f8909b8737e0c0e479360640e405192Vinson Lee#include "main/mtypes.h"
352e85117b5f8909b8737e0c0e479360640e405192Vinson Lee
362e85117b5f8909b8737e0c0e479360640e405192Vinson Lee#include "pipe/p_compiler.h"
372e85117b5f8909b8737e0c0e479360640e405192Vinson Lee#include "pipe/p_format.h"
382e85117b5f8909b8737e0c0e479360640e405192Vinson Lee
392e85117b5f8909b8737e0c0e479360640e405192Vinson Leestruct dd_function_table;
402e85117b5f8909b8737e0c0e479360640e405192Vinson Leestruct pipe_context;
414b87d37e90b6d2d9562a192540833b599bda5a35Brian
42f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian/**
43f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian * Derived renderbuffer class.  Just need to add a pointer to the
44f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian * pipe surface.
45f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian */
46f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brianstruct st_renderbuffer
47f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian{
48f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian   struct gl_renderbuffer Base;
49287c94ea4987033f9c99a2f91c5750c9083504caKeith Whitwell   struct pipe_resource *texture;
50296378b6c8b205048244746e260739448c4ee590Brian Paul   struct pipe_surface *surface; /* temporary view into texture */
51b85b315ebbe25efbd118887bdc87a562d4334fccBrian Paul   GLboolean defined;        /**< defined contents? */
521a82d9648b3db780e58e4966924157542d148c58Brian Paul
53377eb5c30cfe94723cad214f12ca4ff9e5aee35eBrian Paul   struct pipe_transfer *transfer; /**< only used when mapping the resource */
54377eb5c30cfe94723cad214f12ca4ff9e5aee35eBrian Paul
5552411a1951da10bebc439a30c02c7ca99bc27c9cJosé Fonseca   /**
5652411a1951da10bebc439a30c02c7ca99bc27c9cJosé Fonseca    * Used only when hardware accumulation buffers are not supported.
5752411a1951da10bebc439a30c02c7ca99bc27c9cJosé Fonseca    */
5852411a1951da10bebc439a30c02c7ca99bc27c9cJosé Fonseca   boolean software;
5952411a1951da10bebc439a30c02c7ca99bc27c9cJosé Fonseca   void *data;
60c1cac8feecb9f868d7273e8892a6562e533d929aStéphane Marchesin
611a82d9648b3db780e58e4966924157542d148c58Brian Paul   struct st_texture_object *rtt;  /**< GL render to texture's texture */
621a82d9648b3db780e58e4966924157542d148c58Brian Paul   int rtt_level, rtt_face, rtt_slice;
63f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian};
64f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian
65f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian
66f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brianstatic INLINE struct st_renderbuffer *
67f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brianst_renderbuffer(struct gl_renderbuffer *rb)
68f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian{
69f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian   return (struct st_renderbuffer *) rb;
70f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian}
71f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian
72f5713c7d2e7ba8e1170fd9b1dd95379662ab6117Brian
7364da7515009f3551796c90acc74eb0a2ffdb68a0Brianextern struct gl_renderbuffer *
7452411a1951da10bebc439a30c02c7ca99bc27c9cJosé Fonsecast_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw);
7564da7515009f3551796c90acc74eb0a2ffdb68a0Brian
766da9234fd437f97267e7831f034c78b31156d939Brianextern void
776da9234fd437f97267e7831f034c78b31156d939Brianst_init_fbo_functions(struct dd_function_table *functions);
784b87d37e90b6d2d9562a192540833b599bda5a35Brian
7924bd9780bcf400a00f6fc5a89b1648c7e3b7df07Brian Paulextern GLboolean
8024bd9780bcf400a00f6fc5a89b1648c7e3b7df07Brian Paulst_is_depth_stencil_combined(const struct gl_renderbuffer_attachment *depth,
8124bd9780bcf400a00f6fc5a89b1648c7e3b7df07Brian Paul                             const struct gl_renderbuffer_attachment *stencil);
8224bd9780bcf400a00f6fc5a89b1648c7e3b7df07Brian Paul
8324bd9780bcf400a00f6fc5a89b1648c7e3b7df07Brian Paul
844b87d37e90b6d2d9562a192540833b599bda5a35Brian#endif /* ST_CB_FBO_H */
85