OSDN Git Service

Merge remote branch 'origin/master' into lp-binning
authorJosé Fonseca <jfonseca@vmware.com>
Sun, 31 Jan 2010 05:36:33 +0000 (05:36 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Sun, 31 Jan 2010 05:36:33 +0000 (05:36 +0000)
Conflicts:
Makefile
src/gallium/auxiliary/util/u_surface.c
src/gallium/drivers/llvmpipe/lp_flush.c
src/gallium/drivers/llvmpipe/lp_setup.c
src/gallium/drivers/llvmpipe/lp_state_derived.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_surface.c
src/gallium/drivers/llvmpipe/lp_tex_cache.c
src/gallium/drivers/llvmpipe/lp_texture.c
src/gallium/drivers/llvmpipe/lp_tile_cache.c
src/mesa/state_tracker/st_cb_condrender.c

12 files changed:
1  2 
Makefile
progs/trivial/Makefile
src/gallium/auxiliary/util/u_surface.c
src/gallium/drivers/llvmpipe/lp_bld_conv.c
src/gallium/drivers/llvmpipe/lp_draw_arrays.c
src/gallium/drivers/llvmpipe/lp_flush.c
src/gallium/drivers/llvmpipe/lp_jit.c
src/gallium/drivers/llvmpipe/lp_screen.c
src/gallium/drivers/llvmpipe/lp_state_fs.c
src/gallium/drivers/llvmpipe/lp_state_surface.c
src/gallium/drivers/llvmpipe/lp_tex_sample_llvm.c
src/gallium/drivers/llvmpipe/lp_texture.c

diff --cc Makefile
+++ b/Makefile
@@@ -127,7 -127,7 +127,8 @@@ linux-ia64-icc-static 
  linux-icc \
  linux-icc-static \
  linux-llvm \
 +linux-llvm-debug \
+ linux-opengl-es \
  linux-osmesa \
  linux-osmesa-static \
  linux-osmesa16 \
Simple merge
@@@ -36,8 -36,6 +36,7 @@@
  #include "pipe/p_state.h"
  #include "pipe/p_defines.h"
  
- #include "util/u_format.h"
 +#include "util/u_memory.h"
  #include "util/u_surface.h"
  
  
@@@ -35,8 -35,8 +35,7 @@@
  #include "lp_flush.h"
  #include "lp_context.h"
  #include "lp_surface.h"
- #include "lp_winsys.h"
 -#include "lp_state.h"
 -#include "lp_tile_cache.h"
 +#include "lp_setup.h"
  
  
  void
  
  #include "util/u_memory.h"
  #include "util/u_cpu_detect.h"
 +#include "lp_debug.h"
  #include "lp_screen.h"
  #include "lp_bld_intr.h"
- #include "lp_bld_misc.h"
  #include "lp_jit.h"
  
  
@@@ -65,8 -62,6 +65,7 @@@
  #include "util/u_memory.h"
  #include "util/u_format.h"
  #include "util/u_debug_dump.h"
- #include "pipe/internal/p_winsys_screen.h"
 +#include "util/u_time.h"
  #include "pipe/p_shader_tokens.h"
  #include "draw/draw_context.h"
  #include "tgsi/tgsi_dump.h"
@@@ -838,88 -629,11 +837,88 @@@ generate_fragment(struct llvmpipe_conte
        debug_printf("\n");
     }
  
 -   variant->jit_function = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, variant->function);
 +   /*
 +    * Translate the LLVM IR into machine code.
 +    */
 +   variant->jit_function[do_tri_test] = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, function);
  
     if (LP_DEBUG & DEBUG_ASM)
 -      lp_disassemble(variant->jit_function);
 +      lp_disassemble(variant->jit_function[do_tri_test]);
 +}
 +
 +
 +static struct lp_fragment_shader_variant *
 +generate_variant(struct llvmpipe_context *lp,
 +                 struct lp_fragment_shader *shader,
 +                 const struct lp_fragment_shader_variant_key *key)
 +{
 +   struct lp_fragment_shader_variant *variant;
 +
 +   if (LP_DEBUG & DEBUG_JIT) {
 +      unsigned i;
 +
 +      tgsi_dump(shader->base.tokens, 0);
 +      if(key->depth.enabled) {
 +         debug_printf("depth.format = %s\n", pf_name(key->zsbuf_format));
 +         debug_printf("depth.func = %s\n", debug_dump_func(key->depth.func, TRUE));
 +         debug_printf("depth.writemask = %u\n", key->depth.writemask);
 +      }
 +      if(key->alpha.enabled) {
 +         debug_printf("alpha.func = %s\n", debug_dump_func(key->alpha.func, TRUE));
 +         debug_printf("alpha.ref_value = %f\n", key->alpha.ref_value);
 +      }
 +      if(key->blend.logicop_enable) {
 +         debug_printf("blend.logicop_func = %u\n", key->blend.logicop_func);
 +      }
-       else if(key->blend.blend_enable) {
-          debug_printf("blend.rgb_func = %s\n",   debug_dump_blend_func  (key->blend.rgb_func, TRUE));
-          debug_printf("rgb_src_factor = %s\n",   debug_dump_blend_factor(key->blend.rgb_src_factor, TRUE));
-          debug_printf("rgb_dst_factor = %s\n",   debug_dump_blend_factor(key->blend.rgb_dst_factor, TRUE));
-          debug_printf("alpha_func = %s\n",       debug_dump_blend_func  (key->blend.alpha_func, TRUE));
-          debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_src_factor, TRUE));
-          debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_dst_factor, TRUE));
++      else if(key->blend.rt[0].blend_enable) {
++         debug_printf("blend.rgb_func = %s\n",   debug_dump_blend_func  (key->blend.rt[0].rgb_func, TRUE));
++         debug_printf("rgb_src_factor = %s\n",   debug_dump_blend_factor(key->blend.rt[0].rgb_src_factor, TRUE));
++         debug_printf("rgb_dst_factor = %s\n",   debug_dump_blend_factor(key->blend.rt[0].rgb_dst_factor, TRUE));
++         debug_printf("alpha_func = %s\n",       debug_dump_blend_func  (key->blend.rt[0].alpha_func, TRUE));
++         debug_printf("alpha_src_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_src_factor, TRUE));
++         debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.rt[0].alpha_dst_factor, TRUE));
 +      }
