summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2009-10-05 14:42:08 -0600
committerBrian Paul <[email protected]>2009-10-05 14:42:08 -0600
commit55770d09c18c4d33403abb97dfef4f897efbbe2a (patch)
tree3f3cb2ea42c511c11e134c2d414367df82268cea /src
parentf00da2a3ff59c1a7104ac25a1c6eba5a6050ad68 (diff)
parent79892e7976fbb91ae426f5868d5f453e977c1f17 (diff)
Merge branch 'mesa_7_6_branch'
Conflicts: src/gallium/auxiliary/util/u_cpu_detect.c
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c7
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c2
-rw-r--r--src/gallium/auxiliary/draw/draw_vs_aos.c6
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c2
-rw-r--r--src/gallium/auxiliary/translate/translate_generic.c2
-rw-r--r--src/gallium/auxiliary/util/u_debug_profile.c2
-rw-r--r--src/gallium/auxiliary/util/u_debug_symbol.c2
-rw-r--r--src/gallium/auxiliary/util/u_gen_mipmap.c1
-rw-r--r--src/gallium/drivers/softpipe/sp_fs_sse.c2
-rw-r--r--src/gallium/state_trackers/glx/xlib/glx_api.c8
-rw-r--r--src/mesa/drivers/dri/intel/intel_context.c60
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel_read.c4
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_copy.c2
-rw-r--r--src/mesa/drivers/dri/r200/r200_state.c15
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c20
-rw-r--r--src/mesa/drivers/dri/r300/r300_fragprog_common.c13
-rw-r--r--src/mesa/drivers/x11/fakeglx.c4
-rw-r--r--src/mesa/main/context.c1
-rw-r--r--src/mesa/main/dlist.c6
-rw-r--r--src/mesa/main/mipmap.c19
-rw-r--r--src/mesa/main/texobj.c2
-rw-r--r--src/mesa/shader/prog_optimize.c4
-rw-r--r--src/mesa/shader/slang/slang_link.c1
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c12
-rw-r--r--src/mesa/state_tracker/st_cb_fbo.c13
26 files changed, 116 insertions, 96 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 36c882acb75..4f13b3e2bad 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -268,7 +268,7 @@ void cso_release_all( struct cso_context *ctx )
void cso_destroy_context( struct cso_context *ctx )
{
if (ctx) {
- //cso_release_all( ctx );
+ /*cso_release_all( ctx );*/
FREE( ctx );
}
}
diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
index 44147aed9be..734c05f0688 100644
--- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
+++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c
@@ -212,17 +212,10 @@ static void fse_prepare( struct draw_pt_middle_end *middle,
struct draw_vertex_shader *vs = draw->vs.vertex_shader;
vs->prepare(vs, draw);
}
-
-
- //return TRUE;
}
-
-
-
-
static void fse_run_linear( struct draw_pt_middle_end *middle,
unsigned start,
unsigned count )
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index e25f16c354a..6c1cb48e8b8 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -210,7 +210,7 @@ void draw_pt_post_vs_prepare( struct pt_post_vs *pvs,
pvs->run = post_vs_viewport;
}
else {
- //if (opengl)
+ /* if (opengl) */
pvs->run = post_vs_cliptest_viewport_gl;
}
}
diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c
index 62e04a65f30..645d7cccbae 100644
--- a/src/gallium/auxiliary/draw/draw_vs_aos.c
+++ b/src/gallium/auxiliary/draw/draw_vs_aos.c
@@ -891,7 +891,7 @@ static void x87_emit_ex2( struct aos_compilation *cp )
struct x86_reg st1 = x86_make_reg(file_x87, 1);
int stack = cp->func->x87_stack;
-// set_fpu_round_neg_inf( cp );
+ /* set_fpu_round_neg_inf( cp ); */
x87_fld(cp->func, st0); /* a a */
x87_fprndint( cp->func ); /* int(a) a*/
@@ -1759,14 +1759,14 @@ emit_instruction( struct aos_compilation *cp,
return emit_SUB(cp, inst);
case TGSI_OPCODE_LRP:
-// return emit_LERP(cp, inst);
+ /*return emit_LERP(cp, inst);*/
return FALSE;
case TGSI_OPCODE_FRC:
return emit_FRC(cp, inst);
case TGSI_OPCODE_CLAMP:
-// return emit_CLAMP(cp, inst);
+ /*return emit_CLAMP(cp, inst);*/
return FALSE;
case TGSI_OPCODE_FLR:
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
index d01f8666222..d31476228c2 100644
--- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
+++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c
@@ -584,7 +584,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list)
}
#ifdef DEBUG
- //assert(!fenced_list->numUnfenced);
+ /*assert(!fenced_list->numUnfenced);*/
#endif
pipe_mutex_unlock(fenced_list->mutex);
diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c
index 8d39b64c6c1..266e7ee81e6 100644
--- a/src/gallium/auxiliary/translate/translate_generic.c
+++ b/src/gallium/auxiliary/translate/translate_generic.c
@@ -217,7 +217,7 @@ ATTRIB( R8G8_SNORM, 2, char, FROM_8_SNORM, TO_8_SNORM )
ATTRIB( R8_SNORM, 1, char, FROM_8_SNORM, TO_8_SNORM )
ATTRIB( A8R8G8B8_UNORM, 4, ubyte, FROM_8_UNORM, TO_8_UNORM )
-//ATTRIB( R8G8B8A8_UNORM, 4, ubyte, FROM_8_UNORM, TO_8_UNORM )
+/*ATTRIB( R8G8B8A8_UNORM, 4, ubyte, FROM_8_UNORM, TO_8_UNORM )*/
ATTRIB( R32G32B32A32_FIXED, 4, int, FROM_32_FIXED, TO_32_FIXED )
ATTRIB( R32G32B32_FIXED, 3, int, FROM_32_FIXED, TO_32_FIXED )
diff --git a/src/gallium/auxiliary/util/u_debug_profile.c b/src/gallium/auxiliary/util/u_debug_profile.c
index 6d8b244c3ac..d765b501445 100644
--- a/src/gallium/auxiliary/util/u_debug_profile.c
+++ b/src/gallium/auxiliary/util/u_debug_profile.c
@@ -254,7 +254,7 @@ debug_profile_start(void)
{
WCHAR *p;
- // increment starting from the less significant digit
+ /* increment starting from the less significant digit */
p = &wFileName[14];
while(1) {
if(*p == '9') {
diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c
index 811931f81b0..417d0cf04c9 100644
--- a/src/gallium/auxiliary/util/u_debug_symbol.c
+++ b/src/gallium/auxiliary/util/u_debug_symbol.c
@@ -214,7 +214,7 @@ debug_symbol_print_imagehlp(const void *addr)
HANDLE hProcess;
BYTE symbolBuffer[1024];
PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) symbolBuffer;
- DWORD dwDisplacement = 0; // Displacement of the input address, relative to the start of the symbol
+ DWORD dwDisplacement = 0; /* Displacement of the input address, relative to the start of the symbol */
hProcess = GetCurrentProcess();
diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c
index 4e3d35f40e7..aa823aa218b 100644
--- a/src/gallium/auxiliary/util/u_gen_mipmap.c
+++ b/src/gallium/auxiliary/util/u_gen_mipmap.c
@@ -1427,6 +1427,7 @@ set_vertex_data(struct gen_mipmap_state *ctx,
rz = -1.0f;
break;
default:
+ rx = ry = rz = 0.0f;
assert(0);
}
diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c
index 9d3e4670eef..f9129506585 100644
--- a/src/gallium/drivers/softpipe/sp_fs_sse.c
+++ b/src/gallium/drivers/softpipe/sp_fs_sse.c
@@ -138,7 +138,7 @@ fs_sse_run( const struct sp_fragment_shader *base,
machine->Consts,
(const float (*)[4])shader->immediates,
machine->InterpCoefs
- // , &machine->QuadPos
+ /*, &machine->QuadPos*/
);
quad->inout.mask &= ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]);
diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c
index 65012e92538..6cd7ede31cf 100644
--- a/src/gallium/state_trackers/glx/xlib/glx_api.c
+++ b/src/gallium/state_trackers/glx/xlib/glx_api.c
@@ -850,10 +850,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
if (!fbConfig)
return NULL;
parselist++;
- if (*parselist == GLX_RGBA_BIT) {
+ if (*parselist & GLX_RGBA_BIT) {
rgb_flag = GL_TRUE;
}
- else if (*parselist == GLX_COLOR_INDEX_BIT) {
+ else if (*parselist & GLX_COLOR_INDEX_BIT) {
rgb_flag = GL_FALSE;
}
else if (*parselist == 0) {
@@ -1538,9 +1538,9 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig )
if (!fbconfig)
return GLX_BAD_ATTRIBUTE;
if (xmvis->mesa_visual.rgbMode)
- *value = GLX_RGBA_TYPE;
+ *value = GLX_RGBA_BIT;
else
- *value = GLX_COLOR_INDEX_TYPE;
+ *value = GLX_COLOR_INDEX_BIT;
break;
case GLX_X_RENDERABLE_SGIX:
if (!fbconfig)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index d49d95768db..934f7aa1873 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -984,41 +984,35 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
_mesa_make_current(&intel->ctx, &intel_fb->Base, readFb);
- /* The drawbuffer won't always be updated by _mesa_make_current:
- */
- if (intel->ctx.DrawBuffer == &intel_fb->Base) {
-
- if (intel->driReadDrawable != driReadPriv)
- intel->driReadDrawable = driReadPriv;
-
- if (intel->driDrawable != driDrawPriv) {
- if (driDrawPriv->swap_interval == (unsigned)-1) {
- int i;
-
- driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
- ? driGetDefaultVBlankFlags(&intel->optionCache)
- : VBLANK_FLAG_NO_IRQ;
-
- /* Prevent error printf if one crtc is disabled, this will
- * be properly calculated in intelWindowMoved() next.
- */
- driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv);
-
- (*psp->systemTime->getUST) (&intel_fb->swap_ust);
- driDrawableInitVBlank(driDrawPriv);
- intel_fb->vbl_waited = driDrawPriv->vblSeq;
-
- for (i = 0; i < 2; i++) {
- if (intel_fb->color_rb[i])
- intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq;
- }
- }
- intel->driDrawable = driDrawPriv;
- intelWindowMoved(intel);
- }
+ intel->driReadDrawable = driReadPriv;
+
+ if (intel->driDrawable != driDrawPriv) {
+ if (driDrawPriv->swap_interval == (unsigned)-1) {
+ int i;
+
+ driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0)
+ ? driGetDefaultVBlankFlags(&intel->optionCache)
+ : VBLANK_FLAG_NO_IRQ;
- intel_draw_buffer(&intel->ctx, &intel_fb->Base);
+ /* Prevent error printf if one crtc is disabled, this will
+ * be properly calculated in intelWindowMoved() next.
+ */
+ driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv);
+
+ (*psp->systemTime->getUST) (&intel_fb->swap_ust);
+ driDrawableInitVBlank(driDrawPriv);
+ intel_fb->vbl_waited = driDrawPriv->vblSeq;
+
+ for (i = 0; i < 2; i++) {
+ if (intel_fb->color_rb[i])
+ intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq;
+ }
+ }
+ intel->driDrawable = driDrawPriv;
+ intelWindowMoved(intel);
}
+
+ intel_draw_buffer(&intel->ctx, &intel_fb->Base);
}
else {
_mesa_make_current(NULL, NULL, NULL);
diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c
index 44a8695286f..47075001801 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c
@@ -226,14 +226,14 @@ do_blit_readpixels(GLcontext * ctx,
intelFlush(&intel->ctx);
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
+ if (intel->driReadDrawable->numClipRects) {
GLboolean all = (width * height * src->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst,
all ? INTEL_WRITE_FULL :
INTEL_WRITE_PART);
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
+ __DRIdrawablePrivate *dPriv = intel->driReadDrawable;
int nbox = dPriv->numClipRects;
drm_clip_rect_t *box = dPriv->pClipRects;
drm_clip_rect_t rect;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 8f467e65144..f3e312420dd 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -135,7 +135,7 @@ do_copy_texsubimage(struct intel_context *intel,
if (ctx->ReadBuffer->Name == 0) {
/* reading from a window, adjust x, y */
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
+ const __DRIdrawablePrivate *dPriv = intel->driReadDrawable;
y = dPriv->y + (dPriv->h - (y + height));
x += dPriv->x;
diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c
index 76852e315c1..d28e96d9d98 100644
--- a/src/mesa/drivers/dri/r200/r200_state.c
+++ b/src/mesa/drivers/dri/r200/r200_state.c
@@ -1578,13 +1578,6 @@ static void r200ClearStencil( GLcontext *ctx, GLint s )
* Window position and viewport transformation
*/
-/*
- * To correctly position primitives:
- */
-#define SUBPIXEL_X 0.125
-#define SUBPIXEL_Y 0.125
-
-
/**
* Called when window size or position changes or viewport or depth range
* state is changed. We update the hardware viewport state here.
@@ -1609,9 +1602,9 @@ void r200UpdateWindow( GLcontext *ctx )
}
float_ui32_type sx = { v[MAT_SX] };
- float_ui32_type tx = { v[MAT_TX] + xoffset + SUBPIXEL_X };
+ float_ui32_type tx = { v[MAT_TX] + xoffset };
float_ui32_type sy = { v[MAT_SY] * y_scale };
- float_ui32_type ty = { (v[MAT_TY] * y_scale) + y_bias + SUBPIXEL_Y };
+ float_ui32_type ty = { (v[MAT_TY] * y_scale) + y_bias };
float_ui32_type sz = { v[MAT_SZ] * depthScale };
float_ui32_type tz = { v[MAT_TZ] * depthScale };
@@ -1680,8 +1673,8 @@ void r200UpdateViewportOffset( GLcontext *ctx )
float_ui32_type tx;
float_ui32_type ty;
- tx.f = v[MAT_TX] + xoffset + SUBPIXEL_X;
- ty.f = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y;
+ tx.f = v[MAT_TX] + xoffset;
+ ty.f = (- v[MAT_TY]) + yoffset;
if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 ||
rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 )
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 6fcf209af66..2c2b16aa98d 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -376,11 +376,21 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen)
if (screen->chip_family >= CHIP_FAMILY_RV515) {
ctx->Const.FragmentProgram.MaxNativeTemps = R500_PFS_NUM_TEMP_REGS;
ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */
- ctx->Const.FragmentProgram.MaxNativeParameters = R500_PFS_NUM_CONST_REGS;
- ctx->Const.FragmentProgram.MaxNativeAluInstructions = R500_PFS_MAX_INST;
- ctx->Const.FragmentProgram.MaxNativeTexInstructions = R500_PFS_MAX_INST;
- ctx->Const.FragmentProgram.MaxNativeInstructions = R500_PFS_MAX_INST;
- ctx->Const.FragmentProgram.MaxNativeTexIndirections = R500_PFS_MAX_INST;
+
+ /* The hardware limits are higher than this,
+ * but the non-KMS DRM interface artificially limits us
+ * to this many instructions.
+ *
+ * We could of course work around it in the KMS path,
+ * but it would be a mess, so it seems wiser
+ * to leave it as is. Going forward, the Gallium driver
+ * will not be subject to these limitations.
+ */
+ ctx->Const.FragmentProgram.MaxNativeParameters = 255;
+ ctx->Const.FragmentProgram.MaxNativeAluInstructions = 255;
+ ctx->Const.FragmentProgram.MaxNativeTexInstructions = 255;
+ ctx->Const.FragmentProgram.MaxNativeInstructions = 255;
+ ctx->Const.FragmentProgram.MaxNativeTexIndirections = 255;
ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0;
} else {
ctx->Const.FragmentProgram.MaxNativeTemps = R300_PFS_NUM_TEMP_REGS;
diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
index 0bdc90b4a84..70c92528943 100644
--- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c
+++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c
@@ -239,6 +239,19 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog
rewriteFog(&compiler, fp);
r3xx_compile_fragment_program(&compiler);
+
+ if (compiler.is_r500) {
+ /* We need to support the non-KMS DRM interface, which
+ * artificially limits the number of instructions and
+ * constants which are available to us.
+ *
+ * See also the comment in r300_context.c where we
+ * set the MAX_NATIVE_xxx values.
+ */
+ if (fp->code.code.r500.inst_end >= 255 || fp->code.constants.Count > 255)
+ rc_error(&compiler.Base, "Program is too big (upgrade to r300g to avoid this limitation).\n");
+ }
+
fp->error = compiler.Base.Error;
fp->InputsRead = compiler.Base.Program.InputsRead;
diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c
index eb7c4f6417c..6449dc88b0d 100644
--- a/src/mesa/drivers/x11/fakeglx.c
+++ b/src/mesa/drivers/x11/fakeglx.c
@@ -1197,10 +1197,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
if (!fbConfig)
return NULL;
parselist++;
- if (*parselist == GLX_RGBA_BIT) {
+ if (*parselist & GLX_RGBA_BIT) {
rgb_flag = GL_TRUE;
}
- else if (*parselist == GLX_COLOR_INDEX_BIT) {
+ else if (*parselist & GLX_COLOR_INDEX_BIT) {
rgb_flag = GL_FALSE;
}
else if (*parselist == 0) {
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 11b1d244538..ae91bf5f385 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -860,6 +860,7 @@ _mesa_initialize_context(GLcontext *ctx,
_mesa_free_shared_state(ctx, ctx->Shared);
if (ctx->Exec)
_mesa_free(ctx->Exec);
+ return GL_FALSE;
}
#if FEATURE_dispatch
_mesa_init_exec_table(ctx->Exec);
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 6354ed74748..95c1b9015bd 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1961,6 +1961,9 @@ save_Fogiv(GLenum pname, const GLint *params)
case GL_FOG_END:
case GL_FOG_INDEX:
p[0] = (GLfloat) *params;
+ p[1] = 0.0f;
+ p[2] = 0.0f;
+ p[3] = 0.0f;
break;
case GL_FOG_COLOR:
p[0] = INT_TO_FLOAT(params[0]);
@@ -2249,6 +2252,9 @@ save_LightModeliv(GLenum pname, const GLint *params)
case GL_LIGHT_MODEL_TWO_SIDE:
case GL_LIGHT_MODEL_COLOR_CONTROL:
fparam[0] = (GLfloat) params[0];
+ fparam[1] = 0.0F;
+ fparam[2] = 0.0F;
+ fparam[3] = 0.0F;
break;
default:
/* Error will be caught later in gl_LightModelfv */
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 3dca09d9f28..c3928fa513f 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1501,8 +1501,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
GLuint comps;
ASSERT(texObj);
- /* XXX choose cube map face here??? */
- srcImage = texObj->Image[0][texObj->BaseLevel];
+ srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel);
ASSERT(srcImage);
maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
@@ -1510,7 +1509,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
/* Find convertFormat - the format that do_row() will process */
if (srcImage->IsCompressed) {
- /* setup for compressed textures */
+ /* setup for compressed textures - need to allocate temporary
+ * image buffers to hold uncompressed images.
+ */
GLuint row;
GLint components, size;
GLchan *dst;
@@ -1587,11 +1588,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
&dstWidth, &dstHeight, &dstDepth);
if (!nextLevel) {
/* all done */
- if (srcImage->IsCompressed) {
- _mesa_free((void *) srcData);
- _mesa_free(dstData);
- }
- return;
+ break;
}
/* get dest gl_texture_image */
@@ -1682,6 +1679,12 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
}
} /* loop over mipmap levels */
+
+ if (srcImage->IsCompressed) {
+ /* free uncompressed image buffers */
+ _mesa_free((void *) srcData);
+ _mesa_free(dstData);
+ }
}
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index f8ce811eb29..8fd5eaa2661 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -859,7 +859,7 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj)
for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) {
if (texObj == unit->CurrentTex[tex]) {
_mesa_reference_texobj(&unit->CurrentTex[tex],
- ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]);
+ ctx->Shared->DefaultTex[tex]);
ASSERT(unit->CurrentTex[tex]);
break;
}
diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c
index be903106a08..9d937488e37 100644
--- a/src/mesa/shader/prog_optimize.c
+++ b/src/mesa/shader/prog_optimize.c
@@ -217,6 +217,7 @@ _mesa_remove_dead_code(struct gl_program *prog)
if (inst->SrcReg[j].RelAddr) {
if (dbg)
_mesa_printf("abort remove dead code (indirect temp)\n");
+ _mesa_free(removeInst);
return;
}
@@ -232,6 +233,7 @@ _mesa_remove_dead_code(struct gl_program *prog)
if (inst->DstReg.RelAddr) {
if (dbg)
_mesa_printf("abort remove dead code (indirect temp)\n");
+ _mesa_free(removeInst);
return;
}
@@ -422,6 +424,8 @@ _mesa_remove_extra_moves(struct gl_program *prog)
/* now remove the instructions which aren't needed */
rem = remove_instructions(prog, removeInst);
+ _mesa_free(removeInst);
+
if (dbg) {
_mesa_printf("Optimize: End remove extra moves. %u instructions removed\n", rem);
/*_mesa_print_program(prog);*/
diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c
index 8f2b40d5dfb..71038d2d94e 100644
--- a/src/mesa/shader/slang/slang_link.c
+++ b/src/mesa/shader/slang/slang_link.c
@@ -670,6 +670,7 @@ get_main_shader(GLcontext *ctx,
!shader->Main ||
shader->UnresolvedRefs) {
link_error(shProg, "Unresolved symbols");
+ _mesa_free_shader(ctx, shader);
return NULL;
}
}
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 91fc9f98f7c..4a64472fa14 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -599,15 +599,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* viewport state: viewport matching window dims */
{
- const float width = (float) ctx->DrawBuffer->Width;
- const float height = (float) ctx->DrawBuffer->Height;
+ const float w = (float) ctx->DrawBuffer->Width;
+ const float h = (float) ctx->DrawBuffer->Height;
struct pipe_viewport_state vp;
- vp.scale[0] = 0.5f * width;
- vp.scale[1] = -0.5f * height;
+ vp.scale[0] = 0.5f * w;
+ vp.scale[1] = -0.5f * h;
vp.scale[2] = 1.0f;
vp.scale[3] = 1.0f;
- vp.translate[0] = 0.5f * width;
- vp.translate[1] = 0.5f * height;
+ vp.translate[0] = 0.5f * w;
+ vp.translate[1] = 0.5f * h;
vp.translate[2] = 0.0f;
vp.translate[3] = 0.0f;
cso_set_viewport(cso, &vp);
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index a0495209013..57a2a3db5bb 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -165,12 +165,12 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
strb->texture,
0, 0, 0,
surface_usage );
-
- assert(strb->surface->texture);
- assert(strb->surface->format);
- assert(strb->surface->width == width);
- assert(strb->surface->height == height);
-
+ if (strb->surface) {
+ assert(strb->surface->texture);
+ assert(strb->surface->format);
+ assert(strb->surface->width == width);
+ assert(strb->surface->height == height);
+ }
return strb->surface != NULL;
}
@@ -298,6 +298,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw)
default:
_mesa_problem(NULL,
"Unexpected format in st_new_renderbuffer_fb");
+ _mesa_free(strb);
return NULL;
}