[Mesa-dev] [PATCH 2/2] intel: make sure hardware choose the right filter mode

Yuanhan Liu yuanhan.liu at linux.intel.com
Tue Nov 1 02:57:36 PDT 2011


According to bspec, MIPCnt(was set to intelObj->_MaxLevel) was used for
min/mag filter mode determination. For a normal case with no mipmap like
this:

  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

hardware would always choose mag filter(GL_LINEAR) here since MIPCnt was
set to 0 zero, then would make LOD be zero. Then according the formula:
  MagMode = (LOD - Base <= 0)

Thus hardware choose Mag filter.

This would fix all oglc filtercubemin subcase fail

Signed-off-by: Yuanhan Liu <yuanhan.liu at linux.intel.com>
---
 src/mesa/drivers/dri/intel/intel_tex_validate.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index e2b8699..c06a043 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -21,8 +21,14 @@ intel_update_max_level(struct intel_texture_object *intelObj,
 {
    struct gl_texture_object *tObj = &intelObj->base;
 
-   if (sampler->MinFilter == GL_NEAREST ||
-       sampler->MinFilter == GL_LINEAR) {
+   /*
+    * According to Bspec vol5c 1.2.1.5 LOD Computation Pseudocode,
+    * the MIPCnt(here intelObj->_MaxLevel) was used for min/mag
+    * determination.
+    */
+   if ((sampler->MinFilter == sampler->MagFilter) &&
+        (sampler->MinFilter == GL_NEAREST ||
+         sampler->MinFilter == GL_LINEAR)) {
       intelObj->_MaxLevel = tObj->BaseLevel;
    } else {
       intelObj->_MaxLevel = tObj->_MaxLevel;
-- 
1.7.4.4



More information about the mesa-dev mailing list