summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i915
diff options
context:
space:
mode:
authorYuanhan Liu <[email protected]>2012-02-29 15:04:45 +0800
committerYuanhan Liu <[email protected]>2012-03-19 10:06:48 +0800
commit40c995c1fd7865f1b25765aa783fdadbf948b3dd (patch)
treef1d9b1a3faa3eda05843a34cf09db9eb0d1179d3 /src/mesa/drivers/dri/i915
parenta2e7629e688b6c258baf01e14dddf8c5ce645ee2 (diff)
i915: fallback for NPOT cubemap texture
Although some hardware support NPOT cubemap, but it seems we don't know the right layout for NPOT cubemap. Thus seems we need do fallback for other platforms as well. See comments inline the code for more detailed info. v2: give a more detailed info about why we need fallback for other platfroms as well. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=46666 NOTE: This is a candidate for stable release branches. Signed-off-by: Yuanhan Liu <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i915')
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index 902254833d4..fd63a69151f 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -319,6 +319,28 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
((wt != GL_CLAMP) && (wt != GL_CLAMP_TO_EDGE))))
return false;
+ /*
+ * According to 3DSTATE_MAP_STATE at page of 104 in Bspec
+ * Vol3d 3D Instructions:
+ * [DevGDG and DevAlv]: Must be a power of 2 for cube maps.
+ * [DevLPT, DevCST and DevBLB]: If not a power of 2, cube maps
+ * must have all faces enabled.
+ *
+ * But, as I tested on pineview(DevBLB derived), the rendering is
+ * bad(you will find the color isn't samplered right in some
+ * fragments). After checking, it seems that the texture layout is
+ * wrong: making the width and height align of 4(although this
+ * doesn't make much sense) will fix this issue and also broke some
+ * others. Well, Bspec mentioned nothing about the layout alignment
+ * and layout for NPOT cube map. I guess the Bspec just assume it's
+ * a POT cube map.
+ *
+ * Thus, I guess we need do this for other platforms as well.
+ */
+ if (tObj->Target == GL_TEXTURE_CUBE_MAP_ARB &&
+ !is_power_of_two(firstImage->Height))
+ return false;
+
state[I915_TEXREG_SS3] = ss3; /* SS3_NORMALIZED_COORDS */
state[I915_TEXREG_SS3] |=