diff options
author | Dave Airlie <[email protected]> | 2011-09-27 10:08:34 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-09-27 20:02:02 +0100 |
commit | 9f61e43b4903c6cf0ac03a479ec9ed7b15fd6ccf (patch) | |
tree | 8985ff4b3c47899deb7604511ac168fa76e46f63 /src/gallium | |
parent | 0527c11d7aa42bd74f4527d7299e3c18f37c4c44 (diff) |
gallium: move border color to be a color union
EXT_texture_integer also specifies border color should be a color
union, the values are used according to the texture sampler format.
(update docs)
Signed-off-by: Dave Airlie <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/draw/draw_llvm.c | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/util/u_dump_state.c | 2 | ||||
-rw-r--r-- | src/gallium/docs/source/cso/sampler.rst | 5 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_state.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/nv50/nv50_state.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/nvfx/nvfx_fragtex.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_state_derived.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/r600/evergreen_state.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_state.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_tex_sample.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_pipe_sampler.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/trace/tr_dump_state.c | 2 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_state.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h | 8 | ||||
-rw-r--r-- | src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/api_filters.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/vega/paint.c | 2 |
18 files changed, 43 insertions, 42 deletions
diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 24f98588efd..d427d2c9ced 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1509,7 +1509,7 @@ draw_llvm_set_sampler_state(struct draw_context *draw) jit_tex->min_lod = draw->samplers[i]->min_lod; jit_tex->max_lod = draw->samplers[i]->max_lod; jit_tex->lod_bias = draw->samplers[i]->lod_bias; - COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color); + COPY_4V(jit_tex->border_color, draw->samplers[i]->border_color.f); } } } diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c index 5ecf8cbb067..6bb36996632 100644 --- a/src/gallium/auxiliary/util/u_dump_state.c +++ b/src/gallium/auxiliary/util/u_dump_state.c @@ -617,7 +617,7 @@ util_dump_sampler_state(struct os_stream *stream, const struct pipe_sampler_stat util_dump_member(stream, float, state, lod_bias); util_dump_member(stream, float, state, min_lod); util_dump_member(stream, float, state, max_lod); - util_dump_member_array(stream, float, state, border_color); + util_dump_member_array(stream, float, state, border_color.f); util_dump_struct_end(stream); } diff --git a/src/gallium/docs/source/cso/sampler.rst b/src/gallium/docs/source/cso/sampler.rst index 648b5cc60ea..26ffc181031 100644 --- a/src/gallium/docs/source/cso/sampler.rst +++ b/src/gallium/docs/source/cso/sampler.rst @@ -99,8 +99,9 @@ min_lod max_lod Maximum level of detail, used to clamp LOD after bias. border_color - RGBA color used for texel coordinates that are outside the [0,width-1], - [0, height-1] or [0, depth-1] ranges. + Color union used for texel coordinates that are outside the [0,width-1], + [0, height-1] or [0, depth-1] ranges. Interpreted according to sampler + view format. max_anisotropy Maximum anistropy ratio to use when sampling from textures. For example, if max_anistropy=4, a region of up to 1 by 4 texels will be sampled. diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 2812de1fe80..345c109a995 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -279,10 +279,10 @@ i915_create_sampler_state(struct pipe_context *pipe, } { - ubyte r = float_to_ubyte(sampler->border_color[0]); - ubyte g = float_to_ubyte(sampler->border_color[1]); - ubyte b = float_to_ubyte(sampler->border_color[2]); - ubyte a = float_to_ubyte(sampler->border_color[3]); + ubyte r = float_to_ubyte(sampler->border_color.f[0]); + ubyte g = float_to_ubyte(sampler->border_color.f[1]); + ubyte b = float_to_ubyte(sampler->border_color.f[2]); + ubyte a = float_to_ubyte(sampler->border_color.f[3]); cso->state[2] = I915PACKCOLOR8888(r, g, b, a); } return cso; diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index cbe06e58a78..1479ed44f0f 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -729,7 +729,7 @@ lp_setup_set_fragment_sampler_state(struct lp_setup_context *setup, jit_tex->min_lod = sampler->min_lod; jit_tex->max_lod = sampler->max_lod; jit_tex->lod_bias = sampler->lod_bias; - COPY_4V(jit_tex->border_color, sampler->border_color); + COPY_4V(jit_tex->border_color, sampler->border_color.f); } } diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 49ea646c77c..0e08b096f58 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -508,10 +508,10 @@ nv50_sampler_state_create(struct pipe_context *pipe, so->tsc[2] |= (((int)(f[1] * 256.0f) & 0xfff) << 12) | ((int)(f[0] * 256.0f) & 0xfff); - so->tsc[4] = fui(cso->border_color[0]); - so->tsc[5] = fui(cso->border_color[1]); - so->tsc[6] = fui(cso->border_color[2]); - so->tsc[7] = fui(cso->border_color[3]); + so->tsc[4] = fui(cso->border_color.f[0]); + so->tsc[5] = fui(cso->border_color.f[1]); + so->tsc[6] = fui(cso->border_color.f[2]); + so->tsc[7] = fui(cso->border_color.f[3]); return (void *)so; } diff --git a/src/gallium/drivers/nvfx/nvfx_fragtex.c b/src/gallium/drivers/nvfx/nvfx_fragtex.c index 1c4901df0e2..3ef9fcce347 100644 --- a/src/gallium/drivers/nvfx/nvfx_fragtex.c +++ b/src/gallium/drivers/nvfx/nvfx_fragtex.c @@ -25,7 +25,7 @@ nvfx_sampler_state_create(struct pipe_context *pipe, ps->wrap |= nvfx_tex_wrap_compare_mode(cso->compare_func); ps->compare = TRUE; } - ps->bcol = nvfx_tex_border_color(cso->border_color); + ps->bcol = nvfx_tex_border_color(cso->border_color.f); if(nvfx->is_nv4x) nv40_sampler_state_init(pipe, ps, cso); diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 45c11fce1fe..daeb4d716d0 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -762,7 +762,7 @@ static void r300_merge_textures_and_samplers(struct r300_context* r300) /* Set the border color. */ texstate->border_color = r300_get_border_color(view->base.format, - sampler->state.border_color, + sampler->state.border_color.f, r300->screen->caps.is_r500); /* determine min/max levels */ diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 3b7844f0fa4..875c806b0a4 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -938,7 +938,7 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, } rstate->id = R600_PIPE_STATE_SAMPLER; - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); + util_pack_color(state->border_color.f, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); r600_pipe_state_add_reg_noblock(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0, S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | @@ -960,10 +960,10 @@ static void *evergreen_create_sampler_state(struct pipe_context *ctx, 0xFFFFFFFF, NULL, 0); if (uc.ui) { - r600_pipe_state_add_reg_noblock(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL, 0); - r600_pipe_state_add_reg_noblock(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL, 0); - r600_pipe_state_add_reg_noblock(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL, 0); - r600_pipe_state_add_reg_noblock(rstate, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color.f[0]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color.f[1]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color.f[2]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A410_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color.f[3]), 0xFFFFFFFF, NULL, 0); } return rstate; } diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 2e2ce40d447..6edf3857d92 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -981,7 +981,7 @@ static void *r600_create_sampler_state(struct pipe_context *ctx, ss->seamless_cube_map = state->seamless_cube_map; rstate = &ss->rstate; rstate->id = R600_PIPE_STATE_SAMPLER; - util_pack_color(state->border_color, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); + util_pack_color(state->border_color.f, PIPE_FORMAT_B8G8R8A8_UNORM, &uc); r600_pipe_state_add_reg_noblock(rstate, R_03C000_SQ_TEX_SAMPLER_WORD0_0, S_03C000_CLAMP_X(r600_tex_wrap(state->wrap_s)) | S_03C000_CLAMP_Y(r600_tex_wrap(state->wrap_t)) | @@ -998,10 +998,10 @@ static void *r600_create_sampler_state(struct pipe_context *ctx, S_03C004_LOD_BIAS(S_FIXED(CLAMP(state->lod_bias, -16, 16), 6)), 0xFFFFFFFF, NULL, 0); r600_pipe_state_add_reg_noblock(rstate, R_03C008_SQ_TEX_SAMPLER_WORD2_0, S_03C008_TYPE(1), 0xFFFFFFFF, NULL, 0); if (uc.ui) { - r600_pipe_state_add_reg_noblock(rstate, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color[0]), 0xFFFFFFFF, NULL, 0); - r600_pipe_state_add_reg_noblock(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color[1]), 0xFFFFFFFF, NULL, 0); - r600_pipe_state_add_reg_noblock(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color[2]), 0xFFFFFFFF, NULL, 0); - r600_pipe_state_add_reg_noblock(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color[3]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A400_TD_PS_SAMPLER0_BORDER_RED, fui(state->border_color.f[0]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A404_TD_PS_SAMPLER0_BORDER_GREEN, fui(state->border_color.f[1]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A408_TD_PS_SAMPLER0_BORDER_BLUE, fui(state->border_color.f[2]), 0xFFFFFFFF, NULL, 0); + r600_pipe_state_add_reg_noblock(rstate, R_00A40C_TD_PS_SAMPLER0_BORDER_ALPHA, fui(state->border_color.f[3]), 0xFFFFFFFF, NULL, 0); } return rstate; } diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 2e91a709fe0..72629a0bcac 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -672,7 +672,7 @@ get_texel_2d(const struct sp_sampler_variant *samp, if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level)) { - return samp->sampler->border_color; + return samp->sampler->border_color.f; } else { return get_texel_2d_no_border( samp, addr, x, y ); @@ -766,7 +766,7 @@ get_texel_3d(const struct sp_sampler_variant *samp, if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level) || z < 0 || z >= (int) u_minify(texture->depth0, level)) { - return samp->sampler->border_color; + return samp->sampler->border_color.f; } else { return get_texel_3d_no_border( samp, addr, x, y, z ); @@ -783,7 +783,7 @@ get_texel_1d_array(const struct sp_sampler_variant *samp, unsigned level = addr.bits.level; if (x < 0 || x >= (int) u_minify(texture->width0, level)) { - return samp->sampler->border_color; + return samp->sampler->border_color.f; } else { return get_texel_2d_no_border(samp, addr, x, y); @@ -803,7 +803,7 @@ get_texel_2d_array(const struct sp_sampler_variant *samp, if (x < 0 || x >= (int) u_minify(texture->width0, level) || y < 0 || y >= (int) u_minify(texture->height0, level)) { - return samp->sampler->border_color; + return samp->sampler->border_color.f; } else { return get_texel_3d_no_border(samp, addr, x, y, layer); diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index dcfeaacbef1..4885d200584 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -113,10 +113,10 @@ svga_create_sampler_state(struct pipe_context *pipe, cso->compare_func = sampler->compare_func; { - uint32 r = float_to_ubyte(sampler->border_color[0]); - uint32 g = float_to_ubyte(sampler->border_color[1]); - uint32 b = float_to_ubyte(sampler->border_color[2]); - uint32 a = float_to_ubyte(sampler->border_color[3]); + uint32 r = float_to_ubyte(sampler->border_color.f[0]); + uint32 g = float_to_ubyte(sampler->border_color.f[1]); + uint32 b = float_to_ubyte(sampler->border_color.f[2]); + uint32 a = float_to_ubyte(sampler->border_color.f[3]); cso->bordercolor = (a << 24) | (r << 16) | (g << 8) | b; } diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index 291a6a29ca5..652ffa7a94b 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -447,7 +447,7 @@ void trace_dump_sampler_state(const struct pipe_sampler_state *state) trace_dump_member(float, state, lod_bias); trace_dump_member(float, state, min_lod); trace_dump_member(float, state, max_lod); - trace_dump_member_array(float, state, border_color); + trace_dump_member_array(float, state, border_color.f); trace_dump_struct_end(); } diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index a57e805bd13..90a85601852 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -272,7 +272,7 @@ struct pipe_sampler_state unsigned seamless_cube_map:1; float lod_bias; /**< LOD/lambda bias */ float min_lod, max_lod; /**< LOD clamp range, after bias */ - float border_color[4]; + union pipe_color_union border_color; }; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h index 6cb19330f22..6514146e367 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_context.h @@ -228,10 +228,10 @@ struct GalliumD3D10Device : public GalliumD3D10ScreenImpl<threadsafe> samplerd.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; samplerd.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; samplerd.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; - samplerd.border_color[0] = 1.0f; - samplerd.border_color[1] = 1.0f; - samplerd.border_color[2] = 1.0f; - samplerd.border_color[3] = 1.0f; + samplerd.border_color.f[0] = 1.0f; + samplerd.border_color.f[1] = 1.0f; + samplerd.border_color.f[2] = 1.0f; + samplerd.border_color.f[3] = 1.0f; samplerd.min_lod = -FLT_MAX; samplerd.max_lod = FLT_MAX; samplerd.max_anisotropy = 1; diff --git a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h index 3674731b1e1..4405d33ea8a 100644 --- a/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h +++ b/src/gallium/state_trackers/d3d1x/gd3d11/d3d11_screen.h @@ -553,7 +553,7 @@ struct GalliumD3D11ScreenImpl : public GalliumD3D11Screen state.wrap_t = d3d11_to_pipe_wrap[sampler_desc->AddressV]; state.wrap_r = d3d11_to_pipe_wrap[sampler_desc->AddressW]; state.lod_bias = sampler_desc->MipLODBias; - memcpy(state.border_color, sampler_desc->BorderColor, sizeof(state.border_color)); + memcpy(state.border_color.f, sampler_desc->BorderColor, sizeof(state.border_color)); state.min_lod = sampler_desc->MinLOD; state.max_lod = sampler_desc->MaxLOD; diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index 6be460c495c..af824d91bd2 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -194,7 +194,7 @@ static void execute_filter(struct vg_context *ctx, case VG_TILE_FILL: tex_wrap = PIPE_TEX_WRAP_CLAMP_TO_BORDER; /* copy border color */ - memcpy(sampler.border_color, ctx->state.vg.tile_fill_color, + memcpy(sampler.border_color.f, ctx->state.vg.tile_fill_color, sizeof(sampler.border_color)); break; case VG_TILE_PAD: diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index ea551811fcd..40b4b2502f1 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -652,7 +652,7 @@ VGint paint_bind_samplers(struct vg_paint *paint, struct pipe_sampler_state **sa } break; case VG_PAINT_TYPE_PATTERN: { - memcpy(paint->pattern.sampler.border_color, + memcpy(paint->pattern.sampler.border_color.f, ctx->state.vg.tile_fill_color, sizeof(VGfloat) * 4); paint->pattern.sampler.min_img_filter = image_sampler_filter(ctx); |