summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-12-01 11:19:33 +0100
committerMichal Krol <[email protected]>2009-12-01 11:21:21 +0100
commit853d4807fe220b17cf5af5a76b24f2466238013b (patch)
tree0766767f9de7151e7ce0e44b1d477aa694c888dd /src/mesa
parentaf3dea36603687067197c22747537eaeb6c4ad2b (diff)
mesa: Update vertex texture code after gallium changes.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c1
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/get.c8
-rw-r--r--src/mesa/main/get_gen.py2
-rw-r--r--src/mesa/main/mtypes.h1
-rw-r--r--src/mesa/state_tracker/st_atom_sampler.c9
-rw-r--r--src/mesa/state_tracker/st_atom_texture.c8
-rw-r--r--src/mesa/state_tracker/st_extensions.c4
8 files changed, 29 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 48685c087b8..8bdda60697b 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -111,6 +111,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits,
ctx->Const.MaxTextureImageUnits);
ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */
+ ctx->Const.MaxCombinedTextureImageUnits = 0;
/* Mesa limits textures to 4kx4k; it would be nice to fix that someday
*/
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b5bf46718f7..03fc57e6654 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -575,6 +575,7 @@ _mesa_init_constants(GLcontext *ctx)
#if FEATURE_ARB_vertex_shader
ctx->Const.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
+ ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
ctx->Const.MaxVarying = MAX_VARYING;
#endif
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 6c5ce029135..e8932f83b6a 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1876,7 +1876,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetBooleanv");
- params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+ params[0] = INT_TO_BOOLEAN(ctx->Const.MaxCombinedTextureImageUnits);
break;
case GL_CURRENT_PROGRAM:
CHECK_EXT1(ARB_shader_objects, "GetBooleanv");
@@ -3711,7 +3711,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetFloatv");
- params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+ params[0] = (GLfloat)(ctx->Const.MaxCombinedTextureImageUnits);
break;
case GL_CURRENT_PROGRAM:
CHECK_EXT1(ARB_shader_objects, "GetFloatv");
@@ -5546,7 +5546,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetIntegerv");
- params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
+ params[0] = ctx->Const.MaxCombinedTextureImageUnits;
break;
case GL_CURRENT_PROGRAM:
CHECK_EXT1(ARB_shader_objects, "GetIntegerv");
@@ -7382,7 +7382,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params )
break;
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB:
CHECK_EXT1(ARB_vertex_shader, "GetInteger64v");
- params[0] = (GLint64)(MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+ params[0] = (GLint64)(ctx->Const.MaxCombinedTextureImageUnits);
break;
case GL_CURRENT_PROGRAM:
CHECK_EXT1(ARB_shader_objects, "GetInteger64v");
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 930c3362fae..a29962d3348 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -1006,7 +1006,7 @@ StateVars = [
( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint,
["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ),
( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint,
- ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ),
+ ["ctx->Const.MaxCombinedTextureImageUnits"], "", ["ARB_vertex_shader"] ),
# GL_ARB_shader_objects
# Actually, this token isn't part of GL_ARB_shader_objects, but is
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 881d233ca3d..5f012448275 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2319,6 +2319,7 @@ struct gl_constants
GLuint MaxTextureCoordUnits;
GLuint MaxTextureImageUnits;
GLuint MaxVertexTextureImageUnits;
+ GLuint MaxCombinedTextureImageUnits;
GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */
GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 6611956ae83..d6e3a3e5610 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -229,14 +229,23 @@ update_samplers(struct st_context *st)
/*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, sampler);
+ if (su < st->ctx->Const.MaxVertexTextureImageUnits) {
+ cso_single_vertex_sampler(st->cso_context, su, sampler);
+ }
}
else {
/*printf("%s su=%u null\n", __FUNCTION__, su);*/
cso_single_sampler(st->cso_context, su, NULL);
+ if (su < st->ctx->Const.MaxVertexTextureImageUnits) {
+ cso_single_vertex_sampler(st->cso_context, su, NULL);
+ }
}
}
cso_single_sampler_done(st->cso_context);
+ if (st->ctx->Const.MaxVertexTextureImageUnits > 0) {
+ cso_single_vertex_sampler_done(st->cso_context);
+ }
}
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c
index 4d4f97da7ed..0b68447d212 100644
--- a/src/mesa/state_tracker/st_atom_texture.c
+++ b/src/mesa/state_tracker/st_atom_texture.c
@@ -32,6 +32,8 @@
*/
+#include "main/macros.h"
+
#include "st_context.h"
#include "st_atom.h"
#include "st_texture.h"
@@ -99,6 +101,12 @@ update_textures(struct st_context *st)
cso_set_sampler_textures(st->cso_context,
st->state.num_textures,
st->state.sampler_texture);
+ if (st->ctx->Const.MaxVertexTextureImageUnits > 0) {
+ cso_set_vertex_sampler_textures(st->cso_context,
+ MIN2(st->state.num_textures,
+ st->ctx->Const.MaxVertexTextureImageUnits),
+ st->state.sampler_texture);
+ }
}
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 57fe72d76a7..ef3cbc53ee0 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -92,6 +92,10 @@ void st_init_limits(struct st_context *st)
= _min(screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS),
MAX_VERTEX_TEXTURE_IMAGE_UNITS);
+ c->MaxCombinedTextureImageUnits
+ = _min(screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SAMPLERS),
+ MAX_COMBINED_TEXTURE_IMAGE_UNITS);
+
c->MaxTextureCoordUnits
= _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS);