diff options
Diffstat (limited to 'src/gallium/drivers')
38 files changed, 610 insertions, 1690 deletions
diff --git a/src/gallium/drivers/i965/brw_swtnl.c b/src/gallium/drivers/i965/brw_swtnl.c index 464013e7c40..f96301e99e6 100644 --- a/src/gallium/drivers/i965/brw_swtnl.c +++ b/src/gallium/drivers/i965/brw_swtnl.c @@ -3,6 +3,8 @@ #include "brw_pipe_rast.h" +#if 0 + static GLboolean need_swtnl( struct brw_context *brw ) { const struct pipe_rasterizer_state *rast = &brw->curr.rast->templ; @@ -90,6 +92,4 @@ static GLboolean need_swtnl( struct brw_context *brw ) return FALSE; } - - - +#endif diff --git a/src/gallium/drivers/i965/brw_vs_emit.c b/src/gallium/drivers/i965/brw_vs_emit.c index 8a16205d2f6..5dcbd597ddc 100644 --- a/src/gallium/drivers/i965/brw_vs_emit.c +++ b/src/gallium/drivers/i965/brw_vs_emit.c @@ -908,6 +908,7 @@ get_constant(struct brw_vs_compile *c, } +#if 0 /* TODO: relative addressing! */ @@ -936,6 +937,8 @@ static struct brw_reg get_reg( struct brw_vs_compile *c, } } +#endif + /** * Indirect addressing: get reg[[arg] + offset]. diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index e880042b71e..31732514379 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -37,7 +37,6 @@ C_SOURCES = \ lp_surface.c \ lp_tex_sample_llvm.c \ lp_texture.c \ - lp_tile_surface.c \ lp_tile_soa.c CPP_SOURCES = \ @@ -49,11 +48,6 @@ lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxil python lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@ -# to make a .s file to inspect assembly code -.c.s: - $(CC) -S $(INCLUDES) $(DEFINES) $(CFLAGS) $(LIBRARY_DEFINES) $< - - testprogs := lp_test_format \ lp_test_blend \ lp_test_conv diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 808f4903615..9120226de0c 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -42,8 +42,6 @@ #include "lp_perf.h" #include "lp_state.h" #include "lp_surface.h" -#include "lp_texture.h" -#include "lp_winsys.h" #include "lp_query.h" #include "lp_setup.h" diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 27b54c59598..d3d7e26882d 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -40,7 +40,6 @@ #include "lp_debug.h" #include "lp_screen.h" #include "gallivm/lp_bld_intr.h" -#include "gallivm/lp_bld_misc.h" #include "lp_jit.h" diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c index 5ae323fd96c..6dbcb3c9b31 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.c +++ b/src/gallium/drivers/llvmpipe/lp_rast.c @@ -229,13 +229,58 @@ void lp_rast_clear_zstencil( struct lp_rasterizer *rast, unsigned thread_index, const union lp_rast_cmd_arg arg) { - unsigned i; - uint32_t *depth_tile = rast->tasks[thread_index].tile.depth; - + struct lp_rasterizer_task *task = &rast->tasks[thread_index]; + const unsigned tile_x = task->x; + const unsigned tile_y = task->y; + const unsigned height = TILE_SIZE/TILE_VECTOR_HEIGHT; + const unsigned width = TILE_SIZE*TILE_VECTOR_HEIGHT; + unsigned block_size = util_format_get_blocksize(rast->zsbuf_transfer->texture->format); + uint8_t *dst; + unsigned dst_stride = rast->zsbuf_transfer->stride*TILE_VECTOR_HEIGHT; + unsigned i, j; + LP_DBG(DEBUG_RAST, "%s 0x%x\n", __FUNCTION__, arg.clear_zstencil); - for (i = 0; i < TILE_SIZE * TILE_SIZE; i++) - depth_tile[i] = arg.clear_zstencil; + assert(rast->zsbuf_map); + if (!rast->zsbuf_map) + return; + + LP_DBG(DEBUG_RAST, "%s\n", __FUNCTION__); + + /* + * Clear the aera of the swizzled depth/depth buffer matching this tile, in + * stripes of TILE_VECTOR_HEIGHT x TILE_SIZE at a time. + * + * The swizzled depth format is such that the depths for + * TILE_VECTOR_HEIGHT x TILE_VECTOR_WIDTH pixels have consecutive offsets. + */ + + dst = lp_rast_depth_pointer(rast, tile_x, tile_y); + + switch (block_size) { + case 1: + memset(dst, (uint8_t) arg.clear_zstencil, height * width); + break; + case 2: + for (i = 0; i < height; i++) { + uint16_t *row = (uint16_t *)dst; + for (j = 0; j < width; j++) + *row++ = (uint16_t) arg.clear_zstencil; + dst += dst_stride; + } + break; + case 4: + for (i = 0; i < height; i++) { + uint32_t *row = (uint32_t *)dst; + for (j = 0; j < width; j++) + *row++ = arg.clear_zstencil; + dst += dst_stride; + } + break; + default: + assert(0); + break; + } } @@ -282,53 +327,6 @@ void lp_rast_load_color( struct lp_rasterizer *rast, } -static void -lp_tile_read_z32(uint32_t *tile, - const uint8_t *map, - unsigned map_stride, - unsigned x0, unsigned y0, unsigned w, unsigned h) -{ - unsigned x, y; - const uint8_t *map_row = map + y0*map_stride; - for (y = 0; y < h; ++y) { - const uint32_t *map_pixel = (uint32_t *)(map_row + x0*4); - for (x = 0; x < w; ++x) { - *tile++ = *map_pixel++; - } - map_row += map_stride; - } -} - -/** - * Load tile z/stencil from the framebuffer surface. - * This is a bin command called during bin processing. - */ -void lp_rast_load_zstencil( struct lp_rasterizer *rast, - unsigned thread_index, - const union lp_rast_cmd_arg arg ) -{ - struct lp_rasterizer_task *task = &rast->tasks[thread_index]; - const unsigned x = task->x; - const unsigned y = task->y; - unsigned w = TILE_SIZE; - unsigned h = TILE_SIZE; - - if (x + w > rast->state.fb.width) - w -= x + w - rast->state.fb.width; - - if (y + h > rast->state.fb.height) - h -= y + h - rast->state.fb.height; - - LP_DBG(DEBUG_RAST, "%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h); - - assert(rast->zsbuf_transfer->texture->format == PIPE_FORMAT_Z32_UNORM); - lp_tile_read_z32(task->tile.depth, - rast->zsbuf_map, - rast->zsbuf_transfer->stride, - x, y, w, h); -} - - void lp_rast_set_state( struct lp_rasterizer *rast, unsigned thread_index, const union lp_rast_cmd_arg arg ) @@ -377,7 +375,7 @@ void lp_rast_shade_tile( struct lp_rasterizer *rast, color[i] = tile->color[i] + 4 * block_offset; /* depth buffer */ - depth = tile->depth + block_offset; + depth = lp_rast_depth_pointer(rast, tile_x + x, tile_y + y); /* run shader */ state->jit_function[0]( &state->jit_context, @@ -435,12 +433,11 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast, color[i] = tile->color[i] + 4 * block_offset; /* depth buffer */ - depth = tile->depth + block_offset; + depth = lp_rast_depth_pointer(rast, x, y); #ifdef DEBUG - assert(lp_check_alignment(tile->depth, 16)); assert(lp_check_alignment(tile->color[0], 16)); assert(lp_check_alignment(state->jit_context.blend_color, 16)); @@ -557,49 +554,6 @@ static void lp_rast_store_color( struct lp_rasterizer *rast, } -static void -lp_tile_write_z32(const uint32_t *src, uint8_t *dst, unsigned dst_stride, - unsigned x0, unsigned y0, unsigned w, unsigned h) -{ - unsigned x, y; - uint8_t *dst_row = dst + y0*dst_stride; - for (y = 0; y < h; ++y) { - uint32_t *dst_pixel = (uint32_t *)(dst_row + x0*4); - for (x = 0; x < w; ++x) { - *dst_pixel++ = *src++; - } - dst_row += dst_stride; - } -} - -/** - * Write the rasterizer's z/stencil tile to the framebuffer. - */ -static void lp_rast_store_zstencil( struct lp_rasterizer *rast, - unsigned thread_index ) -{ - struct lp_rasterizer_task *task = &rast->tasks[thread_index]; - const unsigned x = task->x; - const unsigned y = task->y; - unsigned w = TILE_SIZE; - unsigned h = TILE_SIZE; - - if (x + w > rast->state.fb.width) - w -= x + w - rast->state.fb.width; - - if (y + h > rast->state.fb.height) - h -= y + h - rast->state.fb.height; - - LP_DBG(DEBUG_RAST, "%s %d,%d %dx%d\n", __FUNCTION__, x, y, w, h); - - assert(rast->zsbuf_transfer->texture->format == PIPE_FORMAT_Z32_UNORM); - lp_tile_write_z32(task->tile.depth, - rast->zsbuf_map, - rast->zsbuf_transfer->stride, - x, y, w, h); -} - - /** * Write the rasterizer's tiles to the framebuffer. */ @@ -611,9 +565,6 @@ lp_rast_end_tile( struct lp_rasterizer *rast, if (rast->state.write_color) lp_rast_store_color(rast, thread_index); - - if (rast->state.write_zstencil) - lp_rast_store_zstencil(rast, thread_index); } @@ -694,7 +645,6 @@ static struct { } cmd_names[] = { RAST(load_color), - RAST(load_zstencil), RAST(clear_color), RAST(clear_zstencil), RAST(triangle), @@ -753,7 +703,6 @@ is_empty_bin( const struct cmd_bin *bin ) for (i = 0; i < head->count; i++) if (head->cmd[i] != lp_rast_load_color && - head->cmd[i] != lp_rast_load_zstencil && head->cmd[i] != lp_rast_set_state) { return FALSE; } @@ -993,7 +942,6 @@ lp_rast_create( struct pipe_screen *screen, struct lp_scene_queue *empty ) for (cbuf = 0; cbuf < PIPE_MAX_COLOR_BUFS; cbuf++ ) task->tile.color[cbuf] = align_malloc(TILE_SIZE * TILE_SIZE * 4, 16); - task->tile.depth = align_malloc(TILE_SIZE * TILE_SIZE * 4, 16); task->rast = rast; task->thread_index = i; } @@ -1016,7 +964,6 @@ void lp_rast_destroy( struct lp_rasterizer *rast ) util_unreference_framebuffer_state(&rast->state.fb); for (i = 0; i < Elements(rast->tasks); i++) { - align_free(rast->tasks[i].tile.depth); for (cbuf = 0; cbuf < PIPE_MAX_COLOR_BUFS; cbuf++ ) align_free(rast->tasks[i].tile.color[cbuf]); } diff --git a/src/gallium/drivers/llvmpipe/lp_rast.h b/src/gallium/drivers/llvmpipe/lp_rast.h index 34da73eb50e..875f18e0c0c 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast.h +++ b/src/gallium/drivers/llvmpipe/lp_rast.h @@ -213,10 +213,6 @@ void lp_rast_load_color( struct lp_rasterizer *, unsigned thread_index, const union lp_rast_cmd_arg ); -void lp_rast_load_zstencil( struct lp_rasterizer *, - unsigned thread_index, - const union lp_rast_cmd_arg ); - void lp_rast_set_state( struct lp_rasterizer *, unsigned thread_index, const union lp_rast_cmd_arg ); diff --git a/src/gallium/drivers/llvmpipe/lp_rast_priv.h b/src/gallium/drivers/llvmpipe/lp_rast_priv.h index 71e3a301e61..5c5497e0929 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_priv.h @@ -29,6 +29,8 @@ #define LP_RAST_PRIV_H #include "os/os_thread.h" +#include "util/u_format.h" +#include "gallivm/lp_bld_debug.h" #include "lp_rast.h" #include "lp_tile_soa.h" @@ -48,8 +50,6 @@ struct lp_rasterizer; struct lp_rast_tile { uint8_t *color[PIPE_MAX_COLOR_BUFS]; - - uint32_t *depth; }; @@ -91,7 +91,7 @@ struct lp_rasterizer struct pipe_transfer *cbuf_transfer[PIPE_MAX_COLOR_BUFS]; struct pipe_transfer *zsbuf_transfer; void *cbuf_map[PIPE_MAX_COLOR_BUFS]; - void *zsbuf_map; + uint8_t *zsbuf_map; struct { struct pipe_framebuffer_state fb; @@ -129,6 +129,31 @@ void lp_rast_shade_quads( struct lp_rasterizer *rast, /** + * Get the pointer to the depth buffer for a block. + * \param x, y location of 4x4 block in window coords + */ +static INLINE void * +lp_rast_depth_pointer( struct lp_rasterizer *rast, + unsigned x, unsigned y ) +{ + void * depth; + assert((x % TILE_VECTOR_WIDTH) == 0); + assert((y % TILE_VECTOR_HEIGHT) == 0); + if(!rast->zsbuf_map) + return NULL; + assert(rast->zsbuf_transfer); + depth = rast->zsbuf_map + + y*rast->zsbuf_transfer->stride + + TILE_VECTOR_HEIGHT*x*util_format_get_blocksize(rast->zsbuf_transfer->texture->format); +#ifdef DEBUG + assert(lp_check_alignment(depth, 16)); +#endif + return depth; +} + + + +/** * Shade all pixels in a 4x4 block. The fragment code omits the * triangle in/out tests. * \param x, y location of 4x4 block in window coords @@ -153,8 +178,7 @@ lp_rast_shade_quads_all( struct lp_rasterizer *rast, for (i = 0; i < rast->state.fb.nr_cbufs; i++) color[i] = tile->color[i] + 4 * block_offset; - /* depth buffer */ - depth = tile->depth + block_offset; + depth = lp_rast_depth_pointer(rast, x, y); /* run shader */ state->jit_function[0]( &state->jit_context, diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 3186069899d..538492bebac 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -45,6 +45,8 @@ #include "lp_fence.h" #include "lp_rast.h" #include "lp_setup_context.h" +#include "lp_screen.h" +#include "lp_winsys.h" #include "draw/draw_context.h" #include "draw/draw_vbuf.h" @@ -172,10 +174,6 @@ begin_binning( struct setup_context *setup ) lp_scene_bin_everywhere( scene, lp_rast_clear_zstencil, setup->clear.zstencil ); - else - lp_scene_bin_everywhere( scene, - lp_rast_load_zstencil, - lp_rast_arg_null() ); } LP_DBG(DEBUG_SETUP, "%s done\n", __FUNCTION__); @@ -476,11 +474,20 @@ lp_setup_set_sampler_textures( struct setup_context *setup, jit_tex->width = tex->width0; jit_tex->height = tex->height0; jit_tex->stride = lp_tex->stride[0]; - if(!lp_tex->dt) + if(!lp_tex->dt) { jit_tex->data = lp_tex->data; - else - /* FIXME: map the rendertarget */ - assert(0); + } + else { + /* + * XXX: Where should this be unmapped? + */ + + struct llvmpipe_screen *screen = llvmpipe_screen(tex->screen); + struct llvmpipe_winsys *winsys = screen->winsys; + jit_tex->data = winsys->displaytarget_map(winsys, lp_tex->dt, + PIPE_BUFFER_USAGE_CPU_READ); + assert(jit_tex->data); + } /* the scene references this texture */ { diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index 9e59a6602cc..a8bf540803b 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -442,8 +442,11 @@ do_triangle_ccw(struct setup_context *setup, maxx = maxx / TILE_SIZE; maxy = maxy / TILE_SIZE; - /* Clamp maxx, maxy to framebuffer size + /* + * Clamp to framebuffer size */ + minx = MAX2(minx, 0); + miny = MAX2(miny, 0); maxx = MIN2(maxx, scene->tiles_x - 1); maxy = MIN2(maxy, scene->tiles_y - 1); diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c index 156cb2d229b..81bc296ab44 100644 --- a/src/gallium/drivers/nouveau/nouveau_screen.c +++ b/src/gallium/drivers/nouveau/nouveau_screen.c @@ -55,7 +55,7 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment, { struct nouveau_device *dev = nouveau_screen(pscreen)->device; struct nouveau_bo *bo = NULL; - uint32_t flags = NOUVEAU_BO_MAP; + uint32_t flags = NOUVEAU_BO_MAP, tile_mode = 0, tile_flags = 0; int ret; if (usage & NOUVEAU_BUFFER_USAGE_TRANSFER) @@ -77,13 +77,15 @@ nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment, flags |= NOUVEAU_BO_VRAM; if (dev->chipset == 0x50 || dev->chipset >= 0x80) { - flags |= NOUVEAU_BO_TILED; if (usage & NOUVEAU_BUFFER_USAGE_ZETA) - flags |= NOUVEAU_BO_ZTILE; + tile_flags = 0x2800; + else + tile_flags = 0x7000; } } - ret = nouveau_bo_new(dev, flags, alignment, size, &bo); + ret = nouveau_bo_new_tile(dev, flags, alignment, size, + tile_mode, tile_flags, &bo); if (ret) return NULL; diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c deleted file mode 100644 index 6f674d6e13f..00000000000 --- a/src/gallium/drivers/nv10/nv10_state.c +++ /dev/null @@ -1,590 +0,0 @@ -#include "draw/draw_context.h" -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "pipe/p_shader_tokens.h" -#include "pipe/p_inlines.h" - -#include "tgsi/tgsi_parse.h" - -#include "nv10_context.h" -#include "nv10_state.h" - -static void * -nv10_blend_state_create(struct pipe_context *pipe, - const struct pipe_blend_state *cso) -{ - struct nv10_blend_state *cb; - - cb = MALLOC(sizeof(struct nv10_blend_state)); - - cb->b_enable = cso->blend_enable ? 1 : 0; - cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) | - (nvgl_blend_func(cso->rgb_src_factor))); - cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) | - (nvgl_blend_func(cso->rgb_dst_factor))); - - cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) | - ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) | - ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) | - ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0)); - - cb->d_enable = cso->dither ? 1 : 0; - - return (void *)cb; -} - -static void -nv10_blend_state_bind(struct pipe_context *pipe, void *blend) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - nv10->blend = (struct nv10_blend_state*)blend; - - nv10->dirty |= NV10_NEW_BLEND; -} - -static void -nv10_blend_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - - -static INLINE unsigned -wrap_mode(unsigned wrap) { - unsigned ret; - - switch (wrap) { - case PIPE_TEX_WRAP_REPEAT: - ret = NV10TCL_TX_FORMAT_WRAP_S_REPEAT; - break; - case PIPE_TEX_WRAP_MIRROR_REPEAT: - ret = NV10TCL_TX_FORMAT_WRAP_S_MIRRORED_REPEAT; - break; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_EDGE; - break; - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP_TO_BORDER; - break; - case PIPE_TEX_WRAP_CLAMP: - ret = NV10TCL_TX_FORMAT_WRAP_S_CLAMP; - break; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: - case PIPE_TEX_WRAP_MIRROR_CLAMP: - default: - NOUVEAU_ERR("unknown wrap mode: %d\n", wrap); - ret = NV10TCL_TX_FORMAT_WRAP_S_REPEAT; - break; - } - - return ret >> NV10TCL_TX_FORMAT_WRAP_S_SHIFT; -} - -static void * -nv10_sampler_state_create(struct pipe_context *pipe, - const struct pipe_sampler_state *cso) -{ - struct nv10_sampler_state *ps; - uint32_t filter = 0; - - ps = MALLOC(sizeof(struct nv10_sampler_state)); - - ps->wrap = ((wrap_mode(cso->wrap_s) << NV10TCL_TX_FORMAT_WRAP_S_SHIFT) | - (wrap_mode(cso->wrap_t) << NV10TCL_TX_FORMAT_WRAP_T_SHIFT)); - - ps->en = 0; - if (cso->max_anisotropy > 1.0) { - /* no idea, binary driver sets it, works without it.. meh.. */ - ps->wrap |= (1 << 5); - -/* if (cso->max_anisotropy >= 16.0) { - ps->en |= NV10TCL_TX_ENABLE_ANISO_16X; - } else - if (cso->max_anisotropy >= 12.0) { - ps->en |= NV10TCL_TX_ENABLE_ANISO_12X; - } else - if (cso->max_anisotropy >= 10.0) { - ps->en |= NV10TCL_TX_ENABLE_ANISO_10X; - } else - if (cso->max_anisotropy >= 8.0) { - ps->en |= NV10TCL_TX_ENABLE_ANISO_8X; - } else - if (cso->max_anisotropy >= 6.0) { - ps->en |= NV10TCL_TX_ENABLE_ANISO_6X; - } else - if (cso->max_anisotropy >= 4.0) { - ps->en |= NV10TCL_TX_ENABLE_ANISO_4X; - } else { - ps->en |= NV10TCL_TX_ENABLE_ANISO_2X; - }*/ - } - - switch (cso->mag_img_filter) { - case PIPE_TEX_FILTER_LINEAR: - filter |= NV10TCL_TX_FILTER_MAGNIFY_LINEAR; - break; - case PIPE_TEX_FILTER_NEAREST: - default: - filter |= NV10TCL_TX_FILTER_MAGNIFY_NEAREST; - break; - } - - switch (cso->min_img_filter) { - case PIPE_TEX_FILTER_LINEAR: - switch (cso->min_mip_filter) { - case PIPE_TEX_MIPFILTER_NEAREST: - filter |= NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST; - break; - case PIPE_TEX_MIPFILTER_LINEAR: - filter |= NV10TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR; - break; - case PIPE_TEX_MIPFILTER_NONE: - default: - filter |= NV10TCL_TX_FILTER_MINIFY_LINEAR; - break; - } - break; - case PIPE_TEX_FILTER_NEAREST: - default: - switch (cso->min_mip_filter) { - case PIPE_TEX_MIPFILTER_NEAREST: - filter |= NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST; - break; - case PIPE_TEX_MIPFILTER_LINEAR: - filter |= NV10TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR; - break; - case PIPE_TEX_MIPFILTER_NONE: - default: - filter |= NV10TCL_TX_FILTER_MINIFY_NEAREST; - break; - } - break; - } - - ps->filt = filter; - -/* if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - switch (cso->compare_func) { - case PIPE_FUNC_NEVER: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NEVER; - break; - case PIPE_FUNC_GREATER: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GREATER; - break; - case PIPE_FUNC_EQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_EQUAL; - break; - case PIPE_FUNC_GEQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GEQUAL; - break; - case PIPE_FUNC_LESS: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LESS; - break; - case PIPE_FUNC_NOTEQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NOTEQUAL; - break; - case PIPE_FUNC_LEQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LEQUAL; - break; - case PIPE_FUNC_ALWAYS: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_ALWAYS; - break; - default: - break; - } - }*/ - - ps->bcol = ((float_to_ubyte(cso->border_color[3]) << 24) | - (float_to_ubyte(cso->border_color[0]) << 16) | - (float_to_ubyte(cso->border_color[1]) << 8) | - (float_to_ubyte(cso->border_color[2]) << 0)); - - return (void *)ps; -} - -static void -nv10_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) -{ - struct nv10_context *nv10 = nv10_context(pipe); - unsigned unit; - - for (unit = 0; unit < nr; unit++) { - nv10->tex_sampler[unit] = sampler[unit]; - nv10->dirty_samplers |= (1 << unit); - } -} - -static void -nv10_sampler_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void -nv10_set_sampler_texture(struct pipe_context *pipe, unsigned nr, - struct pipe_texture **miptree) -{ - struct nv10_context *nv10 = nv10_context(pipe); - unsigned unit; - - for (unit = 0; unit < nr; unit++) { - nv10->tex_miptree[unit] = (struct nv10_miptree *)miptree[unit]; - nv10->dirty_samplers |= (1 << unit); - } -} - -static void * -nv10_rasterizer_state_create(struct pipe_context *pipe, - const struct pipe_rasterizer_state *cso) -{ - struct nv10_rasterizer_state *rs; - int i; - - /*XXX: ignored: - * light_twoside - * offset_cw/ccw -nohw - * scissor - * point_smooth -nohw - * multisample - * offset_units / offset_scale - */ - rs = MALLOC(sizeof(struct nv10_rasterizer_state)); - - rs->templ = cso; - - rs->shade_model = cso->flatshade ? 0x1d00 : 0x1d01; - - rs->line_width = (unsigned char)(cso->line_width * 8.0) & 0xff; - rs->line_smooth_en = cso->line_smooth ? 1 : 0; - - rs->point_size = *(uint32_t*)&cso->point_size; - - rs->poly_smooth_en = cso->poly_smooth ? 1 : 0; - - if (cso->front_winding == PIPE_WINDING_CCW) { - rs->front_face = NV10TCL_FRONT_FACE_CCW; - rs->poly_mode_front = nvgl_polygon_mode(cso->fill_ccw); - rs->poly_mode_back = nvgl_polygon_mode(cso->fill_cw); - } else { - rs->front_face = NV10TCL_FRONT_FACE_CW; - rs->poly_mode_front = nvgl_polygon_mode(cso->fill_cw); - rs->poly_mode_back = nvgl_polygon_mode(cso->fill_ccw); - } - - switch (cso->cull_mode) { - case PIPE_WINDING_CCW: - rs->cull_face_en = 1; - if (cso->front_winding == PIPE_WINDING_CCW) - rs->cull_face = NV10TCL_CULL_FACE_FRONT; - else - rs->cull_face = NV10TCL_CULL_FACE_BACK; - break; - case PIPE_WINDING_CW: - rs->cull_face_en = 1; - if (cso->front_winding == PIPE_WINDING_CW) - rs->cull_face = NV10TCL_CULL_FACE_FRONT; - else - rs->cull_face = NV10TCL_CULL_FACE_BACK; - break; - case PIPE_WINDING_BOTH: - rs->cull_face_en = 1; - rs->cull_face = NV10TCL_CULL_FACE_FRONT_AND_BACK; - break; - case PIPE_WINDING_NONE: - default: - rs->cull_face_en = 0; - rs->cull_face = 0; - break; - } - - if (cso->sprite_coord_enable) { - rs->point_sprite = (1 << 0); - for (i = 0; i < 8; i++) { - if ((cso->sprite_coord_enable >> i) & 1) - rs->point_sprite |= (1 << (8 + i)); - } - } else { - rs->point_sprite = 0; - } - - return (void *)rs; -} - -static void -nv10_rasterizer_state_bind(struct pipe_context *pipe, void *rast) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - nv10->rast = (struct nv10_rasterizer_state*)rast; - - draw_set_rasterizer_state(nv10->draw, (nv10->rast ? nv10->rast->templ : NULL)); - - nv10->dirty |= NV10_NEW_RAST; -} - -static void -nv10_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void * -nv10_depth_stencil_alpha_state_create(struct pipe_context *pipe, - const struct pipe_depth_stencil_alpha_state *cso) -{ - struct nv10_depth_stencil_alpha_state *hw; - - hw = MALLOC(sizeof(struct nv10_depth_stencil_alpha_state)); - - hw->depth.func = nvgl_comparison_op(cso->depth.func); - hw->depth.write_enable = cso->depth.writemask ? 1 : 0; - hw->depth.test_enable = cso->depth.enabled ? 1 : 0; - - hw->stencil.enable = cso->stencil[0].enabled ? 1 : 0; - hw->stencil.wmask = cso->stencil[0].writemask; - hw->stencil.func = nvgl_comparison_op(cso->stencil[0].func); - hw->stencil.ref = cso->stencil[0].ref_value; - hw->stencil.vmask = cso->stencil[0].valuemask; - hw->stencil.fail = nvgl_stencil_op(cso->stencil[0].fail_op); - hw->stencil.zfail = nvgl_stencil_op(cso->stencil[0].zfail_op); - hw->stencil.zpass = nvgl_stencil_op(cso->stencil[0].zpass_op); - - hw->alpha.enabled = cso->alpha.enabled ? 1 : 0; - hw->alpha.func = nvgl_comparison_op(cso->alpha.func); - hw->alpha.ref = float_to_ubyte(cso->alpha.ref_value); - - return (void *)hw; -} - -static void -nv10_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *dsa) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - nv10->dsa = (struct nv10_depth_stencil_alpha_state*)dsa; - - nv10->dirty |= NV10_NEW_DSA; -} - -static void -nv10_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void * -nv10_vp_state_create(struct pipe_context *pipe, - const struct pipe_shader_state *templ) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - return draw_create_vertex_shader(nv10->draw, templ); -} - -static void -nv10_vp_state_bind(struct pipe_context *pipe, void *shader) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - draw_bind_vertex_shader(nv10->draw, (struct draw_vertex_shader *) shader); - - nv10->dirty |= NV10_NEW_VERTPROG; -} - -static void -nv10_vp_state_delete(struct pipe_context *pipe, void *shader) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - draw_delete_vertex_shader(nv10->draw, (struct draw_vertex_shader *) shader); -} - -static void * -nv10_fp_state_create(struct pipe_context *pipe, - const struct pipe_shader_state *cso) -{ - struct nv10_fragment_program *fp; - - fp = CALLOC(1, sizeof(struct nv10_fragment_program)); - fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - - tgsi_scan_shader(cso->tokens, &fp->info); - - return (void *)fp; -} - -static void -nv10_fp_state_bind(struct pipe_context *pipe, void *hwcso) -{ - struct nv10_context *nv10 = nv10_context(pipe); - struct nv10_fragment_program *fp = hwcso; - - nv10->fragprog.current = fp; - nv10->dirty |= NV10_NEW_FRAGPROG; -} - -static void -nv10_fp_state_delete(struct pipe_context *pipe, void *hwcso) -{ - struct nv10_context *nv10 = nv10_context(pipe); - struct nv10_fragment_program *fp = hwcso; - - nv10_fragprog_destroy(nv10, fp); - FREE((void*)fp->pipe.tokens); - FREE(fp); -} - -static void -nv10_set_blend_color(struct pipe_context *pipe, - const struct pipe_blend_color *bcol) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - nv10->blend_color = (struct pipe_blend_color*)bcol; - - nv10->dirty |= NV10_NEW_BLENDCOL; -} - -static void -nv10_set_clip_state(struct pipe_context *pipe, - const struct pipe_clip_state *clip) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - draw_set_clip_state(nv10->draw, clip); -} - -static void -nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, - const struct pipe_constant_buffer *buf ) -{ - struct nv10_context *nv10 = nv10_context(pipe); - struct pipe_screen *pscreen = pipe->screen; - - assert(shader < PIPE_SHADER_TYPES); - assert(index == 0); - - if (buf) { - void *mapped; - if (buf->buffer && buf->buffer->size && - (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) - { - memcpy(nv10->constbuf[shader], mapped, buf->buffer->size); - nv10->constbuf_nr[shader] = - buf->buffer->size / (4 * sizeof(float)); - pipe_buffer_unmap(pscreen, buf->buffer); - } - } -} - -static void -nv10_set_framebuffer_state(struct pipe_context *pipe, - const struct pipe_framebuffer_state *fb) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - nv10->framebuffer = (struct pipe_framebuffer_state*)fb; - - nv10->dirty |= NV10_NEW_FRAMEBUFFER; -} - -static void -nv10_set_polygon_stipple(struct pipe_context *pipe, - const struct pipe_poly_stipple *stipple) -{ - NOUVEAU_ERR("line stipple hahaha\n"); -} - -static void -nv10_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *s) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - nv10->scissor = (struct pipe_scissor_state*)s; - - nv10->dirty |= NV10_NEW_SCISSOR; -} - -static void -nv10_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *vpt) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - nv10->viewport = (struct pipe_viewport_state*)vpt; - - draw_set_viewport_state(nv10->draw, nv10->viewport); - - nv10->dirty |= NV10_NEW_VIEWPORT; -} - -static void -nv10_set_vertex_buffers(struct pipe_context *pipe, unsigned count, - const struct pipe_vertex_buffer *vb) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - memcpy(nv10->vtxbuf, vb, sizeof(*vb) * count); - nv10->dirty |= NV10_NEW_VTXARRAYS; - - draw_set_vertex_buffers(nv10->draw, count, vb); -} - -static void -nv10_set_vertex_elements(struct pipe_context *pipe, unsigned count, - const struct pipe_vertex_element *ve) -{ - struct nv10_context *nv10 = nv10_context(pipe); - - memcpy(nv10->vtxelt, ve, sizeof(*ve) * count); - nv10->dirty |= NV10_NEW_VTXARRAYS; - - draw_set_vertex_elements(nv10->draw, count, ve); -} - -void -nv10_init_state_functions(struct nv10_context *nv10) -{ - nv10->pipe.create_blend_state = nv10_blend_state_create; - nv10->pipe.bind_blend_state = nv10_blend_state_bind; - nv10->pipe.delete_blend_state = nv10_blend_state_delete; - - nv10->pipe.create_sampler_state = nv10_sampler_state_create; - nv10->pipe.bind_fragment_sampler_states = nv10_sampler_state_bind; - nv10->pipe.delete_sampler_state = nv10_sampler_state_delete; - nv10->pipe.set_fragment_sampler_textures = nv10_set_sampler_texture; - - nv10->pipe.create_rasterizer_state = nv10_rasterizer_state_create; - nv10->pipe.bind_rasterizer_state = nv10_rasterizer_state_bind; - nv10->pipe.delete_rasterizer_state = nv10_rasterizer_state_delete; - - nv10->pipe.create_depth_stencil_alpha_state = - nv10_depth_stencil_alpha_state_create; - nv10->pipe.bind_depth_stencil_alpha_state = - nv10_depth_stencil_alpha_state_bind; - nv10->pipe.delete_depth_stencil_alpha_state = - nv10_depth_stencil_alpha_state_delete; - - nv10->pipe.create_vs_state = nv10_vp_state_create; - nv10->pipe.bind_vs_state = nv10_vp_state_bind; - nv10->pipe.delete_vs_state = nv10_vp_state_delete; - - nv10->pipe.create_fs_state = nv10_fp_state_create; - nv10->pipe.bind_fs_state = nv10_fp_state_bind; - nv10->pipe.delete_fs_state = nv10_fp_state_delete; - - nv10->pipe.set_blend_color = nv10_set_blend_color; - nv10->pipe.set_clip_state = nv10_set_clip_state; - nv10->pipe.set_constant_buffer = nv10_set_constant_buffer; - nv10->pipe.set_framebuffer_state = nv10_set_framebuffer_state; - nv10->pipe.set_polygon_stipple = nv10_set_polygon_stipple; - nv10->pipe.set_scissor_state = nv10_set_scissor_state; - nv10->pipe.set_viewport_state = nv10_set_viewport_state; - - nv10->pipe.set_vertex_buffers = nv10_set_vertex_buffers; - nv10->pipe.set_vertex_elements = nv10_set_vertex_elements; -} - diff --git a/src/gallium/drivers/nv20/nv20_state.c b/src/gallium/drivers/nv20/nv20_state.c deleted file mode 100644 index 3d9a276fa12..00000000000 --- a/src/gallium/drivers/nv20/nv20_state.c +++ /dev/null @@ -1,583 +0,0 @@ -#include "draw/draw_context.h" -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "pipe/p_shader_tokens.h" -#include "pipe/p_inlines.h" - -#include "tgsi/tgsi_parse.h" - -#include "nv20_context.h" -#include "nv20_state.h" - -static void * -nv20_blend_state_create(struct pipe_context *pipe, - const struct pipe_blend_state *cso) -{ - struct nv20_blend_state *cb; - - cb = MALLOC(sizeof(struct nv20_blend_state)); - - cb->b_enable = cso->blend_enable ? 1 : 0; - cb->b_srcfunc = ((nvgl_blend_func(cso->alpha_src_factor)<<16) | - (nvgl_blend_func(cso->rgb_src_factor))); - cb->b_dstfunc = ((nvgl_blend_func(cso->alpha_dst_factor)<<16) | - (nvgl_blend_func(cso->rgb_dst_factor))); - - cb->c_mask = (((cso->colormask & PIPE_MASK_A) ? (0x01<<24) : 0) | - ((cso->colormask & PIPE_MASK_R) ? (0x01<<16) : 0) | - ((cso->colormask & PIPE_MASK_G) ? (0x01<< 8) : 0) | - ((cso->colormask & PIPE_MASK_B) ? (0x01<< 0) : 0)); - - cb->d_enable = cso->dither ? 1 : 0; - - return (void *)cb; -} - -static void -nv20_blend_state_bind(struct pipe_context *pipe, void *blend) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - nv20->blend = (struct nv20_blend_state*)blend; - - nv20->dirty |= NV20_NEW_BLEND; -} - -static void -nv20_blend_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - - -static INLINE unsigned -wrap_mode(unsigned wrap) { - unsigned ret; - - switch (wrap) { - case PIPE_TEX_WRAP_REPEAT: - ret = NV20TCL_TX_WRAP_S_REPEAT; - break; - case PIPE_TEX_WRAP_MIRROR_REPEAT: - ret = NV20TCL_TX_WRAP_S_MIRRORED_REPEAT; - break; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - ret = NV20TCL_TX_WRAP_S_CLAMP_TO_EDGE; - break; - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - ret = NV20TCL_TX_WRAP_S_CLAMP_TO_BORDER; - break; - case PIPE_TEX_WRAP_CLAMP: - ret = NV20TCL_TX_WRAP_S_CLAMP; - break; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: - case PIPE_TEX_WRAP_MIRROR_CLAMP: - default: - NOUVEAU_ERR("unknown wrap mode: %d\n", wrap); - ret = NV20TCL_TX_WRAP_S_REPEAT; - break; - } - - return (ret >> NV20TCL_TX_WRAP_S_SHIFT); -} - -static void * -nv20_sampler_state_create(struct pipe_context *pipe, - const struct pipe_sampler_state *cso) -{ - struct nv20_sampler_state *ps; - uint32_t filter = 0; - - ps = MALLOC(sizeof(struct nv20_sampler_state)); - - ps->wrap = ((wrap_mode(cso->wrap_s) << NV20TCL_TX_WRAP_S_SHIFT) | - (wrap_mode(cso->wrap_t) << NV20TCL_TX_WRAP_T_SHIFT)); - - ps->en = 0; - if (cso->max_anisotropy > 1.0) { - /* no idea, binary driver sets it, works without it.. meh.. */ - ps->wrap |= (1 << 5); - -/* if (cso->max_anisotropy >= 8.0) { - ps->en |= NV20TCL_TX_ENABLE_ANISO_8X; - } else - if (cso->max_anisotropy >= 4.0) { - ps->en |= NV20TCL_TX_ENABLE_ANISO_4X; - } else { - ps->en |= NV20TCL_TX_ENABLE_ANISO_2X; - }*/ - } - - switch (cso->mag_img_filter) { - case PIPE_TEX_FILTER_LINEAR: - filter |= NV20TCL_TX_FILTER_MAGNIFY_LINEAR; - break; - case PIPE_TEX_FILTER_NEAREST: - default: - filter |= NV20TCL_TX_FILTER_MAGNIFY_NEAREST; - break; - } - - switch (cso->min_img_filter) { - case PIPE_TEX_FILTER_LINEAR: - switch (cso->min_mip_filter) { - case PIPE_TEX_MIPFILTER_NEAREST: - filter |= - NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_NEAREST; - break; - case PIPE_TEX_MIPFILTER_LINEAR: - filter |= NV20TCL_TX_FILTER_MINIFY_LINEAR_MIPMAP_LINEAR; - break; - case PIPE_TEX_MIPFILTER_NONE: - default: - filter |= NV20TCL_TX_FILTER_MINIFY_LINEAR; - break; - } - break; - case PIPE_TEX_FILTER_NEAREST: - default: - switch (cso->min_mip_filter) { - case PIPE_TEX_MIPFILTER_NEAREST: - filter |= - NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_NEAREST; - break; - case PIPE_TEX_MIPFILTER_LINEAR: - filter |= - NV20TCL_TX_FILTER_MINIFY_NEAREST_MIPMAP_LINEAR; - break; - case PIPE_TEX_MIPFILTER_NONE: - default: - filter |= NV20TCL_TX_FILTER_MINIFY_NEAREST; - break; - } - break; - } - - ps->filt = filter; - -/* if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - switch (cso->compare_func) { - case PIPE_FUNC_NEVER: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NEVER; - break; - case PIPE_FUNC_GREATER: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GREATER; - break; - case PIPE_FUNC_EQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_EQUAL; - break; - case PIPE_FUNC_GEQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_GEQUAL; - break; - case PIPE_FUNC_LESS: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LESS; - break; - case PIPE_FUNC_NOTEQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_NOTEQUAL; - break; - case PIPE_FUNC_LEQUAL: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_LEQUAL; - break; - case PIPE_FUNC_ALWAYS: - ps->wrap |= NV10TCL_TX_WRAP_RCOMP_ALWAYS; - break; - default: - break; - } - }*/ - - ps->bcol = ((float_to_ubyte(cso->border_color[3]) << 24) | - (float_to_ubyte(cso->border_color[0]) << 16) | - (float_to_ubyte(cso->border_color[1]) << 8) | - (float_to_ubyte(cso->border_color[2]) << 0)); - - return (void *)ps; -} - -static void -nv20_sampler_state_bind(struct pipe_context *pipe, unsigned nr, void **sampler) -{ - struct nv20_context *nv20 = nv20_context(pipe); - unsigned unit; - - for (unit = 0; unit < nr; unit++) { - nv20->tex_sampler[unit] = sampler[unit]; - nv20->dirty_samplers |= (1 << unit); - } -} - -static void -nv20_sampler_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void -nv20_set_sampler_texture(struct pipe_context *pipe, unsigned nr, - struct pipe_texture **miptree) -{ - struct nv20_context *nv20 = nv20_context(pipe); - unsigned unit; - - for (unit = 0; unit < nr; unit++) { - nv20->tex_miptree[unit] = (struct nv20_miptree *)miptree[unit]; - nv20->dirty_samplers |= (1 << unit); - } -} - -static void * -nv20_rasterizer_state_create(struct pipe_context *pipe, - const struct pipe_rasterizer_state *cso) -{ - struct nv20_rasterizer_state *rs; - int i; - - /*XXX: ignored: - * light_twoside - * offset_cw/ccw -nohw - * scissor - * point_smooth -nohw - * multisample - * offset_units / offset_scale - */ - rs = MALLOC(sizeof(struct nv20_rasterizer_state)); - - rs->templ = cso; - - rs->shade_model = cso->flatshade ? NV20TCL_SHADE_MODEL_FLAT : - NV20TCL_SHADE_MODEL_SMOOTH; - - rs->line_width = (unsigned char)(cso->line_width * 8.0) & 0xff; - rs->line_smooth_en = cso->line_smooth ? 1 : 0; - - /* XXX: nv20 and nv25 different! */ - rs->point_size = *(uint32_t*)&cso->point_size; - - rs->poly_smooth_en = cso->poly_smooth ? 1 : 0; - - if (cso->front_winding == PIPE_WINDING_CCW) { - rs->front_face = NV20TCL_FRONT_FACE_CCW; - rs->poly_mode_front = nvgl_polygon_mode(cso->fill_ccw); - rs->poly_mode_back = nvgl_polygon_mode(cso->fill_cw); - } else { - rs->front_face = NV20TCL_FRONT_FACE_CW; - rs->poly_mode_front = nvgl_polygon_mode(cso->fill_cw); - rs->poly_mode_back = nvgl_polygon_mode(cso->fill_ccw); - } - - switch (cso->cull_mode) { - case PIPE_WINDING_CCW: - rs->cull_face_en = 1; - if (cso->front_winding == PIPE_WINDING_CCW) - rs->cull_face = NV20TCL_CULL_FACE_FRONT; - else - rs->cull_face = NV20TCL_CULL_FACE_BACK; - break; - case PIPE_WINDING_CW: - rs->cull_face_en = 1; - if (cso->front_winding == PIPE_WINDING_CW) - rs->cull_face = NV20TCL_CULL_FACE_FRONT; - else - rs->cull_face = NV20TCL_CULL_FACE_BACK; - break; - case PIPE_WINDING_BOTH: - rs->cull_face_en = 1; - rs->cull_face = NV20TCL_CULL_FACE_FRONT_AND_BACK; - break; - case PIPE_WINDING_NONE: - default: - rs->cull_face_en = 0; - rs->cull_face = 0; - break; - } - - if (cso->sprite_coord_enable) { - rs->point_sprite = (1 << 0); - for (i = 0; i < 8; i++) { - if ((cso->sprite_coord_enable >> i) & 1) - rs->point_sprite |= (1 << (8 + i)); - } - } else { - rs->point_sprite = 0; - } - - return (void *)rs; -} - -static void -nv20_rasterizer_state_bind(struct pipe_context *pipe, void *rast) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - nv20->rast = (struct nv20_rasterizer_state*)rast; - - draw_set_rasterizer_state(nv20->draw, (nv20->rast ? nv20->rast->templ : NULL)); - - nv20->dirty |= NV20_NEW_RAST; -} - -static void -nv20_rasterizer_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void * -nv20_depth_stencil_alpha_state_create(struct pipe_context *pipe, - const struct pipe_depth_stencil_alpha_state *cso) -{ - struct nv20_depth_stencil_alpha_state *hw; - - hw = MALLOC(sizeof(struct nv20_depth_stencil_alpha_state)); - - hw->depth.func = nvgl_comparison_op(cso->depth.func); - hw->depth.write_enable = cso->depth.writemask ? 1 : 0; - hw->depth.test_enable = cso->depth.enabled ? 1 : 0; - - hw->stencil.enable = cso->stencil[0].enabled ? 1 : 0; - hw->stencil.wmask = cso->stencil[0].writemask; - hw->stencil.func = nvgl_comparison_op(cso->stencil[0].func); - hw->stencil.ref = cso->stencil[0].ref_value; - hw->stencil.vmask = cso->stencil[0].valuemask; - hw->stencil.fail = nvgl_stencil_op(cso->stencil[0].fail_op); - hw->stencil.zfail = nvgl_stencil_op(cso->stencil[0].zfail_op); - hw->stencil.zpass = nvgl_stencil_op(cso->stencil[0].zpass_op); - - hw->alpha.enabled = cso->alpha.enabled ? 1 : 0; - hw->alpha.func = nvgl_comparison_op(cso->alpha.func); - hw->alpha.ref = float_to_ubyte(cso->alpha.ref_value); - - return (void *)hw; -} - -static void -nv20_depth_stencil_alpha_state_bind(struct pipe_context *pipe, void *dsa) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - nv20->dsa = (struct nv20_depth_stencil_alpha_state*)dsa; - - nv20->dirty |= NV20_NEW_DSA; -} - -static void -nv20_depth_stencil_alpha_state_delete(struct pipe_context *pipe, void *hwcso) -{ - FREE(hwcso); -} - -static void * -nv20_vp_state_create(struct pipe_context *pipe, - const struct pipe_shader_state *templ) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - return draw_create_vertex_shader(nv20->draw, templ); -} - -static void -nv20_vp_state_bind(struct pipe_context *pipe, void *shader) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - draw_bind_vertex_shader(nv20->draw, (struct draw_vertex_shader *) shader); - - nv20->dirty |= NV20_NEW_VERTPROG; -} - -static void -nv20_vp_state_delete(struct pipe_context *pipe, void *shader) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - draw_delete_vertex_shader(nv20->draw, (struct draw_vertex_shader *) shader); -} - -static void * -nv20_fp_state_create(struct pipe_context *pipe, - const struct pipe_shader_state *cso) -{ - struct nv20_fragment_program *fp; - - fp = CALLOC(1, sizeof(struct nv20_fragment_program)); - fp->pipe.tokens = tgsi_dup_tokens(cso->tokens); - - tgsi_scan_shader(cso->tokens, &fp->info); - - return (void *)fp; -} - -static void -nv20_fp_state_bind(struct pipe_context *pipe, void *hwcso) -{ - struct nv20_context *nv20 = nv20_context(pipe); - struct nv20_fragment_program *fp = hwcso; - - nv20->fragprog.current = fp; - nv20->dirty |= NV20_NEW_FRAGPROG; -} - -static void -nv20_fp_state_delete(struct pipe_context *pipe, void *hwcso) -{ - struct nv20_context *nv20 = nv20_context(pipe); - struct nv20_fragment_program *fp = hwcso; - - nv20_fragprog_destroy(nv20, fp); - FREE((void*)fp->pipe.tokens); - FREE(fp); -} - -static void -nv20_set_blend_color(struct pipe_context *pipe, - const struct pipe_blend_color *bcol) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - nv20->blend_color = (struct pipe_blend_color*)bcol; - - nv20->dirty |= NV20_NEW_BLENDCOL; -} - -static void -nv20_set_clip_state(struct pipe_context *pipe, - const struct pipe_clip_state *clip) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - draw_set_clip_state(nv20->draw, clip); -} - -static void -nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, - const struct pipe_constant_buffer *buf ) -{ - struct nv20_context *nv20 = nv20_context(pipe); - struct pipe_screen *pscreen = pipe->screen; - - assert(shader < PIPE_SHADER_TYPES); - assert(index == 0); - - if (buf) { - void *mapped; - if (buf->buffer && buf->buffer->size && - (mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ))) - { - memcpy(nv20->constbuf[shader], mapped, buf->buffer->size); - nv20->constbuf_nr[shader] = - buf->buffer->size / (4 * sizeof(float)); - pipe_buffer_unmap(pscreen, buf->buffer); - } - } -} - -static void -nv20_set_framebuffer_state(struct pipe_context *pipe, - const struct pipe_framebuffer_state *fb) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - nv20->framebuffer = (struct pipe_framebuffer_state*)fb; - - nv20->dirty |= NV20_NEW_FRAMEBUFFER; -} - -static void -nv20_set_polygon_stipple(struct pipe_context *pipe, - const struct pipe_poly_stipple *stipple) -{ - NOUVEAU_ERR("line stipple hahaha\n"); -} - -static void -nv20_set_scissor_state(struct pipe_context *pipe, - const struct pipe_scissor_state *s) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - nv20->scissor = (struct pipe_scissor_state*)s; - - nv20->dirty |= NV20_NEW_SCISSOR; -} - -static void -nv20_set_viewport_state(struct pipe_context *pipe, - const struct pipe_viewport_state *vpt) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - nv20->viewport = (struct pipe_viewport_state*)vpt; - - draw_set_viewport_state(nv20->draw, nv20->viewport); - - nv20->dirty |= NV20_NEW_VIEWPORT; -} - -static void -nv20_set_vertex_buffers(struct pipe_context *pipe, unsigned count, - const struct pipe_vertex_buffer *vb) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - memcpy(nv20->vtxbuf, vb, sizeof(*vb) * count); - nv20->dirty |= NV20_NEW_VTXARRAYS; - - draw_set_vertex_buffers(nv20->draw, count, vb); -} - -static void -nv20_set_vertex_elements(struct pipe_context *pipe, unsigned count, - const struct pipe_vertex_element *ve) -{ - struct nv20_context *nv20 = nv20_context(pipe); - - memcpy(nv20->vtxelt, ve, sizeof(*ve) * count); - nv20->dirty |= NV20_NEW_VTXARRAYS; - - draw_set_vertex_elements(nv20->draw, count, ve); -} - -void -nv20_init_state_functions(struct nv20_context *nv20) -{ - nv20->pipe.create_blend_state = nv20_blend_state_create; - nv20->pipe.bind_blend_state = nv20_blend_state_bind; - nv20->pipe.delete_blend_state = nv20_blend_state_delete; - - nv20->pipe.create_sampler_state = nv20_sampler_state_create; - nv20->pipe.bind_fragment_sampler_states = nv20_sampler_state_bind; - nv20->pipe.delete_sampler_state = nv20_sampler_state_delete; - nv20->pipe.set_fragment_sampler_textures = nv20_set_sampler_texture; - - nv20->pipe.create_rasterizer_state = nv20_rasterizer_state_create; - nv20->pipe.bind_rasterizer_state = nv20_rasterizer_state_bind; - nv20->pipe.delete_rasterizer_state = nv20_rasterizer_state_delete; - - nv20->pipe.create_depth_stencil_alpha_state = - nv20_depth_stencil_alpha_state_create; - nv20->pipe.bind_depth_stencil_alpha_state = - nv20_depth_stencil_alpha_state_bind; - nv20->pipe.delete_depth_stencil_alpha_state = - nv20_depth_stencil_alpha_state_delete; - - nv20->pipe.create_vs_state = nv20_vp_state_create; - nv20->pipe.bind_vs_state = nv20_vp_state_bind; - nv20->pipe.delete_vs_state = nv20_vp_state_delete; - - nv20->pipe.create_fs_state = nv20_fp_state_create; - nv20->pipe.bind_fs_state = nv20_fp_state_bind; - nv20->pipe.delete_fs_state = nv20_fp_state_delete; - - nv20->pipe.set_blend_color = nv20_set_blend_color; - nv20->pipe.set_clip_state = nv20_set_clip_state; - nv20->pipe.set_constant_buffer = nv20_set_constant_buffer; - nv20->pipe.set_framebuffer_state = nv20_set_framebuffer_state; - nv20->pipe.set_polygon_stipple = nv20_set_polygon_stipple; - nv20->pipe.set_scissor_state = nv20_set_scissor_state; - nv20->pipe.set_viewport_state = nv20_set_viewport_state; - - nv20->pipe.set_vertex_buffers = nv20_set_vertex_buffers; - nv20->pipe.set_vertex_elements = nv20_set_vertex_elements; -} - diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index 8bfd7b2c909..279b74445ca 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -1,6 +1,5 @@ #include "draw/draw_context.h" #include "pipe/p_defines.h" -#include "util/u_simple_screen.h" #include "nv30_context.h" #include "nv30_screen.h" diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 8f9b26ea56f..aef37d303d8 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -28,7 +28,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param) { switch (param) { case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: - return 16; + return 8; case PIPE_CAP_NPOT_TEXTURES: return 0; case PIPE_CAP_TWO_SIDED_STENCIL: @@ -64,6 +64,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, int param) case NOUVEAU_CAP_HW_VTXBUF: case NOUVEAU_CAP_HW_IDXBUF: return 1; + case PIPE_CAP_MAX_COMBINED_SAMPLERS: + return 16; case PIPE_CAP_INDEP_BLEND_ENABLE: return 0; case PIPE_CAP_INDEP_BLEND_FUNC: diff --git a/src/gallium/drivers/nv30/nv30_surface.c b/src/gallium/drivers/nv30/nv30_surface.c index b48c5ab51a0..bc18e577eee 100644 --- a/src/gallium/drivers/nv30/nv30_surface.c +++ b/src/gallium/drivers/nv30/nv30_surface.c @@ -28,7 +28,6 @@ #include "nv30_context.h" #include "pipe/p_defines.h" -#include "util/u_simple_screen.h" #include "util/u_inlines.h" #include "util/u_tile.h" diff --git a/src/gallium/drivers/nv30/nv30_vbo.c b/src/gallium/drivers/nv30/nv30_vbo.c index a83ddf11546..f406fa0c1d6 100644 --- a/src/gallium/drivers/nv30/nv30_vbo.c +++ b/src/gallium/drivers/nv30/nv30_vbo.c @@ -185,7 +185,7 @@ nv30_draw_arrays(struct pipe_context *pipe, nv30_state_emit(nv30); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); if (!vc) { FIRE_RING(chan); @@ -239,7 +239,7 @@ nv30_draw_elements_u08(struct nv30_context *nv30, void *ib, nv30_state_emit(nv30); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -290,7 +290,7 @@ nv30_draw_elements_u16(struct nv30_context *nv30, void *ib, nv30_state_emit(nv30); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -341,7 +341,7 @@ nv30_draw_elements_u32(struct nv30_context *nv30, void *ib, nv30_state_emit(nv30); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 5, 1, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -417,7 +417,7 @@ nv30_draw_elements_vbo(struct pipe_context *pipe, nv30_state_emit(nv30); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); if (!vc) { FIRE_RING(chan); diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c index b0b90032de1..65dc73e88b3 100644 --- a/src/gallium/drivers/nv40/nv40_context.c +++ b/src/gallium/drivers/nv40/nv40_context.c @@ -1,6 +1,5 @@ #include "draw/draw_context.h" #include "pipe/p_defines.h" -#include "util/u_simple_screen.h" #include "nv40_context.h" #include "nv40_screen.h" diff --git a/src/gallium/drivers/nv40/nv40_draw.c b/src/gallium/drivers/nv40/nv40_draw.c index 60ab49fad1c..48bd84d16c5 100644 --- a/src/gallium/drivers/nv40/nv40_draw.c +++ b/src/gallium/drivers/nv40/nv40_draw.c @@ -88,12 +88,11 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim, struct nv40_screen *screen = nv40->screen; struct nouveau_channel *chan = screen->base.channel; - struct nouveau_pushbuf *pb = chan->pushbuf; struct nouveau_grobj *curie = screen->curie; unsigned i; /* Ensure there's room for 4xfloat32 + potentially 3 begin/end */ - if (pb->remaining < ((count * 20) + 6)) { + if (AVAIL_RING(chan) < ((count * 20) + 6)) { if (rs->prim != NV40TCL_BEGIN_END_STOP) { NOUVEAU_ERR("AIII, missed flush\n"); assert(0); @@ -121,7 +120,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim, /* If it's likely we'll need to empty the push buffer soon, finish * off the primitive now. */ - if (pb->remaining < ((count * 20) + 6)) { + if (AVAIL_RING(chan) < ((count * 20) + 6)) { BEGIN_RING(chan, curie, NV40TCL_BEGIN_END, 1); OUT_RING (chan, NV40TCL_BEGIN_END_STOP); rs->prim = NV40TCL_BEGIN_END_STOP; diff --git a/src/gallium/drivers/nv40/nv40_vbo.c b/src/gallium/drivers/nv40/nv40_vbo.c index 1e14edc56a7..f2048eb8693 100644 --- a/src/gallium/drivers/nv40/nv40_vbo.c +++ b/src/gallium/drivers/nv40/nv40_vbo.c @@ -186,7 +186,7 @@ nv40_draw_arrays(struct pipe_context *pipe, nv40_state_emit(nv40); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); if (!vc) { FIRE_RING(chan); @@ -240,7 +240,7 @@ nv40_draw_elements_u08(struct nv40_context *nv40, void *ib, nv40_state_emit(nv40); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -291,7 +291,7 @@ nv40_draw_elements_u16(struct nv40_context *nv40, void *ib, nv40_state_emit(nv40); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 2, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 2, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -342,7 +342,7 @@ nv40_draw_elements_u32(struct nv40_context *nv40, void *ib, nv40_state_emit(nv40); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 5, 1, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 5, 1, mode, start, count, &restart); if (vc == 0) { FIRE_RING(chan); @@ -418,7 +418,7 @@ nv40_draw_elements_vbo(struct pipe_context *pipe, nv40_state_emit(nv40); - vc = nouveau_vbuf_split(chan->pushbuf->remaining, 6, 256, + vc = nouveau_vbuf_split(AVAIL_RING(chan), 6, 256, mode, start, count, &restart); if (!vc) { FIRE_RING(chan); diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 867bd03e69d..7be12fcdef4 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -22,7 +22,6 @@ #include "draw/draw_context.h" #include "pipe/p_defines.h" -#include "util/u_simple_screen.h" #include "nv50_context.h" #include "nv50_screen.h" diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index ac0c1d02703..7405b67414a 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -25,7 +25,6 @@ #include "nouveau/nouveau_pushbuf.h" #include "nv50_context.h" #include "pipe/p_defines.h" -#include "util/u_simple_screen.h" #include "util/u_inlines.h" #include "util/u_tile.h" diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index d08b4d7354c..7c360e9e73a 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -313,7 +313,7 @@ nv50_upload_sifc(struct nv50_context *nv50, while (count) { unsigned nr = MIN2(count, 1792); - if (chan->pushbuf->remaining <= nr) { + if (AVAIL_RING(chan) <= nr) { FIRE_RING (chan); BEGIN_RING(chan, eng2d, @@ -321,7 +321,7 @@ nv50_upload_sifc(struct nv50_context *nv50, OUT_RELOCh(chan, bo, dst_offset, reloc); OUT_RELOCl(chan, bo, dst_offset, reloc); } - assert(chan->pushbuf->remaining > nr); + assert(AVAIL_RING(chan) > nr); BEGIN_RING(chan, eng2d, NV50_2D_SIFC_DATA | (2 << 29), nr); diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 59709e7d648..d31336ed76f 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -382,6 +382,7 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300, void r300_emit_fb_state(struct r300_context* r300, void* state) { struct pipe_framebuffer_state* fb = (struct pipe_framebuffer_state*)state; + struct r300_screen* r300screen = r300_screen(r300->context.screen); struct r300_texture* tex; struct pipe_surface* surf; int i; @@ -400,10 +401,16 @@ void r300_emit_fb_state(struct r300_context* r300, void* state) /* Set the number of colorbuffers. */ if (fb->nr_cbufs > 1) { - OUT_CS_REG(R300_RB3D_CCTL, - R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) | - R300_RB3D_CCTL_INDEPENDENT_COLOR_CHANNEL_MASK_ENABLE | - R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE); + if (r300screen->caps->is_r500) { + OUT_CS_REG(R300_RB3D_CCTL, + R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) | + R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE | + R300_RB3D_CCTL_INDEPENDENT_COLOR_CHANNEL_MASK_ENABLE); + } else { + OUT_CS_REG(R300_RB3D_CCTL, + R300_RB3D_CCTL_NUM_MULTIWRITES(fb->nr_cbufs) | + R300_RB3D_CCTL_INDEPENDENT_COLORFORMAT_ENABLE_ENABLE); + } } else { OUT_CS_REG(R300_RB3D_CCTL, 0x0); } diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 75a05498eb3..ae4c62b2f1d 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -179,6 +179,7 @@ static void r300_translate_fragment_shader( /* Translate TGSI to our internal representation */ ttr.compiler = &compiler.Base; ttr.info = &fs->info; + ttr.use_half_swizzles = TRUE; r300_tgsi_to_rc(&ttr, fs->state.tokens); diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index da4ec542ade..13cd04a80cc 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -186,8 +186,10 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param) * rendering limits. 2048 pixels should be enough for anybody. */ if (r300screen->caps->is_r500) { return 4096.0f; + } else if (r300screen->caps->is_r400) { + return 4021.0f; } else { - return 2048.0f; + return 2560.0f; } case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: return 16.0f; diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 8d68aa230bf..4d158cff7c7 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -501,6 +501,8 @@ static void const struct pipe_framebuffer_state* state) { struct r300_context* r300 = r300_context(pipe); + struct r300_screen* r300screen = r300_screen(pipe->screen); + unsigned max_width, max_height; uint32_t zbuffer_bpp = 0; r300->fb_state.size = (10 * state->nr_cbufs) + @@ -513,6 +515,20 @@ static void return; } + if (r300screen->caps->is_r500) { + max_width = max_height = 4096; + } else if (r300screen->caps->is_r400) { + max_width = max_height = 4021; + } else { + max_width = max_height = 2560; + } + + if (state->width > max_width || state->height > max_height) { + debug_printf("r300: Implementation error: Render targets are too " + "big in %s, refusing to bind framebuffer state!\n", __FUNCTION__); + return; + } + if (r300->draw) { draw_flush(r300->draw); } @@ -615,6 +631,7 @@ static void r300_set_polygon_stipple(struct pipe_context* pipe, static void* r300_create_rs_state(struct pipe_context* pipe, const struct pipe_rasterizer_state* state) { + struct r300_screen* r300screen = r300_screen(pipe->screen); struct r300_rs_state* rs = CALLOC_STRUCT(r300_rs_state); /* Copy rasterizer state for Draw. */ @@ -629,20 +646,28 @@ static void* r300_create_rs_state(struct pipe_context* pipe, /* If bypassing TCL, or if no TCL engine is present, turn off the HW TCL. * Else, enable HW TCL and force Draw's TCL off. */ if (state->bypass_vs_clip_and_viewport || - !r300_screen(pipe->screen)->caps->has_tcl) { + !r300screen->caps->has_tcl) { rs->vap_control_status |= R300_VAP_TCL_BYPASS; } rs->point_size = pack_float_16_6x(state->point_size) | (pack_float_16_6x(state->point_size) << R300_POINTSIZE_X_SHIFT); - /* set hw limits - clamping done by state tracker in vs or point_size - XXX always need to emit this? */ - rs->point_minmax = - ((int)(0.0 * 6.0) << - R300_GA_POINT_MINMAX_MIN_SHIFT) | - ((int)(4096.0 * 6.0) << - R300_GA_POINT_MINMAX_MAX_SHIFT); + /* Point minimum and maximum sizes. This register has to be emitted, + * and it'd be a step backwards to put it in invariant state. */ + if (r300screen->caps->is_r500) { + rs->point_minmax = + ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) | + ((int)(4096.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT); + } else if (r300screen->caps->is_r400) { + rs->point_minmax = + ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) | + ((int)(4021.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT); + } else { + rs->point_minmax = + ((int)(0.0 * 6.0) << R300_GA_POINT_MINMAX_MIN_SHIFT) | + ((int)(2560.0 * 6.0) << R300_GA_POINT_MINMAX_MAX_SHIFT); + } rs->line_control = pack_float_16_6x(state->line_width) | R300_GA_LINE_CNTL_END_TYPE_COMP; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 67bf8ce13fd..417a57384c4 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -80,7 +80,6 @@ static void r300_setup_texture_state(struct r300_screen* screen, struct r300_tex state->format2 |= R500_TXHEIGHT_BIT11; } } - assert(is_r500 || (pt->width0 <= 2048 && pt->height0 <= 2048)); SCREEN_DBG(screen, DBG_TEX, "r300: Set texture state (%dx%d, %d levels)\n", pt->width0, pt->height0, pt->last_level); diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 941ec17016b..aff4ddd4e23 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -29,6 +29,7 @@ #include "tgsi/tgsi_scan.h" #include "tgsi/tgsi_util.h" +#include "util/u_debug.h" static unsigned translate_opcode(unsigned opcode) { @@ -144,7 +145,7 @@ static unsigned translate_opcode(unsigned opcode) case TGSI_OPCODE_KIL: return RC_OPCODE_KIL; } - fprintf(stderr, "Unknown opcode: %i\n", opcode); + debug_printf("r300: Unknown TGSI/RC opcode: %i\n", opcode); return RC_OPCODE_ILLEGAL_OPCODE; } @@ -306,7 +307,7 @@ static void handle_immediate(struct tgsi_to_rc * ttr, for (i = 0; i < 4; i++) { if (imm->u[i].Float == 0.0f) { swizzle |= RC_SWIZZLE_ZERO << (i * 3); - } else if (imm->u[i].Float == 0.5f) { + } else if (imm->u[i].Float == 0.5f && ttr->use_half_swizzles) { swizzle |= RC_SWIZZLE_HALF << (i * 3); } else if (imm->u[i].Float == 1.0f) { swizzle |= RC_SWIZZLE_ONE << (i * 3); @@ -329,7 +330,8 @@ static void handle_immediate(struct tgsi_to_rc * ttr, } } -void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens) +void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, + const struct tgsi_token * tokens) { struct tgsi_parse_context parser; unsigned imm_index = 0; diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.h b/src/gallium/drivers/r300/r300_tgsi_to_rc.h index 39b473c7bf5..97641a954b9 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.h +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.h @@ -23,6 +23,8 @@ #ifndef R300_TGSI_TO_RC_H #define R300_TGSI_TO_RC_H +#include "pipe/p_compiler.h" + struct radeon_compiler; struct tgsi_full_declaration; @@ -41,6 +43,10 @@ struct tgsi_to_rc { int immediate_offset; struct swizzled_imms * imms_to_swizzle; unsigned imms_to_swizzle_count; + + /* Vertex shaders have no half swizzles, and no way to handle them, so + * until rc grows proper support, indicate if they're safe to use. */ + boolean use_half_swizzles; }; void r300_tgsi_to_rc(struct tgsi_to_rc * ttr, const struct tgsi_token * tokens); diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index fb81b2439b6..a6786c321c6 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -340,6 +340,7 @@ void r300_translate_vertex_shader(struct r300_context* r300, /* Translate TGSI to our internal representation */ ttr.compiler = &compiler.Base; ttr.info = &vs->info; + ttr.use_half_swizzles = FALSE; r300_tgsi_to_rc(&ttr, vs->state.tokens); diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index f4d2d8992c8..8b7ca2e1123 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -253,7 +253,9 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl, assert(index_bias >= 0); assert(min_index <= max_index); assert(offset + index_bias*stride < size); - assert(offset + (index_bias + min_index)*stride < size); + if (min_index != ~0) { + assert(offset + (index_bias + min_index) * stride < size); + } switch (hwtnl->cmd.vdecl[i].identity.type) { case SVGA3D_DECLTYPE_FLOAT1: @@ -314,7 +316,9 @@ enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl, } assert(!stride || width <= stride); - assert(offset + (index_bias + max_index)*stride + width <= size); + if (max_index != ~0) { + assert(offset + (index_bias + max_index) * stride + width <= size); + } } assert(range->indexWidth == range->indexArray.stride); diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 8143be50244..735cdfdae99 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -111,6 +111,8 @@ svga_get_paramf(struct pipe_screen *screen, int param) case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: return 16; + case PIPE_CAP_MAX_COMBINED_SAMPLERS: + return 16; case PIPE_CAP_NPOT_TEXTURES: return 1; case PIPE_CAP_TWO_SIDED_STENCIL: diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h index 9217af2dd99..5db64bf135b 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader.h @@ -98,21 +98,33 @@ struct sh_defi #define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE #define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME -struct ps_sampleinfo +struct sh_sampleinfo { unsigned unused:27; unsigned texture_type:4; unsigned is_reg:1; }; -struct vs_semantic +struct sh_semantic { - unsigned usage:5; - unsigned unused1:11; + unsigned usage:4; + unsigned unused1:12; unsigned usage_index:4; - unsigned unused2:12; + unsigned unused2:11; + unsigned is_reg:1; }; +#define SH_WRITEMASK_0 0x1 +#define SH_WRITEMASK_1 0x2 +#define SH_WRITEMASK_2 0x4 +#define SH_WRITEMASK_3 0x8 +#define SH_WRITEMASK_ALL 0xf + +#define SH_DSTMOD_NONE 0x0 +#define SH_DSTMOD_SATURATE 0x1 +#define SH_DSTMOD_PARTIALPRECISION 0x2 +#define SH_DSTMOD_MSAMPCENTROID 0x4 + struct sh_dstreg { unsigned number:11; @@ -136,17 +148,12 @@ struct sh_dcl { struct sh_op op; union { - struct { - struct ps_sampleinfo sampleinfo; - } ps; - struct { - struct vs_semantic semantic; - } vs; + struct sh_sampleinfo sampleinfo; + struct sh_semantic semantic; } u; struct sh_dstreg reg; }; - struct sh_srcreg { unsigned number:11; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index 70e27d86d30..d2bfb439f38 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -40,102 +40,139 @@ struct dump_info { - SVGA3dShaderVersion version; + uint32 version; boolean is_ps; + int indent; }; -static void dump_op( struct sh_op op, const char *mnemonic ) +#define DUMP_MAX_OP_SRC 4 + +struct dump_op { - assert( op.predicated == 0 ); - assert( op.is_reg == 0 ); + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg dstind; + struct sh_srcreg src[DUMP_MAX_OP_SRC]; + struct sh_srcreg srcind[DUMP_MAX_OP_SRC]; + struct sh_srcreg p0; +}; - if (op.coissue) - _debug_printf( "+" ); - _debug_printf( "%s", mnemonic ); - switch (op.control) { - case 0: - break; - case SVGA3DOPCONT_PROJECT: - _debug_printf( "p" ); - break; - case SVGA3DOPCONT_BIAS: - _debug_printf( "b" ); - break; - default: - assert( 0 ); +static void +dump_indent(int indent) +{ + int i; + + for (i = 0; i < indent; ++i) { + _debug_printf(" "); } } - -static void dump_comp_op( struct sh_op op, const char *mnemonic ) +static void dump_op( struct sh_op op, const char *mnemonic ) { assert( op.is_reg == 0 ); + if (op.predicated) { + _debug_printf("(p0) "); + } if (op.coissue) _debug_printf( "+" ); _debug_printf( "%s", mnemonic ); - switch (op.control) { - case SVGA3DOPCOMP_RESERVED0: - break; - case SVGA3DOPCOMP_GT: - _debug_printf("_gt"); - break; - case SVGA3DOPCOMP_EQ: - _debug_printf("_eq"); - break; - case SVGA3DOPCOMP_GE: - _debug_printf("_ge"); - break; - case SVGA3DOPCOMP_LT: - _debug_printf("_lt"); - break; - case SVGA3DOPCOMPC_NE: - _debug_printf("_ne"); + + switch (op.opcode) { + case SVGA3DOP_TEX: + switch (op.control) { + case 0: + break; + case 1 /* PROJECT */: + _debug_printf("p"); + break; + case 2 /* BIAS */: + _debug_printf("b"); + break; + default: + assert(0); + } break; - case SVGA3DOPCOMP_LE: - _debug_printf("_le"); + + case SVGA3DOP_IFC: + case SVGA3DOP_BREAKC: + case SVGA3DOP_SETP: + switch (op.control) { + case SVGA3DOPCOMP_GT: + _debug_printf("_gt"); + break; + case SVGA3DOPCOMP_EQ: + _debug_printf("_eq"); + break; + case SVGA3DOPCOMP_GE: + _debug_printf("_ge"); + break; + case SVGA3DOPCOMP_LT: + _debug_printf("_lt"); + break; + case SVGA3DOPCOMPC_NE: + _debug_printf("_ne"); + break; + case SVGA3DOPCOMP_LE: + _debug_printf("_le"); + break; + default: + assert(0); + } break; - case SVGA3DOPCOMP_RESERVED1: + default: - assert( 0 ); + assert(op.control == 0); } } +static void +format_reg(const char *name, + const struct sh_reg reg, + const struct sh_srcreg *indreg) +{ + if (reg.relative) { + assert(indreg); + + if (sh_srcreg_type(*indreg) == SVGA3DREG_LOOP) { + _debug_printf("%s[aL+%u]", name, reg.number); + } else { + _debug_printf("%s[a%u.x+%u]", name, indreg->number, reg.number); + } + } else { + _debug_printf("%s%u", name, reg.number); + } +} static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di ) { - assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 ); assert( reg.is_reg == 1 ); switch (sh_reg_type( reg )) { case SVGA3DREG_TEMP: - _debug_printf( "r%u", reg.number ); + format_reg("r", reg, NULL); break; case SVGA3DREG_INPUT: - _debug_printf( "v%u", reg.number ); + format_reg("v", reg, indreg); break; case SVGA3DREG_CONST: - if (reg.relative) { - if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) - _debug_printf( "c[aL+%u]", reg.number ); - else - _debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); - } - else - _debug_printf( "c%u", reg.number ); + format_reg("c", reg, indreg); break; case SVGA3DREG_ADDR: /* VS */ /* SVGA3DREG_TEXTURE */ /* PS */ - if (di->is_ps) - _debug_printf( "t%u", reg.number ); - else - _debug_printf( "a%u", reg.number ); + assert(!reg.relative); + if (di->is_ps) { + format_reg("t", reg, NULL); + } else { + format_reg("a", reg, NULL); + } break; case SVGA3DREG_RASTOUT: + assert(!reg.relative); switch (reg.number) { case 0 /*POSITION*/: _debug_printf( "oPos" ); @@ -154,64 +191,69 @@ static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct case SVGA3DREG_ATTROUT: assert( reg.number < 2 ); - _debug_printf( "oD%u", reg.number ); + format_reg("oD", reg, NULL); break; - case SVGA3DREG_TEXCRDOUT: - /* SVGA3DREG_OUTPUT */ - _debug_printf( "oT%u", reg.number ); + case SVGA3DREG_TEXCRDOUT: /* VS */ + /* SVGA3DREG_OUTPUT */ /* VS3.0+ */ + if (!di->is_ps && di->version >= SVGA3D_VS_30) { + format_reg("o", reg, indreg); + } else { + format_reg("oT", reg, NULL); + } break; case SVGA3DREG_COLOROUT: - _debug_printf( "oC%u", reg.number ); + format_reg("oC", reg, NULL); break; case SVGA3DREG_DEPTHOUT: - _debug_printf( "oD%u", reg.number ); + assert(!reg.relative); + assert(reg.number == 0); + _debug_printf("oDepth"); break; case SVGA3DREG_SAMPLER: - _debug_printf( "s%u", reg.number ); + format_reg("s", reg, NULL); break; case SVGA3DREG_CONSTBOOL: - assert( !reg.relative ); - _debug_printf( "b%u", reg.number ); + format_reg("b", reg, NULL); break; case SVGA3DREG_CONSTINT: - assert( !reg.relative ); - _debug_printf( "i%u", reg.number ); + format_reg("i", reg, NULL); break; case SVGA3DREG_LOOP: + assert(!reg.relative); assert( reg.number == 0 ); _debug_printf( "aL" ); break; case SVGA3DREG_MISCTYPE: + assert(!reg.relative); switch (reg.number) { case SVGA3DMISCREG_POSITION: - _debug_printf( "vPos" ); + _debug_printf("vPos"); break; case SVGA3DMISCREG_FACE: - _debug_printf( "vFace" ); + _debug_printf("vFace"); break; default: assert(0); - break; + _debug_printf("???"); } break; case SVGA3DREG_LABEL: - _debug_printf( "l%u", reg.number ); + format_reg("l", reg, NULL); break; case SVGA3DREG_PREDICATE: - _debug_printf( "p%u", reg.number ); + format_reg("p", reg, NULL); break; - default: assert( 0 ); _debug_printf( "???" ); @@ -233,8 +275,11 @@ static void dump_bdata( boolean bdata ) _debug_printf( bdata ? "TRUE" : "FALSE" ); } -static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) +static void +dump_sampleinfo(struct sh_sampleinfo sampleinfo) { + assert( sampleinfo.is_reg == 1 ); + switch (sampleinfo.texture_type) { case SVGA3DSAMP_2D: _debug_printf( "_2d" ); @@ -250,63 +295,67 @@ static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) } } - -static void dump_usageinfo( struct vs_semantic semantic ) +static void +dump_semantic(uint usage, + uint usage_index) { - switch (semantic.usage) { + switch (usage) { case SVGA3D_DECLUSAGE_POSITION: - _debug_printf("_position" ); + _debug_printf("_position"); break; case SVGA3D_DECLUSAGE_BLENDWEIGHT: - _debug_printf("_blendweight" ); + _debug_printf("_blendweight"); break; case SVGA3D_DECLUSAGE_BLENDINDICES: - _debug_printf("_blendindices" ); + _debug_printf("_blendindices"); break; case SVGA3D_DECLUSAGE_NORMAL: - _debug_printf("_normal" ); + _debug_printf("_normal"); break; case SVGA3D_DECLUSAGE_PSIZE: - _debug_printf("_psize" ); + _debug_printf("_psize"); break; case SVGA3D_DECLUSAGE_TEXCOORD: _debug_printf("_texcoord"); break; case SVGA3D_DECLUSAGE_TANGENT: - _debug_printf("_tangent" ); + _debug_printf("_tangent"); break; case SVGA3D_DECLUSAGE_BINORMAL: - _debug_printf("_binormal" ); + _debug_printf("_binormal"); break; case SVGA3D_DECLUSAGE_TESSFACTOR: - _debug_printf("_tessfactor" ); + _debug_printf("_tessfactor"); break; case SVGA3D_DECLUSAGE_POSITIONT: - _debug_printf("_positiont" ); + _debug_printf("_positiont"); break; case SVGA3D_DECLUSAGE_COLOR: - _debug_printf("_color" ); + _debug_printf("_color"); break; case SVGA3D_DECLUSAGE_FOG: - _debug_printf("_fog" ); + _debug_printf("_fog"); break; case SVGA3D_DECLUSAGE_DEPTH: - _debug_printf("_depth" ); + _debug_printf("_depth"); break; case SVGA3D_DECLUSAGE_SAMPLE: _debug_printf("_sample"); break; default: - assert( 0 ); - return; + assert(!"Unknown usage"); + _debug_printf("_???"); } - if (semantic.usage_index != 0) { - _debug_printf("%d", semantic.usage_index ); + if (usage_index) { + _debug_printf("%u", usage_index); } } -static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) +static void +dump_dstreg(struct sh_dstreg dstreg, + struct sh_srcreg *indreg, + const struct dump_info *di) { union { struct sh_reg reg; @@ -346,7 +395,7 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) _debug_printf( " " ); u.dstreg = dstreg; - dump_reg( u.reg, NULL, di ); + dump_reg( u.reg, indreg, di); if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { _debug_printf( "." ); if (dstreg.write_mask & SVGA3DWRITEMASK_0) @@ -362,23 +411,13 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di ) { - union { - struct sh_reg reg; - struct sh_srcreg srcreg; - } u; - switch (srcreg.modifier) { case SVGA3DSRCMOD_NEG: case SVGA3DSRCMOD_BIASNEG: case SVGA3DSRCMOD_SIGNNEG: case SVGA3DSRCMOD_X2NEG: - _debug_printf( "-" ); - break; - case SVGA3DSRCMOD_ABS: - _debug_printf( "|" ); - break; case SVGA3DSRCMOD_ABSNEG: - _debug_printf( "-|" ); + _debug_printf( "-" ); break; case SVGA3DSRCMOD_COMP: _debug_printf( "1-" ); @@ -386,19 +425,13 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons case SVGA3DSRCMOD_NOT: _debug_printf( "!" ); } - - u.srcreg = srcreg; - dump_reg( u.reg, indreg, di ); + dump_reg( *(struct sh_reg *) &srcreg, indreg, di ); switch (srcreg.modifier) { case SVGA3DSRCMOD_NONE: case SVGA3DSRCMOD_NEG: case SVGA3DSRCMOD_COMP: case SVGA3DSRCMOD_NOT: break; - case SVGA3DSRCMOD_ABS: - case SVGA3DSRCMOD_ABSNEG: - _debug_printf( "|" ); - break; case SVGA3DSRCMOD_BIAS: case SVGA3DSRCMOD_BIASNEG: _debug_printf( "_bias" ); @@ -417,6 +450,10 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons case SVGA3DSRCMOD_DW: _debug_printf( "_dw" ); break; + case SVGA3DSRCMOD_ABS: + case SVGA3DSRCMOD_ABSNEG: + _debug_printf("_abs"); + break; default: assert( 0 ); } @@ -434,58 +471,132 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons } } +static void +parse_op(struct dump_info *di, + const uint **token, + struct dump_op *op, + uint num_dst, + uint num_src) +{ + uint i; + + assert(num_dst <= 1); + assert(num_src <= DUMP_MAX_OP_SRC); + + op->op = *(struct sh_op *)*token; + *token += sizeof(struct sh_op) / sizeof(uint); + + if (num_dst >= 1) { + op->dst = *(struct sh_dstreg *)*token; + *token += sizeof(struct sh_dstreg) / sizeof(uint); + if (op->dst.relative && + (!di->is_ps && di->version >= SVGA3D_VS_30)) { + op->dstind = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + } + } + + if (op->op.predicated) { + op->p0 = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + } + + for (i = 0; i < num_src; ++i) { + op->src[i] = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + if (op->src[i].relative && + ((!di->is_ps && di->version >= SVGA3D_VS_20) || + (di->is_ps && di->version >= SVGA3D_PS_30))) { + op->srcind[i] = *(struct sh_srcreg *)*token; + *token += sizeof(struct sh_srcreg) / sizeof(uint); + } + } +} + +static void +dump_inst(struct dump_info *di, + const unsigned **assem, + struct sh_op op, + const struct sh_opcode_info *info) +{ + struct dump_op dop; + boolean not_first_arg = FALSE; + uint i; + + assert(info->num_dst <= 1); + + di->indent -= info->pre_dedent; + dump_indent(di->indent); + di->indent += info->post_indent; + + dump_op(op, info->mnemonic); + + parse_op(di, assem, &dop, info->num_dst, info->num_src); + if (info->num_dst > 0) { + dump_dstreg(dop.dst, &dop.dstind, di); + not_first_arg = TRUE; + } + + for (i = 0; i < info->num_src; i++) { + if (not_first_arg) { + _debug_printf(", "); + } else { + _debug_printf(" "); + } + dump_srcreg(dop.src[i], &dop.srcind[i], di); + not_first_arg = TRUE; + } + + _debug_printf("\n"); +} + void svga_shader_dump( const unsigned *assem, unsigned dwords, unsigned do_binary ) { - const unsigned *start = assem; boolean finished = FALSE; struct dump_info di; - unsigned i; - if (do_binary) { - for (i = 0; i < dwords; i++) - _debug_printf(" 0x%08x,\n", assem[i]); - - _debug_printf("\n\n"); - } - - di.version.value = *assem++; - di.is_ps = (di.version.type == SVGA3D_PS_TYPE); + di.version = *assem++; + di.is_ps = (di.version & 0xFFFF0000) == 0xFFFF0000; + di.indent = 0; _debug_printf( "%s_%u_%u\n", di.is_ps ? "ps" : "vs", - di.version.major, - di.version.minor ); + (di.version >> 8) & 0xff, + di.version & 0xff ); while (!finished) { struct sh_op op = *(struct sh_op *) assem; - if (assem - start >= dwords) { - _debug_printf("... ran off end of buffer\n"); - assert(0); - return; - } - switch (op.opcode) { case SVGA3DOP_DCL: { struct sh_dcl dcl = *(struct sh_dcl *) assem; _debug_printf( "dcl" ); - if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) - dump_sampleinfo( dcl.u.ps.sampleinfo ); - else if (di.is_ps) { - if (di.version.major == 3 && - sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE) - dump_usageinfo( dcl.u.vs.semantic ); + switch (sh_dstreg_type(dcl.reg)) { + case SVGA3DREG_INPUT: + if ((di.is_ps && di.version >= SVGA3D_PS_30) || + (!di.is_ps && di.version >= SVGA3D_VS_30)) { + dump_semantic(dcl.u.semantic.usage, + dcl.u.semantic.usage_index); + } + break; + case SVGA3DREG_TEXCRDOUT: + if (!di.is_ps && di.version >= SVGA3D_VS_30) { + dump_semantic(dcl.u.semantic.usage, + dcl.u.semantic.usage_index); + } + break; + case SVGA3DREG_SAMPLER: + dump_sampleinfo( dcl.u.sampleinfo ); + break; } - else - dump_usageinfo( dcl.u.vs.semantic ); - dump_dstreg( dcl.reg, &di ); + dump_dstreg(dcl.reg, NULL, &di); _debug_printf( "\n" ); assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); } @@ -518,54 +629,38 @@ svga_shader_dump( break; case SVGA3DOP_TEXCOORD: - assert( di.is_ps ); - dump_op( op, "texcoord" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; - dump_dstreg( unaryop.dst, &di ); - _debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + { + struct sh_opcode_info info = *svga_opcode_info(op.opcode); + + assert(di.is_ps); + if (di.version > SVGA3D_PS_13) { + assert(info.num_src == 0); + + info.num_src = 1; + } + + dump_inst(&di, &assem, op, &info); } - _debug_printf( "\n" ); break; case SVGA3DOP_TEX: - assert( di.is_ps ); - if (0) { - dump_op( op, "tex" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + { + struct sh_opcode_info info = *svga_opcode_info(op.opcode); - dump_dstreg( unaryop.dst, &di ); - _debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + assert(di.is_ps); + if (di.version > SVGA3D_PS_13) { + assert(info.num_src == 0); + + if (di.version > SVGA3D_PS_14) { + info.num_src = 2; + info.mnemonic = "texld"; + } else { + info.num_src = 1; + } } - } - else { - struct sh_binaryop binaryop = *(struct sh_binaryop *) assem; - dump_op( op, "texld" ); - dump_dstreg( binaryop.dst, &di ); - _debug_printf( ", " ); - dump_srcreg( binaryop.src0, NULL, &di ); - _debug_printf( ", " ); - dump_srcreg( binaryop.src1, NULL, &di ); - assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); + dump_inst(&di, &assem, op, &info); } - _debug_printf( "\n" ); break; case SVGA3DOP_DEF: @@ -581,6 +676,21 @@ svga_shader_dump( } break; + case SVGA3DOP_SINCOS: + { + struct sh_opcode_info info = *svga_opcode_info(op.opcode); + + if ((di.is_ps && di.version >= SVGA3D_PS_30) || + (!di.is_ps && di.version >= SVGA3D_VS_30)) { + assert(info.num_src == 3); + + info.num_src = 1; + } + + dump_inst(&di, &assem, op, &info); + } + break; + case SVGA3DOP_PHASE: _debug_printf( "phase\n" ); assem += sizeof( struct sh_op ) / sizeof( unsigned ); @@ -595,59 +705,15 @@ svga_shader_dump( } break; - case SVGA3DOP_RET: - _debug_printf( "ret\n" ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - break; - case SVGA3DOP_END: - _debug_printf( "end\n" ); finished = TRUE; break; default: { - const struct sh_opcode_info *info = svga_opcode_info( op.opcode ); - uint i; - uint num_src = info->num_src + op.predicated; - boolean not_first_arg = FALSE; - - assert( info->num_dst <= 1 ); - - if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3) - num_src += 2; - - dump_comp_op( op, info->mnemonic ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - - if (info->num_dst > 0) { - struct sh_dstreg dstreg = *(struct sh_dstreg *) assem; + const struct sh_opcode_info *info = svga_opcode_info(op.opcode); - dump_dstreg( dstreg, &di ); - assem += sizeof( struct sh_dstreg ) / sizeof( unsigned ); - not_first_arg = TRUE; - } - - for (i = 0; i < num_src; i++) { - struct sh_srcreg srcreg; - struct sh_srcreg indreg; - - srcreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - if (srcreg.relative && !di.is_ps && di.version.major >= 2) { - indreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - } - - if (not_first_arg) - _debug_printf( ", " ); - else - _debug_printf( " " ); - dump_srcreg( srcreg, &indreg, &di ); - not_first_arg = TRUE; - } - - _debug_printf( "\n" ); + dump_inst(&di, &assem, op, info); } } } diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c index 8343bfdaab4..95612a80063 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c @@ -41,103 +41,103 @@ static struct sh_opcode_info opcode_info[] = { - { "nop", 0, 0, SVGA3DOP_NOP }, - { "mov", 1, 1, SVGA3DOP_MOV, }, - { "add", 1, 2, SVGA3DOP_ADD, }, - { "sub", 1, 2, SVGA3DOP_SUB, }, - { "mad", 1, 3, SVGA3DOP_MAD, }, - { "mul", 1, 2, SVGA3DOP_MUL, }, - { "rcp", 1, 1, SVGA3DOP_RCP, }, - { "rsq", 1, 1, SVGA3DOP_RSQ, }, - { "dp3", 1, 2, SVGA3DOP_DP3, }, - { "dp4", 1, 2, SVGA3DOP_DP4, }, - { "min", 1, 2, SVGA3DOP_MIN, }, - { "max", 1, 2, SVGA3DOP_MAX, }, - { "slt", 1, 2, SVGA3DOP_SLT, }, - { "sge", 1, 2, SVGA3DOP_SGE, }, - { "exp", 1, 1, SVGA3DOP_EXP, }, - { "log", 1, 1, SVGA3DOP_LOG, }, - { "lit", 1, 1, SVGA3DOP_LIT, }, - { "dst", 1, 2, SVGA3DOP_DST, }, - { "lrp", 1, 3, SVGA3DOP_LRP, }, - { "frc", 1, 1, SVGA3DOP_FRC, }, - { "m4x4", 1, 2, SVGA3DOP_M4x4, }, - { "m4x3", 1, 2, SVGA3DOP_M4x3, }, - { "m3x4", 1, 2, SVGA3DOP_M3x4, }, - { "m3x3", 1, 2, SVGA3DOP_M3x3, }, - { "m3x2", 1, 2, SVGA3DOP_M3x2, }, - { "call", 0, 1, SVGA3DOP_CALL, }, - { "callnz", 0, 2, SVGA3DOP_CALLNZ, }, - { "loop", 0, 2, SVGA3DOP_LOOP, }, - { "ret", 0, 0, SVGA3DOP_RET, }, - { "endloop", 0, 0, SVGA3DOP_ENDLOOP, }, - { "label", 0, 1, SVGA3DOP_LABEL, }, - { "dcl", 0, 0, SVGA3DOP_DCL, }, - { "pow", 1, 2, SVGA3DOP_POW, }, - { "crs", 1, 2, SVGA3DOP_CRS, }, - { "sgn", 1, 3, SVGA3DOP_SGN, }, - { "abs", 1, 1, SVGA3DOP_ABS, }, - { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */ - { "sincos", 1, 1, SVGA3DOP_SINCOS, }, - { "rep", 0, 1, SVGA3DOP_REP, }, - { "endrep", 0, 0, SVGA3DOP_ENDREP, }, - { "if", 0, 1, SVGA3DOP_IF, }, - { "ifc", 0, 2, SVGA3DOP_IFC, }, - { "else", 0, 0, SVGA3DOP_ELSE, }, - { "endif", 0, 0, SVGA3DOP_ENDIF, }, - { "break", 0, 0, SVGA3DOP_BREAK, }, - { "breakc", 0, 0, SVGA3DOP_BREAKC, }, - { "mova", 1, 1, SVGA3DOP_MOVA, }, - { "defb", 0, 0, SVGA3DOP_DEFB, }, - { "defi", 0, 0, SVGA3DOP_DEFI, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, }, - { "texkill", 1, 0, SVGA3DOP_TEXKILL, }, - { "tex", 0, 0, SVGA3DOP_TEX, }, - { "texbem", 1, 1, SVGA3DOP_TEXBEM, }, - { "texbeml", 1, 1, SVGA3DOP_TEXBEML, }, - { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, }, - { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, }, - { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, }, - { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, }, - { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, }, - { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, }, - { "reserved0", 0, 0, SVGA3DOP_RESERVED0, }, - { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, }, - { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,}, - { "expp", 1, 1, SVGA3DOP_EXPP, }, - { "logp", 1, 1, SVGA3DOP_LOGP, }, - { "cnd", 1, 3, SVGA3DOP_CND, }, - { "def", 0, 0, SVGA3DOP_DEF, }, - { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, }, - { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, }, - { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,}, - { "texdp3", 1, 1, SVGA3DOP_TEXDP3, }, - { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, }, - { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, }, - { "cmp", 1, 3, SVGA3DOP_CMP, }, - { "bem", 1, 2, SVGA3DOP_BEM, }, - { "dp2add", 1, 3, SVGA3DOP_DP2ADD, }, - { "dsx", 1, 1, SVGA3DOP_INVALID, }, - { "dsy", 1, 1, SVGA3DOP_INVALID, }, - { "texldd", 1, 1, SVGA3DOP_INVALID, }, - { "setp", 1, 2, SVGA3DOP_SETP, }, - { "texldl", 1, 1, SVGA3DOP_INVALID, }, - { "breakp", 1, 1, SVGA3DOP_INVALID, }, + { "nop", 0, 0, 0, 0, SVGA3DOP_NOP }, + { "mov", 1, 1, 0, 0, SVGA3DOP_MOV, }, + { "add", 1, 2, 0, 0, SVGA3DOP_ADD, }, + { "sub", 1, 2, 0, 0, SVGA3DOP_SUB, }, + { "mad", 1, 3, 0, 0, SVGA3DOP_MAD, }, + { "mul", 1, 2, 0, 0, SVGA3DOP_MUL, }, + { "rcp", 1, 1, 0, 0, SVGA3DOP_RCP, }, + { "rsq", 1, 1, 0, 0, SVGA3DOP_RSQ, }, + { "dp3", 1, 2, 0, 0, SVGA3DOP_DP3, }, + { "dp4", 1, 2, 0, 0, SVGA3DOP_DP4, }, + { "min", 1, 2, 0, 0, SVGA3DOP_MIN, }, + { "max", 1, 2, 0, 0, SVGA3DOP_MAX, }, + { "slt", 1, 2, 0, 0, SVGA3DOP_SLT, }, + { "sge", 1, 2, 0, 0, SVGA3DOP_SGE, }, + { "exp", 1, 1, 0, 0, SVGA3DOP_EXP, }, + { "log", 1, 1, 0, 0, SVGA3DOP_LOG, }, + { "lit", 1, 1, 0, 0, SVGA3DOP_LIT, }, + { "dst", 1, 2, 0, 0, SVGA3DOP_DST, }, + { "lrp", 1, 3, 0, 0, SVGA3DOP_LRP, }, + { "frc", 1, 1, 0, 0, SVGA3DOP_FRC, }, + { "m4x4", 1, 2, 0, 0, SVGA3DOP_M4x4, }, + { "m4x3", 1, 2, 0, 0, SVGA3DOP_M4x3, }, + { "m3x4", 1, 2, 0, 0, SVGA3DOP_M3x4, }, + { "m3x3", 1, 2, 0, 0, SVGA3DOP_M3x3, }, + { "m3x2", 1, 2, 0, 0, SVGA3DOP_M3x2, }, + { "call", 0, 1, 0, 0, SVGA3DOP_CALL, }, + { "callnz", 0, 2, 0, 0, SVGA3DOP_CALLNZ, }, + { "loop", 0, 2, 0, 1, SVGA3DOP_LOOP, }, + { "ret", 0, 0, 0, 0, SVGA3DOP_RET, }, + { "endloop", 0, 0, 1, 0, SVGA3DOP_ENDLOOP, }, + { "label", 0, 1, 0, 0, SVGA3DOP_LABEL, }, + { "dcl", 0, 0, 0, 0, SVGA3DOP_DCL, }, + { "pow", 1, 2, 0, 0, SVGA3DOP_POW, }, + { "crs", 1, 2, 0, 0, SVGA3DOP_CRS, }, + { "sgn", 1, 3, 0, 0, SVGA3DOP_SGN, }, + { "abs", 1, 1, 0, 0, SVGA3DOP_ABS, }, + { "nrm", 1, 1, 0, 0, SVGA3DOP_NRM, }, /* 3-componenet normalization */ + { "sincos", 1, 3, 0, 0, SVGA3DOP_SINCOS, }, + { "rep", 0, 1, 0, 1, SVGA3DOP_REP, }, + { "endrep", 0, 0, 1, 0, SVGA3DOP_ENDREP, }, + { "if", 0, 1, 0, 1, SVGA3DOP_IF, }, + { "ifc", 0, 2, 0, 1, SVGA3DOP_IFC, }, + { "else", 0, 0, 1, 1, SVGA3DOP_ELSE, }, + { "endif", 0, 0, 1, 0, SVGA3DOP_ENDIF, }, + { "break", 0, 0, 0, 0, SVGA3DOP_BREAK, }, + { "breakc", 0, 2, 0, 0, SVGA3DOP_BREAKC, }, + { "mova", 1, 1, 0, 0, SVGA3DOP_MOVA, }, + { "defb", 0, 0, 0, 0, SVGA3DOP_DEFB, }, + { "defi", 0, 0, 0, 0, SVGA3DOP_DEFI, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, 0, 0, SVGA3DOP_INVALID, }, + { "texcoord", 1, 0, 0, 0, SVGA3DOP_TEXCOORD, }, + { "texkill", 1, 0, 0, 0, SVGA3DOP_TEXKILL, }, + { "tex", 1, 0, 0, 0, SVGA3DOP_TEX, }, + { "texbem", 1, 1, 0, 0, SVGA3DOP_TEXBEM, }, + { "texbeml", 1, 1, 0, 0, SVGA3DOP_TEXBEML, }, + { "texreg2ar", 1, 1, 0, 0, SVGA3DOP_TEXREG2AR, }, + { "texreg2gb", 1, 1, 0, 0, SVGA3DOP_TEXREG2GB, }, + { "texm3x2pad", 1, 1, 0, 0, SVGA3DOP_TEXM3x2PAD, }, + { "texm3x2tex", 1, 1, 0, 0, SVGA3DOP_TEXM3x2TEX, }, + { "texm3x3pad", 1, 1, 0, 0, SVGA3DOP_TEXM3x3PAD, }, + { "texm3x3tex", 1, 1, 0, 0, SVGA3DOP_TEXM3x3TEX, }, + { "reserved0", 0, 0, 0, 0, SVGA3DOP_RESERVED0, }, + { "texm3x3spec", 1, 2, 0, 0, SVGA3DOP_TEXM3x3SPEC, }, + { "texm3x3vspec", 1, 1, 0, 0, SVGA3DOP_TEXM3x3VSPEC,}, + { "expp", 1, 1, 0, 0, SVGA3DOP_EXPP, }, + { "logp", 1, 1, 0, 0, SVGA3DOP_LOGP, }, + { "cnd", 1, 3, 0, 0, SVGA3DOP_CND, }, + { "def", 0, 0, 0, 0, SVGA3DOP_DEF, }, + { "texreg2rgb", 1, 1, 0, 0, SVGA3DOP_TEXREG2RGB, }, + { "texdp3tex", 1, 1, 0, 0, SVGA3DOP_TEXDP3TEX, }, + { "texm3x2depth", 1, 1, 0, 0, SVGA3DOP_TEXM3x2DEPTH,}, + { "texdp3", 1, 1, 0, 0, SVGA3DOP_TEXDP3, }, + { "texm3x3", 1, 1, 0, 0, SVGA3DOP_TEXM3x3, }, + { "texdepth", 1, 0, 0, 0, SVGA3DOP_TEXDEPTH, }, + { "cmp", 1, 3, 0, 0, SVGA3DOP_CMP, }, + { "bem", 1, 2, 0, 0, SVGA3DOP_BEM, }, + { "dp2add", 1, 3, 0, 0, SVGA3DOP_DP2ADD, }, + { "dsx", 1, 1, 0, 0, SVGA3DOP_INVALID, }, + { "dsy", 1, 1, 0, 0, SVGA3DOP_INVALID, }, + { "texldd", 1, 4, 0, 0, SVGA3DOP_INVALID, }, + { "setp", 1, 2, 0, 0, SVGA3DOP_SETP, }, + { "texldl", 1, 2, 0, 0, SVGA3DOP_INVALID, }, + { "breakp", 0, 1, 0, 0, SVGA3DOP_INVALID, }, }; const struct sh_opcode_info *svga_opcode_info( uint op ) diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h index e558de02c53..a5ccae5ae58 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h @@ -38,6 +38,8 @@ struct sh_opcode_info const char *mnemonic; unsigned num_dst:8; unsigned num_src:8; + unsigned pre_dedent:1; + unsigned post_indent:1; unsigned svga_opcode:16; }; diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index 691b83c63fb..a43adac6940 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -32,7 +32,7 @@ #include "util/u_memory.h" #include "util/u_simple_list.h" #include "util/u_network.h" -#include "util/u_time.h" +#include "os/os_time.h" #include "tgsi/tgsi_parse.h" @@ -798,7 +798,7 @@ PIPE_THREAD_ROUTINE(trace_rbug_thread, void_tr_rbug) debug_printf("trace_rbug - remote debugging listening on port %u\n", --port); while(tr_rbug->running) { - util_time_sleep(1); + os_time_sleep(1); c = u_socket_accept(s); if (c < 0) |