mesa/st: move last of renderbuffer functionality into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
This commit is contained in:
parent
98df4f7a83
commit
f74648f912
|
@ -36,7 +36,7 @@
|
|||
#include "util/format/u_format.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "frontend/drm_driver.h"
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_format.h"
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_texture.h"
|
||||
#include "state_tracker/st_context.h"
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
#include "pipe/p_screen.h"
|
||||
#include "state_tracker/st_texture.h"
|
||||
#include "state_tracker/st_context.h"
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "main/texobj.h"
|
||||
|
||||
#include "dri_helpers.h"
|
||||
|
|
|
@ -40,11 +40,11 @@
|
|||
#include "mtypes.h"
|
||||
#include "macros.h"
|
||||
#include "readpix.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "state.h"
|
||||
#include "api_exec_decl.h"
|
||||
|
||||
#include "state_tracker/st_cb_bitmap.h"
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_manager.h"
|
||||
#include "state_tracker/st_scissor.h"
|
||||
|
@ -512,7 +512,7 @@ do_blit_framebuffer(struct gl_context *ctx,
|
|||
if (!srcRb)
|
||||
return;
|
||||
|
||||
st_update_renderbuffer_surface(st, srcRb);
|
||||
_mesa_update_renderbuffer_surface(ctx, srcRb);
|
||||
|
||||
if (!srcRb->surface)
|
||||
return;
|
||||
|
@ -531,7 +531,7 @@ do_blit_framebuffer(struct gl_context *ctx,
|
|||
if (dstRb) {
|
||||
struct pipe_surface *dstSurf;
|
||||
|
||||
st_update_renderbuffer_surface(st, dstRb);
|
||||
_mesa_update_renderbuffer_surface(ctx, dstRb);
|
||||
|
||||
dstSurf = dstRb->surface;
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "util/u_math.h"
|
||||
#include "api_exec_decl.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_manager.h"
|
||||
#include "state_tracker/st_atom.h"
|
||||
#include "state_tracker/st_context.h"
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "api_exec_decl.h"
|
||||
|
||||
#include "util/u_memory.h"
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_cb_eglimage.h"
|
||||
#include "state_tracker/st_context.h"
|
||||
#include "state_tracker/st_format.h"
|
||||
|
@ -449,7 +448,7 @@ render_texture(struct gl_context *ctx,
|
|||
rb->rtt_nr_samples = att->NumSamples;
|
||||
pipe_resource_reference(&rb->texture, pt);
|
||||
|
||||
st_update_renderbuffer_surface(st, rb);
|
||||
_mesa_update_renderbuffer_surface(ctx, rb);
|
||||
|
||||
/* Invalidate buffer state so that the pipe's framebuffer state
|
||||
* gets updated.
|
||||
|
|
|
@ -48,7 +48,6 @@
|
|||
#include "state.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_manager.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "pixeltransfer.h"
|
||||
#include "api_exec_decl.h"
|
||||
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_cb_readpixels.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,9 +35,8 @@
|
|||
#include "util/u_memory.h"
|
||||
#include "util/u_inlines.h"
|
||||
|
||||
#include "state_tracker/st_format.h"
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_context.h"
|
||||
#include "state_tracker/st_format.h"
|
||||
|
||||
/**
|
||||
* Delete a gl_framebuffer.
|
||||
|
@ -270,7 +269,7 @@ renderbuffer_alloc_storage(struct gl_context * ctx,
|
|||
if (!rb->texture)
|
||||
return FALSE;
|
||||
|
||||
st_update_renderbuffer_surface(st, rb);
|
||||
_mesa_update_renderbuffer_surface(ctx, rb);
|
||||
return rb->surface != NULL;
|
||||
}
|
||||
|
||||
|
@ -508,3 +507,136 @@ _mesa_unmap_renderbuffer(struct gl_context *ctx,
|
|||
pipe_texture_unmap(pipe, rb->transfer);
|
||||
rb->transfer = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_regen_renderbuffer_surface(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb)
|
||||
{
|
||||
struct pipe_context *pipe = ctx->pipe;
|
||||
struct pipe_resource *resource = rb->texture;
|
||||
|
||||
struct pipe_surface **psurf =
|
||||
rb->surface_srgb ? &rb->surface_srgb : &rb->surface_linear;
|
||||
struct pipe_surface *surf = *psurf;
|
||||
/* create a new pipe_surface */
|
||||
struct pipe_surface surf_tmpl;
|
||||
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
|
||||
surf_tmpl.format = surf->format;
|
||||
surf_tmpl.nr_samples = rb->rtt_nr_samples;
|
||||
surf_tmpl.u.tex.level = surf->u.tex.level;
|
||||
surf_tmpl.u.tex.first_layer = surf->u.tex.first_layer;
|
||||
surf_tmpl.u.tex.last_layer = surf->u.tex.last_layer;
|
||||
|
||||
/* create -> destroy to avoid blowing up cached surfaces */
|
||||
surf = pipe->create_surface(pipe, resource, &surf_tmpl);
|
||||
pipe_surface_release(pipe, psurf);
|
||||
*psurf = surf;
|
||||
|
||||
rb->surface = *psurf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create or update the pipe_surface of a FBO renderbuffer.
|
||||
* This is usually called after st_finalize_texture.
|
||||
*/
|
||||
void
|
||||
_mesa_update_renderbuffer_surface(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb)
|
||||
{
|
||||
struct st_context *st = st_context(ctx);
|
||||
struct pipe_context *pipe = ctx->pipe;
|
||||
struct pipe_resource *resource = rb->texture;
|
||||
const struct gl_texture_object *stTexObj = NULL;
|
||||
unsigned rtt_width = rb->Width;
|
||||
unsigned rtt_height = rb->Height;
|
||||
unsigned rtt_depth = rb->Depth;
|
||||
|
||||
/*
|
||||
* For winsys fbo, it is possible that the renderbuffer is sRGB-capable but
|
||||
* the format of rb->texture is linear (because we have no control over
|
||||
* the format). Check rb->Format instead of rb->texture->format
|
||||
* to determine if the rb is sRGB-capable.
|
||||
*/
|
||||
boolean enable_srgb = ctx->Color.sRGBEnabled &&
|
||||
_mesa_is_format_srgb(rb->Format);
|
||||
enum pipe_format format = resource->format;
|
||||
|
||||
if (rb->is_rtt) {
|
||||
stTexObj = rb->TexImage->TexObject;
|
||||
if (stTexObj->surface_based)
|
||||
format = stTexObj->surface_format;
|
||||
}
|
||||
|
||||
format = enable_srgb ? util_format_srgb(format) : util_format_linear(format);
|
||||
|
||||
if (resource->target == PIPE_TEXTURE_1D_ARRAY) {
|
||||
rtt_depth = rtt_height;
|
||||
rtt_height = 1;
|
||||
}
|
||||
|
||||
/* find matching mipmap level size */
|
||||
unsigned level;
|
||||
for (level = 0; level <= resource->last_level; level++) {
|
||||
if (u_minify(resource->width0, level) == rtt_width &&
|
||||
u_minify(resource->height0, level) == rtt_height &&
|
||||
(resource->target != PIPE_TEXTURE_3D ||
|
||||
u_minify(resource->depth0, level) == rtt_depth)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(level <= resource->last_level);
|
||||
|
||||
/* determine the layer bounds */
|
||||
unsigned first_layer, last_layer;
|
||||
if (rb->rtt_layered) {
|
||||
first_layer = 0;
|
||||
last_layer = util_max_layer(rb->texture, level);
|
||||
}
|
||||
else {
|
||||
first_layer =
|
||||
last_layer = rb->rtt_face + rb->rtt_slice;
|
||||
}
|
||||
|
||||
/* Adjust for texture views */
|
||||
if (rb->is_rtt && resource->array_size > 1 &&
|
||||
stTexObj->Immutable) {
|
||||
const struct gl_texture_object *tex = stTexObj;
|
||||
first_layer += tex->Attrib.MinLayer;
|
||||
if (!rb->rtt_layered)
|
||||
last_layer += tex->Attrib.MinLayer;
|
||||
else
|
||||
last_layer = MIN2(first_layer + tex->Attrib.NumLayers - 1,
|
||||
last_layer);
|
||||
}
|
||||
|
||||
struct pipe_surface **psurf =
|
||||
enable_srgb ? &rb->surface_srgb : &rb->surface_linear;
|
||||
struct pipe_surface *surf = *psurf;
|
||||
|
||||
if (!surf ||
|
||||
surf->texture->nr_samples != rb->NumSamples ||
|
||||
surf->texture->nr_storage_samples != rb->NumStorageSamples ||
|
||||
surf->format != format ||
|
||||
surf->texture != resource ||
|
||||
surf->width != rtt_width ||
|
||||
surf->height != rtt_height ||
|
||||
surf->nr_samples != rb->rtt_nr_samples ||
|
||||
surf->u.tex.level != level ||
|
||||
surf->u.tex.first_layer != first_layer ||
|
||||
surf->u.tex.last_layer != last_layer) {
|
||||
/* create a new pipe_surface */
|
||||
struct pipe_surface surf_tmpl;
|
||||
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
|
||||
surf_tmpl.format = format;
|
||||
surf_tmpl.nr_samples = rb->rtt_nr_samples;
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.u.tex.first_layer = first_layer;
|
||||
surf_tmpl.u.tex.last_layer = last_layer;
|
||||
|
||||
/* create -> destroy to avoid blowing up cached surfaces */
|
||||
struct pipe_surface *surf = pipe->create_surface(pipe, resource, &surf_tmpl);
|
||||
pipe_surface_release(pipe, psurf);
|
||||
*psurf = surf;
|
||||
}
|
||||
rb->surface = *psurf;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,12 @@ void
|
|||
_mesa_unmap_renderbuffer(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb);
|
||||
|
||||
void
|
||||
_mesa_regen_renderbuffer_surface(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb);
|
||||
void
|
||||
_mesa_update_renderbuffer_surface(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -334,8 +334,6 @@ files_libmesa = files(
|
|||
'state_tracker/st_cb_drawtex.h',
|
||||
'state_tracker/st_cb_eglimage.c',
|
||||
'state_tracker/st_cb_eglimage.h',
|
||||
'state_tracker/st_cb_fbo.c',
|
||||
'state_tracker/st_cb_fbo.h',
|
||||
'state_tracker/st_cb_feedback.c',
|
||||
'state_tracker/st_cb_feedback.h',
|
||||
'state_tracker/st_cb_flush.c',
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "st_context.h"
|
||||
#include "st_atom.h"
|
||||
#include "st_cb_bitmap.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_texture.h"
|
||||
#include "st_util.h"
|
||||
#include "pipe/p_context.h"
|
||||
|
@ -47,6 +46,7 @@
|
|||
#include "util/u_framebuffer.h"
|
||||
#include "main/framebuffer.h"
|
||||
|
||||
#include "main/renderbuffer.h"
|
||||
|
||||
/**
|
||||
* Update framebuffer size.
|
||||
|
@ -109,6 +109,7 @@ framebuffer_quantize_num_samples(struct st_context *st, unsigned num_samples)
|
|||
void
|
||||
st_update_framebuffer_state( struct st_context *st )
|
||||
{
|
||||
struct gl_context *ctx = st->ctx;
|
||||
struct pipe_framebuffer_state framebuffer;
|
||||
struct gl_framebuffer *fb = st->ctx->DrawBuffer;
|
||||
struct gl_renderbuffer *rb;
|
||||
|
@ -148,12 +149,13 @@ st_update_framebuffer_state( struct st_context *st )
|
|||
if (rb->is_rtt || (rb->texture &&
|
||||
_mesa_is_format_srgb(rb->Format))) {
|
||||
/* rendering to a GL texture, may have to update surface */
|
||||
st_update_renderbuffer_surface(st, rb);
|
||||
|
||||
_mesa_update_renderbuffer_surface(ctx, rb);
|
||||
}
|
||||
|
||||
if (rb->surface) {
|
||||
if (rb->surface->context != st->pipe) {
|
||||
st_regen_renderbuffer_surface(st, rb);
|
||||
_mesa_regen_renderbuffer_surface(ctx, rb);
|
||||
}
|
||||
framebuffer.cbufs[i] = rb->surface;
|
||||
update_framebuffer_size(&framebuffer, rb->surface);
|
||||
|
@ -182,10 +184,10 @@ st_update_framebuffer_state( struct st_context *st )
|
|||
if (rb) {
|
||||
if (rb->is_rtt) {
|
||||
/* rendering to a GL texture, may have to update surface */
|
||||
st_update_renderbuffer_surface(st, rb);
|
||||
_mesa_update_renderbuffer_surface(ctx, rb);
|
||||
}
|
||||
if (rb->surface && rb->surface->context != st->pipe) {
|
||||
st_regen_renderbuffer_surface(st, rb);
|
||||
if (rb->surface && rb->surface->context != ctx->pipe) {
|
||||
_mesa_regen_renderbuffer_surface(ctx, rb);
|
||||
}
|
||||
framebuffer.zsbuf = rb->surface;
|
||||
if (rb->surface)
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "st_atom.h"
|
||||
#include "st_cb_bitmap.h"
|
||||
#include "st_cb_clear.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_draw.h"
|
||||
#include "st_format.h"
|
||||
#include "st_nir.h"
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "state_tracker/st_context.h"
|
||||
#include "state_tracker/st_cb_bitmap.h"
|
||||
#include "state_tracker/st_cb_copyimage.h"
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_texture.h"
|
||||
#include "state_tracker/st_util.h"
|
||||
|
|
|
@ -54,8 +54,6 @@
|
|||
#include "st_atom_constbuf.h"
|
||||
#include "st_cb_bitmap.h"
|
||||
#include "st_cb_drawpixels.h"
|
||||
#include "st_cb_readpixels.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_context.h"
|
||||
#include "st_debug.h"
|
||||
#include "st_draw.h"
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include "util/u_inlines.h"
|
||||
#include "util/format/u_format.h"
|
||||
#include "st_cb_eglimage.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_context.h"
|
||||
#include "st_texture.h"
|
||||
#include "st_format.h"
|
||||
|
|
|
@ -1,193 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Framebuffer/renderbuffer functions.
|
||||
*
|
||||
* \author Brian Paul
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "main/context.h"
|
||||
#include "main/bufferobj.h"
|
||||
#include "main/fbobject.h"
|
||||
#include "main/framebuffer.h"
|
||||
#include "main/glformats.h"
|
||||
#include "main/macros.h"
|
||||
#include "main/renderbuffer.h"
|
||||
#include "main/state.h"
|
||||
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_screen.h"
|
||||
#include "st_atom.h"
|
||||
#include "st_context.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_cb_flush.h"
|
||||
#include "st_cb_texture.h"
|
||||
#include "st_format.h"
|
||||
#include "st_texture.h"
|
||||
#include "st_util.h"
|
||||
#include "st_manager.h"
|
||||
|
||||
#include "util/format/u_format.h"
|
||||
#include "util/u_inlines.h"
|
||||
#include "util/u_surface.h"
|
||||
|
||||
void
|
||||
st_regen_renderbuffer_surface(struct st_context *st,
|
||||
struct gl_renderbuffer *rb)
|
||||
{
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
struct pipe_resource *resource = rb->texture;
|
||||
|
||||
struct pipe_surface **psurf =
|
||||
rb->surface_srgb ? &rb->surface_srgb : &rb->surface_linear;
|
||||
struct pipe_surface *surf = *psurf;
|
||||
/* create a new pipe_surface */
|
||||
struct pipe_surface surf_tmpl;
|
||||
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
|
||||
surf_tmpl.format = surf->format;
|
||||
surf_tmpl.nr_samples = rb->rtt_nr_samples;
|
||||
surf_tmpl.u.tex.level = surf->u.tex.level;
|
||||
surf_tmpl.u.tex.first_layer = surf->u.tex.first_layer;
|
||||
surf_tmpl.u.tex.last_layer = surf->u.tex.last_layer;
|
||||
|
||||
/* create -> destroy to avoid blowing up cached surfaces */
|
||||
surf = pipe->create_surface(pipe, resource, &surf_tmpl);
|
||||
pipe_surface_release(pipe, psurf);
|
||||
*psurf = surf;
|
||||
|
||||
rb->surface = *psurf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create or update the pipe_surface of a FBO renderbuffer.
|
||||
* This is usually called after st_finalize_texture.
|
||||
*/
|
||||
void
|
||||
st_update_renderbuffer_surface(struct st_context *st,
|
||||
struct gl_renderbuffer *rb)
|
||||
{
|
||||
struct pipe_context *pipe = st->pipe;
|
||||
struct pipe_resource *resource = rb->texture;
|
||||
const struct gl_texture_object *stTexObj = NULL;
|
||||
unsigned rtt_width = rb->Width;
|
||||
unsigned rtt_height = rb->Height;
|
||||
unsigned rtt_depth = rb->Depth;
|
||||
|
||||
/*
|
||||
* For winsys fbo, it is possible that the renderbuffer is sRGB-capable but
|
||||
* the format of rb->texture is linear (because we have no control over
|
||||
* the format). Check rb->Format instead of rb->texture->format
|
||||
* to determine if the rb is sRGB-capable.
|
||||
*/
|
||||
boolean enable_srgb = st->ctx->Color.sRGBEnabled &&
|
||||
_mesa_is_format_srgb(rb->Format);
|
||||
enum pipe_format format = resource->format;
|
||||
|
||||
if (rb->is_rtt) {
|
||||
stTexObj = rb->TexImage->TexObject;
|
||||
if (stTexObj->surface_based)
|
||||
format = stTexObj->surface_format;
|
||||
}
|
||||
|
||||
format = enable_srgb ? util_format_srgb(format) : util_format_linear(format);
|
||||
|
||||
if (resource->target == PIPE_TEXTURE_1D_ARRAY) {
|
||||
rtt_depth = rtt_height;
|
||||
rtt_height = 1;
|
||||
}
|
||||
|
||||
/* find matching mipmap level size */
|
||||
unsigned level;
|
||||
for (level = 0; level <= resource->last_level; level++) {
|
||||
if (u_minify(resource->width0, level) == rtt_width &&
|
||||
u_minify(resource->height0, level) == rtt_height &&
|
||||
(resource->target != PIPE_TEXTURE_3D ||
|
||||
u_minify(resource->depth0, level) == rtt_depth)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
assert(level <= resource->last_level);
|
||||
|
||||
/* determine the layer bounds */
|
||||
unsigned first_layer, last_layer;
|
||||
if (rb->rtt_layered) {
|
||||
first_layer = 0;
|
||||
last_layer = util_max_layer(rb->texture, level);
|
||||
}
|
||||
else {
|
||||
first_layer =
|
||||
last_layer = rb->rtt_face + rb->rtt_slice;
|
||||
}
|
||||
|
||||
/* Adjust for texture views */
|
||||
if (rb->is_rtt && resource->array_size > 1 &&
|
||||
stTexObj->Immutable) {
|
||||
const struct gl_texture_object *tex = stTexObj;
|
||||
first_layer += tex->Attrib.MinLayer;
|
||||
if (!rb->rtt_layered)
|
||||
last_layer += tex->Attrib.MinLayer;
|
||||
else
|
||||
last_layer = MIN2(first_layer + tex->Attrib.NumLayers - 1,
|
||||
last_layer);
|
||||
}
|
||||
|
||||
struct pipe_surface **psurf =
|
||||
enable_srgb ? &rb->surface_srgb : &rb->surface_linear;
|
||||
struct pipe_surface *surf = *psurf;
|
||||
|
||||
if (!surf ||
|
||||
surf->texture->nr_samples != rb->NumSamples ||
|
||||
surf->texture->nr_storage_samples != rb->NumStorageSamples ||
|
||||
surf->format != format ||
|
||||
surf->texture != resource ||
|
||||
surf->width != rtt_width ||
|
||||
surf->height != rtt_height ||
|
||||
surf->nr_samples != rb->rtt_nr_samples ||
|
||||
surf->u.tex.level != level ||
|
||||
surf->u.tex.first_layer != first_layer ||
|
||||
surf->u.tex.last_layer != last_layer) {
|
||||
/* create a new pipe_surface */
|
||||
struct pipe_surface surf_tmpl;
|
||||
memset(&surf_tmpl, 0, sizeof(surf_tmpl));
|
||||
surf_tmpl.format = format;
|
||||
surf_tmpl.nr_samples = rb->rtt_nr_samples;
|
||||
surf_tmpl.u.tex.level = level;
|
||||
surf_tmpl.u.tex.first_layer = first_layer;
|
||||
surf_tmpl.u.tex.last_layer = last_layer;
|
||||
|
||||
/* create -> destroy to avoid blowing up cached surfaces */
|
||||
struct pipe_surface *surf = pipe->create_surface(pipe, resource, &surf_tmpl);
|
||||
pipe_surface_release(pipe, psurf);
|
||||
*psurf = surf;
|
||||
}
|
||||
rb->surface = *psurf;
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
|
||||
#ifndef ST_CB_FBO_H
|
||||
#define ST_CB_FBO_H
|
||||
|
||||
#include "main/glheader.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "main/fbobject.h"
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
|
||||
struct pipe_context;
|
||||
|
||||
extern void
|
||||
st_update_renderbuffer_surface(struct st_context *st,
|
||||
struct gl_renderbuffer *strb);
|
||||
|
||||
extern void
|
||||
st_regen_renderbuffer_surface(struct st_context *st,
|
||||
struct gl_renderbuffer *strb);
|
||||
|
||||
#endif /* ST_CB_FBO_H */
|
|
@ -38,7 +38,6 @@
|
|||
#include "st_cb_bitmap.h"
|
||||
#include "st_cb_flush.h"
|
||||
#include "st_cb_clear.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_context.h"
|
||||
#include "st_manager.h"
|
||||
#include "pipe/p_context.h"
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include "util/format/u_format.h"
|
||||
#include "cso_cache/cso_context.h"
|
||||
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_atom.h"
|
||||
#include "st_context.h"
|
||||
#include "st_cb_bitmap.h"
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include "state_tracker/st_context.h"
|
||||
#include "state_tracker/st_cb_bitmap.h"
|
||||
#include "state_tracker/st_cb_drawpixels.h"
|
||||
#include "state_tracker/st_cb_fbo.h"
|
||||
#include "state_tracker/st_cb_flush.h"
|
||||
#include "state_tracker/st_cb_texture.h"
|
||||
#include "state_tracker/st_format.h"
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "st_extensions.h"
|
||||
#include "st_format.h"
|
||||
#include "st_cb_bitmap.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "st_cb_flush.h"
|
||||
#include "st_manager.h"
|
||||
#include "st_sampler_view.h"
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include "st_context.h"
|
||||
#include "st_format.h"
|
||||
#include "st_texture.h"
|
||||
#include "st_cb_fbo.h"
|
||||
#include "main/enums.h"
|
||||
|
||||
#include "pipe/p_state.h"
|
||||
|
|
Loading…
Reference in New Issue