-       debug_printf("blend.colormask = 0x%x\n", key->blend.colormask);
++      debug_printf("blend.colormask = 0x%x\n", key->blend.rt[0].colormask);
 +      for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) {
 +         if(key->sampler[i].format) {
 +            debug_printf("sampler[%u] = \n", i);
 +            debug_printf("  .format = %s\n",
 +                         pf_name(key->sampler[i].format));
 +            debug_printf("  .target = %s\n",
 +                         debug_dump_tex_target(key->sampler[i].target, TRUE));
 +            debug_printf("  .pot = %u %u %u\n",
 +                         key->sampler[i].pot_width,
 +                         key->sampler[i].pot_height,
 +                         key->sampler[i].pot_depth);
 +            debug_printf("  .wrap = %s %s %s\n",
 +                         debug_dump_tex_wrap(key->sampler[i].wrap_s, TRUE),
 +                         debug_dump_tex_wrap(key->sampler[i].wrap_t, TRUE),
 +                         debug_dump_tex_wrap(key->sampler[i].wrap_r, TRUE));
 +            debug_printf("  .min_img_filter = %s\n",
 +                         debug_dump_tex_filter(key->sampler[i].min_img_filter, TRUE));
 +            debug_printf("  .min_mip_filter = %s\n",
 +                         debug_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE));
 +            debug_printf("  .mag_img_filter = %s\n",
 +                         debug_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE));
 +            if(key->sampler[i].compare_mode != PIPE_TEX_COMPARE_NONE)
 +               debug_printf("  .compare_func = %s\n", debug_dump_func(key->sampler[i].compare_func, TRUE));
 +            debug_printf("  .normalized_coords = %u\n", key->sampler[i].normalized_coords);
 +            debug_printf("  .prefilter = %u\n", key->sampler[i].prefilter);
 +         }
 +      }
 +   }
 +
 +   variant = CALLOC_STRUCT(lp_fragment_shader_variant);
 +   if(!variant)
 +      return NULL;
 +
 +   variant->shader = shader;
 +   memcpy(&variant->key, key, sizeof *key);
  
 +   generate_fragment(lp, shader, variant, 0);
 +   generate_fragment(lp, shader, variant, 1);
 +
 +   /* insert new variant into linked list */
     variant->next = shader->variants;
     shader->variants = variant;
  
