aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i915/i830_texstate.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2011-04-20 11:48:31 -0700
committerEric Anholt <[email protected]>2011-04-23 13:21:57 -0700
commit1f32c665c8af0622e2bbf451edb999ffbcd7d0fe (patch)
tree42deb7077604e541224b15de3c65eefaea605922 /src/mesa/drivers/dri/i915/i830_texstate.c
parent1df72402d99145425531297eef6772b88ce5225d (diff)
intel: Add support for ARB_sampler_objects.
This extension support consists of replacing "gl_texture_obj->Sampler." with "_mesa_get_samplerobj(ctx, unit)->". One instance of referencing the texture's base sampler remains in the initial miptree allocation, where I'm not sure we have a clear association with any texture unit. Tested with piglit ARB_sampler_objects/sampler-objects. Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i915/i830_texstate.c')
-rw-r--r--src/mesa/drivers/dri/i915/i830_texstate.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c
index 7554bd5e7b9..3298dbb69f5 100644
--- a/src/mesa/drivers/dri/i915/i830_texstate.c
+++ b/src/mesa/drivers/dri/i915/i830_texstate.c
@@ -29,6 +29,7 @@
#include "main/enums.h"
#include "main/colormac.h"
#include "main/macros.h"
+#include "main/samplerobj.h"
#include "intel_mipmap_tree.h"
#include "intel_tex.h"
@@ -120,6 +121,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
struct gl_texture_object *tObj = tUnit->_Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
struct gl_texture_image *firstImage;
+ struct gl_sampler_object *sampler = _mesa_get_samplerobj(ctx, unit);
GLuint *state = i830->state.Tex[unit], format, pitch;
GLint lodbias;
GLubyte border[4];
@@ -193,7 +195,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
float maxlod;
uint32_t minlod_fixed, maxlod_fixed;
- switch (tObj->Sampler.MinFilter) {
+ switch (sampler->MinFilter) {
case GL_NEAREST:
minFilt = FILTER_NEAREST;
mipFilt = MIPFILTER_NONE;
@@ -222,12 +224,12 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
return GL_FALSE;
}
- if (tObj->Sampler.MaxAnisotropy > 1.0) {
+ if (sampler->MaxAnisotropy > 1.0) {
minFilt = FILTER_ANISOTROPIC;
magFilt = FILTER_ANISOTROPIC;
}
else {
- switch (tObj->Sampler.MagFilter) {
+ switch (sampler->MagFilter) {
case GL_NEAREST:
magFilt = FILTER_NEAREST;
break;
@@ -239,7 +241,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
}
- lodbias = (int) ((tUnit->LodBias + tObj->Sampler.LodBias) * 16.0);
+ lodbias = (int) ((tUnit->LodBias + sampler->LodBias) * 16.0);
if (lodbias < -64)
lodbias = -64;
if (lodbias > 63)
@@ -259,8 +261,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
* addressable (smallest resolution) LOD. Use it to cover both
* MAX_LEVEL and MAX_LOD.
*/
- minlod_fixed = U_FIXED(CLAMP(tObj->Sampler.MinLod, 0.0, 11), 4);
- maxlod = MIN2(tObj->Sampler.MaxLod, tObj->_MaxLevel - tObj->BaseLevel);
+ minlod_fixed = U_FIXED(CLAMP(sampler->MinLod, 0.0, 11), 4);
+ maxlod = MIN2(sampler->MaxLod, tObj->_MaxLevel - tObj->BaseLevel);
if (intel->intelScreen->deviceID == PCI_CHIP_I855_GM ||
intel->intelScreen->deviceID == PCI_CHIP_I865_G) {
maxlod_fixed = U_FIXED(CLAMP(maxlod, 0.0, 11.75), 2);
@@ -279,8 +281,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
{
- GLenum ws = tObj->Sampler.WrapS;
- GLenum wt = tObj->Sampler.WrapT;
+ GLenum ws = sampler->WrapS;
+ GLenum wt = sampler->WrapT;
/* 3D textures not available on i830
@@ -300,10 +302,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
}
/* convert border color from float to ubyte */
- CLAMPED_FLOAT_TO_UBYTE(border[0], tObj->Sampler.BorderColor.f[0]);
- CLAMPED_FLOAT_TO_UBYTE(border[1], tObj->Sampler.BorderColor.f[1]);
- CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->Sampler.BorderColor.f[2]);
- CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->Sampler.BorderColor.f[3]);
+ CLAMPED_FLOAT_TO_UBYTE(border[0], sampler->BorderColor.f[0]);
+ CLAMPED_FLOAT_TO_UBYTE(border[1], sampler->BorderColor.f[1]);
+ CLAMPED_FLOAT_TO_UBYTE(border[2], sampler->BorderColor.f[2]);
+ CLAMPED_FLOAT_TO_UBYTE(border[3], sampler->BorderColor.f[3]);
state[I830_TEXREG_TM0S4] = PACK_COLOR_8888(border[3],
border[0],