/**************************************************************************
*
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 VMware, Inc.
* All Rights Reserved.
* Copyright 2008 VMware, Inc. All rights reserved.
*
* 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 TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * 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.
**************************************************************************/
/* Author:
- * Keith Whitwell <keith@tungstengraphics.com>
+ * Keith Whitwell <keithw@vmware.com>
*/
#include "draw/draw_context.h"
#include "lp_setup.h"
-DEBUG_GET_ONCE_BOOL_OPTION(lp_no_rast, "LP_NO_RAST", FALSE)
-
-
static void llvmpipe_destroy( struct pipe_context *pipe )
{
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
lp_print_counters();
+ if (llvmpipe->blitter) {
+ util_blitter_destroy(llvmpipe->blitter);
+ }
+
/* This will also destroy llvmpipe->setup:
*/
if (llvmpipe->draw)
pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL);
- for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
- pipe_sampler_view_reference(&llvmpipe->fragment_sampler_views[i], NULL);
+ for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) {
+ pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_FRAGMENT][i], NULL);
}
- for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) {
- pipe_sampler_view_reference(&llvmpipe->vertex_sampler_views[i], NULL);
+ for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) {
+ pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_VERTEX][i], NULL);
+ }
+
+ for (i = 0; i < Elements(llvmpipe->sampler_views[0]); i++) {
+ pipe_sampler_view_reference(&llvmpipe->sampler_views[PIPE_SHADER_GEOMETRY][i], NULL);
}
for (i = 0; i < Elements(llvmpipe->constants); i++) {
for (j = 0; j < Elements(llvmpipe->constants[i]); j++) {
- pipe_resource_reference(&llvmpipe->constants[i][j], NULL);
+ pipe_resource_reference(&llvmpipe->constants[i][j].buffer, NULL);
}
}
+ for (i = 0; i < llvmpipe->num_vertex_buffers; i++) {
+ pipe_resource_reference(&llvmpipe->vertex_buffer[i].buffer, NULL);
+ }
+
+ lp_delete_setup_variants(llvmpipe);
+
+ LLVMContextDispose(llvmpipe->context);
+ llvmpipe->context = NULL;
+
align_free( llvmpipe );
}
static void
do_flush( struct pipe_context *pipe,
- unsigned flags,
- struct pipe_fence_handle **fence)
+ struct pipe_fence_handle **fence,
+ unsigned flags)
{
- llvmpipe_flush(pipe, flags, fence, __FUNCTION__);
+ llvmpipe_flush(pipe, fence, __FUNCTION__);
}
+static void
+llvmpipe_render_condition ( struct pipe_context *pipe,
+ struct pipe_query *query,
+ boolean condition,
+ uint mode )
+{
+ struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
+
+ llvmpipe->render_cond_query = query;
+ llvmpipe->render_cond_mode = mode;
+ llvmpipe->render_cond_cond = condition;
+}
+
struct pipe_context *
llvmpipe_create_context( struct pipe_screen *screen, void *priv )
{
make_empty_list(&llvmpipe->fs_variants_list);
- llvmpipe->pipe.winsys = screen->winsys;
+ make_empty_list(&llvmpipe->setup_variants_list);
+
+
llvmpipe->pipe.screen = screen;
llvmpipe->pipe.priv = priv;
llvmpipe->pipe.clear = llvmpipe_clear;
llvmpipe->pipe.flush = do_flush;
+ llvmpipe->pipe.render_condition = llvmpipe_render_condition;
+
llvmpipe_init_blend_funcs(llvmpipe);
llvmpipe_init_clip_funcs(llvmpipe);
llvmpipe_init_draw_funcs(llvmpipe);
llvmpipe_init_context_resource_funcs( &llvmpipe->pipe );
llvmpipe_init_surface_functions(llvmpipe);
+ llvmpipe->context = LLVMContextCreate();
+ if (!llvmpipe->context)
+ goto fail;
+
/*
* Create drawing context and plug our rendering stage into it.
*/
- llvmpipe->draw = draw_create(&llvmpipe->pipe);
+ llvmpipe->draw = draw_create_with_llvm_context(&llvmpipe->pipe,
+ llvmpipe->context);
if (!llvmpipe->draw)
goto fail;
/* FIXME: devise alternative to draw_texture_samplers */
- if (debug_get_option_lp_no_rast())
- llvmpipe->no_rast = TRUE;
-
llvmpipe->setup = lp_setup_create( &llvmpipe->pipe,
llvmpipe->draw );
if (!llvmpipe->setup)
goto fail;
+ llvmpipe->blitter = util_blitter_create(&llvmpipe->pipe);
+ if (!llvmpipe->blitter) {
+ goto fail;
+ }
+
+ /* must be done before installing Draw stages */
+ util_blitter_cache_all_shaders(llvmpipe->blitter);
+
/* plug in AA line/point stages */
draw_install_aaline_stage(llvmpipe->draw, &llvmpipe->pipe);
draw_install_aapoint_stage(llvmpipe->draw, &llvmpipe->pipe);
draw_wide_point_threshold(llvmpipe->draw, 10000.0);
draw_wide_line_threshold(llvmpipe->draw, 10000.0);
-#if USE_DRAW_STAGE_PSTIPPLE
- /* Do polygon stipple w/ texture map + frag prog? */
- draw_install_pstipple_stage(llvmpipe->draw, &llvmpipe->pipe);
-#endif
-
lp_reset_counters();
return &llvmpipe->pipe;