2009-07-26 23:44:38 +01:00
|
|
|
/**************************************************************************
|
2022-09-21 11:30:13 -06:00
|
|
|
*
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* Copyright 2007 VMware, Inc.
|
2009-07-26 23:44:38 +01:00
|
|
|
* 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:
|
2022-09-21 11:30:13 -06:00
|
|
|
*
|
2009-07-26 23:44:38 +01:00
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial portions
|
|
|
|
* of the Software.
|
2022-09-21 11:30:13 -06:00
|
|
|
*
|
2009-07-26 23:44:38 +01:00
|
|
|
* 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.
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
2009-07-26 23:44:38 +01:00
|
|
|
* 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.
|
2022-09-21 11:30:13 -06:00
|
|
|
*
|
2009-07-26 23:44:38 +01:00
|
|
|
**************************************************************************/
|
|
|
|
|
s/Tungsten Graphics/VMware/
Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the
old copyright name is creating unnecessary confusion, hence this change.
This was the sed script I used:
$ cat tg2vmw.sed
# Run as:
#
# git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed
#
# Rename copyrights
s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g
/Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./
s/TUNGSTEN GRAPHICS/VMWARE/g
# Rename emails
s/alanh@tungstengraphics.com/alanh@vmware.com/
s/jens@tungstengraphics.com/jowen@vmware.com/g
s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/
s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g
s/keithw\?@tungstengraphics.com/keithw@vmware.com/g
s/michel@tungstengraphics.com/daenzer@vmware.com/g
s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/
s/zack@tungstengraphics.com/zackr@vmware.com/
# Remove dead links
s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g
# C string src/gallium/state_trackers/vega/api_misc.c
s/"Tungsten Graphics, Inc"/"VMware, Inc"/
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-17 16:27:50 +00:00
|
|
|
/* Authors: Keith Whitwell <keithw@vmware.com>
|
2009-07-26 23:44:38 +01:00
|
|
|
*/
|
|
|
|
|
2009-12-10 14:55:28 -07:00
|
|
|
#include "pipe/p_state.h"
|
2010-02-02 14:42:17 +00:00
|
|
|
#include "util/u_inlines.h"
|
2010-05-03 17:08:17 -06:00
|
|
|
#include "util/u_framebuffer.h"
|
2009-12-10 14:55:28 -07:00
|
|
|
#include "util/u_surface.h"
|
2009-07-26 23:44:38 +01:00
|
|
|
#include "lp_context.h"
|
2010-04-02 09:17:47 -06:00
|
|
|
#include "lp_scene.h"
|
2009-07-26 23:44:38 +01:00
|
|
|
#include "lp_state.h"
|
2009-10-09 12:26:49 +01:00
|
|
|
#include "lp_setup.h"
|
2009-07-26 23:44:38 +01:00
|
|
|
|
|
|
|
#include "draw/draw_context.h"
|
|
|
|
|
2019-06-27 15:05:31 -07:00
|
|
|
#include "util/format/u_format.h"
|
2009-12-03 11:58:36 +01:00
|
|
|
|
2009-07-26 23:44:38 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the framebuffer surface info: color buffers, zbuffer, stencil buffer.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
|
|
|
|
const struct pipe_framebuffer_state *fb)
|
|
|
|
{
|
|
|
|
struct llvmpipe_context *lp = llvmpipe_context(pipe);
|
|
|
|
|
2023-06-23 00:24:20 +08:00
|
|
|
bool changed = !util_framebuffer_state_equal(&lp->framebuffer, fb);
|
2009-07-26 23:44:38 +01:00
|
|
|
|
2010-04-23 09:10:18 -06:00
|
|
|
assert(fb->width <= LP_MAX_WIDTH);
|
|
|
|
assert(fb->height <= LP_MAX_HEIGHT);
|
2010-04-02 09:17:47 -06:00
|
|
|
|
2009-12-10 14:55:28 -07:00
|
|
|
if (changed) {
|
2013-10-29 13:36:41 -07:00
|
|
|
/*
|
|
|
|
* If no depth buffer is bound, send the utility function the default
|
|
|
|
* format for no bound depth (PIPE_FORMAT_NONE).
|
2022-09-21 11:30:13 -06:00
|
|
|
*/
|
2023-02-16 12:42:51 -05:00
|
|
|
enum pipe_format depth_format = fb->zsbuf && !(LP_PERF & PERF_NO_DEPTH) ?
|
2013-10-29 13:36:41 -07:00
|
|
|
fb->zsbuf->format : PIPE_FORMAT_NONE;
|
|
|
|
const struct util_format_description *depth_desc =
|
|
|
|
util_format_description(depth_format);
|
|
|
|
|
2022-01-28 09:46:47 -05:00
|
|
|
if (fb->zsbuf && fb->zsbuf->context != pipe) {
|
2016-01-20 00:48:07 +01:00
|
|
|
debug_printf("Illegal setting of fb state with zsbuf created in "
|
|
|
|
"another context\n");
|
|
|
|
}
|
2022-09-21 11:30:13 -06:00
|
|
|
for (unsigned i = 0; i < fb->nr_cbufs; i++) {
|
2022-01-28 09:46:47 -05:00
|
|
|
if (fb->cbufs[i] &&
|
|
|
|
fb->cbufs[i]->context != pipe) {
|
2016-01-20 00:48:07 +01:00
|
|
|
debug_printf("Illegal setting of fb state with cbuf %d created in "
|
|
|
|
"another context\n", i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-10 14:55:28 -07:00
|
|
|
util_copy_framebuffer_state(&lp->framebuffer, fb);
|
2009-07-26 23:44:38 +01:00
|
|
|
|
2010-09-16 10:45:52 +01:00
|
|
|
if (LP_PERF & PERF_NO_DEPTH) {
|
2016-01-20 00:48:07 +01:00
|
|
|
pipe_surface_reference(&lp->framebuffer.zsbuf, NULL);
|
2010-09-16 10:45:52 +01:00
|
|
|
}
|
|
|
|
|
2013-10-29 13:36:41 -07:00
|
|
|
/*
|
|
|
|
* Calculate the floating point depth sense and Minimum Resolvable Depth
|
|
|
|
* value for the llvmpipe module. This is separate from the draw module.
|
2013-10-22 15:48:00 -07:00
|
|
|
*/
|
2013-10-29 13:36:41 -07:00
|
|
|
lp->floating_point_depth =
|
|
|
|
(util_get_depth_format_type(depth_desc) == UTIL_FORMAT_TYPE_FLOAT);
|
2022-09-21 11:30:13 -06:00
|
|
|
|
2013-10-29 13:36:41 -07:00
|
|
|
lp->mrd = util_get_depth_format_mrd(depth_desc);
|
2013-10-22 15:48:00 -07:00
|
|
|
|
2013-10-29 13:36:41 -07:00
|
|
|
/* Tell the draw module how deep the Z/depth buffer is. */
|
|
|
|
draw_set_zs_format(lp->draw, depth_format);
|
2009-07-26 23:44:38 +01:00
|
|
|
|
2022-09-21 11:30:13 -06:00
|
|
|
lp_setup_bind_framebuffer(lp->setup, &lp->framebuffer);
|
2024-10-10 10:46:07 -04:00
|
|
|
draw_set_viewmask(lp->draw, fb->viewmask);
|
2009-07-26 23:44:38 +01:00
|
|
|
|
2009-10-08 16:33:12 +01:00
|
|
|
lp->dirty |= LP_NEW_FRAMEBUFFER;
|
|
|
|
}
|
2009-07-26 23:44:38 +01:00
|
|
|
}
|