diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i915/i830_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915/i915_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fallback.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vtbl.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_clear.c | 33 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_context.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_screen.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/glslcompiler/glslcompiler.c | 8 | ||||
-rw-r--r-- | src/mesa/main/extensions.c | 4 | ||||
-rw-r--r-- | src/mesa/main/fbobject.c | 27 | ||||
-rw-r--r-- | src/mesa/main/getstring.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/prog_print.c | 24 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 53 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_mesa_to_tgsi.c | 11 |
14 files changed, 128 insertions, 48 deletions
diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index fdce8af31f4..9c540cb2bb7 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -73,6 +73,8 @@ i830CreateContext(const __GLcontextModes * mesaVis, return GL_FALSE; } + _math_matrix_ctr(&intel->ViewportMatrix); + /* Initialize swrast, tnl driver tables: */ intelInitSpanFuncs(ctx); intelInitTriFuncs(ctx); diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 6e2d41e19ab..7549029a1be 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -119,6 +119,8 @@ i915CreateContext(const __GLcontextModes * mesaVis, return GL_FALSE; } + _math_matrix_ctr(&intel->ViewportMatrix); + /* Initialize swrast, tnl driver tables: */ intelInitSpanFuncs(ctx); intelInitTriFuncs(ctx); diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index e63098fdd4a..5f4f2d515df 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -75,8 +75,8 @@ static GLboolean do_check_fallback(struct brw_context *brw) /* _NEW_STENCIL */ - if (ctx->Stencil.Enabled && - !brw->intel.hw_stencil) { + if (ctx->Stencil.Enabled && + (ctx->DrawBuffer->Name == 0 && !brw->intel.hw_stencil)) { DBG("FALLBACK: stencil\n"); return GL_TRUE; } diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index b501a59ccd5..15ceac6ba1e 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -67,6 +67,8 @@ static void brw_destroy_context( struct intel_context *intel ) brw_destroy_state(brw); brw_draw_destroy( brw ); + _mesa_free(brw->wm.compile_data); + brw_FrameBufferTexDestroy( brw ); for (i = 0; i < brw->state.nr_draw_regions; i++) @@ -90,6 +92,7 @@ static void brw_destroy_context( struct intel_context *intel ) dri_bo_release(&brw->wm.bind_bo); for (i = 0; i < BRW_WM_MAX_SURF; i++) dri_bo_release(&brw->wm.surf_bo[i]); + dri_bo_release(&brw->wm.sampler_bo); dri_bo_release(&brw->wm.prog_bo); dri_bo_release(&brw->wm.state_bo); dri_bo_release(&brw->cc.prog_bo); diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index b2291363164..7c297ec9366 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -54,6 +54,17 @@ #define FILE_DEBUG_FLAG DEBUG_BLIT +#define TRI_CLEAR_COLOR_BITS (BUFFER_BIT_BACK_LEFT | \ + BUFFER_BIT_FRONT_LEFT | \ + BUFFER_BIT_COLOR0 | \ + BUFFER_BIT_COLOR1 | \ + BUFFER_BIT_COLOR2 | \ + BUFFER_BIT_COLOR3 | \ + BUFFER_BIT_COLOR4 | \ + BUFFER_BIT_COLOR5 | \ + BUFFER_BIT_COLOR6 | \ + BUFFER_BIT_COLOR7) + /** * Perform glClear where mask contains only color, depth, and/or stencil. * @@ -75,8 +86,8 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) GLboolean saved_shader_program = 0; unsigned int saved_active_texture; - assert((mask & ~(BUFFER_BIT_BACK_LEFT | BUFFER_BIT_FRONT_LEFT | - BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) == 0); + assert((mask & ~(TRI_CLEAR_COLOR_BITS | BUFFER_BIT_DEPTH | + BUFFER_BIT_STENCIL)) == 0); _mesa_PushAttrib(GL_COLOR_BUFFER_BIT | GL_CURRENT_BIT | @@ -170,11 +181,11 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) while (mask != 0) { GLuint this_mask = 0; + GLuint color_bit; - if (mask & BUFFER_BIT_BACK_LEFT) - this_mask = BUFFER_BIT_BACK_LEFT; - else if (mask & BUFFER_BIT_FRONT_LEFT) - this_mask = BUFFER_BIT_FRONT_LEFT; + color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS); + if (color_bit != 0) + this_mask |= (1 << (color_bit - 1)); /* Clear depth/stencil in the same pass as color. */ this_mask |= (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)); @@ -186,6 +197,9 @@ intel_clear_tris(GLcontext *ctx, GLbitfield mask) _mesa_DrawBuffer(GL_FRONT_LEFT); else if (this_mask & BUFFER_BIT_BACK_LEFT) _mesa_DrawBuffer(GL_BACK_LEFT); + else if (color_bit != 0) + _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0 + + (color_bit - BUFFER_COLOR0 - 1)); else _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); @@ -313,8 +327,11 @@ intelClear(GLcontext *ctx, GLbitfield mask) * buffer with it. */ if (mask & (BUFFER_BIT_DEPTH | BUFFER_BIT_STENCIL)) { - tri_mask |= blit_mask & BUFFER_BIT_BACK_LEFT; - blit_mask &= ~BUFFER_BIT_BACK_LEFT; + int color_bit = _mesa_ffs(mask & TRI_CLEAR_COLOR_BITS); + if (color_bit != 0) { + tri_mask |= blit_mask & (1 << (color_bit - 1)); + blit_mask &= ~(1 << (color_bit - 1)); + } } /* SW fallback clearing */ diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index d7ccfa06058..1aa173db181 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -573,8 +573,6 @@ intelInitContext(struct intel_context *intel, intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); - _math_matrix_ctr(&intel->ViewportMatrix); - if (IS_965(intelScreen->deviceID) && !intel->intelScreen->irq_active) { _mesa_printf("IRQs not active. Exiting\n"); exit(1); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index a52271158c6..d6110b8163a 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -302,6 +302,7 @@ intelDestroyScreen(__DRIscreenPrivate * sPriv) dri_bufmgr_destroy(intelScreen->bufmgr); intelUnmapScreenRegions(intelScreen); + driDestroyOptionCache(&intelScreen->optionCache); FREE(intelScreen); sPriv->private = NULL; diff --git a/src/mesa/drivers/glslcompiler/glslcompiler.c b/src/mesa/drivers/glslcompiler/glslcompiler.c index 918ec418563..54a4c1a7c6d 100644 --- a/src/mesa/drivers/glslcompiler/glslcompiler.c +++ b/src/mesa/drivers/glslcompiler/glslcompiler.c @@ -72,6 +72,7 @@ struct options { const char *VertFile; const char *FragFile; const char *OutputFile; + GLboolean Params; }; static struct options Options; @@ -228,6 +229,8 @@ PrintShaderInstructions(GLuint shader, FILE *f) struct gl_shader *sh = _mesa_lookup_shader(ctx, shader); struct gl_program *prog = sh->Program; _mesa_fprint_program_opt(stdout, prog, Options.Mode, Options.LineNumbers); + if (Options.Params) + _mesa_print_program_parameters(ctx, prog); } @@ -258,6 +261,7 @@ Usage(void) printf(" --debug emit debug-style instructions\n"); printf(" --number, -n emit line numbers\n"); printf(" --output, -o FILE output filename\n"); + printf(" --params also emit program parameter info\n"); printf(" --help display this information\n"); } @@ -272,6 +276,7 @@ ParseOptions(int argc, char *argv[]) Options.VertFile = NULL; Options.FragFile = NULL; Options.OutputFile = NULL; + Options.Params = GL_FALSE; if (argc == 1) { Usage(); @@ -305,6 +310,9 @@ ParseOptions(int argc, char *argv[]) Options.OutputFile = argv[i + 1]; i++; } + else if (strcmp(argv[i], "--params") == 0) { + Options.Params = GL_TRUE; + } else if (strcmp(argv[i], "--help") == 0) { Usage(); exit(0); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 1b31e283cd3..9c8bd13e692 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -208,7 +208,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_shading_language_100 = GL_TRUE; #endif #if FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */ + ctx->Extensions.ARB_shading_language_120 = GL_TRUE; #endif ctx->Extensions.ARB_shadow = GL_TRUE; ctx->Extensions.ARB_shadow_ambient = GL_TRUE; @@ -433,7 +433,7 @@ _mesa_enable_2_1_extensions(GLcontext *ctx) ctx->Extensions.EXT_texture_sRGB = GL_TRUE; #endif #ifdef FEATURE_ARB_shading_language_120 - ctx->Extensions.ARB_shading_language_120 = GL_FALSE; /* not quite done */ + ctx->Extensions.ARB_shading_language_120 = GL_TRUE; #endif } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index c3cdc110379..23b3fb68fbd 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -303,6 +303,20 @@ _mesa_framebuffer_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, /** + * For debug only. + */ +static void +att_incomplete(const char *msg) +{ +#if 0 + _mesa_printf("attachment incomplete: %s\n", msg); +#else + (void) msg; +#endif +} + + +/** * Test if an attachment point is complete and update its Complete field. * \param format if GL_COLOR, this is a color attachment point, * if GL_DEPTH, this is a depth component attachment point, @@ -323,20 +337,26 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, struct gl_texture_image *texImage; if (!texObj) { + att_incomplete("no texobj"); att->Complete = GL_FALSE; return; } texImage = texObj->Image[att->CubeMapFace][att->TextureLevel]; if (!texImage) { + att_incomplete("no teximage"); att->Complete = GL_FALSE; return; } if (texImage->Width < 1 || texImage->Height < 1) { + att_incomplete("teximage width/height=0"); + _mesa_printf("texobj = %u\n", texObj->Name); + _mesa_printf("level = %d\n", att->TextureLevel); att->Complete = GL_FALSE; return; } if (texObj->Target == GL_TEXTURE_3D && att->Zoffset >= texImage->Depth) { + att_incomplete("bad z offset"); att->Complete = GL_FALSE; return; } @@ -344,6 +364,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, if (format == GL_COLOR) { if (texImage->TexFormat->BaseFormat != GL_RGB && texImage->TexFormat->BaseFormat != GL_RGBA) { + att_incomplete("bad format"); att->Complete = GL_FALSE; return; } @@ -358,11 +379,13 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } else { att->Complete = GL_FALSE; + att_incomplete("bad depth format"); return; } } else { /* no such thing as stencil textures */ + att_incomplete("illegal stencil texture"); att->Complete = GL_FALSE; return; } @@ -372,6 +395,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, if (!att->Renderbuffer->InternalFormat || att->Renderbuffer->Width < 1 || att->Renderbuffer->Height < 1) { + att_incomplete("0x0 renderbuffer"); att->Complete = GL_FALSE; return; } @@ -381,6 +405,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, ASSERT(att->Renderbuffer->RedBits); ASSERT(att->Renderbuffer->GreenBits); ASSERT(att->Renderbuffer->BlueBits); + att_incomplete("bad renderbuffer color format"); att->Complete = GL_FALSE; return; } @@ -395,6 +420,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, /* OK */ } else { + att_incomplete("bad renderbuffer depth format"); att->Complete = GL_FALSE; return; } @@ -411,6 +437,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } else { att->Complete = GL_FALSE; + att_incomplete("bad renderbuffer stencil format"); return; } } diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c index a9e22d340a3..a42c44686dd 100644 --- a/src/mesa/main/getstring.c +++ b/src/mesa/main/getstring.c @@ -93,7 +93,7 @@ compute_version(const GLcontext *ctx) (ctx->Extensions.EXT_stencil_two_side || ctx->Extensions.ATI_separate_stencil)); const GLboolean ver_2_1 = (ver_2_0 && - /*ctx->Extensions.ARB_shading_language_120 &&*/ + ctx->Extensions.ARB_shading_language_120 && ctx->Extensions.EXT_pixel_buffer_object && ctx->Extensions.EXT_texture_sRGB); if (ver_2_1) diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index ce48767a871..516ea733017 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -212,15 +212,13 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, GLboolean relAddr, const struct gl_program *prog) { static char str[100]; + const char *addr = relAddr ? "ADDR+" : ""; str[0] = 0; switch (mode) { case PROG_PRINT_DEBUG: - if (relAddr) - _mesa_sprintf(str, "%s[ADDR+%d]", file_string(f, mode), index); - else - _mesa_sprintf(str, "%s[%d]", file_string(f, mode), index); + _mesa_sprintf(str, "%s[%s%d]", file_string(f, mode), addr, index); break; case PROG_PRINT_ARB: @@ -235,19 +233,19 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, _mesa_sprintf(str, "temp%d", index); break; case PROGRAM_ENV_PARAM: - _mesa_sprintf(str, "program.env[%d]", index); + _mesa_sprintf(str, "program.env[%s%d]", addr, index); break; case PROGRAM_LOCAL_PARAM: - _mesa_sprintf(str, "program.local[%d]", index); + _mesa_sprintf(str, "program.local[%s%d]", addr, index); break; case PROGRAM_VARYING: /* extension */ - _mesa_sprintf(str, "varying[%d]", index); + _mesa_sprintf(str, "varying[%s%d]", addr, index); break; case PROGRAM_CONSTANT: /* extension */ - _mesa_sprintf(str, "constant[%d]", index); + _mesa_sprintf(str, "constant[%s%d]", addr, index); break; case PROGRAM_UNIFORM: /* extension */ - _mesa_sprintf(str, "uniform[%d]", index); + _mesa_sprintf(str, "uniform[%s%d]", addr, index); break; case PROGRAM_STATE_VAR: { @@ -284,16 +282,16 @@ reg_string(enum register_file f, GLint index, gl_prog_print_mode mode, _mesa_sprintf(str, "c[%d]", index); break; case PROGRAM_VARYING: /* extension */ - _mesa_sprintf(str, "varying[%d]", index); + _mesa_sprintf(str, "varying[%s%d]", addr, index); break; case PROGRAM_UNIFORM: /* extension */ - _mesa_sprintf(str, "uniform[%d]", index); + _mesa_sprintf(str, "uniform[%s%d]", addr, index); break; case PROGRAM_CONSTANT: /* extension */ - _mesa_sprintf(str, "constant[%d]", index); + _mesa_sprintf(str, "constant[%s%d]", addr, index); break; case PROGRAM_STATE_VAR: /* extension */ - _mesa_sprintf(str, "state[%d]", index); + _mesa_sprintf(str, "state[%s%d]", addr, index); break; default: _mesa_problem(NULL, "bad file in reg_string()"); diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 2dd122c9a54..ac01462bd55 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -451,7 +451,7 @@ emit_arl_load(slang_emit_info *emitInfo, struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL); inst->SrcReg[0].File = file; inst->SrcReg[0].Index = index; - inst->SrcReg[0].Swizzle = swizzle; + inst->SrcReg[0].Swizzle = fix_swizzle(swizzle); inst->DstReg.File = PROGRAM_ADDRESS; inst->DstReg.Index = 0; inst->DstReg.WriteMask = WRITEMASK_X; @@ -873,6 +873,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) if (n->Children[0]->Store->Size != n->Children[1]->Store->Size) { slang_info_log_error(emitInfo->log, "invalid operands to == or !="); + n->Store = NULL; return NULL; } @@ -902,6 +903,7 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) slang_ir_storage tempStore; if (!alloc_local_temp(emitInfo, &tempStore, 4)) { + n->Store = NULL; return NULL; /* out of temps */ } @@ -1813,6 +1815,25 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) } +/** + * Return the size of a swizzle mask given that some swizzle components + * may be NIL/undefined. For example: + * swizzle_size(".zzxx") = 4 + * swizzle_size(".xy??") = 2 + * swizzle_size(".w???") = 1 + */ +static GLuint +swizzle_size(GLuint swizzle) +{ + GLuint i; + for (i = 0; i < 4; i++) { + if (GET_SWZ(swizzle, i) == SWIZZLE_NIL) + return i; + } + return 4; +} + + static struct prog_instruction * emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n) { @@ -1820,14 +1841,24 @@ emit_swizzle(slang_emit_info *emitInfo, slang_ir_node *n) inst = emit(emitInfo, n->Children[0]); -#if 0 - assert(n->Store->Parent); - /* Apply this node's swizzle to parent's storage */ - GLuint swizzle = n->Store->Swizzle; - _slang_copy_ir_storage(n->Store, n->Store->Parent); - n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle); - assert(!n->Store->Parent); -#endif + if (n->Children[0]->Opcode == IR_VAR || + n->Children[0]->Opcode == IR_SWIZZLE || + n->Children[0]->Opcode == IR_ELEMENT) { + /* We can resolve the swizzle now. Other swizzles will be resolved + * in storage_to_src_reg(). + */ + const GLuint swizzle = n->Store->Swizzle; + assert(n->Store->Parent); + /* new storage is parent storage with updated Swizzle + Size fields */ + _slang_copy_ir_storage(n->Store, n->Store->Parent); + /* Apply this node's swizzle to parent's storage */ + n->Store->Swizzle = _slang_swizzle_swizzle(n->Store->Swizzle, swizzle); + /* Update size */ + n->Store->Size = swizzle_size(n->Store->Swizzle); + assert(!n->Store->Parent); + assert(n->Store->Index >= 0); + } + return inst; } @@ -2428,7 +2459,9 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, maxUniforms = ctx->Const.VertexProgram.MaxUniformComponents / 4; } if (prog->Parameters->NumParameters > maxUniforms) { - slang_info_log_error(log, "Constant/uniform register limit exceeded"); + slang_info_log_error(log, "Constant/uniform register limit exceeded " + "(max=%u vec4)", maxUniforms); + return GL_FALSE; } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 8b9b18f94df..862d29fb1bd 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -41,7 +41,7 @@ #include "shader/prog_instruction.h" #include "shader/prog_parameter.h" #include "shader/prog_print.h" -#include "pipe/p_debug.h" +#include "util/u_debug.h" /* * Map mesa register file to TGSI register file. @@ -475,15 +475,6 @@ compile_instruction( break; case OPCODE_RSQ: fullinst->Instruction.Opcode = TGSI_OPCODE_RSQ; - - /* KW: Don't do this here. If particular hardware needs to do - * this, can do so in the driver.. - */ -#if 0 - tgsi_util_set_full_src_register_sign_mode( - &fullinst->FullSrcRegisters[0], - TGSI_UTIL_SIGN_CLEAR ); -#endif break; case OPCODE_SCS: fullinst->Instruction.Opcode = TGSI_OPCODE_SCS; |