summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/README23
-rw-r--r--src/gallium/drivers/llvmpipe/SConscript9
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_alpha.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_bld_depth.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_context.c7
-rw-r--r--src/gallium/drivers/llvmpipe/lp_fence.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.c47
-rw-r--r--src/gallium/drivers/llvmpipe/lp_flush.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_perf.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_query.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene_queue.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c24
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c22
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h1
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c21
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_setup.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_vertex.c9
-rw-r--r--src/gallium/drivers/llvmpipe/lp_surface.c2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_test_main.c13
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c6
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.h10
23 files changed, 114 insertions, 103 deletions
diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README
index e9374cc6ef..1fc7746a83 100644
--- a/src/gallium/drivers/llvmpipe/README
+++ b/src/gallium/drivers/llvmpipe/README
@@ -12,7 +12,7 @@ Requirements
See /proc/cpuinfo to know what your CPU supports.
- - LLVM 2.6 (or later)
+ - LLVM. Version 2.8 recommended. 2.6 or later required.
For Linux, on a recent Debian based distribution do:
@@ -30,21 +30,8 @@ Requirements
debug=no. This is necessary as LLVM builds as static library so the chosen
MS CRT must match.
- The version of LLVM from SVN ("2.7svn") from mid-March 2010 is pretty
- stable and has some features not in version 2.6.
-
- scons (optional)
- - udis86, http://udis86.sourceforge.net/ (optional). My personal repository
- supports more opcodes which haven't been merged upstream yet:
-
- git clone git://anongit.freedesktop.org/~jrfonseca/udis86
- cd udis86
- ./autogen.sh
- ./configure --with-pic
- make
- sudo make install
-
Building
========
@@ -94,13 +81,7 @@ that no tail call optimizations are done by gcc.
To better profile JIT code you'll need to build LLVM with oprofile integration.
- source_dir=$PWD/llvm-2.6
- build_dir=$source_dir/build/profile
- install_dir=$source_dir-profile
-
- mkdir -p "$build_dir"
- cd "$build_dir" && \
- $source_dir/configure \
+ ./configure \
--prefix=$install_dir \
--enable-optimized \
--disable-profiling \
diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript
index 26b258b956..c10a8cbc12 100644
--- a/src/gallium/drivers/llvmpipe/SConscript
+++ b/src/gallium/drivers/llvmpipe/SConscript
@@ -96,10 +96,15 @@ if env['platform'] != 'embedded':
tests.append('round')
for test in tests:
+ testname = 'lp_test_' + test
target = env.Program(
- target = 'lp_test_' + test,
- source = ['lp_test_' + test + '.c', 'lp_test_main.c'],
+ target = testname,
+ source = [testname + '.c', 'lp_test_main.c'],
)
env.InstallProgram(target)
+
+ # http://www.scons.org/wiki/UnitTests
+ alias = env.Alias(testname, [target], target[0].abspath)
+ AlwaysBuild(alias)
Export('llvmpipe')
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h
index 5c9392504f..06206a24d8 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_alpha.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_alpha.h
@@ -34,10 +34,12 @@
#ifndef LP_BLD_ALPHA_H
#define LP_BLD_ALPHA_H
+#include "pipe/p_compiler.h"
#include "gallivm/lp_bld.h"
struct pipe_alpha_state;
+struct gallivm_state;
struct lp_type;
struct lp_build_mask_context;
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.h b/src/gallium/drivers/llvmpipe/lp_bld_depth.h
index 038b136a28..e01fc46ec1 100644
--- a/src/gallium/drivers/llvmpipe/lp_bld_depth.h
+++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.h
@@ -36,10 +36,14 @@
#define LP_BLD_DEPTH_H
+#include "pipe/p_compiler.h"
+#include "pipe/p_state.h"
+
#include "gallivm/lp_bld.h"
struct pipe_depth_state;
+struct gallivm_state;
struct util_format_description;
struct lp_type;
struct lp_build_mask_context;
diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c
index 2de20d6e9a..8a5655d499 100644
--- a/src/gallium/drivers/llvmpipe/lp_context.c
+++ b/src/gallium/drivers/llvmpipe/lp_context.c
@@ -125,6 +125,10 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
}
}
+ for (i = 0; i < llvmpipe->num_vertex_buffers; i++) {
+ pipe_resource_reference(&llvmpipe->vertex_buffer[i].buffer, NULL);
+ }
+
gallivm_destroy(llvmpipe->gallivm);
align_free( llvmpipe );
@@ -132,10 +136,9 @@ static void llvmpipe_destroy( struct pipe_context *pipe )
static void
do_flush( struct pipe_context *pipe,
- unsigned flags,
struct pipe_fence_handle **fence)
{
- llvmpipe_flush(pipe, flags, fence, __FUNCTION__);
+ llvmpipe_flush(pipe, fence, __FUNCTION__);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c
index 3a55e76bc3..a21a3c7448 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.c
+++ b/src/gallium/drivers/llvmpipe/lp_fence.c
@@ -47,6 +47,9 @@ lp_fence_create(unsigned rank)
static int fence_id;
struct lp_fence *fence = CALLOC_STRUCT(lp_fence);
+ if (!fence)
+ return NULL;
+
pipe_reference_init(&fence->reference, 1);
pipe_mutex_init(fence->mutex);
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c
index 85e3cdec82..42430550ea 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.c
+++ b/src/gallium/drivers/llvmpipe/lp_flush.c
@@ -40,12 +40,10 @@
/**
- * \param flags bitmask of PIPE_FLUSH_x flags
* \param fence if non-null, returns pointer to a fence which can be waited on
*/
void
llvmpipe_flush( struct pipe_context *pipe,
- unsigned flags,
struct pipe_fence_handle **fence,
const char *reason)
{
@@ -54,7 +52,7 @@ llvmpipe_flush( struct pipe_context *pipe,
draw_flush(llvmpipe->draw);
/* ask the setup module to flush */
- lp_setup_flush(llvmpipe->setup, flags, fence, reason);
+ lp_setup_flush(llvmpipe->setup, fence, reason);
if (llvmpipe_variant_count > 1000) {
@@ -65,23 +63,21 @@ llvmpipe_flush( struct pipe_context *pipe,
/* Enable to dump BMPs of the color/depth buffers each frame */
if (0) {
- if (flags & PIPE_FLUSH_FRAME) {
- static unsigned frame_no = 1;
- char filename[256];
- unsigned i;
-
- for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
- util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no);
- debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[0]);
- }
-
- if (0) {
- util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no);
- debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf);
- }
-
- ++frame_no;
+ static unsigned frame_no = 1;
+ char filename[256];
+ unsigned i;
+
+ for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) {
+ util_snprintf(filename, sizeof(filename), "cbuf%u_%u", i, frame_no);
+ debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.cbufs[i]);
+ }
+
+ if (0) {
+ util_snprintf(filename, sizeof(filename), "zsbuf_%u", frame_no);
+ debug_dump_surface_bmp(&llvmpipe->pipe, filename, llvmpipe->framebuffer.zsbuf);
}
+
+ ++frame_no;
}
}
@@ -90,9 +86,9 @@ llvmpipe_finish( struct pipe_context *pipe,
const char *reason )
{
struct pipe_fence_handle *fence = NULL;
- llvmpipe_flush(pipe, 0, &fence, reason);
+ llvmpipe_flush(pipe, &fence, reason);
if (fence) {
- pipe->screen->fence_finish(pipe->screen, fence, 0);
+ pipe->screen->fence_finish(pipe->screen, fence, PIPE_TIMEOUT_INFINITE);
pipe->screen->fence_reference(pipe->screen, &fence, NULL);
}
}
@@ -110,7 +106,6 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
struct pipe_resource *resource,
unsigned level,
int layer,
- unsigned flush_flags,
boolean read_only,
boolean cpu_access,
boolean do_not_block,
@@ -118,10 +113,10 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
{
unsigned referenced;
- referenced = pipe->is_resource_referenced(pipe, resource, level, layer);
+ referenced = llvmpipe_is_resource_referenced(pipe, resource, level, layer);
- if ((referenced & PIPE_REFERENCED_FOR_WRITE) ||
- ((referenced & PIPE_REFERENCED_FOR_READ) && !read_only)) {
+ if ((referenced & LP_REFERENCED_FOR_WRITE) ||
+ ((referenced & LP_REFERENCED_FOR_READ) && !read_only)) {
if (cpu_access) {
/*
@@ -136,7 +131,7 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
* Just flush.
*/
- llvmpipe_flush(pipe, flush_flags, NULL, reason);
+ llvmpipe_flush(pipe, NULL, reason);
}
}
diff --git a/src/gallium/drivers/llvmpipe/lp_flush.h b/src/gallium/drivers/llvmpipe/lp_flush.h
index 579d24c68a..efff94c8c0 100644
--- a/src/gallium/drivers/llvmpipe/lp_flush.h
+++ b/src/gallium/drivers/llvmpipe/lp_flush.h
@@ -36,7 +36,6 @@ struct pipe_resource;
void
llvmpipe_flush(struct pipe_context *pipe,
- unsigned flags,
struct pipe_fence_handle **fence,
const char *reason);
@@ -49,7 +48,6 @@ llvmpipe_flush_resource(struct pipe_context *pipe,
struct pipe_resource *resource,
unsigned level,
int layer,
- unsigned flush_flags,
boolean read_only,
boolean cpu_access,
boolean do_not_block,
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index a775990f92..482a902dd2 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -36,9 +36,7 @@
#include "util/u_memory.h"
#include "gallivm/lp_bld_init.h"
#include "gallivm/lp_bld_debug.h"
-#include "gallivm/lp_bld_intr.h"
#include "lp_context.h"
-#include "lp_screen.h"
#include "lp_jit.h"
diff --git a/src/gallium/drivers/llvmpipe/lp_perf.h b/src/gallium/drivers/llvmpipe/lp_perf.h
index b23a100b87..455adf7d6f 100644
--- a/src/gallium/drivers/llvmpipe/lp_perf.h
+++ b/src/gallium/drivers/llvmpipe/lp_perf.h
@@ -33,6 +33,7 @@
#ifndef LP_PERF_H
#define LP_PERF_H
+#include "pipe/p_compiler.h"
/**
* Various counters
diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c
index 84c66dd36e..1e2401fa84 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -69,7 +69,7 @@ llvmpipe_destroy_query(struct pipe_context *pipe, struct pipe_query *q)
*/
if (pq->fence) {
if (!lp_fence_issued(pq->fence))
- llvmpipe_flush(pipe, 0, NULL, __FUNCTION__);
+ llvmpipe_flush(pipe, NULL, __FUNCTION__);
if (!lp_fence_signalled(pq->fence))
lp_fence_wait(pq->fence);
@@ -99,7 +99,7 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
if (!lp_fence_signalled(pq->fence)) {
if (!lp_fence_issued(pq->fence))
- llvmpipe_flush(pipe, 0, NULL, __FUNCTION__);
+ llvmpipe_flush(pipe, NULL, __FUNCTION__);
if (!wait)
return FALSE;
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 978d17c575..5d0f5f8b7b 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -74,6 +74,7 @@ lp_scene_create( struct pipe_context *pipe )
void
lp_scene_destroy(struct lp_scene *scene)
{
+ lp_fence_reference(&scene->fence, NULL);
pipe_mutex_destroy(scene->mutex);
assert(scene->data.head->next == NULL);
FREE(scene->data.head);
diff --git a/src/gallium/drivers/llvmpipe/lp_scene_queue.h b/src/gallium/drivers/llvmpipe/lp_scene_queue.h
index fd7c65a2c8..dd9ab593b4 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene_queue.h
+++ b/src/gallium/drivers/llvmpipe/lp_scene_queue.h
@@ -29,6 +29,8 @@
#ifndef LP_SCENE_QUEUE
#define LP_SCENE_QUEUE
+#include "pipe/p_compiler.h"
+
struct lp_scene_queue;
struct lp_scene;
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 9459a3cd11..521a52ad3a 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -151,7 +151,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_INDEP_BLEND_ENABLE:
return 1;
case PIPE_CAP_INDEP_BLEND_FUNC:
- return 0;
+ return 1;
case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER:
return 1;
@@ -164,6 +164,9 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
return 1;
case PIPE_CAP_DEPTH_CLAMP:
return 0;
+ case PIPE_CAP_TGSI_INSTANCEID:
+ case PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR:
+ return 1;
default:
return 0;
}
@@ -222,8 +225,7 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
enum pipe_format format,
enum pipe_texture_target target,
unsigned sample_count,
- unsigned bind,
- unsigned geom_flags )
+ unsigned bind)
{
struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
struct sw_winsys *winsys = screen->winsys;
@@ -276,6 +278,11 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
return util_format_s3tc_enabled;
}
+ /* u_format doesn't support RGTC yet */
+ if (format_desc->layout == UTIL_FORMAT_LAYOUT_RGTC) {
+ return FALSE;
+ }
+
/*
* Everything else should be supported by u_format.
*/
@@ -341,10 +348,9 @@ llvmpipe_fence_reference(struct pipe_screen *screen,
/**
* Has the fence been executed/finished?
*/
-static int
+static boolean
llvmpipe_fence_signalled(struct pipe_screen *screen,
- struct pipe_fence_handle *fence,
- unsigned flag)
+ struct pipe_fence_handle *fence)
{
struct lp_fence *f = (struct lp_fence *) fence;
return lp_fence_signalled(f);
@@ -354,15 +360,15 @@ llvmpipe_fence_signalled(struct pipe_screen *screen,
/**
* Wait for the fence to finish.
*/
-static int
+static boolean
llvmpipe_fence_finish(struct pipe_screen *screen,
struct pipe_fence_handle *fence_handle,
- unsigned flag)
+ uint64_t timeout)
{
struct lp_fence *f = (struct lp_fence *) fence_handle;
lp_fence_wait(f);
- return 0;
+ return TRUE;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index db04c84efb..3813e0ed97 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -333,12 +333,8 @@ fail:
}
-/**
- * \param flags bitmask of PIPE_FLUSH_x flags
- */
void
lp_setup_flush( struct lp_setup_context *setup,
- unsigned flags,
struct pipe_fence_handle **fence,
const char *reason)
{
@@ -469,7 +465,7 @@ lp_setup_clear( struct lp_setup_context *setup,
unsigned flags )
{
if (!lp_setup_try_clear( setup, color, depth, stencil, flags )) {
- lp_setup_flush(setup, 0, NULL, __FUNCTION__);
+ lp_setup_flush(setup, NULL, __FUNCTION__);
if (!lp_setup_try_clear( setup, color, depth, stencil, flags ))
assert(0);
@@ -753,20 +749,20 @@ lp_setup_is_resource_referenced( const struct lp_setup_context *setup,
/* check the render targets */
for (i = 0; i < setup->fb.nr_cbufs; i++) {
if (setup->fb.cbufs[i]->texture == texture)
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+ return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE;
}
if (setup->fb.zsbuf && setup->fb.zsbuf->texture == texture) {
- return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE;
+ return LP_REFERENCED_FOR_READ | LP_REFERENCED_FOR_WRITE;
}
/* check textures referenced by the scene */
for (i = 0; i < Elements(setup->scenes); i++) {
if (lp_scene_is_resource_referenced(setup->scenes[i], texture)) {
- return PIPE_REFERENCED_FOR_READ;
+ return LP_REFERENCED_FOR_READ;
}
}
- return PIPE_UNREFERENCED;
+ return LP_UNREFERENCED;
}
@@ -996,6 +992,8 @@ lp_setup_destroy( struct lp_setup_context *setup )
lp_scene_destroy(scene);
}
+ lp_fence_reference(&setup->last_fence, NULL);
+
FREE( setup );
}
@@ -1062,6 +1060,8 @@ lp_setup_begin_query(struct lp_setup_context *setup,
{
/* init the query to its beginning state */
assert(setup->active_query == NULL);
+
+ set_scene_state(setup, SETUP_ACTIVE, "begin_query");
if (setup->scene) {
if (!lp_scene_bin_everywhere(setup->scene,
@@ -1091,6 +1091,8 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
{
union lp_rast_cmd_arg dummy = { 0 };
+ set_scene_state(setup, SETUP_ACTIVE, "end_query");
+
assert(setup->active_query == pq);
setup->active_query = NULL;
@@ -1108,7 +1110,7 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
if (!lp_scene_bin_everywhere(setup->scene,
LP_RAST_OP_END_QUERY,
dummy)) {
- lp_setup_flush(setup, 0, NULL, __FUNCTION__);
+ lp_setup_flush(setup, NULL, __FUNCTION__);
}
}
else {
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 0d6e161a21..8655259d27 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -64,7 +64,6 @@ lp_setup_clear(struct lp_setup_context *setup,
void
lp_setup_flush( struct lp_setup_context *setup,
- unsigned flags,
struct pipe_fence_handle **fence,
const char *reason);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 2c4943a69f..6243a96f45 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -90,7 +90,6 @@
#include "lp_context.h"
#include "lp_debug.h"
#include "lp_perf.h"
-#include "lp_screen.h"
#include "lp_setup.h"
#include "lp_state.h"
#include "lp_tex_sample.h"
@@ -335,7 +334,8 @@ generate_fs(struct gallivm_state *gallivm,
/* Build the actual shader */
lp_build_tgsi_soa(gallivm, tokens, type, &mask,
- consts_ptr, interp->pos, interp->inputs,
+ consts_ptr, NULL, /* sys values array */
+ interp->pos, interp->inputs,
outputs, sampler, &shader->info.base);
/* Alpha test */
@@ -546,6 +546,7 @@ generate_fragment(struct llvmpipe_context *lp,
unsigned i;
unsigned chan;
unsigned cbuf;
+ boolean cbuf0_write_all;
/* Adjust color input interpolation according to flatshade state:
*/
@@ -559,6 +560,15 @@ generate_fragment(struct llvmpipe_context *lp,
}
}
+ /* check if writes to cbuf[0] are to be copied to all cbufs */
+ cbuf0_write_all = FALSE;
+ for (i = 0;i < shader->info.base.num_properties; i++) {
+ if (shader->info.base.properties[i].name ==
+ TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS) {
+ cbuf0_write_all = TRUE;
+ break;
+ }
+ }
/* TODO: actually pick these based on the fs and color buffer
* characteristics. */
@@ -697,9 +707,10 @@ generate_fragment(struct llvmpipe_context *lp,
mask_input,
counter);
- for(cbuf = 0; cbuf < key->nr_cbufs; cbuf++)
- for(chan = 0; chan < NUM_CHANNELS; ++chan)
- fs_out_color[cbuf][chan][i] = out_color[cbuf][chan];
+ for (cbuf = 0; cbuf < key->nr_cbufs; cbuf++)
+ for (chan = 0; chan < NUM_CHANNELS; ++chan)
+ fs_out_color[cbuf][chan][i] =
+ out_color[cbuf * !cbuf0_write_all][chan];
}
sampler->destroy(sampler);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_setup.c b/src/gallium/drivers/llvmpipe/lp_state_setup.c
index ad751b9ef4..9f1ec146e9 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_setup.c
@@ -651,7 +651,7 @@ generate_setup_variant(struct gallivm_state *gallivm,
LLVMTypeRef arg_types[7];
LLVMBasicBlockRef block;
LLVMBuilderRef builder = gallivm->builder;
- int64_t t0, t1;
+ int64_t t0 = 0, t1;
if (0)
goto fail;
diff --git a/src/gallium/drivers/llvmpipe/lp_state_vertex.c b/src/gallium/drivers/llvmpipe/lp_state_vertex.c
index fb29423dd3..be86f66de9 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_vertex.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_vertex.c
@@ -33,6 +33,8 @@
#include "lp_state.h"
#include "draw/draw_context.h"
+#include "util/u_inlines.h"
+#include "util/u_transfer.h"
static void *
@@ -80,8 +82,9 @@ llvmpipe_set_vertex_buffers(struct pipe_context *pipe,
assert(count <= PIPE_MAX_ATTRIBS);
- memcpy(llvmpipe->vertex_buffer, buffers, count * sizeof(buffers[0]));
- llvmpipe->num_vertex_buffers = count;
+ util_copy_vertex_buffers(llvmpipe->vertex_buffer,
+ &llvmpipe->num_vertex_buffers,
+ buffers, count);
llvmpipe->dirty |= LP_NEW_VERTEX;
@@ -112,4 +115,6 @@ llvmpipe_init_vertex_funcs(struct llvmpipe_context *llvmpipe)
llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers;
llvmpipe->pipe.set_index_buffer = llvmpipe_set_index_buffer;
+
+ llvmpipe->pipe.redefine_user_buffer = u_default_redefine_user_buffer;
}
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c
index e7e46a628a..f49638acf0 100644
--- a/src/gallium/drivers/llvmpipe/lp_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_surface.c
@@ -69,7 +69,6 @@ lp_resource_copy(struct pipe_context *pipe,
llvmpipe_flush_resource(pipe,
dst, dst_level, dstz,
- 0, /* flush_flags */
FALSE, /* read_only */
TRUE, /* cpu_access */
FALSE, /* do_not_block */
@@ -77,7 +76,6 @@ lp_resource_copy(struct pipe_context *pipe,
llvmpipe_flush_resource(pipe,
src, src_level, src_box->z,
- 0, /* flush_flags */
TRUE, /* read_only */
TRUE, /* cpu_access */
FALSE, /* do_not_block */
diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c
index 149ee6f125..d229c62031 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_main.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_main.c
@@ -35,24 +35,13 @@
#include "util/u_cpu_detect.h"
+#include "util/u_math.h"
#include "gallivm/lp_bld_const.h"
#include "gallivm/lp_bld_init.h"
#include "lp_test.h"
-#ifdef PIPE_CC_MSVC
-static INLINE double
-round(double x)
-{
- if (x >= 0.0)
- return floor(x + 0.5);
- else
- return ceil(x - 0.5);
-}
-#endif
-
-
void
dump_type(FILE *fp,
struct lp_type type)
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 9753da5e57..fa4ce5bf2a 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -575,7 +575,6 @@ llvmpipe_get_transfer(struct pipe_context *pipe,
if (!llvmpipe_flush_resource(pipe, resource,
level,
box->depth > 1 ? -1 : box->z,
- 0, /* flush_flags */
read_only,
TRUE, /* cpu_access */
do_not_block,
@@ -695,7 +694,7 @@ llvmpipe_transfer_unmap(struct pipe_context *pipe,
transfer->box.z);
}
-static unsigned int
+unsigned int
llvmpipe_is_resource_referenced( struct pipe_context *pipe,
struct pipe_resource *presource,
unsigned level, int layer)
@@ -703,7 +702,7 @@ llvmpipe_is_resource_referenced( struct pipe_context *pipe,
struct llvmpipe_context *llvmpipe = llvmpipe_context( pipe );
if (presource->target == PIPE_BUFFER)
- return PIPE_UNREFERENCED;
+ return LP_UNREFERENCED;
return lp_setup_is_resource_referenced(llvmpipe->setup, presource);
}
@@ -1401,7 +1400,6 @@ llvmpipe_init_context_resource_funcs(struct pipe_context *pipe)
pipe->transfer_destroy = llvmpipe_transfer_destroy;
pipe->transfer_map = llvmpipe_transfer_map;
pipe->transfer_unmap = llvmpipe_transfer_unmap;
- pipe->is_resource_referenced = llvmpipe_is_resource_referenced;
pipe->transfer_flush_region = u_default_transfer_flush_region;
pipe->transfer_inline_write = u_default_transfer_inline_write;
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h
index b789c0f409..b4a0dfd1c3 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.h
+++ b/src/gallium/drivers/llvmpipe/lp_texture.h
@@ -243,4 +243,14 @@ llvmpipe_init_screen_texture_funcs(struct pipe_screen *screen);
extern void
llvmpipe_init_context_texture_funcs(struct pipe_context *pipe);
+
+#define LP_UNREFERENCED 0
+#define LP_REFERENCED_FOR_READ (1 << 0)
+#define LP_REFERENCED_FOR_WRITE (1 << 1)
+
+unsigned int
+llvmpipe_is_resource_referenced( struct pipe_context *pipe,
+ struct pipe_resource *presource,
+ unsigned level, int layer);
+
#endif /* LP_TEXTURE_H */