~ubuntu-branches/ubuntu/raring/mesa/raring-proposed

« back to all changes in this revision

Viewing changes to src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

  • Committer: Package Import Robot
  • Author(s): Maarten Lankhorst
  • Date: 2013-03-14 12:18:29 UTC
  • mfrom: (1.7.14)
  • Revision ID: package-import@ubuntu.com-20130314121829-bv7c0z6t1pob5ket
Tags: 9.0.3-0ubuntu1
New upstream release. (LP: #1134466)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1853
1853
      shadow_comparitor = this->result;
1854
1854
   }
1855
1855
 
 
1856
   const glsl_type *lod_type;
1856
1857
   src_reg lod, dPdx, dPdy;
1857
1858
   switch (ir->op) {
 
1859
   case ir_tex:
 
1860
      lod = src_reg(0.0f);
 
1861
      lod_type = glsl_type::float_type;
 
1862
      break;
1858
1863
   case ir_txf:
1859
1864
   case ir_txl:
1860
1865
   case ir_txs:
1861
1866
      ir->lod_info.lod->accept(this);
1862
1867
      lod = this->result;
 
1868
      lod_type = ir->lod_info.lod->type;
1863
1869
      break;
1864
1870
   case ir_txd:
1865
1871
      ir->lod_info.grad.dPdx->accept(this);
1867
1873
 
1868
1874
      ir->lod_info.grad.dPdy->accept(this);
1869
1875
      dPdy = this->result;
 
1876
 
 
1877
      lod_type = ir->lod_info.grad.dPdx->type;
1870
1878
      break;
1871
 
   case ir_tex:
1872
1879
   case ir_txb:
1873
1880
      break;
1874
1881
   }
1898
1905
   inst->mlen = inst->header_present + 1; /* always at least one */
1899
1906
   inst->sampler = sampler;
1900
1907
   inst->dst = dst_reg(this, ir->type);
 
1908
   inst->dst.writemask = WRITEMASK_XYZW;
1901
1909
   inst->shadow_compare = ir->shadow_comparitor != NULL;
1902
1910
 
1903
1911
   if (ir->offset != NULL && ir->op != ir_txf)
1908
1916
 
1909
1917
   if (ir->op == ir_txs) {
1910
1918
      int writemask = intel->gen == 4 ? WRITEMASK_W : WRITEMASK_X;
1911
 
      emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, writemask),
1912
 
           lod));
 
1919
      emit(MOV(dst_reg(MRF, param_base, lod_type, writemask), lod));
1913
1920
   } else {
1914
1921
      int i, coord_mask = 0, zero_mask = 0;
1915
1922
      /* Load the coordinate */
1952
1959
      }
1953
1960
 
1954
1961
      /* Load the LOD info */
1955
 
      if (ir->op == ir_txl) {
 
1962
      if (ir->op == ir_tex || ir->op == ir_txl) {
1956
1963
         int mrf, writemask;
1957
1964
         if (intel->gen >= 5) {
1958
1965
            mrf = param_base + 1;
1967
1974
            mrf = param_base;
1968
1975
            writemask = WRITEMASK_Z;
1969
1976
         }
1970
 
         emit(MOV(dst_reg(MRF, mrf, ir->lod_info.lod->type, writemask), lod));
 
1977
         emit(MOV(dst_reg(MRF, mrf, lod_type, writemask), lod));
1971
1978
      } else if (ir->op == ir_txf) {
1972
 
         emit(MOV(dst_reg(MRF, param_base, ir->lod_info.lod->type, WRITEMASK_W),
 
1979
         emit(MOV(dst_reg(MRF, param_base, lod_type, WRITEMASK_W),
1973
1980
                  lod));
1974
1981
      } else if (ir->op == ir_txd) {
1975
 
         const glsl_type *type = ir->lod_info.grad.dPdx->type;
 
1982
         const glsl_type *type = lod_type;
1976
1983
 
1977
1984
         if (intel->gen >= 5) {
1978
1985
            dPdx.swizzle = BRW_SWIZZLE4(SWIZZLE_X,SWIZZLE_X,SWIZZLE_Y,SWIZZLE_Y);
2004
2011
void
2005
2012
vec4_visitor::swizzle_result(ir_texture *ir, src_reg orig_val, int sampler)
2006
2013
{
2007
 
   this->result = orig_val;
2008
 
 
2009
2014
   int s = c->key.tex.swizzles[sampler];
2010
2015
 
 
2016
   this->result = src_reg(this, ir->type);
 
2017
   dst_reg swizzled_result(this->result);
 
2018
 
2011
2019
   if (ir->op == ir_txs || ir->type == glsl_type::float_type
2012
 
                        || s == SWIZZLE_NOOP)
 
2020
                        || s == SWIZZLE_NOOP) {
 
2021
      emit(MOV(swizzled_result, orig_val));
2013
2022
      return;
 
2023
   }
2014
2024
 
2015
2025
   int zero_mask = 0, one_mask = 0, copy_mask = 0;
2016
2026
   int swizzle[4];
2030
2040
      }
2031
2041
   }
2032
2042
 
2033
 
   this->result = src_reg(this, ir->type);
2034
 
   dst_reg swizzled_result(this->result);
2035
 
 
2036
2043
   if (copy_mask) {
2037
2044
      orig_val.swizzle = BRW_SWIZZLE4(swizzle[0], swizzle[1], swizzle[2], swizzle[3]);
2038
2045
      swizzled_result.writemask = copy_mask;