mesa: Update vertex texture code after gallium changes.
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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");
|
||||
|
@@ -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
|
||||
|
@@ -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 */
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user