st/mesa: also clamp and quantize per-unit lod bias
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
@@ -105,6 +105,7 @@ void
|
|||||||
st_convert_sampler(const struct st_context *st,
|
st_convert_sampler(const struct st_context *st,
|
||||||
const struct gl_texture_object *texobj,
|
const struct gl_texture_object *texobj,
|
||||||
const struct gl_sampler_object *msamp,
|
const struct gl_sampler_object *msamp,
|
||||||
|
float tex_unit_lod_bias,
|
||||||
struct pipe_sampler_state *sampler)
|
struct pipe_sampler_state *sampler)
|
||||||
{
|
{
|
||||||
memset(sampler, 0, sizeof(*sampler));
|
memset(sampler, 0, sizeof(*sampler));
|
||||||
@@ -119,7 +120,7 @@ st_convert_sampler(const struct st_context *st,
|
|||||||
if (texobj->Target != GL_TEXTURE_RECTANGLE_ARB)
|
if (texobj->Target != GL_TEXTURE_RECTANGLE_ARB)
|
||||||
sampler->normalized_coords = 1;
|
sampler->normalized_coords = 1;
|
||||||
|
|
||||||
sampler->lod_bias = msamp->LodBias;
|
sampler->lod_bias = msamp->LodBias + tex_unit_lod_bias;
|
||||||
/* Reduce the number of states by allowing only the values that AMD GCN
|
/* Reduce the number of states by allowing only the values that AMD GCN
|
||||||
* can represent. Apps use lod_bias for smooth transitions to bigger mipmap
|
* can represent. Apps use lod_bias for smooth transitions to bigger mipmap
|
||||||
* levels.
|
* levels.
|
||||||
@@ -241,9 +242,9 @@ st_convert_sampler_from_unit(const struct st_context *st,
|
|||||||
|
|
||||||
msamp = _mesa_get_samplerobj(ctx, texUnit);
|
msamp = _mesa_get_samplerobj(ctx, texUnit);
|
||||||
|
|
||||||
st_convert_sampler(st, texobj, msamp, sampler);
|
st_convert_sampler(st, texobj, msamp, ctx->Texture.Unit[texUnit].LodBias,
|
||||||
|
sampler);
|
||||||
|
|
||||||
sampler->lod_bias += ctx->Texture.Unit[texUnit].LodBias;
|
|
||||||
sampler->seamless_cube_map |= ctx->Texture.CubeMapSeamless;
|
sampler->seamless_cube_map |= ctx->Texture.CubeMapSeamless;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2972,7 +2972,7 @@ st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj,
|
|||||||
if (!st_finalize_texture(ctx, pipe, texObj, 0))
|
if (!st_finalize_texture(ctx, pipe, texObj, 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
st_convert_sampler(st, texObj, sampObj, &sampler);
|
st_convert_sampler(st, texObj, sampObj, 0, &sampler);
|
||||||
view = st_get_texture_sampler_view_from_stobj(st, stObj, sampObj, 0);
|
view = st_get_texture_sampler_view_from_stobj(st, stObj, sampObj, 0);
|
||||||
} else {
|
} else {
|
||||||
view = st_get_buffer_sampler_view_from_stobj(st, stObj);
|
view = st_get_buffer_sampler_view_from_stobj(st, stObj);
|
||||||
|
@@ -281,6 +281,7 @@ void
|
|||||||
st_convert_sampler(const struct st_context *st,
|
st_convert_sampler(const struct st_context *st,
|
||||||
const struct gl_texture_object *texobj,
|
const struct gl_texture_object *texobj,
|
||||||
const struct gl_sampler_object *msamp,
|
const struct gl_sampler_object *msamp,
|
||||||
|
float tex_unit_lod_bias,
|
||||||
struct pipe_sampler_state *sampler);
|
struct pipe_sampler_state *sampler);
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user