aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-08-07 07:51:02 +0200
committermarha <marha@users.sourceforge.net>2012-08-07 07:51:02 +0200
commitf8e35ebbe71eed74ccf68af8ccda4182f1edc7f0 (patch)
tree0451299b4aaaaf6d2423d1faf07dc9f35c9f80d8 /mesalib/src/mesa
parent18e75aa6ae27a6e44d93babd96afbbe0cd6077c8 (diff)
downloadvcxsrv-f8e35ebbe71eed74ccf68af8ccda4182f1edc7f0.tar.gz
vcxsrv-f8e35ebbe71eed74ccf68af8ccda4182f1edc7f0.tar.bz2
vcxsrv-f8e35ebbe71eed74ccf68af8ccda4182f1edc7f0.zip
mesa xserver xkeyboard-config git update 7 Aug 2012
Diffstat (limited to 'mesalib/src/mesa')
-rw-r--r--mesalib/src/mesa/drivers/dri/common/dri_util.c23
-rw-r--r--mesalib/src/mesa/program/nvfragparse.c2
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_sampler.c106
-rw-r--r--mesalib/src/mesa/state_tracker/st_atom_texture.c99
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_bitmap.c25
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_clear.c4
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c16
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.c10
-rw-r--r--mesalib/src/mesa/state_tracker/st_context.h12
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp3
10 files changed, 159 insertions, 141 deletions
diff --git a/mesalib/src/mesa/drivers/dri/common/dri_util.c b/mesalib/src/mesa/drivers/dri/common/dri_util.c
index f9b2a73b2..91ae186fe 100644
--- a/mesalib/src/mesa/drivers/dri/common/dri_util.c
+++ b/mesalib/src/mesa/drivers/dri/common/dri_util.c
@@ -197,12 +197,6 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
return NULL;
}
- if (mesa_api != API_OPENGL && num_attribs != 0) {
- *error = __DRI_CTX_ERROR_UNKNOWN_ATTRIBUTE;
- assert(!"Should not get here.");
- return NULL;
- }
-
for (unsigned i = 0; i < num_attribs; i++) {
switch (attribs[i * 2]) {
case __DRI_CTX_ATTRIB_MAJOR_VERSION:
@@ -224,6 +218,23 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
}
}
+ /* The EGL_KHR_create_context spec says:
+ *
+ * "Flags are only defined for OpenGL context creation, and specifying
+ * a flags value other than zero for other types of contexts,
+ * including OpenGL ES contexts, will generate an error."
+ *
+ * The GLX_EXT_create_context_es2_profile specification doesn't say
+ * anything specific about this case. However, none of the known flags
+ * have any meaning in an ES context, so this seems safe.
+ */
+ if (mesa_api != __DRI_API_OPENGL
+ && mesa_api != __DRI_API_OPENGL_CORE
+ && flags != 0) {
+ *error = __DRI_CTX_ERROR_BAD_FLAG;
+ return NULL;
+ }
+
/* There are no forward-compatible contexts before OpenGL 3.0. The
* GLX_ARB_create_context spec says:
*
diff --git a/mesalib/src/mesa/program/nvfragparse.c b/mesalib/src/mesa/program/nvfragparse.c
index bcc553a9b..20c8579b0 100644
--- a/mesalib/src/mesa/program/nvfragparse.c
+++ b/mesalib/src/mesa/program/nvfragparse.c
@@ -582,7 +582,7 @@ Parse_TextureImageId(struct parse_state *parseState,
RETURN_ERROR1("Expected TEX# source");
}
unit = atoi((const char *) imageSrc + 3);
- if ((unit < 0 || unit > MAX_TEXTURE_IMAGE_UNITS) ||
+ if ((unit < 0 || unit >= MAX_TEXTURE_IMAGE_UNITS) ||
(unit == 0 && (imageSrc[3] != '0' || imageSrc[4] != 0))) {
RETURN_ERROR1("Invalied TEX# source index");
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_sampler.c b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
index dc0c789c5..f39fd7551 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_sampler.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_sampler.c
@@ -195,84 +195,82 @@ convert_sampler(struct st_context *st,
}
+/**
+ * Update the gallium driver's sampler state for fragment, vertex or
+ * geometry shader stage.
+ */
static void
-update_vertex_samplers(struct st_context *st)
+update_shader_samplers(struct st_context *st,
+ unsigned shader_stage,
+ const struct gl_program *prog,
+ unsigned max_units,
+ struct pipe_sampler_state *samplers,
+ unsigned *num_samplers)
{
- const struct gl_context *ctx = st->ctx;
- struct gl_vertex_program *vprog = ctx->VertexProgram._Current;
- GLuint su;
-
- if (st->state.num_vertex_samplers == 0 && vprog->Base.SamplersUsed == 0)
- return;
- st->state.num_vertex_samplers = 0;
-
- /* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxVertexTextureImageUnits; su++) {
- struct pipe_sampler_state *sampler = st->state.vertex_samplers + su;
-
- if (vprog->Base.SamplersUsed & (1 << su)) {
- GLuint texUnit;
-
- texUnit = vprog->Base.SamplerUnits[su];
+ GLuint unit;
+ GLbitfield samplers_used;
+ const GLuint old_max = *num_samplers;
- convert_sampler(st, sampler, texUnit);
+ samplers_used = prog->SamplersUsed;
- st->state.num_vertex_samplers = su + 1;
-
- cso_single_vertex_sampler(st->cso_context, su, sampler);
- } else {
- cso_single_vertex_sampler(st->cso_context, su, NULL);
- }
- }
- cso_single_vertex_sampler_done(st->cso_context);
-}
-
-
-static void
-update_fragment_samplers(struct st_context *st)
-{
- const struct gl_context *ctx = st->ctx;
- struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
- GLuint su;
- GLuint samplers_used = fprog->Base.SamplersUsed;
- GLuint old_max = st->state.num_samplers;
+ if (*num_samplers == 0 && samplers_used == 0x0)
+ return;
- st->state.num_samplers = 0;
+ *num_samplers = 0;
/* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
- struct pipe_sampler_state *sampler = st->state.samplers + su;
+ for (unit = 0; unit < max_units; unit++, samplers_used >>= 1) {
+ struct pipe_sampler_state *sampler = samplers + unit;
if (samplers_used & 1) {
- GLuint texUnit;
-
- texUnit = fprog->Base.SamplerUnits[su];
+ const GLuint texUnit = prog->SamplerUnits[unit];
convert_sampler(st, sampler, texUnit);
- st->state.num_samplers = su + 1;
+ *num_samplers = unit + 1;
- /*printf("%s su=%u non-null\n", __FUNCTION__, su);*/
- cso_single_sampler(st->cso_context, su, sampler);
+ cso_single_sampler(st->cso_context, shader_stage, unit, sampler);
+ }
+ else if (samplers_used != 0 || unit < old_max) {
+ cso_single_sampler(st->cso_context, shader_stage, unit, NULL);
}
- else if (samplers_used != 0 || su < old_max) {
- /*printf("%s su=%u null\n", __FUNCTION__, su);*/
- cso_single_sampler(st->cso_context, su, NULL);
- } else {
- /* if we've reset all the old views and we have no more new ones */
+ else {
+ /* if we've reset all the old samplers and we have no more new ones */
break;
}
}
- cso_single_sampler_done(st->cso_context);
+ cso_single_sampler_done(st->cso_context, shader_stage);
}
static void
update_samplers(struct st_context *st)
{
- update_fragment_samplers(st);
- update_vertex_samplers(st);
+ const struct gl_context *ctx = st->ctx;
+
+ update_shader_samplers(st,
+ PIPE_SHADER_FRAGMENT,
+ &ctx->FragmentProgram._Current->Base,
+ ctx->Const.MaxTextureImageUnits,
+ st->state.fragment_samplers,
+ &st->state.num_fragment_samplers);
+
+ update_shader_samplers(st,
+ PIPE_SHADER_VERTEX,
+ &ctx->VertexProgram._Current->Base,
+ ctx->Const.MaxVertexTextureImageUnits,
+ st->state.vertex_samplers,
+ &st->state.num_vertex_samplers);
+
+/*
+ update_shader_samplers(st,
+ PIPE_SHADER_GEOMETRY,
+ &ctx->GeometryProgram._Current->Base,
+ ctx->Const.MaxGeometryTextureImageUnits,
+ st->state.geometry_samplers,
+ &st->state.num_geometry_samplers);
+*/
}
diff --git a/mesalib/src/mesa/state_tracker/st_atom_texture.c b/mesalib/src/mesa/state_tracker/st_atom_texture.c
index fefa59860..e88675d4e 100644
--- a/mesalib/src/mesa/state_tracker/st_atom_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_atom_texture.c
@@ -254,84 +254,81 @@ update_single_texture(struct st_context *st,
}
+
static void
-update_vertex_textures(struct st_context *st)
+update_textures(struct st_context *st,
+ unsigned shader_stage,
+ const struct gl_program *prog,
+ unsigned max_units,
+ struct pipe_sampler_view **sampler_views,
+ unsigned *num_textures)
{
- const struct gl_context *ctx = st->ctx;
- struct gl_vertex_program *vprog = ctx->VertexProgram._Current;
- GLuint su;
+ const GLuint old_max = *num_textures;
+ GLbitfield samplers_used = prog->SamplersUsed;
+ GLuint unit;
- if (!vprog->Base.SamplersUsed && st->state.num_vertex_textures == 0)
+ if (samplers_used == 0x0 && old_max == 0)
return;
- st->state.num_vertex_textures = 0;
+ *num_textures = 0;
/* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++) {
+ for (unit = 0; unit < max_units; unit++, samplers_used >>= 1) {
struct pipe_sampler_view *sampler_view = NULL;
- if (vprog->Base.SamplersUsed & (1 << su)) {
- GLboolean retval;
- GLuint texUnit;
- texUnit = vprog->Base.SamplerUnits[su];
+ if (samplers_used & 1) {
+ const GLuint texUnit = prog->SamplerUnits[unit];
+ GLboolean retval;
retval = update_single_texture(st, &sampler_view, texUnit);
if (retval == GL_FALSE)
continue;
- st->state.num_vertex_textures = su + 1;
+ *num_textures = unit + 1;
+ }
+ else if (samplers_used == 0 && unit >= old_max) {
+ /* if we've reset all the old views and we have no more new ones */
+ break;
}
- pipe_sampler_view_reference(&st->state.sampler_vertex_views[su],
- sampler_view);
- }
- if (ctx->Const.MaxVertexTextureImageUnits > 0) {
- GLuint numUnits = MIN2(st->state.num_vertex_textures,
- ctx->Const.MaxVertexTextureImageUnits);
- cso_set_vertex_sampler_views(st->cso_context,
- numUnits,
- st->state.sampler_vertex_views);
+ pipe_sampler_view_reference(&(sampler_views[unit]), sampler_view);
}
+
+ cso_set_sampler_views(st->cso_context,
+ shader_stage,
+ MIN2(*num_textures, max_units),
+ sampler_views);
}
+
static void
-update_fragment_textures(struct st_context *st)
+update_vertex_textures(struct st_context *st)
{
const struct gl_context *ctx = st->ctx;
- struct gl_fragment_program *fprog = ctx->FragmentProgram._Current;
- GLuint su;
- int old_max = st->state.num_textures;
- GLbitfield samplers_used = fprog->Base.SamplersUsed;
-
- st->state.num_textures = 0;
-
- /* loop over sampler units (aka tex image units) */
- for (su = 0; su < ctx->Const.MaxTextureImageUnits; su++, samplers_used >>= 1) {
- struct pipe_sampler_view *sampler_view = NULL;
-
- if (samplers_used & 1) {
- GLboolean retval;
- GLuint texUnit;
- texUnit = fprog->Base.SamplerUnits[su];
-
- retval = update_single_texture(st, &sampler_view, texUnit);
- if (retval == GL_FALSE)
- continue;
+ if (ctx->Const.MaxVertexTextureImageUnits > 0) {
+ update_textures(st,
+ PIPE_SHADER_VERTEX,
+ &ctx->VertexProgram._Current->Base,
+ ctx->Const.MaxVertexTextureImageUnits,
+ st->state.vertex_sampler_views,
+ &st->state.num_vertex_textures);
+ }
+}
- st->state.num_textures = su + 1;
- } else if (samplers_used == 0 && su >= old_max) {
- /* if we've reset all the old views and we have no more new ones */
- break;
- }
- pipe_sampler_view_reference(&st->state.sampler_views[su], sampler_view);
- }
+static void
+update_fragment_textures(struct st_context *st)
+{
+ const struct gl_context *ctx = st->ctx;
- cso_set_fragment_sampler_views(st->cso_context,
- st->state.num_textures,
- st->state.sampler_views);
+ update_textures(st,
+ PIPE_SHADER_FRAGMENT,
+ &ctx->FragmentProgram._Current->Base,
+ ctx->Const.MaxTextureImageUnits,
+ st->state.fragment_sampler_views,
+ &st->state.num_fragment_textures);
}
diff --git a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
index c26058874..3c17bd6c3 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_bitmap.c
@@ -454,8 +454,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
assert(height <= (GLsizei)maxSize);
cso_save_rasterizer(cso);
- cso_save_samplers(cso);
- cso_save_fragment_sampler_views(cso);
+ cso_save_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_save_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_save_viewport(cso);
cso_save_fragment_shader(cso);
cso_save_stream_outputs(cso);
@@ -480,23 +480,26 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* user samplers, plus our bitmap sampler */
{
struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS];
- uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_samplers);
+ uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_fragment_samplers);
uint i;
- for (i = 0; i < st->state.num_samplers; i++) {
- samplers[i] = &st->state.samplers[i];
+ for (i = 0; i < st->state.num_fragment_samplers; i++) {
+ samplers[i] = &st->state.fragment_samplers[i];
}
samplers[fpv->bitmap_sampler] =
&st->bitmap.samplers[sv->texture->target != PIPE_TEXTURE_RECT];
- cso_set_samplers(cso, num, (const struct pipe_sampler_state **) samplers);
+ cso_set_samplers(cso, PIPE_SHADER_FRAGMENT, num,
+ (const struct pipe_sampler_state **) samplers);
}
/* user textures, plus the bitmap texture */
{
struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
- uint num = MAX2(fpv->bitmap_sampler + 1, st->state.num_textures);
- memcpy(sampler_views, st->state.sampler_views, sizeof(sampler_views));
+ uint num = MAX2(fpv->bitmap_sampler + 1,
+ st->state.num_fragment_textures);
+ memcpy(sampler_views, st->state.fragment_sampler_views,
+ sizeof(sampler_views));
sampler_views[fpv->bitmap_sampler] = sv;
- cso_set_fragment_sampler_views(cso, num, sampler_views);
+ cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num, sampler_views);
}
/* viewport state: viewport matching window dims */
@@ -535,8 +538,8 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* restore state */
cso_restore_rasterizer(cso);
- cso_restore_samplers(cso);
- cso_restore_fragment_sampler_views(cso);
+ cso_restore_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_restore_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_restore_viewport(cso);
cso_restore_fragment_shader(cso);
cso_restore_vertex_shader(cso);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_clear.c b/mesalib/src/mesa/state_tracker/st_cb_clear.c
index 3cd8756f2..e731b6b5e 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_clear.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_clear.c
@@ -217,6 +217,7 @@ clear_with_quad(struct gl_context *ctx,
cso_save_stencil_ref(st->cso_context);
cso_save_depth_stencil_alpha(st->cso_context);
cso_save_rasterizer(st->cso_context);
+ cso_save_sample_mask(st->cso_context);
cso_save_viewport(st->cso_context);
cso_save_fragment_shader(st->cso_context);
cso_save_stream_outputs(st->cso_context);
@@ -277,7 +278,7 @@ clear_with_quad(struct gl_context *ctx,
cso_set_vertex_elements(st->cso_context, 2, st->velems_util_draw);
cso_set_stream_outputs(st->cso_context, 0, NULL, 0);
-
+ cso_set_sample_mask(st->cso_context, ~0);
cso_set_rasterizer(st->cso_context, &st->clear.raster);
/* viewport state: viewport matching window dims */
@@ -313,6 +314,7 @@ clear_with_quad(struct gl_context *ctx,
cso_restore_stencil_ref(st->cso_context);
cso_restore_depth_stencil_alpha(st->cso_context);
cso_restore_rasterizer(st->cso_context);
+ cso_restore_sample_mask(st->cso_context);
cso_restore_viewport(st->cso_context);
cso_restore_fragment_shader(st->cso_context);
cso_restore_vertex_shader(st->cso_context);
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index f288a9632..88068ac60 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -679,8 +679,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_save_rasterizer(cso);
cso_save_viewport(cso);
- cso_save_samplers(cso);
- cso_save_fragment_sampler_views(cso);
+ cso_save_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_save_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_save_fragment_shader(cso);
cso_save_stream_outputs(cso);
cso_save_vertex_shader(cso);
@@ -751,11 +751,11 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST;
sampler.normalized_coords = normalized;
- cso_single_sampler(cso, 0, &sampler);
+ cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 0, &sampler);
if (num_sampler_view > 1) {
- cso_single_sampler(cso, 1, &sampler);
+ cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, 1, &sampler);
}
- cso_single_sampler_done(cso);
+ cso_single_sampler_done(cso, PIPE_SHADER_FRAGMENT);
}
/* viewport state: viewport matching window dims */
@@ -778,7 +778,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
cso_set_stream_outputs(st->cso_context, 0, NULL, 0);
/* texture state: */
- cso_set_fragment_sampler_views(cso, num_sampler_view, sv);
+ cso_set_sampler_views(cso, PIPE_SHADER_FRAGMENT, num_sampler_view, sv);
/* Compute Gallium window coords (y=0=top) with pixel zoom.
* Recall that these coords are transformed by the current
@@ -804,8 +804,8 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z,
/* restore state */
cso_restore_rasterizer(cso);
cso_restore_viewport(cso);
- cso_restore_samplers(cso);
- cso_restore_fragment_sampler_views(cso);
+ cso_restore_samplers(cso, PIPE_SHADER_FRAGMENT);
+ cso_restore_sampler_views(cso, PIPE_SHADER_FRAGMENT);
cso_restore_fragment_shader(cso);
cso_restore_vertex_shader(cso);
cso_restore_geometry_shader(cso);
diff --git a/mesalib/src/mesa/state_tracker/st_context.c b/mesalib/src/mesa/state_tracker/st_context.c
index 6b7c047ed..2f9516178 100644
--- a/mesalib/src/mesa/state_tracker/st_context.c
+++ b/mesalib/src/mesa/state_tracker/st_context.c
@@ -248,8 +248,14 @@ static void st_destroy_context_priv( struct st_context *st )
st_destroy_drawpix(st);
st_destroy_drawtex(st);
- for (i = 0; i < Elements(st->state.sampler_views); i++) {
- pipe_sampler_view_release(st->pipe, &st->state.sampler_views[i]);
+ for (i = 0; i < Elements(st->state.fragment_sampler_views); i++) {
+ pipe_sampler_view_release(st->pipe,
+ &st->state.fragment_sampler_views[i]);
+ }
+
+ for (i = 0; i < Elements(st->state.vertex_sampler_views); i++) {
+ pipe_sampler_view_release(st->pipe,
+ &st->state.vertex_sampler_views[i]);
}
if (st->default_texture) {
diff --git a/mesalib/src/mesa/state_tracker/st_context.h b/mesalib/src/mesa/state_tracker/st_context.h
index cdac5a1c7..0dfd81c1b 100644
--- a/mesalib/src/mesa/state_tracker/st_context.h
+++ b/mesalib/src/mesa/state_tracker/st_context.h
@@ -98,23 +98,23 @@ struct st_context
struct pipe_blend_state blend;
struct pipe_depth_stencil_alpha_state depth_stencil;
struct pipe_rasterizer_state rasterizer;
- struct pipe_sampler_state samplers[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_state vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_state fragment_samplers[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_state vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_clip_state clip;
struct {
void *ptr;
unsigned size;
} constants[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
- struct pipe_sampler_view *sampler_views[PIPE_MAX_SAMPLERS];
- struct pipe_sampler_view *sampler_vertex_views[PIPE_MAX_VERTEX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *vertex_sampler_views[PIPE_MAX_VERTEX_SAMPLERS];
struct pipe_scissor_state scissor;
struct pipe_viewport_state viewport;
unsigned sample_mask;
- GLuint num_samplers;
+ GLuint num_fragment_samplers;
GLuint num_vertex_samplers;
- GLuint num_textures;
+ GLuint num_fragment_textures;
GLuint num_vertex_textures;
GLuint poly_stipple[32]; /**< In OpenGL's bottom-to-top order */
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index fcd69b18d..66627acb6 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -4790,7 +4790,7 @@ get_mesa_program(struct gl_context *ctx,
struct gl_shader_program *shader_program,
struct gl_shader *shader)
{
- glsl_to_tgsi_visitor* v = new glsl_to_tgsi_visitor();
+ glsl_to_tgsi_visitor* v;
struct gl_program *prog;
GLenum target;
const char *target_string;
@@ -4822,6 +4822,7 @@ get_mesa_program(struct gl_context *ctx,
if (!prog)
return NULL;
prog->Parameters = _mesa_new_parameter_list();
+ v = new glsl_to_tgsi_visitor();
v->ctx = ctx;
v->prog = prog;
v->shader_program = shader_program;