Mesa (master): i965: add software fallback for conformant 3D textures and GL_CLAMP
Robert Ellison
papillo at kemper.freedesktop.org
Wed Mar 4 23:59:07 UTC 2009
Module: Mesa
Branch: master
Commit: 34683150878e0af0859c94d0c1f0c4bf8395b042
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=34683150878e0af0859c94d0c1f0c4bf8395b042
Author: Robert Ellison <papillo at vmware.com>
Date: Wed Mar 4 16:48:51 2009 -0700
i965: add software fallback for conformant 3D textures and GL_CLAMP
The i965 hardware cannot do GL_CLAMP behavior on textures; an earlier
commit forced a software fallback if strict conformance was required
(i.e. the INTEL_STRICT_CONFORMANCE environment variable was set) and
2D textures were used, but it was somewhat flawed - it could trigger
the software fallback even if 2D textures weren't enabled, as long
as one texture unit was enabled.
This fixes that, and adds software fallback for GL_CLAMP behavior with
1D and 3D textures.
It also adds support for a particular setting of the INTEL_STRICT_CONFORMANCE
environment variable, which forces software fallbacks to be taken *all*
the time. This is helpful with debugging. The value is:
export INTEL_STRICT_CONFORMANCE=2
---
.../drivers/i915simple/i915_state_sampler.c | 2 +-
src/mesa/drivers/dri/i915/intel_tris.c | 4 +-
src/mesa/drivers/dri/i965/brw_draw.c | 29 ++++++++++++++++---
src/mesa/drivers/dri/intel/intel_context.c | 10 +++++-
src/mesa/drivers/dri/intel/intel_context.h | 7 ++++-
5 files changed, 41 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/i915simple/i915_state_sampler.c b/src/gallium/drivers/i915simple/i915_state_sampler.c
index c09c106..3667ed1 100644
--- a/src/gallium/drivers/i915simple/i915_state_sampler.c
+++ b/src/gallium/drivers/i915simple/i915_state_sampler.c
@@ -116,7 +116,7 @@ static void update_sampler(struct i915_context *i915,
ws == PIPE_TEX_WRAP_CLAMP_TO_BORDER ||
wt == PIPE_TEX_WRAP_CLAMP_TO_BORDER ||
wr == PIPE_TEX_WRAP_CLAMP_TO_BORDER)) {
- if (i915->strict_conformance) {
+ if (i915->conformance_mode > 0) {
assert(0);
/* sampler->fallback = true; */
/* TODO */
diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c
index e809965..a857803 100644
--- a/src/mesa/drivers/dri/i915/intel_tris.c
+++ b/src/mesa/drivers/dri/i915/intel_tris.c
@@ -989,7 +989,7 @@ intelChooseRenderState(GLcontext * ctx)
intel->draw_tri = intel_fallback_tri;
if (flags & DD_TRI_SMOOTH) {
- if (intel->strict_conformance)
+ if (intel->conformance_mode > 0)
intel->draw_tri = intel_fallback_tri;
}
@@ -1001,7 +1001,7 @@ intelChooseRenderState(GLcontext * ctx)
}
if (flags & DD_POINT_SMOOTH) {
- if (intel->strict_conformance)
+ if (intel->conformance_mode > 0)
intel->draw_point = intel_fallback_point;
}
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 7ab1ece..0b64999 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -195,11 +195,15 @@ static GLboolean check_fallbacks( struct brw_context *brw,
GLuint i;
/* If we don't require strict OpenGL conformance, never
- * use fallbacks.
+ * use fallbacks. If we're forcing fallbacks, always
+ * use fallfacks.
*/
- if (!brw->intel.strict_conformance)
+ if (brw->intel.conformance_mode == 0)
return GL_FALSE;
+ if (brw->intel.conformance_mode == 2)
+ return GL_TRUE;
+
if (ctx->Polygon.SmoothFlag) {
for (i = 0; i < nr_prims; i++)
if (reduced_prim[prim[i].mode] == GL_TRIANGLES)
@@ -248,10 +252,25 @@ static GLboolean check_fallbacks( struct brw_context *brw,
{
int u;
for (u = 0; u < ctx->Const.MaxTextureCoordUnits; u++) {
- if (ctx->Texture.Unit[u].Enabled) {
- if (ctx->Texture.Unit[u].CurrentTex[TEXTURE_2D_INDEX]->WrapS == GL_CLAMP ||
- ctx->Texture.Unit[u].CurrentTex[TEXTURE_2D_INDEX]->WrapT == GL_CLAMP) {
+ struct gl_texture_unit *texUnit = &ctx->Texture.Unit[u];
+ if (texUnit->Enabled) {
+ if (texUnit->Enabled & TEXTURE_1D_BIT) {
+ if (texUnit->CurrentTex[TEXTURE_1D_INDEX]->WrapS == GL_CLAMP) {
+ return GL_TRUE;
+ }
+ }
+ if (texUnit->Enabled & TEXTURE_2D_BIT) {
+ if (texUnit->CurrentTex[TEXTURE_2D_INDEX]->WrapS == GL_CLAMP ||
+ texUnit->CurrentTex[TEXTURE_2D_INDEX]->WrapT == GL_CLAMP) {
+ return GL_TRUE;
+ }
+ }
+ if (texUnit->Enabled & TEXTURE_3D_BIT) {
+ if (texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapS == GL_CLAMP ||
+ texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapT == GL_CLAMP ||
+ texUnit->CurrentTex[TEXTURE_3D_INDEX]->WrapR == GL_CLAMP) {
return GL_TRUE;
+ }
}
}
}
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index b3f6fc0..6585323 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -506,10 +506,16 @@ intelInitContext(struct intel_context *intel,
* start.
*/
if (getenv("INTEL_STRICT_CONFORMANCE")) {
- intel->strict_conformance = 1;
+ unsigned int value = atoi(getenv("INTEL_STRICT_CONFORMANCE"));
+ if (value > 0) {
+ intel->conformance_mode = value;
+ }
+ else {
+ intel->conformance_mode = 1;
+ }
}
- if (intel->strict_conformance) {
+ if (intel->conformance_mode > 0) {
ctx->Const.MinLineWidth = 1.0;
ctx->Const.MinLineWidthAA = 1.0;
ctx->Const.MaxLineWidth = 1.0;
diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h
index 18dc43c..f2ecb9e 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -229,7 +229,12 @@ struct intel_context
GLboolean hw_stipple;
GLboolean depth_buffer_is_float;
GLboolean no_rast;
- GLboolean strict_conformance;
+
+ /* 0 - nonconformant, best performance;
+ * 1 - fallback to sw for known conformance bugs
+ * 2 - always fallback to sw
+ */
+ GLuint conformance_mode;
/* State for intelvb.c and inteltris.c.
*/
More information about the mesa-commit
mailing list