Mesa (master): glsl: Document glsl_type::sampler_dimensionality
Module: Mesa Branch: master Commit: dedc81e1dced8768334c300d630b4683fd8a1ba2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dedc81e1dced8768334c300d630b4683fd8a1ba2 Author: Chad Versace Date: Thu Mar 3 14:07:42 2011 -0800 glsl: Document glsl_type::sampler_dimensionality --- src/glsl/glsl_types.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h index 3c2672c..1b069df 100644 --- a/src/glsl/glsl_types.h +++ b/src/glsl/glsl_types.h @@ -70,7 +70,7 @@ struct glsl_type { GLenum gl_type; glsl_base_type base_type; - unsigned sampler_dimensionality:3; + unsigned sampler_dimensionality:3; /**< \see glsl_sampler_dim */ unsigned sampler_shadow:1; unsigned sampler_array:1; unsigned sampler_type:2;/**< Type of data returned using this sampler. ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Revert "mesa: Convert fixed function fragment program generator to GLSL IR."
Module: Mesa Branch: master Commit: 098f9c5325de16bfb5bf8b0e93e0ec1871db4a76 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=098f9c5325de16bfb5bf8b0e93e0ec1871db4a76 Author: Eric Anholt Date: Sat Mar 12 15:00:55 2011 -0800 Revert "mesa: Convert fixed function fragment program generator to GLSL IR." This reverts commit 7cb87dffce2c7a37f960f3a865cf92fd193dd8c5. There were regressions (Bug #35244) and more review has been requested. --- src/mesa/main/ff_fragment_shader.cpp | 1435 ++ src/mesa/main/state.c| 12 +- src/mesa/main/texenvprogram.h|2 +- src/mesa/program/program.c |2 +- 4 files changed, 783 insertions(+), 668 deletions(-) Diff: http://cgit.freedesktop.org/mesa/mesa/diff/?id=098f9c5325de16bfb5bf8b0e93e0ec1871db4a76 ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Revert "mesa: Track a computed _CurrentFragmentProgram for current gl_shader_program"
Module: Mesa Branch: master Commit: 07c420a3c6799a744088f1bbe1c1a5ff157a1771 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=07c420a3c6799a744088f1bbe1c1a5ff157a1771 Author: Eric Anholt Date: Sat Mar 12 15:00:49 2011 -0800 Revert "mesa: Track a computed _CurrentFragmentProgram for current gl_shader_program" This reverts commit b4452c3baad6e0379eeb7f22f2e51d13999e1323. --- src/mesa/main/mtypes.h |1 - src/mesa/main/state.c | 13 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 81e2819..4f83e2e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2191,7 +2191,6 @@ struct gl_shader_state struct gl_shader_program *CurrentVertexProgram; struct gl_shader_program *CurrentGeometryProgram; struct gl_shader_program *CurrentFragmentProgram; - struct gl_shader_program *_CurrentFragmentProgram; /** * Program used by glUniform calls. diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index cf9fe89..1b2b2f3 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -43,7 +43,6 @@ #include "pixel.h" #include "program/program.h" #include "program/prog_parameter.h" -#include "shaderobj.h" #include "state.h" #include "stencil.h" #include "texenvprogram.h" @@ -250,7 +249,7 @@ update_program(struct gl_context *ctx) { const struct gl_shader_program *vsProg = ctx->Shader.CurrentVertexProgram; const struct gl_shader_program *gsProg = ctx->Shader.CurrentGeometryProgram; - struct gl_shader_program *fsProg = ctx->Shader.CurrentFragmentProgram; + const struct gl_shader_program *fsProg = ctx->Shader.CurrentFragmentProgram; const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current; const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current; const struct gl_geometry_program *prevGP = ctx->GeometryProgram._Current; @@ -276,22 +275,20 @@ update_program(struct gl_context *ctx) /* Use shader programs */ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, fsProg->FragmentProgram); - _mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram, -fsProg); } else if (ctx->FragmentProgram._Enabled) { /* use user-defined fragment program */ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, ctx->FragmentProgram.Current); - _mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram, -NULL); } else if (ctx->FragmentProgram._MaintainTexEnvProgram) { /* Use fragment program generated from fixed-function state. */ struct gl_shader_program *f = _mesa_get_fixed_func_fragment_program(ctx); +#if 0 _mesa_reference_shader_program(ctx, -&ctx->Shader._CurrentFragmentProgram, f); +&ctx->Shader.CurrentFragmentProgram, f); +#endif _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, f->FragmentProgram); @@ -299,8 +296,6 @@ update_program(struct gl_context *ctx) else { /* no fragment program */ _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); - _mesa_reference_shader_program(ctx, &ctx->Shader._CurrentFragmentProgram, -NULL); } if (gsProg && gsProg->LinkStatus && gsProg->GeometryProgram) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): Revert "i965: Use the fixed function GLSL program instead of the ARB program."
Module: Mesa Branch: master Commit: 403be190a3fe63ae03bc0111e0a0b026495b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=403be190a3fe63ae03bc0111e0a0b026495b Author: Eric Anholt Date: Sat Mar 12 15:00:14 2011 -0800 Revert "i965: Use the fixed function GLSL program instead of the ARB program." This reverts commit 81b34a4e3a7aec9cdf2781757408dc5e9eec79cb. There were regressions in the core change that this depends on. --- src/mesa/drivers/dri/i965/brw_fs.cpp |6 +++--- src/mesa/drivers/dri/i965/brw_wm_state.c |4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index ba4b508..ce7959b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -1381,7 +1381,7 @@ fs_visitor::visit(ir_texture *ir) assert(!ir->projector); sampler = _mesa_get_sampler_uniform_value(ir->sampler, - ctx->Shader._CurrentFragmentProgram, +ctx->Shader.CurrentFragmentProgram, &brw->fragment_program->Base); sampler = c->fp->program.Base.SamplerUnits[sampler]; @@ -3454,7 +3454,7 @@ fs_visitor::generate_code() if (unlikely(INTEL_DEBUG & DEBUG_WM)) { printf("Native code for fragment shader %d:\n", -ctx->Shader._CurrentFragmentProgram->Name); +ctx->Shader.CurrentFragmentProgram->Name); } foreach_iter(exec_list_iterator, iter, this->instructions) { @@ -3723,7 +3723,7 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) { struct intel_context *intel = &brw->intel; struct gl_context *ctx = &intel->ctx; - struct gl_shader_program *prog = ctx->Shader._CurrentFragmentProgram; + struct gl_shader_program *prog = ctx->Shader.CurrentFragmentProgram; if (!prog) return GL_FALSE; diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 8d67b97..5b5afc4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -131,9 +131,9 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) /* If using the fragment shader backend, the program is always * 8-wide. */ - if (ctx->Shader._CurrentFragmentProgram) { + if (ctx->Shader.CurrentFragmentProgram) { struct brw_shader *shader = (struct brw_shader *) - ctx->Shader._CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]; + ctx->Shader.CurrentFragmentProgram->_LinkedShaders[MESA_SHADER_FRAGMENT]; if (shader != NULL && shader->ir != NULL) { key->is_glsl = GL_TRUE; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i915g: fix transfer coherency
Module: Mesa Branch: master Commit: 7735f8c6e525da0ea830f5a54a329abe2d6a1006 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7735f8c6e525da0ea830f5a54a329abe2d6a1006 Author: Daniel Vetter Date: Sat Mar 12 22:57:17 2011 +0100 i915g: fix transfer coherency The kernel drm takes care of all coherency as long as we don't forget to submit all outstanding commands in the batchbuffer ... Also move batchbuffer initialization up because otherwise transfers for some helper textures fail with a segmentation fault. And kill the dead code, flushes should now be correct everywhere. Signed-off-by: Daniel Vetter --- src/gallium/drivers/i915/i915_context.c |8 src/gallium/drivers/i915/i915_flush.c| 22 -- src/gallium/drivers/i915/i915_resource_texture.c |3 +++ 3 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c index 5dbf0cf..cb3de82 100644 --- a/src/gallium/drivers/i915/i915_context.c +++ b/src/gallium/drivers/i915/i915_context.c @@ -151,6 +151,10 @@ i915_create_context(struct pipe_screen *screen, void *priv) util_slab_create(&i915->transfer_pool, sizeof(struct pipe_transfer), 16, UTIL_SLAB_SINGLETHREADED); + /* Batch stream debugging is a bit hacked up at the moment: +*/ + i915->batch = i915->iws->batchbuffer_create(i915->iws); + /* * Create drawing context and plug our rendering stage into it. */ @@ -183,9 +187,5 @@ i915_create_context(struct pipe_screen *screen, void *priv) i915->dynamic_dirty = ~0; i915->flush_dirty = 0; - /* Batch stream debugging is a bit hacked up at the moment: -*/ - i915->batch = i915->iws->batchbuffer_create(i915->iws); - return &i915->base; } diff --git a/src/gallium/drivers/i915/i915_flush.c b/src/gallium/drivers/i915/i915_flush.c index 87966d9..a5407cf 100644 --- a/src/gallium/drivers/i915/i915_flush.c +++ b/src/gallium/drivers/i915/i915_flush.c @@ -45,28 +45,6 @@ static void i915_flush_pipe( struct pipe_context *pipe, draw_flush(i915->draw); -#if 0 - /* Do we need to emit an MI_FLUSH command to flush the hardware -* caches? -*/ - /* XXX These flags are now implicit. All of them. */ - if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) { - unsigned flush = MI_FLUSH; - - if (!(flags & PIPE_FLUSH_RENDER_CACHE)) -flush |= INHIBIT_FLUSH_RENDER_CACHE; - - if (flags & PIPE_FLUSH_TEXTURE_CACHE) -flush |= FLUSH_MAP_CACHE; - - if (!BEGIN_BATCH(1)) { -FLUSH_BATCH(NULL); -assert(BEGIN_BATCH(1)); - } - OUT_BATCH( flush ); - } -#endif - if (i915->batch->map == i915->batch->ptr) { return; } diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index cfb72e9..7816925 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -759,6 +759,9 @@ i915_texture_transfer_map(struct pipe_context *pipe, assert(box->z == 0); offset = i915_texture_offset(tex, transfer->level, box->z); + /* TODO this is a sledgehammer */ + pipe->flush(pipe, NULL); + map = iws->buffer_map(iws, tex->buffer, (transfer->usage & PIPE_TRANSFER_WRITE) ? TRUE : FALSE); if (map == NULL) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): st/mesa: fix crash when using both user and vbo buffers with the same stride
Module: Mesa Branch: 7.9 Commit: 7272f8fb1892e991a3b6d35dee801aee582fb5cc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7272f8fb1892e991a3b6d35dee801aee582fb5cc Author: Marek Olšák Date: Sun Feb 20 18:05:24 2011 +0100 st/mesa: fix crash when using both user and vbo buffers with the same stride If two buffers had the same stride where one buffer is a user one and the other is a vbo, it was considered to be one interleaved buffer, resulting in incorrect rendering and crashes. This patch makes sure that the interleaved buffer is either user or vbo, not both. (cherry picked from commit 695cdee67827ee2c11e1445eb2022d3a530f1b23) --- src/mesa/state_tracker/st_draw.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 318e088..eb869de 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -250,6 +250,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, GLint firstStride = -1; GLuint num_client_arrays = 0; const GLubyte *client_addr = NULL; + GLboolean user_memory; for (attr = 0; attr < vpv->num_inputs; attr++) { const GLuint mesaAttr = vp->index_to_input[attr]; @@ -258,6 +259,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, if (firstStride < 0) { firstStride = stride; + user_memory = !bufObj || !bufObj->Name; } else if (firstStride != stride) { return GL_FALSE; @@ -268,6 +270,9 @@ is_interleaved_arrays(const struct st_vertex_program *vp, /* Try to detect if the client-space arrays are * "close" to each other. */ + if (!user_memory) { +return GL_FALSE; + } if (!client_addr) { client_addr = arrays[mesaAttr]->Ptr; } @@ -277,6 +282,9 @@ is_interleaved_arrays(const struct st_vertex_program *vp, } } else if (!firstBufObj) { + if (user_memory) { +return GL_FALSE; + } firstBufObj = bufObj; } else if (bufObj != firstBufObj) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): r300/compiler: remove unused variables
Module: Mesa Branch: 7.9 Commit: c91d217ff70ac40067b4f829a9422ab1dec44475 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c91d217ff70ac40067b4f829a9422ab1dec44475 Author: Marek Olšák Date: Tue Mar 8 22:13:29 2011 +0100 r300/compiler: remove unused variables (cherry picked from commit ff8baec5bc377cab716b0510d98195fb5564fb1a) --- .../drivers/dri/r300/compiler/radeon_program_tex.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index c2f4fe3..8643884 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -147,7 +147,7 @@ int radeonTransformTEX( return 1; } else { struct rc_instruction * inst_rcp = NULL; - struct rc_instruction *inst_mul, *inst_add, *inst_cmp, *inst_cmp2, *inst_mul2; + struct rc_instruction *inst_mul, *inst_add, *inst_cmp; unsigned tmp_texsample; unsigned tmp_sum; int pass, fail; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): r300/compiler: fix equal and notequal shadow compare functions
Module: Mesa Branch: 7.9 Commit: e2baddb65350c58d960a1651f81a13cb4392f46c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2baddb65350c58d960a1651f81a13cb4392f46c Author: Marek Olšák Date: Tue Mar 8 07:36:40 2011 +0100 r300/compiler: fix equal and notequal shadow compare functions (cherry picked from commit 4dfcf3c4fe6edd1785348f4f6fc1ef0af2fff6f6) --- .../drivers/dri/r300/compiler/radeon_program_tex.c | 34 +-- 1 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index df88134..c2f4fe3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -30,14 +30,14 @@ /* Series of transformations to be done on textures. */ static struct rc_src_register shadow_ambient(struct r300_fragment_program_compiler *compiler, - int tmu) +int tmu) { struct rc_src_register reg = { 0, }; if (compiler->enable_shadow_ambient) { reg.File = RC_FILE_CONSTANT; reg.Index = rc_constants_add_state(&compiler->Base.Program.Constants, - RC_STATE_SHADOW_AMBIENT, tmu); + RC_STATE_SHADOW_AMBIENT, tmu); reg.Swizzle = RC_SWIZZLE_; } else { reg.File = RC_FILE_NONE; @@ -134,13 +134,6 @@ int radeonTransformTEX( (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) { rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; - /* Fake EQUAL/NOTEQUAL, they are equal to NEVER/ALWAYS due to precision issues anyway. */ - if (comparefunc == RC_COMPARE_FUNC_EQUAL) { - comparefunc = RC_COMPARE_FUNC_NEVER; - } else if (comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { - comparefunc = RC_COMPARE_FUNC_ALWAYS; - } - if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { inst->U.I.Opcode = RC_OPCODE_MOV; @@ -154,7 +147,7 @@ int radeonTransformTEX( return 1; } else { struct rc_instruction * inst_rcp = NULL; - struct rc_instruction *inst_mul, *inst_cmp, *inst_add; + struct rc_instruction *inst_mul, *inst_add, *inst_cmp, *inst_cmp2, *inst_mul2; unsigned tmp_texsample; unsigned tmp_sum; int pass, fail; @@ -209,22 +202,27 @@ int radeonTransformTEX( inst_add->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_; inst_add->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; inst_add->U.I.SrcReg[1].Index = tmp_texsample; - inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_; + inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_; - /* Recall that SrcReg[0] is r, SrcReg[tex] is tex and: + /* Note that SrcReg[0] is r, SrcReg[1] is tex and: * LESS:r < tex <=> -tex+r < 0 * GEQUAL: r >= tex <=> not (-tex+r < 0) * GREATER: r > tex <=> tex-r < 0 * LEQUAL: r <= tex <=> not ( tex-r < 0) -* -* This negates either r or tex: */ - if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL) +* EQUAL: GEQUAL +* NOTEQUAL:LESS +*/ + + /* This negates either r or tex: */ + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL || + comparefunc == RC_COMPARE_FUNC_EQUAL || comparefunc == RC_COMPARE_FUNC_NOTEQUAL) inst_add->U.I.SrcReg[1].Negate = inst_add->U.I.SrcReg[1].Negate ^ RC_MASK_XYZW; else inst_add->U.I.SrcReg[0].Negate = inst_add->U.I.SrcReg[0].Negate ^ RC_MASK_XYZW; /* This negates the whole expresion: */ - if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER) { + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER || + comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { p
Mesa (7.9): r300/compiler: saturate Z before the shadow comparison
Module: Mesa Branch: 7.9 Commit: 20c7067257e0db51fab8188168e3c5e2656c76b8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=20c7067257e0db51fab8188168e3c5e2656c76b8 Author: Marek Olšák Date: Tue Mar 8 04:00:07 2011 +0100 r300/compiler: saturate Z before the shadow comparison This fixes: https://bugs.freedesktop.org/show_bug.cgi?id=31159 NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit eb1acd16130a2945122d373357ee72585e520755) --- .../drivers/dri/r300/compiler/radeon_program_tex.c | 81 +++- 1 files changed, 44 insertions(+), 37 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 37f6def..df88134 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -134,6 +134,13 @@ int radeonTransformTEX( (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) { rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; + /* Fake EQUAL/NOTEQUAL, they are equal to NEVER/ALWAYS due to precision issues anyway. */ + if (comparefunc == RC_COMPARE_FUNC_EQUAL) { + comparefunc = RC_COMPARE_FUNC_NEVER; + } else if (comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { + comparefunc = RC_COMPARE_FUNC_ALWAYS; + } + if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { inst->U.I.Opcode = RC_OPCODE_MOV; @@ -146,14 +153,11 @@ int radeonTransformTEX( return 1; } else { - rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; struct rc_instruction * inst_rcp = NULL; - struct rc_instruction * inst_mad; - struct rc_instruction * inst_cmp; + struct rc_instruction *inst_mul, *inst_cmp, *inst_add; unsigned tmp_texsample; unsigned tmp_sum; - unsigned tmp_recip_w = 0; - int pass, fail, tex; + int pass, fail; /* Save the output register. */ struct rc_dst_register output_reg = inst->U.I.DstReg; @@ -164,49 +168,49 @@ int radeonTransformTEX( inst->U.I.DstReg.Index = tmp_texsample; inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; - if (inst->U.I.Opcode == RC_OPCODE_TXP) { - tmp_recip_w = rc_find_free_temporary(c); + tmp_sum = rc_find_free_temporary(c); + if (inst->U.I.Opcode == RC_OPCODE_TXP) { /* Compute 1/W. */ inst_rcp = rc_insert_new_instruction(c, inst); inst_rcp->U.I.Opcode = RC_OPCODE_RCP; inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_rcp->U.I.DstReg.Index = tmp_recip_w; + inst_rcp->U.I.DstReg.Index = tmp_sum; inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; inst_rcp->U.I.SrcReg[0].Swizzle = RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3)); } - /* Perspective-divide Z by W (if it's TXP) and add the texture sample (see below). */ - tmp_sum = rc_find_free_temporary(c); - inst_mad = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); - inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->U.I.DstReg.Index = tmp_sum; - inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mad->U.I.SrcReg[0].Swizzle = + /* Divide Z by W (if it's TXP) and saturate. */ + inst_mul = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); + inst_mul->U.I.Opcode = inst->U.I.Opcode == RC_OPCODE_TXP ? RC_OPCODE_MUL : RC_OPCODE_MOV; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = tmp_sum; + inst_mul->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mul->U.I.SaturateMode = RC_SATURATE_ZERO_ONE; + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[0].Swizzle =
Mesa (7.9): r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500
Module: Mesa Branch: 7.9 Commit: ca76f4f6aaa27fea64cf720c6de843522d02b3a0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca76f4f6aaa27fea64cf720c6de843522d02b3a0 Author: Marek Olšák Date: Sat Mar 12 11:20:57 2011 +0100 r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500 The docs say it can be set for direct texture lookups, but even that causes problems. This fixes the wireframe bug: https://bugs.freedesktop.org/show_bug.cgi?id=32688 NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit 6da4866ffdb19315bbb48f6778d1a5297b842a77) --- .../drivers/dri/r300/compiler/r500_fragprog_emit.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index abbf704..147cb67 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -373,7 +373,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst | (inst->DstReg.WriteMask << 11) | R500_INST_TEX_SEM_WAIT; code->inst[ip].inst1 = R500_TEX_ID(inst->TexSrcUnit) - | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED; + | R500_TEX_SEM_ACQUIRE; if (inst->TexSrcTarget == RC_TEXTURE_RECT) code->inst[ip].inst1 |= R500_TEX_UNSCALED; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): r300/compiler: TEX instructions don' t support negation on source arguments
Module: Mesa Branch: 7.9 Commit: c7305375d1aa97e3936cc817eca1c3801484d818 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c7305375d1aa97e3936cc817eca1c3801484d818 Author: Marek Olšák Date: Sat Mar 12 10:22:18 2011 +0100 r300/compiler: TEX instructions don't support negation on source arguments This fixes piglit: - glsl-fs-texture2d-dependent-4 NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit 1e97b4dd103a00f497cc92571498ffd7178ba263) --- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index bc42441..c4de2ff 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -74,9 +74,6 @@ static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) if (opcode == RC_OPCODE_KIL && (reg.Swizzle != RC_SWIZZLE_XYZW || reg.Negate != RC_MASK_NONE)) return 0; - if (reg.Negate) - reg.Negate ^= RC_MASK_XYZW; - for(i = 0; i < 4; ++i) { unsigned int swz = GET_SWZ(reg.Swizzle, i); if (swz == RC_SWIZZLE_UNUSED) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): r300/compiler: Abs doesn't cancel Negate ( in the conversion to native swizzles)
Module: Mesa Branch: 7.9 Commit: dea5e972ffd92556a9a87e084552aa826498dfde URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=dea5e972ffd92556a9a87e084552aa826498dfde Author: Marek Olšák Date: Sat Mar 12 10:18:45 2011 +0100 r300/compiler: Abs doesn't cancel Negate (in the conversion to native swizzles) NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit 589d835dfd9b07f49ee12af2dfa04a4e054bec68) --- .../dri/r300/compiler/r300_fragprog_swizzle.c |6 -- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c |3 --- 2 files changed, 0 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c index 1aa40c7..4e9cb30 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c @@ -98,9 +98,6 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) unsigned int relevant; int j; - if (reg.Abs) - reg.Negate = RC_MASK_NONE; - if (opcode == RC_OPCODE_KIL || opcode == RC_OPCODE_TEX || opcode == RC_OPCODE_TXB || @@ -142,9 +139,6 @@ static void r300_swizzle_split( struct rc_src_register src, unsigned int mask, struct rc_swizzle_split * split) { - if (src.Abs) - src.Negate = RC_MASK_NONE; - split->NumPhases = 0; while(mask) { diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 627ce37..bc42441 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -100,9 +100,6 @@ static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) return 0; } else { /* ALU instructions support almost everything */ - if (reg.Abs) - return 1; - relevant = 0; for(i = 0; i < 3; ++i) { unsigned int swz = GET_SWZ(reg.Swizzle, i); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): r300/compiler: fix translating the src negate bits in pair_translate
Module: Mesa Branch: 7.9 Commit: c198d29fbe8fc6456ff751f26e109c691692360a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c198d29fbe8fc6456ff751f26e109c691692360a Author: Marek Olšák Date: Sat Mar 12 09:32:16 2011 +0100 r300/compiler: fix translating the src negate bits in pair_translate (1, -_, ...) was converted to (-1, ...) because of the negation in the second component. Masking out the unused bits fixes this. Piglit: - glsl-fs-texture2d-branching NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit d96305e4fcc67047e730cdc177bfa3da4307ff5a) --- .../dri/r300/compiler/radeon_pair_translate.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index 840c7a5..a500a2c 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -211,16 +211,21 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, if (needrgb && !istranscendent) { unsigned int srcrgb = 0; unsigned int srcalpha = 0; + unsigned int srcmask = 0; int j; /* We don't care about the alpha channel here. We only * want the part of the swizzle that writes to rgb, * since we are creating an rgb instruction. */ for(j = 0; j < 3; ++j) { unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); - if (swz < 3) + + if (swz < RC_SWIZZLE_W) srcrgb = 1; - else if (swz < 4) + else if (swz == RC_SWIZZLE_W) srcalpha = 1; + + if (swz < RC_SWIZZLE_UNUSED) + srcmask |= 1 << j; } source = rc_pair_alloc_source(pair, srcrgb, srcalpha, inst->SrcReg[i].File, inst->SrcReg[i].Index); @@ -232,7 +237,7 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, pair->RGB.Arg[i].Source = source; pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff; pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); + pair->RGB.Arg[i].Negate = !!(srcmask & inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); } if (needalpha) { unsigned int srcrgb = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): r300/compiler: fix the saturate modifier when applied to TEX instructions
Module: Mesa Branch: 7.9 Commit: 90292b8001ad55995aef6581fe27637fb8983973 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=90292b8001ad55995aef6581fe27637fb8983973 Author: Marek Olšák Date: Sat Mar 12 06:07:24 2011 +0100 r300/compiler: fix the saturate modifier when applied to TEX instructions This bug can only be triggered if the source texture is either signed or float. (cherry picked from commit e4707604ab46252d2e010906124775d3300f0be1) --- .../drivers/dri/r300/compiler/radeon_program_tex.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 6c3ce6c..37f6def 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -401,17 +401,21 @@ int radeonTransformTEX( } } - /* Cannot write texture to output registers (all chips) or with masks (non-r500) */ + /* Cannot write texture to output registers or with saturate (all chips), +* or with masks (non-r500). */ if (inst->U.I.Opcode != RC_OPCODE_KIL && (inst->U.I.DstReg.File != RC_FILE_TEMPORARY || +inst->U.I.SaturateMode || (!c->is_r500 && inst->U.I.DstReg.WriteMask != RC_MASK_XYZW))) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst); inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.SaturateMode = inst->U.I.SaturateMode; inst_mov->U.I.DstReg = inst->U.I.DstReg; inst_mov->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; inst_mov->U.I.SrcReg[0].Index = rc_find_free_temporary(c); + inst->U.I.SaturateMode = 0; inst->U.I.DstReg.File = RC_FILE_TEMPORARY; inst->U.I.DstReg.Index = inst_mov->U.I.SrcReg[0].Index; inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails
Module: Mesa Branch: 7.9 Commit: 6ea13078fb57c33243ffd24ee064d7425dd2faef URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6ea13078fb57c33243ffd24ee064d7425dd2faef Author: Marek Olšák Date: Sat Mar 12 21:44:59 2011 +0100 st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails This fixes: state_tracker/st_format.c:401:st_pipe_format_to_mesa_format: Assertion `0' failed. (cherry picked from commit fb5d9e1199cabe653ae1bb822bb66ce9f0ce7f55) Conflicts: src/mesa/state_tracker/st_cb_fbo.c --- src/mesa/state_tracker/st_cb_fbo.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index ce64a73..ff8eaad 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -74,6 +74,10 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, else format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples); + if (format == PIPE_FORMAT_NONE) { + return FALSE; + } + /* init renderbuffer fields */ strb->Base.Width = width; strb->Base.Height = height; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.9): st/mesa: fix crash when DrawBuffer->_ColorDrawBuffers[0] is NULL
Module: Mesa Branch: 7.9 Commit: 48d44713f91e2a601747a868ca59e5fca4f313a2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=48d44713f91e2a601747a868ca59e5fca4f313a2 Author: Marek Olšák Date: Sun Feb 20 16:50:48 2011 +0100 st/mesa: fix crash when DrawBuffer->_ColorDrawBuffers[0] is NULL This fixes the game Tiny and Big. (cherry picked from commit 7942e6a5ae0113f1cbdf62b772849cf6cdd4eca1) --- src/mesa/state_tracker/st_cb_clear.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index fd7bfc4..c2a006f 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -297,9 +297,11 @@ clear_with_quad(GLcontext *ctx, cso_set_fragment_shader_handle(st->cso_context, st->clear.fs); cso_set_vertex_shader_handle(st->cso_context, st->clear.vs); - st_translate_color(ctx->Color.ClearColor, - ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { + st_translate_color(ctx->Color.ClearColor, + ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, + clearColor); + } /* draw quad matching scissor rect */ draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, clearColor); @@ -551,9 +553,11 @@ st_Clear(GLcontext *ctx, GLbitfield mask) ctx->DrawBuffer->Visual.stencilBits == 0)) clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL; - st_translate_color(ctx->Color.ClearColor, - ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { + st_translate_color(ctx->Color.ClearColor, +ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, +clearColor); + } st->pipe->clear(st->pipe, clear_buffers, ctx->Color.ClearColor, ctx->Depth.Clear, ctx->Stencil.Clear); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): st/mesa: fix crash when using both user and vbo buffers with the same stride
Module: Mesa Branch: 7.10 Commit: ea26cc8696013d6c44b915e96ed438cfcedc0a2c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea26cc8696013d6c44b915e96ed438cfcedc0a2c Author: Marek Olšák Date: Sun Feb 20 18:05:24 2011 +0100 st/mesa: fix crash when using both user and vbo buffers with the same stride If two buffers had the same stride where one buffer is a user one and the other is a vbo, it was considered to be one interleaved buffer, resulting in incorrect rendering and crashes. This patch makes sure that the interleaved buffer is either user or vbo, not both. (cherry picked from commit 695cdee67827ee2c11e1445eb2022d3a530f1b23) --- src/mesa/state_tracker/st_draw.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 61a0e1b..73e3aeb 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -250,6 +250,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, GLint firstStride = -1; GLuint num_client_arrays = 0; const GLubyte *client_addr = NULL; + GLboolean user_memory; for (attr = 0; attr < vpv->num_inputs; attr++) { const GLuint mesaAttr = vp->index_to_input[attr]; @@ -258,6 +259,7 @@ is_interleaved_arrays(const struct st_vertex_program *vp, if (firstStride < 0) { firstStride = stride; + user_memory = !bufObj || !bufObj->Name; } else if (firstStride != stride) { return GL_FALSE; @@ -268,6 +270,9 @@ is_interleaved_arrays(const struct st_vertex_program *vp, /* Try to detect if the client-space arrays are * "close" to each other. */ + if (!user_memory) { +return GL_FALSE; + } if (!client_addr) { client_addr = arrays[mesaAttr]->Ptr; } @@ -277,6 +282,9 @@ is_interleaved_arrays(const struct st_vertex_program *vp, } } else if (!firstBufObj) { + if (user_memory) { +return GL_FALSE; + } firstBufObj = bufObj; } else if (bufObj != firstBufObj) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): r300/compiler: remove unused variables
Module: Mesa Branch: 7.10 Commit: 954787cee1c5ad32beb071445ea388e050be533d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=954787cee1c5ad32beb071445ea388e050be533d Author: Marek Olšák Date: Tue Mar 8 22:13:29 2011 +0100 r300/compiler: remove unused variables (cherry picked from commit ff8baec5bc377cab716b0510d98195fb5564fb1a) --- .../drivers/dri/r300/compiler/radeon_program_tex.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 80d8954..1cf77d9 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -150,7 +150,7 @@ int radeonTransformTEX( return 1; } else { struct rc_instruction * inst_rcp = NULL; - struct rc_instruction *inst_mul, *inst_add, *inst_cmp, *inst_cmp2, *inst_mul2; + struct rc_instruction *inst_mul, *inst_add, *inst_cmp; unsigned tmp_texsample; unsigned tmp_sum; int pass, fail; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): r300/compiler: fix equal and notequal shadow compare functions
Module: Mesa Branch: 7.10 Commit: 75fd54e7bda8f862fd6b283e481b42a729dabdf3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=75fd54e7bda8f862fd6b283e481b42a729dabdf3 Author: Marek Olšák Date: Tue Mar 8 07:36:40 2011 +0100 r300/compiler: fix equal and notequal shadow compare functions (cherry picked from commit 4dfcf3c4fe6edd1785348f4f6fc1ef0af2fff6f6) --- .../drivers/dri/r300/compiler/radeon_program_tex.c | 34 +-- 1 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index 01165a1..80d8954 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -33,14 +33,14 @@ /* Series of transformations to be done on textures. */ static struct rc_src_register shadow_ambient(struct r300_fragment_program_compiler *compiler, - int tmu) +int tmu) { struct rc_src_register reg = { 0, }; if (compiler->enable_shadow_ambient) { reg.File = RC_FILE_CONSTANT; reg.Index = rc_constants_add_state(&compiler->Base.Program.Constants, - RC_STATE_SHADOW_AMBIENT, tmu); + RC_STATE_SHADOW_AMBIENT, tmu); reg.Swizzle = RC_SWIZZLE_; } else { reg.File = RC_FILE_NONE; @@ -137,13 +137,6 @@ int radeonTransformTEX( (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) { rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; - /* Fake EQUAL/NOTEQUAL, they are equal to NEVER/ALWAYS due to precision issues anyway. */ - if (comparefunc == RC_COMPARE_FUNC_EQUAL) { - comparefunc = RC_COMPARE_FUNC_NEVER; - } else if (comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { - comparefunc = RC_COMPARE_FUNC_ALWAYS; - } - if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { inst->U.I.Opcode = RC_OPCODE_MOV; @@ -157,7 +150,7 @@ int radeonTransformTEX( return 1; } else { struct rc_instruction * inst_rcp = NULL; - struct rc_instruction *inst_mul, *inst_cmp, *inst_add; + struct rc_instruction *inst_mul, *inst_add, *inst_cmp, *inst_cmp2, *inst_mul2; unsigned tmp_texsample; unsigned tmp_sum; int pass, fail; @@ -212,22 +205,27 @@ int radeonTransformTEX( inst_add->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_; inst_add->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; inst_add->U.I.SrcReg[1].Index = tmp_texsample; - inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_; + inst_add->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_; - /* Recall that SrcReg[0] is r, SrcReg[tex] is tex and: + /* Note that SrcReg[0] is r, SrcReg[1] is tex and: * LESS:r < tex <=> -tex+r < 0 * GEQUAL: r >= tex <=> not (-tex+r < 0) * GREATER: r > tex <=> tex-r < 0 * LEQUAL: r <= tex <=> not ( tex-r < 0) -* -* This negates either r or tex: */ - if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL) +* EQUAL: GEQUAL +* NOTEQUAL:LESS +*/ + + /* This negates either r or tex: */ + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL || + comparefunc == RC_COMPARE_FUNC_EQUAL || comparefunc == RC_COMPARE_FUNC_NOTEQUAL) inst_add->U.I.SrcReg[1].Negate = inst_add->U.I.SrcReg[1].Negate ^ RC_MASK_XYZW; else inst_add->U.I.SrcReg[0].Negate = inst_add->U.I.SrcReg[0].Negate ^ RC_MASK_XYZW; /* This negates the whole expresion: */ - if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER) { + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER || + comparefunc == RC_COMPARE_FUNC_NOTEQUAL) {
Mesa (7.10): r300/compiler: saturate Z before the shadow comparison
Module: Mesa Branch: 7.10 Commit: 8453dce232530e6607da932156b811d133dc1070 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8453dce232530e6607da932156b811d133dc1070 Author: Marek Olšák Date: Tue Mar 8 04:00:07 2011 +0100 r300/compiler: saturate Z before the shadow comparison This fixes: https://bugs.freedesktop.org/show_bug.cgi?id=31159 NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit eb1acd16130a2945122d373357ee72585e520755) --- .../drivers/dri/r300/compiler/radeon_program_tex.c | 81 +++- 1 files changed, 44 insertions(+), 37 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index bf65a53..01165a1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -137,6 +137,13 @@ int radeonTransformTEX( (compiler->state.unit[inst->U.I.TexSrcUnit].compare_mode_enabled))) { rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; + /* Fake EQUAL/NOTEQUAL, they are equal to NEVER/ALWAYS due to precision issues anyway. */ + if (comparefunc == RC_COMPARE_FUNC_EQUAL) { + comparefunc = RC_COMPARE_FUNC_NEVER; + } else if (comparefunc == RC_COMPARE_FUNC_NOTEQUAL) { + comparefunc = RC_COMPARE_FUNC_ALWAYS; + } + if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { inst->U.I.Opcode = RC_OPCODE_MOV; @@ -149,14 +156,11 @@ int radeonTransformTEX( return 1; } else { - rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; struct rc_instruction * inst_rcp = NULL; - struct rc_instruction * inst_mad; - struct rc_instruction * inst_cmp; + struct rc_instruction *inst_mul, *inst_cmp, *inst_add; unsigned tmp_texsample; unsigned tmp_sum; - unsigned tmp_recip_w = 0; - int pass, fail, tex; + int pass, fail; /* Save the output register. */ struct rc_dst_register output_reg = inst->U.I.DstReg; @@ -167,49 +171,49 @@ int radeonTransformTEX( inst->U.I.DstReg.Index = tmp_texsample; inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; - if (inst->U.I.Opcode == RC_OPCODE_TXP) { - tmp_recip_w = rc_find_free_temporary(c); + tmp_sum = rc_find_free_temporary(c); + if (inst->U.I.Opcode == RC_OPCODE_TXP) { /* Compute 1/W. */ inst_rcp = rc_insert_new_instruction(c, inst); inst_rcp->U.I.Opcode = RC_OPCODE_RCP; inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_rcp->U.I.DstReg.Index = tmp_recip_w; + inst_rcp->U.I.DstReg.Index = tmp_sum; inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; inst_rcp->U.I.SrcReg[0].Swizzle = RC_MAKE_SWIZZLE_SMEAR(GET_SWZ(inst->U.I.SrcReg[0].Swizzle, 3)); } - /* Perspective-divide Z by W (if it's TXP) and add the texture sample (see below). */ - tmp_sum = rc_find_free_temporary(c); - inst_mad = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); - inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->U.I.DstReg.Index = tmp_sum; - inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - inst_mad->U.I.SrcReg[0].Swizzle = + /* Divide Z by W (if it's TXP) and saturate. */ + inst_mul = rc_insert_new_instruction(c, inst_rcp ? inst_rcp : inst); + inst_mul->U.I.Opcode = inst->U.I.Opcode == RC_OPCODE_TXP ? RC_OPCODE_MUL : RC_OPCODE_MOV; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = tmp_sum; + inst_mul->U.I.DstReg.WriteMask = RC_MASK_W; + inst_mul->U.I.SaturateMode = RC_SATURATE_ZERO_ONE; + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[0].Swizzle =
Mesa (7.10): r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500
Module: Mesa Branch: 7.10 Commit: e48b0b9032bb857ec837c3649615eaed132d1d1d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e48b0b9032bb857ec837c3649615eaed132d1d1d Author: Marek Olšák Date: Sat Mar 12 11:20:57 2011 +0100 r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500 The docs say it can be set for direct texture lookups, but even that causes problems. This fixes the wireframe bug: https://bugs.freedesktop.org/show_bug.cgi?id=32688 NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit 6da4866ffdb19315bbb48f6778d1a5297b842a77) --- .../drivers/dri/r300/compiler/r500_fragprog_emit.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 5da82d9..5e13d30 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -372,7 +372,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst | (inst->DstReg.WriteMask << 11) | R500_INST_TEX_SEM_WAIT; code->inst[ip].inst1 = R500_TEX_ID(inst->TexSrcUnit) - | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED; + | R500_TEX_SEM_ACQUIRE; if (inst->TexSrcTarget == RC_TEXTURE_RECT) code->inst[ip].inst1 |= R500_TEX_UNSCALED; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): r300/compiler: TEX instructions don' t support negation on source arguments
Module: Mesa Branch: 7.10 Commit: 3a1b2bb372557ad894bf95e2abb35db78dc1bda8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a1b2bb372557ad894bf95e2abb35db78dc1bda8 Author: Marek Olšák Date: Sat Mar 12 10:22:18 2011 +0100 r300/compiler: TEX instructions don't support negation on source arguments This fixes piglit: - glsl-fs-texture2d-dependent-4 NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit 1e97b4dd103a00f497cc92571498ffd7178ba263) --- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 899f0d9..140eeed 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -77,9 +77,6 @@ static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) if (opcode == RC_OPCODE_KIL && (reg.Swizzle != RC_SWIZZLE_XYZW || reg.Negate != RC_MASK_NONE)) return 0; - if (reg.Negate) - reg.Negate ^= RC_MASK_XYZW; - for(i = 0; i < 4; ++i) { unsigned int swz = GET_SWZ(reg.Swizzle, i); if (swz == RC_SWIZZLE_UNUSED) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): r300/compiler: Abs doesn't cancel Negate ( in the conversion to native swizzles)
Module: Mesa Branch: 7.10 Commit: 38f0e9b651fd53c67ead7f9d29c157f8e050a797 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=38f0e9b651fd53c67ead7f9d29c157f8e050a797 Author: Marek Olšák Date: Sat Mar 12 10:18:45 2011 +0100 r300/compiler: Abs doesn't cancel Negate (in the conversion to native swizzles) NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit 589d835dfd9b07f49ee12af2dfa04a4e054bec68) --- .../dri/r300/compiler/r300_fragprog_swizzle.c |6 -- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c |3 --- 2 files changed, 0 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c index 05d3da8..2649316 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c @@ -98,9 +98,6 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) unsigned int relevant; int j; - if (reg.Abs) - reg.Negate = RC_MASK_NONE; - if (opcode == RC_OPCODE_KIL || opcode == RC_OPCODE_TEX || opcode == RC_OPCODE_TXB || @@ -140,9 +137,6 @@ static void r300_swizzle_split( struct rc_src_register src, unsigned int mask, struct rc_swizzle_split * split) { - if (src.Abs) - src.Negate = RC_MASK_NONE; - split->NumPhases = 0; while(mask) { diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index ef81be4..899f0d9 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -103,9 +103,6 @@ static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) return 0; } else { /* ALU instructions support almost everything */ - if (reg.Abs) - return 1; - relevant = 0; for(i = 0; i < 3; ++i) { unsigned int swz = GET_SWZ(reg.Swizzle, i); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): r300/compiler: fix translating the src negate bits in pair_translate
Module: Mesa Branch: 7.10 Commit: aaf7c86b3040aea4be7f47308056a8bf10e9e039 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=aaf7c86b3040aea4be7f47308056a8bf10e9e039 Author: Marek Olšák Date: Sat Mar 12 09:32:16 2011 +0100 r300/compiler: fix translating the src negate bits in pair_translate (1, -_, ...) was converted to (-1, ...) because of the negation in the second component. Masking out the unused bits fixes this. Piglit: - glsl-fs-texture2d-branching NOTE: This is a candidate for the 7.9 and 7.10 branches. (cherry picked from commit d96305e4fcc67047e730cdc177bfa3da4307ff5a) --- .../dri/r300/compiler/radeon_pair_translate.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index fc05366..5126821 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -213,16 +213,21 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, if (needrgb && !istranscendent) { unsigned int srcrgb = 0; unsigned int srcalpha = 0; + unsigned int srcmask = 0; int j; /* We don't care about the alpha channel here. We only * want the part of the swizzle that writes to rgb, * since we are creating an rgb instruction. */ for(j = 0; j < 3; ++j) { unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); - if (swz < 3) + + if (swz < RC_SWIZZLE_W) srcrgb = 1; - else if (swz < 4) + else if (swz == RC_SWIZZLE_W) srcalpha = 1; + + if (swz < RC_SWIZZLE_UNUSED) + srcmask |= 1 << j; } source = rc_pair_alloc_source(pair, srcrgb, srcalpha, inst->SrcReg[i].File, inst->SrcReg[i].Index); @@ -234,7 +239,7 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, pair->RGB.Arg[i].Source = source; pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff; pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); + pair->RGB.Arg[i].Negate = !!(srcmask & inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); } if (needalpha) { unsigned int srcrgb = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): r300/compiler: fix the saturate modifier when applied to TEX instructions
Module: Mesa Branch: 7.10 Commit: c3fcd8af4f843052963b2145f136de46e33e8904 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c3fcd8af4f843052963b2145f136de46e33e8904 Author: Marek Olšák Date: Sat Mar 12 06:07:24 2011 +0100 r300/compiler: fix the saturate modifier when applied to TEX instructions This bug can only be triggered if the source texture is either signed or float. (cherry picked from commit e4707604ab46252d2e010906124775d3300f0be1) --- .../drivers/dri/r300/compiler/radeon_program_tex.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c index f9d9f34..bf65a53 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_tex.c @@ -420,17 +420,21 @@ int radeonTransformTEX( scale_texcoords(compiler, inst, RC_STATE_R300_TEXSCALE_FACTOR); } - /* Cannot write texture to output registers (all chips) or with masks (non-r500) */ + /* Cannot write texture to output registers or with saturate (all chips), +* or with masks (non-r500). */ if (inst->U.I.Opcode != RC_OPCODE_KIL && (inst->U.I.DstReg.File != RC_FILE_TEMPORARY || +inst->U.I.SaturateMode || (!c->is_r500 && inst->U.I.DstReg.WriteMask != RC_MASK_XYZW))) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst); inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.SaturateMode = inst->U.I.SaturateMode; inst_mov->U.I.DstReg = inst->U.I.DstReg; inst_mov->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; inst_mov->U.I.SrcReg[0].Index = rc_find_free_temporary(c); + inst->U.I.SaturateMode = 0; inst->U.I.DstReg.File = RC_FILE_TEMPORARY; inst->U.I.DstReg.Index = inst_mov->U.I.SrcReg[0].Index; inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails
Module: Mesa Branch: 7.10 Commit: b5d293e4fdb2944b27bea94204086c8ec9be8dbc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5d293e4fdb2944b27bea94204086c8ec9be8dbc Author: Marek Olšák Date: Sat Mar 12 21:44:04 2011 +0100 st/mesa: fail to alloc a renderbuffer if st_choose_renderbuffer_format fails This fixes: state_tracker/st_format.c:401:st_pipe_format_to_mesa_format: Assertion `0' failed. (cherry picked from commit fb5d9e1199cabe653ae1bb822bb66ce9f0ce7f55) Conflicts: src/mesa/state_tracker/st_cb_fbo.c --- src/mesa/state_tracker/st_cb_fbo.c |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 15f8fb3..473ed4d 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -77,6 +77,10 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, struct gl_renderbuffer *r else format = st_choose_renderbuffer_format(screen, internalFormat, rb->NumSamples); + if (format == PIPE_FORMAT_NONE) { + return FALSE; + } + /* init renderbuffer fields */ strb->Base.Width = width; strb->Base.Height = height; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (7.10): st/mesa: fix crash when DrawBuffer->_ColorDrawBuffers[0] is NULL
Module: Mesa Branch: 7.10 Commit: 3a02a2bf25945d4afbb72add08d7d7b983e77ee8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3a02a2bf25945d4afbb72add08d7d7b983e77ee8 Author: Marek Olšák Date: Sun Feb 20 16:50:48 2011 +0100 st/mesa: fix crash when DrawBuffer->_ColorDrawBuffers[0] is NULL This fixes the game Tiny and Big. (cherry picked from commit 7942e6a5ae0113f1cbdf62b772849cf6cdd4eca1) --- src/mesa/state_tracker/st_cb_clear.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index c2d554d..5aedeb2 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -297,9 +297,11 @@ clear_with_quad(struct gl_context *ctx, cso_set_fragment_shader_handle(st->cso_context, st->clear.fs); cso_set_vertex_shader_handle(st->cso_context, st->clear.vs); - st_translate_color(ctx->Color.ClearColor, - ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { + st_translate_color(ctx->Color.ClearColor, + ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, + clearColor); + } /* draw quad matching scissor rect */ draw_quad(st, x0, y0, x1, y1, (GLfloat) ctx->Depth.Clear, clearColor); @@ -551,9 +553,11 @@ st_Clear(struct gl_context *ctx, GLbitfield mask) ctx->DrawBuffer->Visual.stencilBits == 0)) clear_buffers |= PIPE_CLEAR_DEPTHSTENCIL; - st_translate_color(ctx->Color.ClearColor, - ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, - clearColor); + if (ctx->DrawBuffer->_ColorDrawBuffers[0]) { + st_translate_color(ctx->Color.ClearColor, +ctx->DrawBuffer->_ColorDrawBuffers[0]->_BaseFormat, +clearColor); + } st->pipe->clear(st->pipe, clear_buffers, ctx->Color.ClearColor, ctx->Depth.Clear, ctx->Stencil.Clear); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i915g: don't recalculate fb dimension
Module: Mesa Branch: master Commit: f6087955888ee089f986c19b576ef574c9e7bd06 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6087955888ee089f986c19b576ef574c9e7bd06 Author: Daniel Vetter Date: Sat Mar 12 00:16:35 2011 +0100 i915g: don't recalculate fb dimension The statetracker should do this for us correctly. Signed-off-by: Daniel Vetter --- src/gallium/drivers/i915/i915_clear.c|2 +- src/gallium/drivers/i915/i915_context.h |2 - src/gallium/drivers/i915/i915_state_static.c | 31 ++--- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/src/gallium/drivers/i915/i915_clear.c b/src/gallium/drivers/i915/i915_clear.c index d11361b..4a97746 100644 --- a/src/gallium/drivers/i915/i915_clear.c +++ b/src/gallium/drivers/i915/i915_clear.c @@ -144,5 +144,5 @@ i915_clear_render(struct pipe_context *pipe, unsigned buffers, const float *rgba i915_update_derived(i915); i915_clear_emit(pipe, buffers, rgba, depth, stencil, - 0, 0, i915->current.fb_width, i915->current.fb_height); + 0, 0, i915->framebuffer.width, i915->framebuffer.height); } diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 51a364b..e42c9dc 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -159,8 +159,6 @@ struct i915_state unsigned dst_buf_vars; uint32_t draw_offset; uint32_t draw_size; - /* for clears */ - uint16_t fb_height, fb_width; unsigned id;/* track lost context events */ }; diff --git a/src/gallium/drivers/i915/i915_state_static.c b/src/gallium/drivers/i915/i915_state_static.c index fbbcf94..70b3dff 100644 --- a/src/gallium/drivers/i915/i915_state_static.c +++ b/src/gallium/drivers/i915/i915_state_static.c @@ -78,29 +78,6 @@ buf_3d_tiling_bits(enum i915_winsys_buffer_tile tiling) return tiling_bits; } -/** - * Examine framebuffer state to determine width, height. - */ -static boolean -framebuffer_size(const struct pipe_framebuffer_state *fb, - uint *width, uint *height) -{ - if (fb->cbufs[0]) { - *width = fb->cbufs[0]->width; - *height = fb->cbufs[0]->height; - return TRUE; - } - else if (fb->zsbuf) { - *width = fb->zsbuf->width; - *height = fb->zsbuf->height; - return TRUE; - } - else { - *width = *height = 0; - return FALSE; - } -} - static void update_framebuffer(struct i915_context *i915) { struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0]; @@ -109,7 +86,6 @@ static void update_framebuffer(struct i915_context *i915) unsigned x, y, w, h; int layer; uint32_t draw_offset; - boolean ret; if (cbuf_surface) { struct i915_texture *tex = i915_texture(cbuf_surface->texture); @@ -160,15 +136,14 @@ static void update_framebuffer(struct i915_context *i915) /* drawing rect calculations */ draw_offset = x | (y << 16); - ret = framebuffer_size(&i915->framebuffer, &w, &h); - assert(ret); if (i915->current.draw_offset != draw_offset) { i915->current.draw_offset = draw_offset; i915_set_flush_dirty(i915, I915_PIPELINE_FLUSH); } + + w = i915->framebuffer.width; + h = i915->framebuffer.height; i915->current.draw_size = (w - 1 + x) | ((h - 1 + y) << 16); - i915->current.fb_height = h; - i915->current.fb_width = w; i915->hardware_dirty |= I915_HW_STATIC; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i915g: use y-tiling when the blitter is not used
Module: Mesa Branch: master Commit: d46c6084ce5b8c9d1d39aea0b391ea262a545343 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d46c6084ce5b8c9d1d39aea0b391ea262a545343 Author: Daniel Vetter Date: Fri Mar 11 16:08:11 2011 +0100 i915g: use y-tiling when the blitter is not used The blitter is broken. Who'd have guessed? Signed-off-by: Daniel Vetter --- src/gallium/drivers/i915/i915_resource_texture.c |5 - 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/i915/i915_resource_texture.c b/src/gallium/drivers/i915/i915_resource_texture.c index df60493..cfb72e9 100644 --- a/src/gallium/drivers/i915/i915_resource_texture.c +++ b/src/gallium/drivers/i915/i915_resource_texture.c @@ -184,7 +184,10 @@ i915_texture_tiling(struct i915_screen *is, struct i915_texture *tex) /* XXX X-tiling might make sense */ return I915_TILE_NONE; - return I915_TILE_X; + if (is->debug.use_blitter) + return I915_TILE_X; + else + return I915_TILE_Y; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): i915g: implement copy_region using u_blitter
Module: Mesa Branch: master Commit: f0c56e2a23ec3a6ffa5aebe613a469e39601e7af URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0c56e2a23ec3a6ffa5aebe613a469e39601e7af Author: Daniel Vetter Date: Fri Mar 11 20:21:00 2011 +0100 i915g: implement copy_region using u_blitter Signed-off-by: Daniel Vetter works --- src/gallium/drivers/i915/i915_context.c |3 + src/gallium/drivers/i915/i915_context.h | 23 ++- src/gallium/drivers/i915/i915_state.c | 63 +++ src/gallium/drivers/i915/i915_surface.c | 48 --- 4 files changed, 128 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c index f1a14bc..5dbf0cf 100644 --- a/src/gallium/drivers/i915/i915_context.c +++ b/src/gallium/drivers/i915/i915_context.c @@ -170,6 +170,9 @@ i915_create_context(struct pipe_screen *screen, void *priv) draw_install_aaline_stage(i915->draw, &i915->base); draw_install_aapoint_stage(i915->draw, &i915->base); + /* augmented draw pipeline clobbers state functions */ + i915_init_fixup_state_functions(i915); + /* Create blitter last - calls state creation functions. */ i915->blitter = util_blitter_create(&i915->base); assert(i915->blitter); diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 62becbc..51a364b 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -240,8 +240,6 @@ struct i915_context { struct i915_winsys_batchbuffer *batch; - struct blitter_context* blitter; - /** Vertex buffer */ struct i915_winsys_buffer *vbo; size_t vbo_offset; @@ -257,6 +255,26 @@ struct i915_context { int num_validation_buffers; struct util_slab_mempool transfer_pool; + + /** blitter/hw-clear */ + struct blitter_context* blitter; + + /** State tracking needed by u_blitter for save/restore. */ + void *saved_fs; + void (*saved_bind_fs_state)(struct pipe_context *pipe, void *shader); + void *saved_vs; + struct pipe_clip_state saved_clip; + struct i915_velems_state *saved_velems; + unsigned saved_nr_vertex_buffers; + struct pipe_vertex_buffer saved_vertex_buffers[PIPE_MAX_ATTRIBS]; + unsigned saved_nr_samplers; + void *saved_samplers[PIPE_MAX_SAMPLERS]; + void (*saved_bind_sampler_states)(struct pipe_context *pipe, + unsigned num, void **sampler); + unsigned saved_nr_sampler_views; + struct pipe_sampler_view *saved_sampler_views[PIPE_MAX_SAMPLERS]; + void (*saved_set_sampler_views)(struct pipe_context *pipe, + unsigned num, struct pipe_sampler_view **views); }; /* A flag for each state_tracker state object: @@ -344,6 +362,7 @@ void i915_clear_emit(struct pipe_context *pipe, unsigned buffers, const float *r * */ void i915_init_state_functions( struct i915_context *i915 ); +void i915_init_fixup_state_functions( struct i915_context *i915 ); void i915_init_flush_functions( struct i915_context *i915 ); void i915_init_string_functions( struct i915_context *i915 ); diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 4d134c1..1b57c57 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -287,6 +287,17 @@ i915_create_sampler_state(struct pipe_context *pipe, return cso; } +static void i915_fixup_bind_sampler_states(struct pipe_context *pipe, + unsigned num, void **sampler) +{ + struct i915_context *i915 = i915_context(pipe); + + i915->saved_nr_samplers = num; + memcpy(&i915->saved_samplers, sampler, sizeof(void *) * num); + + i915->saved_bind_sampler_states(pipe, num, sampler); +} + static void i915_bind_sampler_states(struct pipe_context *pipe, unsigned num, void **sampler) { @@ -466,6 +477,17 @@ i915_create_fs_state(struct pipe_context *pipe, } static void +i915_fixup_bind_fs_state(struct pipe_context *pipe, void *shader) +{ + struct i915_context *i915 = i915_context(pipe); + draw_flush(i915->draw); + + i915->saved_fs = shader; + + i915->saved_bind_fs_state(pipe, shader); +} + +static void i915_bind_fs_state(struct pipe_context *pipe, void *shader) { struct i915_context *i915 = i915_context(pipe); @@ -505,6 +527,8 @@ static void i915_bind_vs_state(struct pipe_context *pipe, void *shader) { struct i915_context *i915 = i915_context(pipe); + i915->saved_vs = shader; + /* just pass-through to draw module */ draw_bind_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader); @@ -571,6 +595,27 @@ static void i915_set_constant_buffer(struct pipe_context *pipe, } +static void +i915_fixup_set_fragment_sampler_views(struct pipe_context *pipe, + unsigned num, +
Mesa (master): i915g: fix use after free
Module: Mesa Branch: master Commit: 06713a40798d97aa520b119731418ff16a92e4ba URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=06713a40798d97aa520b119731418ff16a92e4ba Author: Daniel Vetter Date: Fri Mar 11 23:20:44 2011 +0100 i915g: fix use after free Pipe templates should be copied if still needed after the create call completes. Signed-off-by: Daniel Vetter --- src/gallium/drivers/i915/i915_context.h |2 +- src/gallium/drivers/i915/i915_state.c |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h index 96abaf3..62becbc 100644 --- a/src/gallium/drivers/i915/i915_context.h +++ b/src/gallium/drivers/i915/i915_context.h @@ -188,7 +188,7 @@ struct i915_rasterizer_state { unsigned LIS7; unsigned sc[1]; - const struct pipe_rasterizer_state *templ; + struct pipe_rasterizer_state templ; union { float f; unsigned u; } ds[2]; }; diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index a694649..4d134c1 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -688,7 +688,7 @@ i915_create_rasterizer_state(struct pipe_context *pipe, { struct i915_rasterizer_state *cso = CALLOC_STRUCT( i915_rasterizer_state ); - cso->templ = rasterizer; + cso->templ = *rasterizer; cso->color_interp = rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; cso->light_twoside = rasterizer->light_twoside; cso->ds[0].u = _3DSTATE_DEPTH_OFFSET_SCALE; @@ -759,7 +759,7 @@ static void i915_bind_rasterizer_state( struct pipe_context *pipe, /* pass-through to draw module */ draw_set_rasterizer_state(i915->draw, - (i915->rasterizer ? i915->rasterizer->templ : NULL), + (i915->rasterizer ? &(i915->rasterizer->templ) : NULL), raster); i915->dirty |= I915_NEW_RASTERIZER; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: Delay the creation of simple helper shaders
Module: Mesa Branch: master Commit: 1a79064da12a8be71dca7656e5eebc4b85d2b35f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1a79064da12a8be71dca7656e5eebc4b85d2b35f Author: Jakob Bornecrantz Date: Sat Mar 5 13:27:00 2011 +0100 gallium: Delay the creation of simple helper shaders --- src/gallium/auxiliary/util/u_blit.c | 92 +- src/gallium/auxiliary/util/u_gen_mipmap.c | 104 +++- src/mesa/state_tracker/st_cb_clear.c | 54 +++- 3 files changed, 154 insertions(+), 96 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index d1d7e86..421726b 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -128,21 +128,6 @@ util_create_blit(struct pipe_context *pipe, struct cso_context *cso) ctx->velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } - /* vertex shader - still required to provide the linkage between -* fragment shader input semantics and vertex_element/buffers. -*/ - { - const uint semantic_names[] = { TGSI_SEMANTIC_POSITION, - TGSI_SEMANTIC_GENERIC }; - const uint semantic_indexes[] = { 0, 0 }; - ctx->vs = util_make_vertex_passthrough_shader(pipe, 2, semantic_names, -semantic_indexes); - } - - /* fragment shader */ - ctx->fs[TGSI_WRITEMASK_XYZW] = - util_make_fragment_tex_shader(pipe, TGSI_TEXTURE_2D, -TGSI_INTERPOLATE_LINEAR); ctx->vbuf = NULL; /* init vertex data that doesn't change */ @@ -170,7 +155,8 @@ util_destroy_blit(struct blit_state *ctx) struct pipe_context *pipe = ctx->pipe; unsigned i; - pipe->delete_vs_state(pipe, ctx->vs); + if (ctx->vs) + pipe->delete_vs_state(pipe, ctx->vs); for (i = 0; i < Elements(ctx->fs); i++) if (ctx->fs[i]) @@ -186,6 +172,59 @@ util_destroy_blit(struct blit_state *ctx) /** + * Helper function to set the fragment shaders. + */ +static INLINE void +set_fragment_shader(struct blit_state *ctx, uint writemask) +{ + if (!ctx->fs[writemask]) + ctx->fs[writemask] = + util_make_fragment_tex_shader_writemask(ctx->pipe, TGSI_TEXTURE_2D, + TGSI_INTERPOLATE_LINEAR, + writemask); + + cso_set_fragment_shader_handle(ctx->cso, ctx->fs[writemask]); +} + + +/** + * Helper function to set the depthwrite shader. + */ +static INLINE void +set_depth_fragment_shader(struct blit_state *ctx) +{ + if (!ctx->fs_depth) + ctx->fs_depth = + util_make_fragment_tex_shader_writedepth(ctx->pipe, TGSI_TEXTURE_2D, + TGSI_INTERPOLATE_LINEAR); + + cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth); +} + + +/** + * Helper function to set the vertex shader. + */ +static INLINE void +set_vertex_shader(struct blit_state *ctx) +{ + /* vertex shader - still required to provide the linkage between +* fragment shader input semantics and vertex_element/buffers. +*/ + if (!ctx->vs) { + const uint semantic_names[] = { TGSI_SEMANTIC_POSITION, + TGSI_SEMANTIC_GENERIC }; + const uint semantic_indexes[] = { 0, 0 }; + ctx->vs = util_make_vertex_passthrough_shader(ctx->pipe, 2, +semantic_names, +semantic_indexes); + } + + cso_set_vertex_shader_handle(ctx->cso, ctx->vs); +} + + +/** * Get offset of next free slot in vertex buffer for quad vertices. */ static unsigned @@ -530,22 +569,11 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* shaders */ if (dst_is_depth) { - if (ctx->fs_depth == NULL) - ctx->fs_depth = -util_make_fragment_tex_shader_writedepth(pipe, TGSI_TEXTURE_2D, - TGSI_INTERPOLATE_LINEAR); - - cso_set_fragment_shader_handle(ctx->cso, ctx->fs_depth); + set_depth_fragment_shader(ctx); } else { - if (ctx->fs[writemask] == NULL) - ctx->fs[writemask] = -util_make_fragment_tex_shader_writemask(pipe, TGSI_TEXTURE_2D, -TGSI_INTERPOLATE_LINEAR, -writemask); - - cso_set_fragment_shader_handle(ctx->cso, ctx->fs[writemask]); + set_fragment_shader(ctx, writemask); } - cso_set_vertex_shader_handle(ctx->cso, ctx->vs); + set_vertex_shader(ctx); /* drawing dest */ memset(&fb, 0, sizeof(fb)); @@ -720,8 +748,8 @@ util_blit_pixels_tex(struct blit_state *ctx, cso_set_fragment_sampler_views(ctx->cso, 1, &src_sampler_view); /* shaders */ - cso_set_fragment_shader_handle(ctx->cso, ctx->fs[TGSI_WRITEMAS
Mesa (master): r600g: Fix VS sampler view offsets for r600/r700.
Module: Mesa Branch: master Commit: 7339915a4bfb563c5986d139e83aa7664f346e89 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7339915a4bfb563c5986d139e83aa7664f346e89 Author: Carl-Philip Hänsch Date: Sat Mar 12 19:25:11 2011 +0100 r600g: Fix VS sampler view offsets for r600/r700. 077c448d184799e0d9ec962013ec784c6a5c1807 missed this. Signed-off-by: Henri Verbeet --- src/gallium/drivers/r600/r600_state.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 2f7263c..200e8e4 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -501,7 +501,8 @@ static void r600_set_vs_sampler_view(struct pipe_context *ctx, unsigned count, for (int i = 0; i < count; i++) { if (resource[i]) { - r600_context_pipe_state_set_vs_resource(&rctx->ctx, &resource[i]->state, i); + r600_context_pipe_state_set_vs_resource(&rctx->ctx, &resource[i]->state, + i + R600_MAX_CONST_BUFFERS); } } } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g: Fix an unused variable warning.
Module: Mesa Branch: master Commit: 656c314573c2b63ef92fc035dd811b9d6dc82c1c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=656c314573c2b63ef92fc035dd811b9d6dc82c1c Author: Henri Verbeet Date: Wed Mar 9 21:57:52 2011 +0100 r600g: Fix an unused variable warning. --- src/gallium/drivers/r600/r600_texture.c |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 86a9def..dc351bf 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -405,10 +405,12 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, /* Would like some magic "get_bool_option_once" routine. */ if (force_tiling == -1) { - struct r600_screen *rscreen = (struct r600_screen *)screen; +#if 0 /* reenable when 2D tiling is fixed better */ - /*if (r600_get_minor_version(rscreen->radeon) >= 9) - force_tiling = debug_get_bool_option("R600_TILING", TRUE);*/ + struct r600_screen *rscreen = (struct r600_screen *)screen; + if (r600_get_minor_version(rscreen->radeon) >= 9) + force_tiling = debug_get_bool_option("R600_TILING", TRUE); +#endif force_tiling = debug_get_bool_option("R600_TILING", FALSE); } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): u_blitter: Do blits in linear color space.
Module: Mesa Branch: master Commit: ab21147c899ba1506df38438b6750d3dc5eaabdf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ab21147c899ba1506df38438b6750d3dc5eaabdf Author: Henri Verbeet Date: Sat Mar 12 16:33:50 2011 +0100 u_blitter: Do blits in linear color space. Blits between sRGB and linear formats should happen in linear color space. This fixes piglit fbo/fbo-srgb-blit. --- src/gallium/auxiliary/util/u_blit.c| 57 src/gallium/auxiliary/util/u_blitter.c |3 +- src/mesa/state_tracker/st_cb_texture.c |2 +- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index ff3baf7..d1d7e86 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -304,8 +304,10 @@ util_blit_pixels_writemask(struct blit_state *ctx, { struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe->screen; + enum pipe_format src_format, dst_format; struct pipe_sampler_view *sampler_view = NULL; struct pipe_sampler_view sv_templ; + struct pipe_surface *dst_surface; struct pipe_framebuffer_state fb; const int srcW = abs(srcX1 - srcX0); const int srcH = abs(srcY1 - srcY0); @@ -326,12 +328,15 @@ util_blit_pixels_writemask(struct blit_state *ctx, regions_overlap(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1); + src_format = util_format_linear(src_tex->format); + dst_format = util_format_linear(dst->format); + /* * Check for simple case: no format conversion, no flipping, no stretching, * no overlapping. * Filter mode should not matter since there's no stretching. */ - if (dst->format == src_tex->format && + if (dst_format == src_format && srcX0 < srcX1 && dstX0 < dstX1 && srcY0 < srcY1 && @@ -354,6 +359,14 @@ util_blit_pixels_writemask(struct blit_state *ctx, return; } + if (dst_format == dst->format) { + dst_surface = dst; + } else { + struct pipe_surface templ = *dst; + templ.format = dst_format; + dst_surface = pipe->create_surface(pipe, dst->texture, &templ); + } + /* Create a temporary texture when src and dest alias or when src * is anything other than a 2d texture. * XXX should just use appropriate shader to access 1d / 3d slice / cube face, @@ -361,9 +374,9 @@ util_blit_pixels_writemask(struct blit_state *ctx, * * This can still be improved upon. */ - if ((src_tex == dst->texture && - dst->u.tex.level == src_level && - dst->u.tex.first_layer == srcZ0) || + if ((src_tex == dst_surface->texture && + dst_surface->u.tex.level == src_level && + dst_surface->u.tex.first_layer == srcZ0) || (src_tex->target != PIPE_TEXTURE_2D && src_tex->target != PIPE_TEXTURE_2D && src_tex->target != PIPE_TEXTURE_RECT)) @@ -392,7 +405,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, /* create temp texture */ memset(&texTemp, 0, sizeof(texTemp)); texTemp.target = ctx->internal_target; - texTemp.format = src_tex->format; + texTemp.format = src_format; texTemp.last_level = 0; texTemp.width0 = srcW; texTemp.height0 = srcH; @@ -439,7 +452,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, pipe_resource_reference(&tex, NULL); } else { - u_sampler_view_default_template(&sv_templ, src_tex, src_tex->format); + u_sampler_view_default_template(&sv_templ, src_tex, src_format); sampler_view = pipe->create_sampler_view(pipe, src_tex, &sv_templ); if (!sampler_view) { @@ -460,13 +473,13 @@ util_blit_pixels_writemask(struct blit_state *ctx, } } - dst_is_depth = util_format_is_depth_or_stencil(dst->format); + dst_is_depth = util_format_is_depth_or_stencil(dst_format); assert(screen->is_format_supported(screen, sampler_view->format, ctx->internal_target, sampler_view->texture->nr_samples, PIPE_BIND_SAMPLER_VIEW)); - assert(screen->is_format_supported(screen, dst->format, ctx->internal_target, - dst->texture->nr_samples, + assert(screen->is_format_supported(screen, dst_format, ctx->internal_target, + dst_surface->texture->nr_samples, dst_is_depth ? PIPE_BIND_DEPTH_STENCIL : PIPE_BIND_RENDER_TARGET)); /* save state (restored below) */ @@ -502,12 +515,12 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_single_sampler_done(ctx->cso); /* viewport */ - ctx->viewport.scale[0] = 0.5f * dst->width; - ctx->viewport.scale[1] = 0.5f * dst->height; + ctx->viewport.scale[0] = 0.5f * dst_surface->width; + ctx->viewport.scale[1] = 0.5f *
Mesa (master): r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500
Module: Mesa Branch: master Commit: 6da4866ffdb19315bbb48f6778d1a5297b842a77 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6da4866ffdb19315bbb48f6778d1a5297b842a77 Author: Marek Olšák Date: Sat Mar 12 11:20:57 2011 +0100 r300/compiler: do not set TEX_IGNORE_UNCOVERED on r500 The docs say it can be set for direct texture lookups, but even that causes problems. This fixes the wireframe bug: https://bugs.freedesktop.org/show_bug.cgi?id=32688 NOTE: This is a candidate for the 7.9 and 7.10 branches. --- .../drivers/dri/r300/compiler/r500_fragprog_emit.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 1febc19..301b444 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -372,7 +372,7 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst | (inst->DstReg.WriteMask << 11) | R500_INST_TEX_SEM_WAIT; code->inst[ip].inst1 = R500_TEX_ID(inst->TexSrcUnit) - | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED; + | R500_TEX_SEM_ACQUIRE; if (inst->TexSrcTarget == RC_TEXTURE_RECT) code->inst[ip].inst1 |= R500_TEX_UNSCALED; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300/compiler: TEX instructions don' t support negation on source arguments
Module: Mesa Branch: master Commit: 1e97b4dd103a00f497cc92571498ffd7178ba263 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e97b4dd103a00f497cc92571498ffd7178ba263 Author: Marek Olšák Date: Sat Mar 12 10:22:18 2011 +0100 r300/compiler: TEX instructions don't support negation on source arguments This fixes piglit: - glsl-fs-texture2d-dependent-4 NOTE: This is a candidate for the 7.9 and 7.10 branches. --- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 899f0d9..140eeed 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -77,9 +77,6 @@ static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) if (opcode == RC_OPCODE_KIL && (reg.Swizzle != RC_SWIZZLE_XYZW || reg.Negate != RC_MASK_NONE)) return 0; - if (reg.Negate) - reg.Negate ^= RC_MASK_XYZW; - for(i = 0; i < 4; ++i) { unsigned int swz = GET_SWZ(reg.Swizzle, i); if (swz == RC_SWIZZLE_UNUSED) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300/compiler: Abs doesn't cancel Negate ( in the conversion to native swizzles)
Module: Mesa Branch: master Commit: 589d835dfd9b07f49ee12af2dfa04a4e054bec68 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=589d835dfd9b07f49ee12af2dfa04a4e054bec68 Author: Marek Olšák Date: Sat Mar 12 10:18:45 2011 +0100 r300/compiler: Abs doesn't cancel Negate (in the conversion to native swizzles) NOTE: This is a candidate for the 7.9 and 7.10 branches. --- .../dri/r300/compiler/r300_fragprog_swizzle.c |6 -- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c |3 --- 2 files changed, 0 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c index fa906f2..5223aaa 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c @@ -98,9 +98,6 @@ static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) unsigned int relevant; int j; - if (reg.Abs) - reg.Negate = RC_MASK_NONE; - if (opcode == RC_OPCODE_KIL || opcode == RC_OPCODE_TEX || opcode == RC_OPCODE_TXB || @@ -140,9 +137,6 @@ static void r300_swizzle_split( struct rc_src_register src, unsigned int mask, struct rc_swizzle_split * split) { - if (src.Abs) - src.Negate = RC_MASK_NONE; - split->NumPhases = 0; while(mask) { diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index ef81be4..899f0d9 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -103,9 +103,6 @@ static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) return 0; } else { /* ALU instructions support almost everything */ - if (reg.Abs) - return 1; - relevant = 0; for(i = 0; i < 3; ++i) { unsigned int swz = GET_SWZ(reg.Swizzle, i); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r300/compiler: fix translating the src negate bits in pair_translate
Module: Mesa Branch: master Commit: d96305e4fcc67047e730cdc177bfa3da4307ff5a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d96305e4fcc67047e730cdc177bfa3da4307ff5a Author: Marek Olšák Date: Sat Mar 12 09:32:16 2011 +0100 r300/compiler: fix translating the src negate bits in pair_translate (1, -_, ...) was converted to (-1, ...) because of the negation in the second component. Masking out the unused bits fixes this. Piglit: - glsl-fs-texture2d-branching NOTE: This is a candidate for the 7.9 and 7.10 branches. --- .../dri/r300/compiler/radeon_pair_translate.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index 6d7263b..9e03eb1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -214,16 +214,21 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, if (needrgb && !istranscendent) { unsigned int srcrgb = 0; unsigned int srcalpha = 0; + unsigned int srcmask = 0; int j; /* We don't care about the alpha channel here. We only * want the part of the swizzle that writes to rgb, * since we are creating an rgb instruction. */ for(j = 0; j < 3; ++j) { unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); - if (swz < 3) + + if (swz < RC_SWIZZLE_W) srcrgb = 1; - else if (swz < 4) + else if (swz == RC_SWIZZLE_W) srcalpha = 1; + + if (swz < RC_SWIZZLE_UNUSED) + srcmask |= 1 << j; } source = rc_pair_alloc_source(pair, srcrgb, srcalpha, inst->SrcReg[i].File, inst->SrcReg[i].Index); @@ -236,7 +241,7 @@ static void set_pair_instruction(struct r300_fragment_program_compiler *c, pair->RGB.Arg[i].Swizzle = rc_init_swizzle(inst->SrcReg[i].Swizzle, 3); pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); + pair->RGB.Arg[i].Negate = !!(srcmask & inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); } if (needalpha) { unsigned int srcrgb = 0; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit