diff options
Diffstat (limited to 'mesalib/src/gallium/auxiliary')
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_blitter.c | 26 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_debug_stack.c | 5 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_dump_defines.c | 31 | ||||
-rw-r--r-- | mesalib/src/gallium/auxiliary/util/u_inlines.h | 16 |
4 files changed, 67 insertions, 11 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_blitter.c b/mesalib/src/gallium/auxiliary/util/u_blitter.c index 95224020c..e37be4e0a 100644 --- a/mesalib/src/gallium/auxiliary/util/u_blitter.c +++ b/mesalib/src/gallium/auxiliary/util/u_blitter.c @@ -103,7 +103,10 @@ struct blitter_context_priv void *velem_state_readbuf; /* Sampler state. */ - void *sampler_state, *sampler_state_linear; + void *sampler_state; + void *sampler_state_linear; + void *sampler_state_rect; + void *sampler_state_rect_linear; /* Rasterizer state. */ void *rs_state, *rs_state_scissor, *rs_discard_state; @@ -223,10 +226,15 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) sampler_state.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; sampler_state.normalized_coords = 1; ctx->sampler_state = pipe->create_sampler_state(pipe, &sampler_state); + sampler_state.normalized_coords = 0; + ctx->sampler_state_rect = pipe->create_sampler_state(pipe, &sampler_state); sampler_state.min_img_filter = PIPE_TEX_FILTER_LINEAR; sampler_state.mag_img_filter = PIPE_TEX_FILTER_LINEAR; + sampler_state.normalized_coords = 1; ctx->sampler_state_linear = pipe->create_sampler_state(pipe, &sampler_state); + sampler_state.normalized_coords = 0; + ctx->sampler_state_rect_linear = pipe->create_sampler_state(pipe, &sampler_state); /* rasterizer state */ memset(&rs_state, 0, sizeof(rs_state)); @@ -365,8 +373,10 @@ void util_blitter_destroy(struct blitter_context *blitter) ctx->delete_fs_state(pipe, ctx->fs_col_int[i]); } - pipe->delete_sampler_state(pipe, ctx->sampler_state); + pipe->delete_sampler_state(pipe, ctx->sampler_state_rect_linear); + pipe->delete_sampler_state(pipe, ctx->sampler_state_rect); pipe->delete_sampler_state(pipe, ctx->sampler_state_linear); + pipe->delete_sampler_state(pipe, ctx->sampler_state); u_upload_destroy(ctx->upload); FREE(ctx); } @@ -1317,9 +1327,17 @@ void util_blitter_blit_generic(struct blitter_context *blitter, src_samples <= 1 && (dstbox->width != abs(srcbox->width) || dstbox->height != abs(srcbox->height))) { - sampler_state = ctx->sampler_state_linear; + if (src_target == PIPE_TEXTURE_RECT) { + sampler_state = ctx->sampler_state_rect_linear; + } else { + sampler_state = ctx->sampler_state_linear; + } } else { - sampler_state = ctx->sampler_state; + if (src_target == PIPE_TEXTURE_RECT) { + sampler_state = ctx->sampler_state_rect; + } else { + sampler_state = ctx->sampler_state; + } } /* Set samplers. */ diff --git a/mesalib/src/gallium/auxiliary/util/u_debug_stack.c b/mesalib/src/gallium/auxiliary/util/u_debug_stack.c index 558b911f2..50a248a97 100644 --- a/mesalib/src/gallium/auxiliary/util/u_debug_stack.c +++ b/mesalib/src/gallium/auxiliary/util/u_debug_stack.c @@ -48,10 +48,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace, if(!nr_frames) return; -#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) - __asm__ __volatile__("mov (%%ebp),%0": "=r" (frame_pointer)); - frame_pointer = (const void **)frame_pointer[0]; -#elif defined(PIPE_CC_GCC) +#if defined(PIPE_CC_GCC) frame_pointer = ((const void **)__builtin_frame_address(1)); #elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86) __asm { diff --git a/mesalib/src/gallium/auxiliary/util/u_dump_defines.c b/mesalib/src/gallium/auxiliary/util/u_dump_defines.c index 692d4447c..cc6268773 100644 --- a/mesalib/src/gallium/auxiliary/util/u_dump_defines.c +++ b/mesalib/src/gallium/auxiliary/util/u_dump_defines.c @@ -73,6 +73,23 @@ util_dump_enum_continuous(unsigned value, } +/** + * Same as DEFINE_UTIL_DUMP_CONTINUOUS but with static assertions to detect + * failures to update lists. + */ +#define DEFINE_UTIL_DUMP_CONTINUOUS_COUNT(_name, _count) \ + const char * \ + util_dump_##_name(unsigned value, boolean shortened) \ + { \ + STATIC_ASSERT(Elements(util_dump_##_name##_names) == _count); \ + STATIC_ASSERT(Elements(util_dump_##_name##_short_names) == _count); \ + if(shortened) \ + return util_dump_enum_continuous(value, Elements(util_dump_##_name##_short_names), util_dump_##_name##_short_names); \ + else \ + return util_dump_enum_continuous(value, Elements(util_dump_##_name##_names), util_dump_##_name##_names); \ + } + + static const char * util_dump_blend_factor_names[] = { UTIL_DUMP_INVALID_NAME, /* 0x0 */ @@ -262,7 +279,11 @@ util_dump_tex_target_names[] = { "PIPE_TEXTURE_1D", "PIPE_TEXTURE_2D", "PIPE_TEXTURE_3D", - "PIPE_TEXTURE_CUBE" + "PIPE_TEXTURE_CUBE", + "PIPE_TEXTURE_RECT", + "PIPE_TEXTURE_1D_ARRAY", + "PIPE_TEXTURE_2D_ARRAY", + "PIPE_TEXTURE_CUBE_ARRAY", }; static const char * @@ -271,10 +292,14 @@ util_dump_tex_target_short_names[] = { "1d", "2d", "3d", - "cube" + "cube", + "rect", + "1d_array", + "2d_array", + "cube_array", }; -DEFINE_UTIL_DUMP_CONTINUOUS(tex_target) +DEFINE_UTIL_DUMP_CONTINUOUS_COUNT(tex_target, PIPE_MAX_TEXTURE_TYPES) static const char * diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index 2ff90c982..ba745ebb5 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -582,6 +582,22 @@ util_copy_constant_buffer(struct pipe_constant_buffer *dst, } } +static INLINE unsigned +util_max_layer(struct pipe_resource *r, unsigned level) +{ + switch (r->target) { + case PIPE_TEXTURE_CUBE: + return 6 - 1; + case PIPE_TEXTURE_3D: + return u_minify(r->depth0, level) - 1; + case PIPE_TEXTURE_1D_ARRAY: + case PIPE_TEXTURE_2D_ARRAY: + case PIPE_TEXTURE_CUBE_ARRAY: + return r->array_size - 1; + default: + return 0; + } +} #ifdef __cplusplus } |