summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Hourihane <alanh@tungstengraphics.com>2005-01-06 14:35:44 +0000
committerAlan Hourihane <alanh@tungstengraphics.com>2005-01-06 14:35:44 +0000
commita2db56b34b7fe0fb58441d293ba56b8ed48141a8 (patch)
treeae1ede85df888975714ed214757e4c7cee9206b4 /src
parent9f149bf2068c8897497d2b795006ae7334cfc3f6 (diff)
Add Intel i915GM support, and these extensions.
* GL_ARB_texture_cube_map * GL_EXT_blend_equation_separate * GL_ATI_blend_equation_separate * GL_ARB_point_parameters * GL_NV_blend_square * GL_EXT_cull_vertex * GL_ARB_depth_texture * GL_SGIX_depth_texture * GL_ARB_shadow * GL_EXT_shadow_funcs * GL_3DFX_texture_compression_FXT1 (Keith Whitwell, Tungsten Graphics)
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i915/i830_reg.h45
-rw-r--r--src/mesa/drivers/dri/i915/i830_state.c204
-rw-r--r--src/mesa/drivers/dri/i915/i915_context.c31
-rw-r--r--src/mesa/drivers/dri/i915/i915_metaops.c6
-rw-r--r--src/mesa/drivers/dri/i915/i915_reg.h72
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c157
-rw-r--r--src/mesa/drivers/dri/i915/i915_tex.c7
-rw-r--r--src/mesa/drivers/dri/i915/i915_texprog.c13
-rw-r--r--src/mesa/drivers/dri/i915/i915_texstate.c240
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c34
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.h59
-rw-r--r--src/mesa/drivers/dri/i915/intel_ioctl.c2
-rw-r--r--src/mesa/drivers/dri/i915/intel_screen.c1
-rw-r--r--src/mesa/drivers/dri/i915/intel_state.c127
-rw-r--r--src/mesa/drivers/dri/i915/intel_tex.c16
15 files changed, 436 insertions, 578 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_reg.h b/src/mesa/drivers/dri/i915/i830_reg.h
index b931a6b63c..c45b88ca52 100644
--- a/src/mesa/drivers/dri/i915/i830_reg.h
+++ b/src/mesa/drivers/dri/i915/i830_reg.h
@@ -205,21 +205,6 @@
#define ENABLE_DST_ABLEND_FACTOR (1<<5)
#define DST_ABLEND_FACT(x) (x)
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_DST_COLR 0x09
-#define BLENDFACT_INV_DST_COLR 0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
-#define BLENDFACT_CONST_COLOR 0x0c
-#define BLENDFACT_INV_CONST_COLOR 0x0d
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
/* _3DSTATE_MAP_BLEND_ARG, p152 */
#define _3DSTATE_MAP_BLEND_ARG_CMD(stage) (CMD_3D|(0x0e<<24)|((stage)<<20))
@@ -363,19 +348,6 @@
#define SRC_BLND_FACT(x) ((x)<<6)
#define DST_BLND_FACT(x) (x)
-/* Use the blendfact defines for BLND_FACTOR macros */
-#if 0
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-#endif
/* _3DSTATE_MODES_2, p192 */
#define _3DSTATE_MODES_2_CMD (CMD_3D|(0x0f<<24))
@@ -387,14 +359,6 @@
#define ALPHA_REF_VALUE(x) (x)
#define ALPHA_TEST_REF_MASK 0x3fff
-#define COMPAREFUNC_ALWAYS 0
-#define COMPAREFUNC_NEVER 0x1
-#define COMPAREFUNC_LESS 0x2
-#define COMPAREFUNC_EQUAL 0x3
-#define COMPAREFUNC_LEQUAL 0x4
-#define COMPAREFUNC_GREATER 0x5
-#define COMPAREFUNC_NOTEQUAL 0x6
-#define COMPAREFUNC_GEQUAL 0x7
/* _3DSTATE_MODES_3, p193 */
#define _3DSTATE_MODES_3_CMD (CMD_3D|(0x02<<24))
@@ -495,15 +459,6 @@
#define STENCIL_PASS_DEPTH_FAIL_OP(x) ((x)<<17)
#define STENCIL_PASS_DEPTH_PASS_OP(x) ((x)<<14)
-#define STENCILOP_KEEP 0
-#define STENCILOP_ZERO 0x1
-#define STENCILOP_REPLACE 0x2
-#define STENCILOP_INCRSAT 0x3
-#define STENCILOP_DECRSAT 0x4
-#define STENCILOP_INCR 0x5
-#define STENCILOP_DECR 0x6
-#define STENCILOP_INVERT 0x7
-
#define ENABLE_STENCIL_TEST_FUNC_MASK ((1<<13)|(1<<12)|(1<<11)|(1<<10)|(1<<9))
#define ENABLE_STENCIL_TEST_FUNC (1<<13)
/* Uses COMPAREFUNC */
diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c
index a5ebc9e2aa..ec19fe980d 100644
--- a/src/mesa/drivers/dri/i915/i830_state.c
+++ b/src/mesa/drivers/dri/i915/i830_state.c
@@ -44,7 +44,7 @@ static void i830StencilFunc(GLcontext *ctx, GLenum func, GLint ref,
GLuint mask)
{
i830ContextPtr i830 = I830_CONTEXT(ctx);
- int test = 0;
+ int test = intel_translate_compare_func(func);
mask = mask & 0xff;
@@ -52,34 +52,6 @@ static void i830StencilFunc(GLcontext *ctx, GLenum func, GLint ref,
fprintf(stderr, "%s : func: %s, ref : 0x%x, mask: 0x%x\n", __FUNCTION__,
_mesa_lookup_enum_by_nr(func), ref, mask);
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default:
- return;
- }
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_STATE4] &= ~MODE4_ENABLE_STENCIL_TEST_MASK;
@@ -219,42 +191,13 @@ static void i830StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
static void i830AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
{
i830ContextPtr i830 = I830_CONTEXT(ctx);
- int test = 0;
+ int test = intel_translate_compare_func(func);
GLubyte refByte;
GLuint refInt;
UNCLAMPED_FLOAT_TO_UBYTE(refByte, ref);
refInt = (GLuint)refByte;
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default:
- return;
- }
-
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_STATE2] &= ~ALPHA_TEST_REF_MASK;
i830->state.Ctx[I830_CTXREG_STATE2] |= (ENABLE_ALPHA_TEST_FUNC |
@@ -314,55 +257,6 @@ static void i830BlendColor(GLcontext *ctx, const GLfloat color[4])
i830->state.Ctx[I830_CTXREG_BLENDCOLOR1] = (a<<24) | (r<<16) | (g<<8) | b;
}
-
-/**
- * Calculate the hardware blend factor setting. This same function is used
- * for source and destination of both alpha and RGB.
- *
- * \returns
- * The hardware register value for the specified blend factor. This value
- * will need to be shifted into the correct position for either source or
- * destination factor.
- */
-static int translate_blend_factor( GLenum factor )
-{
- switch(factor) {
- case GL_ZERO:
- return BLENDFACT_ZERO;
- case GL_SRC_ALPHA:
- return BLENDFACT_SRC_ALPHA;
- case GL_ONE:
- return BLENDFACT_ONE;
- case GL_SRC_COLOR:
- return BLENDFACT_SRC_COLR;
- case GL_ONE_MINUS_SRC_COLOR:
- return BLENDFACT_INV_SRC_COLR;
- case GL_DST_COLOR:
- return BLENDFACT_DST_COLR;
- case GL_ONE_MINUS_DST_COLOR:
- return BLENDFACT_INV_DST_COLR;
- case GL_ONE_MINUS_SRC_ALPHA:
- return BLENDFACT_INV_SRC_ALPHA;
- case GL_DST_ALPHA:
- return BLENDFACT_DST_ALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return BLENDFACT_INV_DST_ALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return BLENDFACT_SRC_ALPHA_SATURATE;
- case GL_CONSTANT_COLOR:
- return BLENDFACT_CONST_COLOR;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- return BLENDFACT_INV_CONST_COLOR;
- case GL_CONSTANT_ALPHA:
- return BLENDFACT_CONST_ALPHA;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- return BLENDFACT_INV_CONST_ALPHA;
- default:
- return BLENDFACT_ZERO;
- }
-}
-
-
/**
* Sets both the blend equation (called "function" in i830 docs) and the
* blend function (called "factor" in i830 docs). This is done in a single
@@ -380,8 +274,8 @@ static void i830_set_blend_state( GLcontext * ctx )
int s1;
- funcRGB = SRC_BLND_FACT( translate_blend_factor( ctx->Color.BlendSrcRGB ) )
- | DST_BLND_FACT( translate_blend_factor( ctx->Color.BlendDstRGB ) );
+ funcRGB = SRC_BLND_FACT( intel_translate_blend_factor( ctx->Color.BlendSrcRGB ) )
+ | DST_BLND_FACT( intel_translate_blend_factor( ctx->Color.BlendDstRGB ) );
switch(ctx->Color.BlendEquationRGB) {
case GL_FUNC_ADD:
@@ -408,8 +302,8 @@ static void i830_set_blend_state( GLcontext * ctx )
}
- funcA = SRC_ABLEND_FACT( translate_blend_factor( ctx->Color.BlendSrcA ) )
- | DST_ABLEND_FACT( translate_blend_factor( ctx->Color.BlendDstA ) );
+ funcA = SRC_ABLEND_FACT( intel_translate_blend_factor( ctx->Color.BlendSrcA ) )
+ | DST_ABLEND_FACT( intel_translate_blend_factor( ctx->Color.BlendDstA ) );
switch(ctx->Color.BlendEquationA) {
case GL_FUNC_ADD:
@@ -510,39 +404,11 @@ static void i830BlendFuncSeparate(GLcontext *ctx, GLenum sfactorRGB,
static void i830DepthFunc(GLcontext *ctx, GLenum func)
{
i830ContextPtr i830 = I830_CONTEXT(ctx);
- int test = 0;
+ int test = intel_translate_compare_func(func);
if (INTEL_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
- switch(func) {
- case GL_NEVER:
- test = COMPAREFUNC_NEVER;
- break;
- case GL_LESS:
- test = COMPAREFUNC_LESS;
- break;
- case GL_LEQUAL:
- test = COMPAREFUNC_LEQUAL;
- break;
- case GL_GREATER:
- test = COMPAREFUNC_GREATER;
- break;
- case GL_GEQUAL:
- test = COMPAREFUNC_GEQUAL;
- break;
- case GL_NOTEQUAL:
- test = COMPAREFUNC_NOTEQUAL;
- break;
- case GL_EQUAL:
- test = COMPAREFUNC_EQUAL;
- break;
- case GL_ALWAYS:
- test = COMPAREFUNC_ALWAYS;
- break;
- default: return;
- }
-
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_STATE3] &= ~DEPTH_TEST_FUNC_MASK;
i830->state.Ctx[I830_CTXREG_STATE3] |= (ENABLE_DEPTH_TEST_FUNC |
@@ -662,65 +528,11 @@ static void i830Scissor(GLcontext *ctx, GLint x, GLint y,
static void i830LogicOp(GLcontext *ctx, GLenum opcode)
{
i830ContextPtr i830 = I830_CONTEXT(ctx);
- int tmp = 0;
+ int tmp = intel_translate_logic_op( opcode );
if (INTEL_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
- /* FIXME: This should be a look-up table, like the r200 driver. */
- switch(opcode) {
- case GL_CLEAR:
- tmp = LOGICOP_CLEAR;
- break;
- case GL_AND:
- tmp = LOGICOP_AND;
- break;
- case GL_AND_REVERSE:
- tmp = LOGICOP_AND_RVRSE;
- break;
- case GL_COPY:
- tmp = LOGICOP_COPY;
- break;
- case GL_COPY_INVERTED:
- tmp = LOGICOP_COPY_INV;
- break;
- case GL_AND_INVERTED:
- tmp = LOGICOP_AND_INV;
- break;
- case GL_NOOP:
- tmp = LOGICOP_NOOP;
- break;
- case GL_XOR:
- tmp = LOGICOP_XOR;
- break;
- case GL_OR:
- tmp = LOGICOP_OR;
- break;
- case GL_OR_INVERTED:
- tmp = LOGICOP_OR_INV;
- break;
- case GL_NOR:
- tmp = LOGICOP_NOR;
- break;
- case GL_EQUIV:
- tmp = LOGICOP_EQUIV;
- break;
- case GL_INVERT:
- tmp = LOGICOP_INV;
- break;
- case GL_OR_REVERSE:
- tmp = LOGICOP_OR_RVRSE;
- break;
- case GL_NAND:
- tmp = LOGICOP_NAND;
- break;
- case GL_SET:
- tmp = LOGICOP_SET;
- break;
- default:
- return;
- }
-
I830_STATECHANGE(i830, I830_UPLOAD_CTX);
i830->state.Ctx[I830_CTXREG_STATE4] &= ~LOGICOP_MASK;
i830->state.Ctx[I830_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c
index ff2ac28b8d..591100882f 100644
--- a/src/mesa/drivers/dri/i915/i915_context.c
+++ b/src/mesa/drivers/dri/i915/i915_context.c
@@ -48,6 +48,21 @@
static const char * const card_extensions[] =
{
"GL_ARB_fragment_program",
+ "GL_ARB_texture_cube_map",
+ "GL_EXT_blend_equation_separate",
+ "GL_ATI_blend_equation_separate",
+ "GL_ARB_point_parameters",
+
+/* New
+ */
+ "GL_NV_blend_square",
+ "GL_EXT_cull_vertex",
+ "GL_ARB_depth_texture",
+ "GL_SGIX_depth_texture", /* ARB extn won't work if not enabled */
+ "GL_ARB_shadow",
+ "GL_EXT_shadow_funcs",
+ "GL_3DFX_texture_compression_FXT1",
+
NULL
};
@@ -84,9 +99,12 @@ static const GLubyte *i915GetString( GLcontext *ctx, GLenum name )
{
if (name == GL_EXTENSIONS)
return
+ "GL_3DFX_texture_compression_FXT1 "
+ "GL_ARB_depth_texture "
"GL_ARB_fragment_program "
"GL_ARB_multitexture "
"GL_ARB_point_parameters "
+ "GL_ARB_shadow "
"GL_ARB_texture_border_clamp "
"GL_ARB_texture_compression "
"GL_ARB_texture_cube_map "
@@ -106,6 +124,7 @@ static const GLubyte *i915GetString( GLcontext *ctx, GLenum name )
"GL_EXT_blend_subtract "
"GL_EXT_clip_volume_hint "
"GL_EXT_compiled_vertex_array "
+ "GL_EXT_cull_vertex "
"GL_EXT_draw_range_elements "
"GL_EXT_fog_coord "
"GL_EXT_multi_draw_arrays "
@@ -113,16 +132,19 @@ static const GLubyte *i915GetString( GLcontext *ctx, GLenum name )
"GL_EXT_rescale_normal "
"GL_EXT_secondary_color "
"GL_EXT_separate_specular_color "
+ "GL_EXT_shadow_funcs "
"GL_EXT_stencil_wrap "
"GL_EXT_texture3D "
"GL_EXT_texture_env_add "
"GL_EXT_texture_env_combine "
"GL_EXT_texture_filter_anisotropic "
"GL_IBM_texture_mirrored_repeat "
- "GL_MESA_ycbcr_texture "
"GL_MESA_window_pos "
+ "GL_MESA_ycbcr_texture "
+ "GL_NV_blend_square "
"GL_NV_texgen_reflection "
- "GL_SGIS_generate_mipmap";
+ "GL_SGIS_generate_mipmap ";
+
return intelGetString( ctx, name );
}
@@ -177,8 +199,9 @@ GLboolean i915CreateContext( const __GLcontextModes *mesaVis,
sizeof( struct i915_texture_object ),
(destroy_texture_object_t *)intelDestroyTexObj );
- /* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are tightly
- * FIXME: packed, but they're not in Intel graphics hardware.
+ /* FIXME: driCalculateMaxTextureLevels assumes that mipmaps are
+ * tightly packed, but they're not in Intel graphics
+ * hardware.
*/
ctx->Const.MaxTextureUnits = 1;
driCalculateMaxTextureLevels( intel->texture_heaps,
diff --git a/src/mesa/drivers/dri/i915/i915_metaops.c b/src/mesa/drivers/dri/i915/i915_metaops.c
index 809419bd77..3176c727d0 100644
--- a/src/mesa/drivers/dri/i915/i915_metaops.c
+++ b/src/mesa/drivers/dri/i915/i915_metaops.c
@@ -240,7 +240,7 @@ static void set_no_texture( i915ContextPtr i915 )
i915->meta.emitted &= ~I915_UPLOAD_PROGRAM;
}
-
+#if 0
static void enable_texture_blend_replace( i915ContextPtr i915 )
{
static const GLuint prog[] = {
@@ -323,7 +323,7 @@ static void set_tex_rect_source( i915ContextPtr i915,
i915->meta.emitted &= ~I915_UPLOAD_TEX(0);
}
-
+#endif
/* Select between front and back draw buffers.
*/
@@ -334,6 +334,7 @@ static void set_draw_offset( i915ContextPtr i915,
i915->meta.emitted &= ~I915_UPLOAD_BUFFERS;
}
+#if 0
/* Setup an arbitary draw format, useful for targeting texture or agp
* memory.
*/
@@ -352,6 +353,7 @@ static void set_draw_format( i915ContextPtr i915,
/* fprintf(stderr, "%s: DV1: %x\n", */
/* __FUNCTION__, i915->meta.Buffer[I915_DESTREG_DV1]); */
}
+#endif
static void set_vertex_format( i915ContextPtr i915 )
{
diff --git a/src/mesa/drivers/dri/i915/i915_reg.h b/src/mesa/drivers/dri/i915/i915_reg.h
index 9436cdeb66..3241b36b66 100644
--- a/src/mesa/drivers/dri/i915/i915_reg.h
+++ b/src/mesa/drivers/dri/i915/i915_reg.h
@@ -236,23 +236,6 @@
#define IAB_DST_FACTOR_SHIFT 0
#define IAB_DST_FACTOR_MASK (BLENDFACT_MASK<<0)
-#define BLENDFACT_ZERO 0x01
-#define BLENDFACT_ONE 0x02
-#define BLENDFACT_SRC_COLR 0x03
-#define BLENDFACT_INV_SRC_COLR 0x04
-#define BLENDFACT_SRC_ALPHA 0x05
-#define BLENDFACT_INV_SRC_ALPHA 0x06
-#define BLENDFACT_DST_ALPHA 0x07
-#define BLENDFACT_INV_DST_ALPHA 0x08
-#define BLENDFACT_DST_COLR 0x09
-#define BLENDFACT_INV_DST_COLR 0x0a
-#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
-#define BLENDFACT_CONST_COLOR 0x0c
-#define BLENDFACT_INV_CONST_COLOR 0x0d
-#define BLENDFACT_CONST_ALPHA 0x0e
-#define BLENDFACT_INV_CONST_ALPHA 0x0f
-#define BLENDFACT_MASK 0x0f
-
#define BLENDFUNC_ADD 0x0
#define BLENDFUNC_SUBTRACT 0x1
@@ -393,23 +376,6 @@
S4_VFMT_XYZW_MASK | \
S4_VFMT_FOG_PARAM)
-#define COMPAREFUNC_ALWAYS 0
-#define COMPAREFUNC_NEVER 0x1
-#define COMPAREFUNC_LESS 0x2
-#define COMPAREFUNC_EQUAL 0x3
-#define COMPAREFUNC_LEQUAL 0x4
-#define COMPAREFUNC_GREATER 0x5
-#define COMPAREFUNC_NOTEQUAL 0x6
-#define COMPAREFUNC_GEQUAL 0x7
-
-#define STENCILOP_KEEP 0
-#define STENCILOP_ZERO 0x1
-#define STENCILOP_REPLACE 0x2
-#define STENCILOP_INCRSAT 0x3
-#define STENCILOP_DECRSAT 0x4
-#define STENCILOP_INCR 0x5
-#define STENCILOP_DECR 0x6
-#define STENCILOP_INVERT 0x7
#define S5_WRITEDISABLE_ALPHA (1<<31)
#define S5_WRITEDISABLE_RED (1<<30)
@@ -466,23 +432,7 @@
#define _3DSTATE_MODES_4_CMD (CMD_3D|(0x0d<<24))
#define ENABLE_LOGIC_OP_FUNC (1<<23)
#define LOGIC_OP_FUNC(x) ((x)<<18)
-#define LOGICOP_MASK ((1<<18)|(1<<19)|(1<<20)|(1<<21))
-#define LOGICOP_CLEAR 0
-#define LOGICOP_NOR 0x1
-#define LOGICOP_AND_INV 0x2
-#define LOGICOP_COPY_INV 0x3
-#define LOGICOP_AND_RVRSE 0x4
-#define LOGICOP_INV 0x5
-#define LOGICOP_XOR 0x6
-#define LOGICOP_NAND 0x7
-#define LOGICOP_AND 0x8
-#define LOGICOP_EQUIV 0x9
-#define LOGICOP_NOOP 0xa
-#define LOGICOP_OR_INV 0xb
-#define LOGICOP_COPY 0xc
-#define LOGICOP_OR_RVRSE 0xd
-#define LOGICOP_OR 0xe
-#define LOGICOP_SET 0xf
+#define LOGICOP_MASK (0xf<<18)
#define MODE4_ENABLE_STENCIL_TEST_MASK ((1<<17)|(0xff00))
#define ENABLE_STENCIL_TEST_MASK (1<<17)
#define STENCIL_TEST_MASK(x) ((x)<<8)
@@ -769,6 +719,12 @@
#define MT_32BIT_XLVU8888 (7<<3)
#define MT_32BIT_ARGB2101010 (8<<3)
#define MT_32BIT_ABGR2101010 (9<<3)
+#define MT_32BIT_AWVU2101010 (0xA<<3)
+#define MT_32BIT_GR1616 (0xB<<3)
+#define MT_32BIT_VU1616 (0xC<<3)
+#define MT_32BIT_xI824 (0xD<<3)
+#define MT_32BIT_xA824 (0xE<<3)
+#define MT_32BIT_xL824 (0xF<<3)
#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */
#define MT_422_YCRCB_NORMAL (1<<3)
#define MT_422_YCRCB_SWAPUV (2<<3)
@@ -792,6 +748,7 @@
#define MS4_CUBE_FACE_ENA_MASK (0x3f<<15)
#define MS4_MAX_LOD_SHIFT 9
#define MS4_MAX_LOD_MASK (0x3f<<9)
+#define MS4_MIP_LAYOUT_LEGACY (0<<8)
#define MS4_VOLUME_DEPTH_SHIFT 0
#define MS4_VOLUME_DEPTH_MASK (0xff<<0)
@@ -826,20 +783,17 @@
#define SS2_LOD_BIAS_SHIFT 5
#define SS2_LOD_BIAS_ONE (0x10<<5)
#define SS2_LOD_BIAS_MASK (0x1ff<<5)
+/* Shadow requires:
+ * MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format
+ * FILTER_4X4_x MIN and MAG filters
+ */
#define SS2_SHADOW_ENABLE (1<<4)
#define SS2_MAX_ANISO_MASK (1<<3)
#define SS2_MAX_ANISO_2 (0<<3)
#define SS2_MAX_ANISO_4 (1<<3)
#define SS2_SHADOW_FUNC_SHIFT 0
#define SS2_SHADOW_FUNC_MASK (0x7<<0)
-#define SHADOWOP_ALWAYS 0
-#define SHADOWOP_NEVER 1
-#define SHADOWOP_LESS 2
-#define SHADOWOP_EQUAL 3
-#define SHADOWOP_LEQUAL 4
-#define SHADOWOP_GREATER 5
-#define SHADOWOP_NOTEQUAL 6
-#define SHADOWOP_GEQUAL 7
+/* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */
#define SS3_MIN_LOD_SHIFT 24
#define SS3_MIN_LOD_ONE (0x10<<24)
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index cb9a719c1d..da8e1ed81e 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -42,35 +42,13 @@
#include "i915_context.h"
#include "i915_reg.h"
-static int translate_compare_func( GLenum func )
-{
- switch(func) {
- case GL_NEVER:
- return COMPAREFUNC_NEVER;
- case GL_LESS:
- return COMPAREFUNC_LESS;
- case GL_LEQUAL:
- return COMPAREFUNC_LEQUAL;
- case GL_GREATER:
- return COMPAREFUNC_GREATER;
- case GL_GEQUAL:
- return COMPAREFUNC_GEQUAL;
- case GL_NOTEQUAL:
- return COMPAREFUNC_NOTEQUAL;
- case GL_EQUAL:
- return COMPAREFUNC_EQUAL;
- case GL_ALWAYS:
- default:
- return COMPAREFUNC_ALWAYS;
- }
-}
static void i915StencilFunc(GLcontext *ctx, GLenum func, GLint ref,
GLuint mask)
{
i915ContextPtr i915 = I915_CONTEXT(ctx);
- int test = translate_compare_func( func );
+ int test = intel_translate_compare_func( func );
mask = mask & 0xff;
@@ -106,37 +84,14 @@ static void i915StencilMask(GLcontext *ctx, GLuint mask)
STENCIL_WRITE_MASK(mask));
}
-static int translate_stencil_op( GLenum op )
-{
- switch(op) {
- case GL_KEEP:
- return STENCILOP_KEEP;
- case GL_ZERO:
- return STENCILOP_ZERO;
- case GL_REPLACE:
- return STENCILOP_REPLACE;
- case GL_INCR:
- return STENCILOP_INCRSAT;
- case GL_DECR:
- return STENCILOP_DECRSAT;
- case GL_INCR_WRAP:
- return STENCILOP_INCR;
- case GL_DECR_WRAP:
- return STENCILOP_DECR;
- case GL_INVERT:
- return STENCILOP_INVERT;
- default:
- return 0;
- }
-}
static void i915StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
GLenum zpass)
{
i915ContextPtr i915 = I915_CONTEXT(ctx);
- int fop = translate_stencil_op(fail);
- int dfop = translate_stencil_op(zfail);
- int dpop = translate_stencil_op(zpass);
+ int fop = intel_translate_stencil_op(fail);
+ int dfop = intel_translate_stencil_op(zfail);
+ int dpop = intel_translate_stencil_op(zpass);
if (INTEL_DEBUG&DEBUG_DRI)
@@ -159,7 +114,7 @@ static void i915StencilOp(GLcontext *ctx, GLenum fail, GLenum zfail,
static void i915AlphaFunc(GLcontext *ctx, GLenum func, GLfloat ref)
{
i915ContextPtr i915 = I915_CONTEXT(ctx);
- int test = translate_compare_func( func );
+ int test = intel_translate_compare_func( func );
GLubyte refByte;
UNCLAMPED_FLOAT_TO_UBYTE(refByte, ref);
@@ -214,43 +169,6 @@ static void i915BlendColor(GLcontext *ctx, const GLfloat color[4])
i915->state.Ctx[I915_CTXREG_BLENDCOLOR1] = (a<<24) | (r<<16) | (g<<8) | b;
}
-static int translate_blend_factor( GLenum factor )
-{
- switch(factor) {
- case GL_ZERO:
- return BLENDFACT_ZERO;
- case GL_SRC_ALPHA:
- return BLENDFACT_SRC_ALPHA;
- case GL_ONE:
- return BLENDFACT_ONE;
- case GL_SRC_COLOR:
- return BLENDFACT_SRC_COLR;
- case GL_ONE_MINUS_SRC_COLOR:
- return BLENDFACT_INV_SRC_COLR;
- case GL_DST_COLOR:
- return BLENDFACT_DST_COLR;
- case GL_ONE_MINUS_DST_COLOR:
- return BLENDFACT_INV_DST_COLR;
- case GL_ONE_MINUS_SRC_ALPHA:
- return BLENDFACT_INV_SRC_ALPHA;
- case GL_DST_ALPHA:
- return BLENDFACT_DST_ALPHA;
- case GL_ONE_MINUS_DST_ALPHA:
- return BLENDFACT_INV_DST_ALPHA;
- case GL_SRC_ALPHA_SATURATE:
- return BLENDFACT_SRC_ALPHA_SATURATE;
- case GL_CONSTANT_COLOR:
- return BLENDFACT_CONST_COLOR;
- case GL_ONE_MINUS_CONSTANT_COLOR:
- return BLENDFACT_INV_CONST_COLOR;
- case GL_CONSTANT_ALPHA:
- return BLENDFACT_CONST_ALPHA;
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- return BLENDFACT_INV_CONST_ALPHA;
- default:
- return BLENDFACT_ZERO;
- }
-}
#define DST_BLND_FACT(f) ((f)<<S6_CBUF_DST_BLEND_FACT_SHIFT)
#define SRC_BLND_FACT(f) ((f)<<S6_CBUF_SRC_BLEND_FACT_SHIFT)
@@ -300,12 +218,12 @@ static void i915UpdateBlendState( GLcontext *ctx )
srcA = dstA = GL_ONE;
}
- lis6 |= SRC_BLND_FACT(translate_blend_factor(srcRGB));
- lis6 |= DST_BLND_FACT(translate_blend_factor(dstRGB));
+ lis6 |= SRC_BLND_FACT(intel_translate_blend_factor(srcRGB));
+ lis6 |= DST_BLND_FACT(intel_translate_blend_factor(dstRGB));
lis6 |= translate_blend_equation( eqRGB ) << S6_CBUF_BLEND_FUNC_SHIFT;
- iab |= SRC_ABLND_FACT(translate_blend_factor(srcA));
- iab |= DST_ABLND_FACT(translate_blend_factor(dstA));
+ iab |= SRC_ABLND_FACT(intel_translate_blend_factor(srcA));
+ iab |= DST_ABLND_FACT(intel_translate_blend_factor(dstA));
iab |= translate_blend_equation( eqA ) << IAB_FUNC_SHIFT;
if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB)
@@ -341,7 +259,7 @@ static void i915BlendEquationSeparate(GLcontext *ctx, GLenum eqRGB,
static void i915DepthFunc(GLcontext *ctx, GLenum func)
{
i915ContextPtr i915 = I915_CONTEXT(ctx);
- int test = translate_compare_func( func );
+ int test = intel_translate_compare_func( func );
if (INTEL_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
@@ -462,64 +380,11 @@ static void i915Scissor(GLcontext *ctx, GLint x, GLint y,
static void i915LogicOp(GLcontext *ctx, GLenum opcode)
{
i915ContextPtr i915 = I915_CONTEXT(ctx);
- int tmp = 0;
+ int tmp = intel_translate_logic_op(opcode);
if (INTEL_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
- switch(opcode) {
- case GL_CLEAR:
- tmp = LOGICOP_CLEAR;
- break;
- case GL_AND:
- tmp = LOGICOP_AND;
- break;
- case GL_AND_REVERSE:
- tmp = LOGICOP_AND_RVRSE;
- break;
- case GL_COPY:
- tmp = LOGICOP_COPY;
- break;
- case GL_COPY_INVERTED:
- tmp = LOGICOP_COPY_INV;
- break;
- case GL_AND_INVERTED:
- tmp = LOGICOP_AND_INV;
- break;
- case GL_NOOP:
- tmp = LOGICOP_NOOP;
- break;
- case GL_XOR:
- tmp = LOGICOP_XOR;
- break;
- case GL_OR:
- tmp = LOGICOP_OR;
- break;
- case GL_OR_INVERTED:
- tmp = LOGICOP_OR_INV;
- break;
- case GL_NOR:
- tmp = LOGICOP_NOR;
- break;
- case GL_EQUIV:
- tmp = LOGICOP_EQUIV;
- break;
- case GL_INVERT:
- tmp = LOGICOP_INV;
- break;
- case GL_OR_REVERSE:
- tmp = LOGICOP_OR_RVRSE;
- break;
- case GL_NAND:
- tmp = LOGICOP_NAND;
- break;
- case GL_SET:
- tmp = LOGICOP_SET;
- break;
- default:
- return;
- }
-
I915_STATECHANGE(i915, I915_UPLOAD_CTX);
i915->state.Ctx[I915_CTXREG_STATE4] &= ~LOGICOP_MASK;
i915->state.Ctx[I915_CTXREG_STATE4] |= LOGIC_OP_FUNC(tmp);
diff --git a/src/mesa/drivers/dri/i915/i915_tex.c b/src/mesa/drivers/dri/i915/i915_tex.c
index e1ff2af522..4f77833e19 100644
--- a/src/mesa/drivers/dri/i915/i915_tex.c
+++ b/src/mesa/drivers/dri/i915/i915_tex.c
@@ -85,6 +85,13 @@ static void i915TexParameter( GLcontext *ctx, GLenum target,
t->intel.dirty = I915_UPLOAD_TEX_ALL;
break;
+ case GL_TEXTURE_COMPARE_MODE:
+ t->intel.dirty = I915_UPLOAD_TEX_ALL;
+ break;
+ case GL_TEXTURE_COMPARE_FUNC:
+ t->intel.dirty = I915_UPLOAD_TEX_ALL;
+ break;
+
case GL_TEXTURE_BASE_LEVEL:
case GL_TEXTURE_MAX_LEVEL:
case GL_TEXTURE_MIN_LOD:
diff --git a/src/mesa/drivers/dri/i915/i915_texprog.c b/src/mesa/drivers/dri/i915/i915_texprog.c
index ecf3a38a20..3eaf53d7d5 100644
--- a/src/mesa/drivers/dri/i915/i915_texprog.c
+++ b/src/mesa/drivers/dri/i915/i915_texprog.c
@@ -74,6 +74,19 @@ static GLuint get_source( struct i915_fragment_program *p,
}
return p->src_texture;
+
+ /* Crossbar: */
+ case GL_TEXTURE0:
+ case GL_TEXTURE1:
+ case GL_TEXTURE2:
+ case GL_TEXTURE3:
+ case GL_TEXTURE4:
+ case GL_TEXTURE5:
+ case GL_TEXTURE6:
+ case GL_TEXTURE7: {
+ return UREG_BAD;
+ }
+
case GL_CONSTANT:
return i915_emit_const4fv( p, p->ctx->Texture.Unit[unit].EnvColor );
case GL_PRIMARY_COLOR:
diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c
index 2f94e6743a..6dede76b2e 100644
--- a/src/mesa/drivers/dri/i915/i915_texstate.c
+++ b/src/mesa/drivers/dri/i915/i915_texstate.c
@@ -60,102 +60,18 @@ static GLint step_offsets[6][2] = { {0,2},
#define I915_TEX_UNIT_ENABLED(unit) (1<<unit)
-static void i915SetTexImages( i915ContextPtr i915,
- struct gl_texture_object *tObj )
+static void i915LayoutTextureImages( i915ContextPtr i915,
+ struct gl_texture_object *tObj )
{
- GLuint total_height, pitch, i, textureFormat;
- i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
+ i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
GLint firstLevel, lastLevel, numLevels;
- GLint ss2 = 0;
-
- switch( baseImage->TexFormat->MesaFormat ) {
- case MESA_FORMAT_L8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_L8;
- break;
-
- case MESA_FORMAT_I8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_I8;
- break;
-
- case MESA_FORMAT_A8:
- t->intel.texelBytes = 1;
- textureFormat = MAPSURF_8BIT | MT_8BIT_A8;
- break;
-
- case MESA_FORMAT_AL88:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_AY88;
- break;
-
- case MESA_FORMAT_RGB565:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
- break;
-
- case MESA_FORMAT_ARGB1555:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
- break;
-
- case MESA_FORMAT_ARGB4444:
- t->intel.texelBytes = 2;
- textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB4444;
- break;
-
- case MESA_FORMAT_ARGB8888:
- t->intel.texelBytes = 4;
- textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
- break;
-
- case MESA_FORMAT_YCBCR_REV:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_NORMAL);
- ss2 |= SS2_COLORSPACE_CONVERSION;
- break;
-
- case MESA_FORMAT_YCBCR:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_422 | MT_422_YCRCB_SWAPY);
- ss2 |= SS2_COLORSPACE_CONVERSION;
- break;
-
- case MESA_FORMAT_RGB_FXT1:
- case MESA_FORMAT_RGBA_FXT1:
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
- break;
- case MESA_FORMAT_RGBA_DXT1:
- case MESA_FORMAT_RGB_DXT1:
- /*
- * DXTn pitches are Width/4 * blocksize in bytes
- * for DXT1: blocksize=8 so Width/4*8 = Width * 2
- * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
- */
- t->intel.texelBytes = 2;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
- break;
- case MESA_FORMAT_RGBA_DXT3:
- t->intel.texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
- break;
- case MESA_FORMAT_RGBA_DXT5:
- t->intel.texelBytes = 4;
- textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
- break;
-
- default:
- fprintf(stderr, "%s: bad image format\n", __FUNCTION__);
- abort();
- }
+ GLint i, total_height, pitch;
/* Compute which mipmap levels we really want to send to the hardware.
*/
driCalculateTextureFirstLastLevel( (driTextureObject *) t );
-
/* Figure out the amount of memory required to hold all the mipmap
* levels. Choose the smallest pitch to accomodate the largest
* mipmap:
@@ -272,21 +188,135 @@ static void i915SetTexImages( i915ContextPtr i915,
t->intel.Pitch = pitch;
t->intel.base.totalSize = total_height*pitch;
t->intel.max_level = numLevels-1;
+}
+
+
+
+static void i915SetTexImages( i915ContextPtr i915,
+ struct gl_texture_object *tObj )
+{
+ GLuint textureFormat;
+ i915TextureObjectPtr t = (i915TextureObjectPtr) tObj->DriverData;
+ const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel];
+ GLint ss2 = 0;
+
+ switch( baseImage->TexFormat->MesaFormat ) {
+ case MESA_FORMAT_L8:
+ t->intel.texelBytes = 1;
+ textureFormat = MAPSURF_8BIT | MT_8BIT_L8;
+ break;
+
+ case MESA_FORMAT_I8:
+ t->intel.texelBytes = 1;
+ textureFormat = MAPSURF_8BIT | MT_8BIT_I8;
+ break;
+
+ case MESA_FORMAT_A8:
+ t->intel.texelBytes = 1;
+ textureFormat = MAPSURF_8BIT | MT_8BIT_A8;
+ break;
+
+ case MESA_FORMAT_AL88:
+ t->intel.texelBytes = 2;
+ textureFormat = MAPSURF_16BIT | MT_16BIT_AY88;
+ break;
+
+ case MESA_FORMAT_RGB565:
+ t->intel.texelBytes = 2;
+ textureFormat = MAPSURF_16BIT | MT_16BIT_RGB565;
+ break;
+
+ case MESA_FORMAT_ARGB1555:
+ t->intel.texelBytes = 2;
+ textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB1555;
+ break;
+
+ case MESA_FORMAT_ARGB4444:
+ t->intel.texelBytes = 2;
+ textureFormat = MAPSURF_16BIT | MT_16BIT_ARGB4444;
+ break;
+
+ case MESA_FORMAT_ARGB8888:
+ t->intel.texelBytes = 4;
+ textureFormat = MAPSURF_32BIT | MT_32BIT_ARGB8888;
+ break;
+
+ case MESA_FORMAT_YCBCR_REV:
+ t->intel.texelBytes = 2;
+ textureFormat = (MAPSURF_422 | MT_422_YCRCB_NORMAL);
+ ss2 |= SS2_COLORSPACE_CONVERSION;
+ break;
+
+ case MESA_FORMAT_YCBCR:
+ t->intel.texelBytes = 2;
+ textureFormat = (MAPSURF_422 | MT_422_YCRCB_SWAPY);
+ ss2 |= SS2_COLORSPACE_CONVERSION;
+ break;
+
+ case MESA_FORMAT_RGB_FXT1:
+ case MESA_FORMAT_RGBA_FXT1:
+ t->intel.texelBytes = 2;
+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1);
+ break;
+
+ case MESA_FORMAT_DEPTH_COMPONENT16:
+ t->intel.texelBytes = 2;
+ textureFormat = (MAPSURF_16BIT | MT_16BIT_L16);
+ break;
+
+ case MESA_FORMAT_RGBA_DXT1:
+ case MESA_FORMAT_RGB_DXT1:
+ /*
+ * DXTn pitches are Width/4 * blocksize in bytes
+ * for DXT1: blocksize=8 so Width/4*8 = Width * 2
+ * for DXT3/5: blocksize=16 so Width/4*16 = Width * 4
+ */
+ t->intel.texelBytes = 2;
+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1);
+ break;
+
+ case MESA_FORMAT_RGBA_DXT3:
+ t->intel.texelBytes = 4;
+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3);
+ break;
+
+ case MESA_FORMAT_RGBA_DXT5:
+ t->intel.texelBytes = 4;
+ textureFormat = (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5);
+ break;
+
+#if 0
+ case MESA_FORMAT_DEPTH_COMPONENT_X8Z24:
+ t->intel.texelBytes = 4;
+ textureFormat = (MAPSURF_32BIT | MT_32BIT_xL824);
+ break;
+#endif
+
+ default:
+ fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__,
+ baseImage->TexFormat->MesaFormat);
+ abort();
+ }
+
+ i915LayoutTextureImages( i915, tObj );
+
t->Setup[I915_TEXREG_MS3] =
- (((tObj->Image[0][firstLevel]->Height - 1) << MS3_HEIGHT_SHIFT) |
- ((tObj->Image[0][firstLevel]->Width - 1) << MS3_WIDTH_SHIFT) |
+ (((tObj->Image[0][t->intel.base.firstLevel]->Height - 1) << MS3_HEIGHT_SHIFT) |
+ ((tObj->Image[0][t->intel.base.firstLevel]->Width - 1) << MS3_WIDTH_SHIFT) |
textureFormat |
MS3_USE_FENCE_REGS);
+
t->Setup[I915_TEXREG_MS4] =
- ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) |
+ ((((t->intel.Pitch / 4) - 1) << MS4_PITCH_SHIFT) |
MS4_CUBE_FACE_ENA_MASK |
(((t->intel.max_level * 4)) << MS4_MAX_LOD_SHIFT) |
- ((tObj->Image[0][firstLevel]->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
+ ((tObj->Image[0][t->intel.base.firstLevel]->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT));
- t->Setup[I915_TEXREG_SS2] &= ~SS2_COLORSPACE_CONVERSION;
+ t->Setup[I915_TEXREG_SS2] &= ~(SS2_COLORSPACE_CONVERSION);
t->Setup[I915_TEXREG_SS2] |= ss2;
t->intel.dirty = I915_UPLOAD_TEX_ALL;
+
}
@@ -312,7 +342,7 @@ static GLuint translate_wrap_mode( GLenum wrap )
static void i915ImportTexObjState( struct gl_texture_object *texObj )
{
i915TextureObjectPtr t = (i915TextureObjectPtr)texObj->DriverData;
- int minFilt = 0, mipFilt = 0, magFilt = 0;
+ int minFilt = 0, mipFilt = 0, magFilt = 0, shadow = 0;
if(INTEL_DEBUG&DEBUG_DRI)
fprintf(stderr, "%s\n", __FUNCTION__);
@@ -363,12 +393,26 @@ static void i915ImportTexObjState( struct gl_texture_object *texObj )
}
}
- t->Setup[I915_TEXREG_SS2] &= ~SS2_MIN_FILTER_MASK;
- t->Setup[I915_TEXREG_SS2] &= ~SS2_MIP_FILTER_MASK;
- t->Setup[I915_TEXREG_SS2] &= ~SS2_MAG_FILTER_MASK;
+ if (texObj->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB &&
+ texObj->Target != GL_TEXTURE_3D) {
+
+ shadow = SS2_SHADOW_ENABLE;
+ shadow |= intel_translate_compare_func( texObj->CompareFunc );
+
+ minFilt = FILTER_4X4_FLAT;
+ magFilt = FILTER_4X4_FLAT;
+ }
+
+
+ t->Setup[I915_TEXREG_SS2] &= ~(SS2_MIN_FILTER_MASK |
+ SS2_MIP_FILTER_MASK |
+ SS2_MAG_FILTER_MASK |
+ SS2_SHADOW_ENABLE |
+ SS2_SHADOW_FUNC_MASK);
t->Setup[I915_TEXREG_SS2] |= ((minFilt << SS2_MIN_FILTER_SHIFT) |
(mipFilt << SS2_MIP_FILTER_SHIFT) |
- (magFilt << SS2_MAG_FILTER_SHIFT));
+ (magFilt << SS2_MAG_FILTER_SHIFT) |
+ shadow);
{
GLuint ss3 = t->Setup[I915_TEXREG_SS3] & ~(SS3_TCX_ADDR_MODE_MASK |
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index 1ff7b8be7f..ba155d53ec 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -72,7 +72,7 @@ int prevLockLine;
* Mesa's Driver Functions
***************************************/
-#define DRIVER_DATE "20041007"
+#define DRIVER_DATE "20041217"
const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
{
@@ -96,6 +96,8 @@ const GLubyte *intelGetString( GLcontext *ctx, GLenum name )
chipset = "Intel(R) 865G"; break;
case PCI_CHIP_I915_G:
chipset = "Intel(R) 915G"; break;
+ case PCI_CHIP_I915_GM:
+ chipset = "Intel(R) 915GM"; break;
default:
chipset = "Unknown Intel Chipset"; break;
}
@@ -123,29 +125,15 @@ static void intelBufferSize(GLframebuffer *buffer,
UNLOCK_HARDWARE(intel);
}
-
-
-/**
- * Extension strings exported by the intel driver.
- *
- * \note
- * It appears that ARB_texture_env_crossbar and NV_blend_square have
- * "disappeared" compared to the old i830-specific driver.
- *
- * \note
- * See implementation of \c glGetString in each hw_context.c file:
- * This set of extensions is overridden and many are not actually
- * exported to the driver. They are however enabled internally as
- * Mesa requires this when calculating things like GL version number.
- */
static const char * const card_extensions[] =
{
+ "GL_APPLE_client_storage",
"GL_ARB_multisample",
"GL_ARB_multitexture",
"GL_ARB_point_parameters",
"GL_ARB_texture_border_clamp",
- "GL_ARB_texture_cube_map",
"GL_ARB_texture_compression",
+ "GL_ARB_texture_cube_map",
"GL_ARB_texture_env_add",
"GL_ARB_texture_env_combine",
"GL_ARB_texture_env_dot3",
@@ -154,7 +142,6 @@ static const char * const card_extensions[] =
"GL_ARB_vertex_buffer_object",
"GL_ARB_vertex_program",
"GL_ARB_window_pos",
-
"GL_EXT_abgr",
"GL_EXT_bgra",
"GL_EXT_blend_color",
@@ -167,27 +154,30 @@ static const char * const card_extensions[] =
"GL_EXT_secondary_color",
"GL_EXT_stencil_wrap",
"GL_EXT_texture_edge_clamp",
+ "GL_EXT_texture_env_add",
"GL_EXT_texture_env_combine",
"GL_EXT_texture_env_dot3",
"GL_EXT_texture_filter_anisotropic",
"GL_EXT_texture_lod_bias",
-
"GL_3DFX_texture_compression_FXT1",
- "GL_APPLE_client_storage",
+ "GL_IBM_texture_mirrored_repeat",
+ "GL_INGR_blend_func_separate",
"GL_MESA_pack_invert",
"GL_MESA_ycbcr_texture",
+ "GL_NV_texture_rectangle",
"GL_NV_vertex_program",
"GL_NV_vertex_program1_1",
"GL_SGIS_generate_mipmap",
-
+ "GL_SGIS_texture_border_clamp",
+ "GL_SGIS_texture_edge_clamp",
NULL
};
-
extern const struct tnl_pipeline_stage _intel_render_stage;
static const struct tnl_pipeline_stage *intel_pipeline[] = {
&_tnl_vertex_transform_stage,
+ &_tnl_vertex_cull_stage,
&_tnl_normal_transform_stage,
&_tnl_lighting_stage,
&_tnl_fog_coordinate_stage,
diff --git a/src/mesa/drivers/dri/i915/intel_context.h b/src/mesa/drivers/dri/i915/intel_context.h
index be941fd300..442c5a759a 100644
--- a/src/mesa/drivers/dri/i915/intel_context.h
+++ b/src/mesa/drivers/dri/i915/intel_context.h
@@ -411,6 +411,7 @@ extern int INTEL_DEBUG;
#define PCI_CHIP_I855_GM 0x3582
#define PCI_CHIP_I865_G 0x2572
#define PCI_CHIP_I915_G 0x2582
+#define PCI_CHIP_I915_GM 0x2592
/* ================================================================
@@ -439,6 +440,64 @@ extern const GLubyte *intelGetString( GLcontext *ctx, GLenum name );
*/
extern void intelInitStateFuncs( struct dd_function_table *functions );
+#define COMPAREFUNC_ALWAYS 0
+#define COMPAREFUNC_NEVER 0x1
+#define COMPAREFUNC_LESS 0x2
+#define COMPAREFUNC_EQUAL 0x3
+#define COMPAREFUNC_LEQUAL 0x4
+#define COMPAREFUNC_GREATER 0x5
+#define COMPAREFUNC_NOTEQUAL 0x6
+#define COMPAREFUNC_GEQUAL 0x7
+
+#define STENCILOP_KEEP 0
+#define STENCILOP_ZERO 0x1
+#define STENCILOP_REPLACE 0x2
+#define STENCILOP_INCRSAT 0x3
+#define STENCILOP_DECRSAT 0x4
+#define STENCILOP_INCR 0x5
+#define STENCILOP_DECR 0x6
+#define STENCILOP_INVERT 0x7
+
+#define LOGICOP_CLEAR 0
+#define LOGICOP_NOR 0x1
+#define LOGICOP_AND_INV 0x2
+#define LOGICOP_COPY_INV 0x3
+#define LOGICOP_AND_RVRSE 0x4
+#define LOGICOP_INV 0x5
+#define LOGICOP_XOR 0x6
+#define LOGICOP_NAND 0x7
+#define LOGICOP_AND 0x8
+#define LOGICOP_EQUIV 0x9
+#define LOGICOP_NOOP 0xa
+#define LOGICOP_OR_INV 0xb
+#define LOGICOP_COPY 0xc
+#define LOGICOP_OR_RVRSE 0xd
+#define LOGICOP_OR 0xe
+#define LOGICOP_SET 0xf
+
+#define BLENDFACT_ZERO 0x01
+#define BLENDFACT_ONE 0x02
+#define BLENDFACT_SRC_COLR 0x03
+#define BLENDFACT_INV_SRC_COLR 0x04
+#define BLENDFACT_SRC_ALPHA 0x05
+#define BLENDFACT_INV_SRC_ALPHA 0x06
+#define BLENDFACT_DST_ALPHA 0x07
+#define BLENDFACT_INV_DST_ALPHA 0x08
+#define BLENDFACT_DST_COLR 0x09
+#define BLENDFACT_INV_DST_COLR 0x0a
+#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b
+#define BLENDFACT_CONST_COLOR 0x0c
+#define BLENDFACT_INV_CONST_COLOR 0x0d
+#define BLENDFACT_CONST_ALPHA 0x0e
+#define BLENDFACT_INV_CONST_ALPHA 0x0f
+#define BLENDFACT_MASK 0x0f
+
+
+extern int intel_translate_compare_func( GLenum func );
+extern int intel_translate_stencil_op( GLenum op );
+extern int intel_translate_blend_factor( GLenum factor );
+extern int intel_translate_logic_op( GLenum opcode );
+
/* ================================================================
* intel_ioctl.c:
diff --git a/src/mesa/drivers/dri/i915/intel_ioctl.c b/src/mesa/drivers/dri/i915/intel_ioctl.c
index b2e72efac1..3662918dd8 100644
--- a/src/mesa/drivers/dri/i915/intel_ioctl.c
+++ b/src/mesa/drivers/dri/i915/intel_ioctl.c
@@ -108,7 +108,7 @@ void intel_dump_batchbuffer( long offset,
fprintf(stderr, "\n\n\nSTART BATCH (%d dwords):\n", count);
for (i = 0; i < count/4; i += 4)
fprintf(stderr, "\t0x%lx: 0x%08x 0x%08x 0x%08x 0x%08x\n",
- offset + i*4, ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]);
+ (unsigned int)offset + i*4, ptr[i], ptr[i+1], ptr[i+2], ptr[i+3]);
fprintf(stderr, "END BATCH\n\n\n");
}
diff --git a/src/mesa/drivers/dri/i915/intel_screen.c b/src/mesa/drivers/dri/i915/intel_screen.c
index c5f1542f22..8236718477 100644
--- a/src/mesa/drivers/dri/i915/intel_screen.c
+++ b/src/mesa/drivers/dri/i915/intel_screen.c
@@ -292,6 +292,7 @@ static GLboolean intelCreateContext( const __GLcontextModes *mesaVis,
sharedContextPrivate );
case PCI_CHIP_I915_G:
+ case PCI_CHIP_I915_GM:
return i915CreateContext( mesaVis, driContextPriv,
sharedContextPrivate );
diff --git a/src/mesa/drivers/dri/i915/intel_state.c b/src/mesa/drivers/dri/i915/intel_state.c
index 44ef775465..76bfaec18f 100644
--- a/src/mesa/drivers/dri/i915/intel_state.c
+++ b/src/mesa/drivers/dri/i915/intel_state.c
@@ -36,6 +36,133 @@
#include "intel_context.h"
#include "swrast/swrast.h"
+int intel_translate_compare_func( GLenum func )
+{
+ switch(func) {
+ case GL_NEVER:
+ return COMPAREFUNC_NEVER;
+ case GL_LESS:
+ return COMPAREFUNC_LESS;
+ case GL_LEQUAL:
+ return COMPAREFUNC_LEQUAL;
+ case GL_GREATER:
+ return COMPAREFUNC_GREATER;
+ case GL_GEQUAL:
+ return COMPAREFUNC_GEQUAL;
+ case GL_NOTEQUAL:
+ return COMPAREFUNC_NOTEQUAL;
+ case GL_EQUAL:
+ return COMPAREFUNC_EQUAL;
+ case GL_ALWAYS:
+ return COMPAREFUNC_ALWAYS;
+ }
+
+ fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, func);
+ return COMPAREFUNC_ALWAYS;
+}
+
+int intel_translate_stencil_op( GLenum op )
+{
+ switch(op) {
+ case GL_KEEP:
+ return STENCILOP_KEEP;
+ case GL_ZERO:
+ return STENCILOP_ZERO;
+ case GL_REPLACE:
+ return STENCILOP_REPLACE;
+ case GL_INCR:
+ return STENCILOP_INCRSAT;
+ case GL_DECR:
+ return STENCILOP_DECRSAT;
+ case GL_INCR_WRAP:
+ return STENCILOP_INCR;
+ case GL_DECR_WRAP:
+ return STENCILOP_DECR;
+ case GL_INVERT:
+ return STENCILOP_INVERT;
+ default:
+ return STENCILOP_ZERO;
+ }
+}
+
+int intel_translate_blend_factor( GLenum factor )
+{
+ switch(factor) {
+ case GL_ZERO:
+ return BLENDFACT_ZERO;
+ case GL_SRC_ALPHA:
+ return BLENDFACT_SRC_ALPHA;
+ case GL_ONE:
+ return BLENDFACT_ONE;
+ case GL_SRC_COLOR:
+ return BLENDFACT_SRC_COLR;
+ case GL_ONE_MINUS_SRC_COLOR:
+ return BLENDFACT_INV_SRC_COLR;
+ case GL_DST_COLOR:
+ return BLENDFACT_DST_COLR;
+ case GL_ONE_MINUS_DST_COLOR:
+ return BLENDFACT_INV_DST_COLR;
+ case GL_ONE_MINUS_SRC_ALPHA:
+ return BLENDFACT_INV_SRC_ALPHA;
+ case GL_DST_ALPHA:
+ return BLENDFACT_DST_ALPHA;
+ case GL_ONE_MINUS_DST_ALPHA:
+ return BLENDFACT_INV_DST_ALPHA;
+ case GL_SRC_ALPHA_SATURATE:
+ return BLENDFACT_SRC_ALPHA_SATURATE;
+ case GL_CONSTANT_COLOR:
+ return BLENDFACT_CONST_COLOR;
+ case GL_ONE_MINUS_CONSTANT_COLOR:
+ return BLENDFACT_INV_CONST_COLOR;
+ case GL_CONSTANT_ALPHA:
+ return BLENDFACT_CONST_ALPHA;
+ case GL_ONE_MINUS_CONSTANT_ALPHA:
+ return BLENDFACT_INV_CONST_ALPHA;
+ }
+
+ fprintf(stderr, "Unknown value in %s: %x\n", __FUNCTION__, factor);
+ return BLENDFACT_ZERO;
+}
+
+int intel_translate_logic_op( GLenum opcode )
+{
+ switch(opcode) {
+ case GL_CLEAR:
+ return LOGICOP_CLEAR;
+ case GL_AND:
+ return LOGICOP_AND;
+ case GL_AND_REVERSE:
+ return LOGICOP_AND_RVRSE;
+ case GL_COPY:
+ return LOGICOP_COPY;
+ case GL_COPY_INVERTED:
+ return LOGICOP_COPY_INV;
+ case GL_AND_INVERTED:
+ return LOGICOP_AND_INV;
+ case GL_NOOP:
+ return LOGICOP_NOOP;
+ case GL_XOR:
+ return LOGICOP_XOR;
+ case GL_OR:
+ return LOGICOP_OR;
+ case GL_OR_INVERTED:
+ return LOGICOP_OR_INV;
+ case GL_NOR:
+ return LOGICOP_NOR;
+ case GL_EQUIV:
+ return LOGICOP_EQUIV;
+ case GL_INVERT:
+ return LOGICOP_INV;
+ case GL_OR_REVERSE:
+ return LOGICOP_OR_RVRSE;
+ case GL_NAND:
+ return LOGICOP_NAND;
+ case GL_SET:
+ return LOGICOP_SET;
+ default:
+ return LOGICOP_SET;
+ }
+}
static void intelDrawBuffer(GLcontext *ctx, GLenum mode )
{
diff --git a/src/mesa/drivers/dri/i915/intel_tex.c b/src/mesa/drivers/dri/i915/intel_tex.c
index b6b8188275..5fc904e601 100644
--- a/src/mesa/drivers/dri/i915/intel_tex.c
+++ b/src/mesa/drivers/dri/i915/intel_tex.c
@@ -28,6 +28,7 @@
#include "glheader.h"
#include "mtypes.h"
#include "imports.h"
+#include "macros.h"
#include "simple_list.h"
#include "enums.h"
#include "image.h"
@@ -509,10 +510,7 @@ intelChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_ALPHA12:
case GL_ALPHA16:
case GL_COMPRESSED_ALPHA:
-/* if (1 || intel->intelScreen->deviceID == PCI_CHIP_I915_G) */
- return &_mesa_texformat_a8;
-/* else */
-/* return &_mesa_texformat_al88; */
+ return &_mesa_texformat_a8;
case 1:
case GL_LUMINANCE:
@@ -570,8 +568,16 @@ intelChooseTextureFormat( GLcontext *ctx, GLint internalFormat,
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
return &_mesa_texformat_rgba_dxt5;
+ case GL_DEPTH_COMPONENT:
+ case GL_DEPTH_COMPONENT16:
+ case GL_DEPTH_COMPONENT24:
+ case GL_DEPTH_COMPONENT32:
+ return &_mesa_texformat_depth_component16;
+
default:
- fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__);
+ fprintf(stderr, "unexpected texture format %s in %s\n",
+ _mesa_lookup_enum_by_nr(internalFormat),
+ __FUNCTION__);
return NULL;
}