[virglrenderer-devel] [PATCH 14/16] vrend: Warn on lod bias usage
Jakob Bornecrantz
jakob.bornecrantz at collabora.com
Fri Dec 22 18:57:54 UTC 2017
This is not supported in GLES, only warn any setting other then the default.
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz at collabora.com>
---
src/vrend_renderer.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 2023a62..cb672fd 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -506,8 +506,9 @@ static void __report_core_warn(const char *fname, struct vrend_context *ctx, enu
#define GLES_WARN_POLYGON_MODE 2
#define GLES_WARN_DEPTH_RANGE 3
#define GLES_WARN_POINT_SIZE 4
+#define GLES_WARN_LOD_BIAS 5
-static const char *vrend_gles_warn_strings[] = { "None", "Stipple", "Polygon Mode", "Depth Range", "Point Size" };
+static const char *vrend_gles_warn_strings[] = { "None", "Stipple", "Polygon Mode", "Depth Range", "Point Size", "Lod Bias" };
static void __report_gles_warn(const char *fname, struct vrend_context *ctx, enum virgl_ctx_errors error, uint32_t value)
{
@@ -1275,9 +1276,15 @@ int vrend_create_sampler_state(struct vrend_context *ctx,
glSamplerParameterf(state->id, GL_TEXTURE_MAG_FILTER, convert_mag_filter(templ->mag_img_filter));
glSamplerParameterf(state->id, GL_TEXTURE_MIN_LOD, templ->min_lod);
glSamplerParameterf(state->id, GL_TEXTURE_MAX_LOD, templ->max_lod);
- glSamplerParameterf(state->id, GL_TEXTURE_LOD_BIAS, templ->lod_bias);
glSamplerParameteri(state->id, GL_TEXTURE_COMPARE_MODE, templ->compare_mode ? GL_COMPARE_R_TO_TEXTURE : GL_NONE);
glSamplerParameteri(state->id, GL_TEXTURE_COMPARE_FUNC, GL_NEVER + templ->compare_func);
+ if (vrend_state.use_gles) {
+ if (templ->lod_bias != 0.0f) {
+ report_gles_warn(ctx, GLES_WARN_LOD_BIAS, 0);
+ }
+ } else {
+ glSamplerParameterf(state->id, GL_TEXTURE_LOD_BIAS, templ->lod_bias);
+ }
glSamplerParameterIuiv(state->id, GL_TEXTURE_BORDER_COLOR, templ->border_color.ui);
}
@@ -3697,8 +3704,15 @@ static void vrend_apply_sampler_state(struct vrend_context *ctx,
glTexParameterf(target, GL_TEXTURE_MIN_LOD, state->min_lod);
if (tex->state.max_lod != state->max_lod || set_all)
glTexParameterf(target, GL_TEXTURE_MAX_LOD, state->max_lod);
- if (tex->state.lod_bias != state->lod_bias || set_all)
- glTexParameterf(target, GL_TEXTURE_LOD_BIAS, state->lod_bias);
+ if (tex->state.lod_bias != state->lod_bias || set_all) {
+ if (vrend_state.use_gles) {
+ if (state->lod_bias) {
+ report_gles_warn(ctx, GLES_WARN_LOD_BIAS, 0);
+ }
+ } else {
+ glTexParameterf(target, GL_TEXTURE_LOD_BIAS, state->lod_bias);
+ }
+ }
}
if (tex->state.compare_mode != state->compare_mode || set_all)
--
2.11.0
More information about the virglrenderer-devel
mailing list