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/lp_jit.c17
-rw-r--r--src/gallium/drivers/llvmpipe/lp_scene.c3
-rw-r--r--src/gallium/drivers/llvmpipe/lp_screen.c25
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_surface.c4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.h2
-rw-r--r--src/gallium/drivers/llvmpipe/lp_tile_soa.py35
6 files changed, 52 insertions, 34 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index 927e472ff2..2f804bb11c 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -166,8 +166,6 @@ lp_jit_screen_cleanup(struct llvmpipe_screen *screen)
void
lp_jit_screen_init(struct llvmpipe_screen *screen)
{
- char *error = NULL;
-
util_cpu_detect();
#if 0
@@ -179,17 +177,10 @@ lp_jit_screen_init(struct llvmpipe_screen *screen)
lp_build_init();
- screen->module = LLVMModuleCreateWithName("llvmpipe");
-
- screen->provider = LLVMCreateModuleProviderForExistingModule(screen->module);
-
- if (LLVMCreateJITCompiler(&screen->engine, screen->provider, 1, &error)) {
- _debug_printf("%s\n", error);
- LLVMDisposeMessage(error);
- assert(0);
- }
-
- screen->target = LLVMGetExecutionEngineTargetData(screen->engine);
+ screen->module = lp_build_module;
+ screen->provider = lp_build_provider;
+ screen->engine = lp_build_engine;
+ screen->target = lp_build_target;
screen->pass = LLVMCreateFunctionPassManager(screen->provider);
LLVMAddTargetData(screen->target, screen->pass);
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 681ce674d4..0c51b52d17 100644
--- a/src/gallium/drivers/llvmpipe/lp_scene.c
+++ b/src/gallium/drivers/llvmpipe/lp_scene.c
@@ -483,6 +483,9 @@ void lp_scene_begin_binning( struct lp_scene *scene,
scene->tiles_x = align(fb->width, TILE_SIZE) / TILE_SIZE;
scene->tiles_y = align(fb->height, TILE_SIZE) / TILE_SIZE;
+
+ assert(scene->tiles_x <= TILES_X);
+ assert(scene->tiles_y <= TILES_Y);
}
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
index 3d6c7930a0..6999599558 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -28,6 +28,7 @@
#include "util/u_memory.h"
#include "util/u_format.h"
+#include "util/u_format_s3tc.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
@@ -186,17 +187,17 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
case PIPE_FORMAT_DXT1_RGBA:
case PIPE_FORMAT_DXT3_RGBA:
case PIPE_FORMAT_DXT5_RGBA:
- return FALSE;
+ return util_format_s3tc_enabled;
default:
break;
}
if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) {
- if(format_desc->block.width != 1 ||
- format_desc->block.height != 1)
+ if(format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
return FALSE;
- if(format_desc->layout != UTIL_FORMAT_LAYOUT_PLAIN)
+ if(format_desc->block.width != 1 ||
+ format_desc->block.height != 1)
return FALSE;
if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
@@ -220,20 +221,6 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
return FALSE;
}
- /* FIXME: Temporary restrictions. See lp_bld_sample_soa.c */
- if(tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) {
- if(!format_desc->is_bitmask)
- return FALSE;
-
- if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB &&
- format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS)
- return FALSE;
-
- /* not supported yet */
- if (format == PIPE_FORMAT_Z16_UNORM)
- return FALSE;
- }
-
return TRUE;
}
@@ -300,6 +287,8 @@ llvmpipe_create_screen(struct sw_winsys *winsys)
screen->base.context_create = llvmpipe_create_context;
screen->base.flush_frontbuffer = llvmpipe_flush_frontbuffer;
+ util_format_s3tc_init();
+
llvmpipe_init_screen_texture_funcs(&screen->base);
llvmpipe_init_screen_buffer_funcs(&screen->base);
llvmpipe_init_screen_fence_funcs(&screen->base);
diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c
index 048ac5b968..7d86c5750c 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_surface.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c
@@ -32,6 +32,7 @@
#include "util/u_inlines.h"
#include "util/u_surface.h"
#include "lp_context.h"
+#include "lp_scene.h"
#include "lp_state.h"
#include "lp_setup.h"
@@ -51,6 +52,9 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe,
boolean changed = !util_framebuffer_state_equal(&lp->framebuffer, fb);
+ assert(fb->width <= MAXWIDTH);
+ assert(fb->height <= MAXHEIGHT);
+
if (changed) {
util_copy_framebuffer_state(&lp->framebuffer, fb);
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h
index 2350c26e4f..49623949bf 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.h
+++ b/src/gallium/drivers/llvmpipe/lp_texture.h
@@ -32,7 +32,7 @@
#include "pipe/p_state.h"
-#define LP_MAX_TEXTURE_2D_LEVELS 13 /* 4K x 4K for now */
+#define LP_MAX_TEXTURE_2D_LEVELS 12 /* 2K x 2K for now */
#define LP_MAX_TEXTURE_3D_LEVELS 10 /* 512 x 512 x 512 for now */
diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
index 6a3ede02a4..c1226e499c 100644
--- a/src/gallium/drivers/llvmpipe/lp_tile_soa.py
+++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py
@@ -45,6 +45,28 @@ sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), '../../auxiliary/u
from u_format_pack import *
+def is_format_supported(format):
+ '''Determines whether we actually have the plumbing necessary to generate the
+ to read/write to/from this format.'''
+
+ # FIXME: Ideally we would support any format combination here.
+
+ if format.layout != PLAIN:
+ return False
+
+ for i in range(4):
+ channel = format.channels[i]
+ if channel.type not in (VOID, UNSIGNED, SIGNED, FLOAT):
+ return False
+ if channel.type == FLOAT and channel.size not in (32 ,64):
+ return False
+
+ if format.colorspace not in ('rgb', 'srgb'):
+ return False
+
+ return True
+
+
def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
'''Generate the function to read pixels from a particular format'''
@@ -95,11 +117,16 @@ def generate_format_read(format, dst_channel, dst_native_type, dst_suffix):
shift += width
else:
for i in range(4):
+ if names[i]:
+ print ' %s %s;' % (dst_native_type, names[i])
+ for i in range(4):
src_channel = format.channels[i]
if names[i]:
value = '(*src_pixel++)'
value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
- print ' %s %s = %s;' % (dst_native_type, names[i], value)
+ print ' %s = %s;' % (names[i], value)
+ elif src_channel.size:
+ print ' ++src_pixel;'
else:
assert False
@@ -230,6 +257,8 @@ def emit_tile_pixel_write_code(format, src_channel):
value = 'TILE_PIXEL(src, x, y, %u)' % inv_swizzle[i]
value = conversion_expr(src_channel, dst_channel, dst_native_type, value, clamp=False)
print ' *dst_pixel++ = %s;' % value
+ else:
+ print ' ++dst_pixel;'
else:
assert False
@@ -251,7 +280,8 @@ def generate_format_write(format, src_channel, src_native_type, src_suffix):
and format.block_size() <= 32 \
and format.is_pot() \
and not format.is_mixed() \
- and format.channels[0].type == UNSIGNED:
+ and (format.channels[0].type == UNSIGNED \
+ or format.channels[1].type == UNSIGNED):
emit_unrolled_write_code(format, src_channel)
else:
emit_tile_pixel_write_code(format, src_channel)
@@ -325,6 +355,7 @@ def main():
print '#include "pipe/p_compiler.h"'
print '#include "util/u_format.h"'
print '#include "util/u_math.h"'
+ print '#include "util/u_half.h"'
print '#include "lp_tile_soa.h"'
print
print 'const unsigned char'