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);
}
}
}
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);
}
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.
}
{
- 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;
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);
}
}
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;
}
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);
/* 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 */
}
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)) |
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;
}
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)) |
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;
}
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 );
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 );
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);
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);
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;
}
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();
}
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;
};
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;
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;
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:
}
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);
st_translate_color(msamp->BorderColor.f,
teximg ? teximg->_BaseFormat : GL_RGBA,
- sampler->border_color);
+ sampler->border_color.f);
}
sampler->max_anisotropy = (msamp->MaxAnisotropy == 1.0 ?