@@@ -1019,8 -726,12 +1018,8 @@@ llvmpipe_set_constant_buffer(struct pip
     /* note: reference counting */
     pipe_buffer_reference(&llvmpipe->constants[shader], constants);
  
 -   if(shader == PIPE_SHADER_FRAGMENT) {
 -      llvmpipe->jit_context.constants = data;
 -   }
 -
     if(shader == PIPE_SHADER_VERTEX) {
-       draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX,
+       draw_set_mapped_constant_buffer(llvmpipe->draw, PIPE_SHADER_VERTEX, 0,
                                        data, size);
     }
  
@@@ -1071,14 -776,11 +1070,14 @@@ make_variant_key(struct llvmpipe_contex
        assert(format_desc->layout == UTIL_FORMAT_COLORSPACE_RGB ||
               format_desc->layout == UTIL_FORMAT_COLORSPACE_SRGB);
  
 -      /* mask out color channels not present in the color buffer */
 +      /* mask out color channels not present in the color buffer.
 +       * Should be simple to incorporate per-cbuf writemasks:
 +       */
        for(chan = 0; chan < 4; ++chan) {
           enum util_format_swizzle swizzle = format_desc->swizzle[chan];
 -         if(swizzle > 4)
 -            key->blend.rt[0].colormask &= ~(1 << chan);
 +
 +         if(swizzle <= UTIL_FORMAT_SWIZZLE_W)
-             key->cbuf_blend[i].colormask |= (1 << chan);
++            key->blend.rt[0].colormask |= (1 << chan);
        }
     }
  
@@@ -1110,34 -807,8 +1109,34 @@@ llvmpipe_update_fs(struct llvmpipe_cont
        variant = variant->next;
     }
  
 -   if(!variant)
 -      variant = generate_fragment(lp, shader, &key);
 +   if (!variant) {
 +      struct util_time t0, t1;
 +      int64_t dt;
 +      util_time_get(&t0);
 +
 +      variant = generate_variant(lp, shader, &key);
 +
 +      util_time_get(&t1);
 +      dt = util_time_diff(&t0, &t1);
 +      LP_COUNT_ADD(llvm_compile_time, dt);
 +      LP_COUNT_ADD(nr_llvm_compiles, 2);  /* emit vs. omit in/out test */
 +   }
  
     shader->current = variant;
-             !key.blend.blend_enable &&
-             key.blend.colormask == 0xf &&
 +
 +   /* TODO: put this in the variant */
 +   /* TODO: most of these can be relaxed, in particular the colormask */
 +   opaque = !key.blend.logicop_enable &&
++            !key.blend.rt[0].blend_enable &&
++            key.blend.rt[0].colormask == 0xf &&
 +            !key.alpha.enabled &&
 +            !key.depth.enabled &&
 +            !key.scissor &&
 +            !shader->info.uses_kill
 +            ? TRUE : FALSE;
 +
 +   lp_setup_set_fs_functions(lp->setup, 
 +                             shader->current->jit_function[0],
 +                             shader->current->jit_function[1],
 +                             opaque);
  }
  /* Authors:  Keith Whitwell <keith@tungstengraphics.com>
   */
  
 +#include "pipe/p_state.h"
 +#include "util/u_surface.h"
  #include "lp_context.h"
  #include "lp_state.h"
- #include "lp_surface.h"
 -#include "lp_tile_cache.h"
 +#include "lp_setup.h"
  
  #include "draw/draw_context.h"
  
  #include "pipe/p_shader_tokens.h"
  #include "lp_bld_debug.h"
  #include "lp_bld_type.h"
- #include "lp_bld_intr.h"
  #include "lp_bld_sample.h"
  #include "lp_bld_tgsi.h"
 -#include "lp_state.h"
 +#include "lp_jit.h"
  #include "lp_tex_sample.h"