当前位置: 首页>>代码示例>>C++>>正文


C++ BITFIELD64_BIT函数代码示例

本文整理汇总了C++中BITFIELD64_BIT函数的典型用法代码示例。如果您正苦于以下问题:C++ BITFIELD64_BIT函数的具体用法?C++ BITFIELD64_BIT怎么用?C++ BITFIELD64_BIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BITFIELD64_BIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _mesa_nop_fragment_program

/**
 * Make the given fragment program into a "no-op" shader.
 * Actually, just copy the incoming fragment color (or texcoord)
 * to the output color.
 * This is for debug/test purposes.
 */
void
_mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *prog)
{
    struct prog_instruction *inst;
    GLuint inputAttr;

    inst = _mesa_alloc_instructions(2);
    if (!inst) {
        _mesa_error(ctx, GL_OUT_OF_MEMORY, "_mesa_nop_fragment_program");
        return;
    }

    _mesa_init_instructions(inst, 2);

    inst[0].Opcode = OPCODE_MOV;
    inst[0].DstReg.File = PROGRAM_OUTPUT;
    inst[0].DstReg.Index = FRAG_RESULT_COLOR;
    inst[0].SrcReg[0].File = PROGRAM_INPUT;
    if (prog->Base.InputsRead & VARYING_BIT_COL0)
        inputAttr = VARYING_SLOT_COL0;
    else
        inputAttr = VARYING_SLOT_TEX0;
    inst[0].SrcReg[0].Index = inputAttr;

    inst[1].Opcode = OPCODE_END;

    _mesa_free_instructions(prog->Base.Instructions,
                            prog->Base.NumInstructions);

    prog->Base.Instructions = inst;
    prog->Base.NumInstructions = 2;
    prog->Base.InputsRead = BITFIELD64_BIT(inputAttr);
    prog->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR);
}
开发者ID:LunarG,项目名称:VulkanTools,代码行数:40,代码来源:programopt.c

示例2: brw_color_buffer_write_enabled

bool
brw_color_buffer_write_enabled(struct brw_context *brw)
{
   struct gl_context *ctx = &brw->ctx;
   /* BRW_NEW_FRAGMENT_PROGRAM */
   const struct gl_fragment_program *fp = brw->fragment_program;
   int i;

   /* _NEW_BUFFERS */
   for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
      struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[i];

      /* _NEW_COLOR */
      if (rb &&
	  (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR) ||
	   fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + i)) &&
	  (ctx->Color.ColorMask[i][0] ||
	   ctx->Color.ColorMask[i][1] ||
	   ctx->Color.ColorMask[i][2] ||
	   ctx->Color.ColorMask[i][3])) {
	 return true;
      }
   }

   return false;
}
开发者ID:ashmew2,项目名称:kolibriosSVN,代码行数:26,代码来源:brw_wm_state.c

示例3: mark

static void
mark(struct gl_program *prog, ir_variable *var, int offset, int len,
     gl_shader_stage stage)
{
   /* As of GLSL 1.20, varyings can only be floats, floating-point
    * vectors or matrices, or arrays of them.  For Mesa programs using
    * InputsRead/OutputsWritten, everything but matrices uses one
    * slot, while matrices use a slot per column.  Presumably
    * something doing a more clever packing would use something other
    * than InputsRead/OutputsWritten.
    */

   for (int i = 0; i < len; i++) {
      int idx = var->data.location + var->data.index + offset + i;
      bool is_patch_generic = var->data.patch &&
                              idx != VARYING_SLOT_TESS_LEVEL_INNER &&
                              idx != VARYING_SLOT_TESS_LEVEL_OUTER;
      GLbitfield64 bitfield;

      if (is_patch_generic) {
         assert(idx >= VARYING_SLOT_PATCH0 && idx < VARYING_SLOT_TESS_MAX);
         bitfield = BITFIELD64_BIT(idx - VARYING_SLOT_PATCH0);
      }
      else {
         assert(idx < VARYING_SLOT_MAX);
         bitfield = BITFIELD64_BIT(idx);
      }

      if (var->data.mode == ir_var_shader_in) {
         if (is_patch_generic)
            prog->PatchInputsRead |= bitfield;
         else
            prog->InputsRead |= bitfield;

         /* double inputs read is only for vertex inputs */
         if (stage == MESA_SHADER_VERTEX &&
             var->type->without_array()->is_dual_slot_double())
            prog->DoubleInputsRead |= bitfield;

         if (stage == MESA_SHADER_FRAGMENT) {
            gl_fragment_program *fprog = (gl_fragment_program *) prog;
            fprog->InterpQualifier[idx] =
               (glsl_interp_qualifier) var->data.interpolation;
            if (var->data.centroid)
               fprog->IsCentroid |= bitfield;
            if (var->data.sample)
               fprog->IsSample |= bitfield;
         }
      } else if (var->data.mode == ir_var_system_value) {
         prog->SystemValuesRead |= bitfield;
      } else {
         assert(var->data.mode == ir_var_shader_out);
         if (is_patch_generic)
            prog->PatchOutputsWritten |= bitfield;
         else
            prog->OutputsWritten |= bitfield;
      }
   }
}
开发者ID:ILMostro,项目名称:iotg-lin-gfx-mesa,代码行数:59,代码来源:ir_set_program_inouts.cpp

示例4: brw_compute_barycentric_interp_modes

/**
 * Return a bitfield where bit n is set if barycentric interpolation mode n
 * (see enum brw_wm_barycentric_interp_mode) is needed by the fragment shader.
 */
static unsigned
brw_compute_barycentric_interp_modes(struct brw_context *brw,
                                     bool shade_model_flat,
                                     const struct gl_fragment_program *fprog)
{
   unsigned barycentric_interp_modes = 0;
   int attr;

   /* Loop through all fragment shader inputs to figure out what interpolation
    * modes are in use, and set the appropriate bits in
    * barycentric_interp_modes.
    */
   for (attr = 0; attr < VARYING_SLOT_MAX; ++attr) {
      enum glsl_interp_qualifier interp_qualifier =
         fprog->InterpQualifier[attr];
      bool is_centroid = fprog->IsCentroid & BITFIELD64_BIT(attr);
      bool is_gl_Color = attr == VARYING_SLOT_COL0 || attr == VARYING_SLOT_COL1;

      /* Ignore unused inputs. */
      if (!(fprog->Base.InputsRead & BITFIELD64_BIT(attr)))
         continue;

      /* Ignore WPOS and FACE, because they don't require interpolation. */
      if (attr == VARYING_SLOT_POS || attr == VARYING_SLOT_FACE)
         continue;

      /* Determine the set (or sets) of barycentric coordinates needed to
       * interpolate this variable.  Note that when
       * brw->needs_unlit_centroid_workaround is set, centroid interpolation
       * uses PIXEL interpolation for unlit pixels and CENTROID interpolation
       * for lit pixels, so we need both sets of barycentric coordinates.
       */
      if (interp_qualifier == INTERP_QUALIFIER_NOPERSPECTIVE) {
         if (is_centroid) {
            barycentric_interp_modes |=
               1 << BRW_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC;
         }
         if (!is_centroid || brw->needs_unlit_centroid_workaround) {
            barycentric_interp_modes |=
               1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC;
         }
      } else if (interp_qualifier == INTERP_QUALIFIER_SMOOTH ||
                 (!(shade_model_flat && is_gl_Color) &&
                  interp_qualifier == INTERP_QUALIFIER_NONE)) {
         if (is_centroid) {
            barycentric_interp_modes |=
               1 << BRW_WM_PERSPECTIVE_CENTROID_BARYCENTRIC;
         }
         if (!is_centroid || brw->needs_unlit_centroid_workaround) {
            barycentric_interp_modes |=
               1 << BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC;
         }
      }
   }

   return barycentric_interp_modes;
}
开发者ID:kaltsi,项目名称:mesa,代码行数:61,代码来源:brw_wm.c

示例5: brw_fs_precompile

bool
brw_fs_precompile(struct gl_context *ctx,
                  struct gl_shader_program *shader_prog,
                  struct gl_program *prog)
{
   struct brw_context *brw = brw_context(ctx);
   struct brw_wm_prog_key key;

   struct gl_fragment_program *fp = (struct gl_fragment_program *) prog;
   struct brw_fragment_program *bfp = brw_fragment_program(fp);
   bool program_uses_dfdy = fp->UsesDFdy;

   memset(&key, 0, sizeof(key));

   if (brw->gen < 6) {
      if (fp->UsesKill)
         key.iz_lookup |= IZ_PS_KILL_ALPHATEST_BIT;

      if (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH))
         key.iz_lookup |= IZ_PS_COMPUTES_DEPTH_BIT;

      /* Just assume depth testing. */
      key.iz_lookup |= IZ_DEPTH_TEST_ENABLE_BIT;
      key.iz_lookup |= IZ_DEPTH_WRITE_ENABLE_BIT;
   }

   if (brw->gen < 6 || _mesa_bitcount_64(fp->Base.InputsRead &
                                         BRW_FS_VARYING_INPUT_MASK) > 16)
      key.input_slots_valid = fp->Base.InputsRead | VARYING_BIT_POS;

   brw_setup_tex_for_precompile(brw, &key.tex, &fp->Base);

   if (fp->Base.InputsRead & VARYING_BIT_POS) {
      key.drawable_height = ctx->DrawBuffer->Height;
   }

   key.nr_color_regions = _mesa_bitcount_64(fp->Base.OutputsWritten &
         ~(BITFIELD64_BIT(FRAG_RESULT_DEPTH) |
         BITFIELD64_BIT(FRAG_RESULT_SAMPLE_MASK)));

   if ((fp->Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) {
      key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer) ||
                          key.nr_color_regions > 1;
   }

   key.program_string_id = bfp->id;

   uint32_t old_prog_offset = brw->wm.base.prog_offset;
   struct brw_wm_prog_data *old_prog_data = brw->wm.prog_data;

   bool success = brw_codegen_wm_prog(brw, shader_prog, bfp, &key);

   brw->wm.base.prog_offset = old_prog_offset;
   brw->wm.prog_data = old_prog_data;

   return success;
}
开发者ID:aphogat,项目名称:mesa,代码行数:57,代码来源:brw_wm.c

示例6: init_registers

/* Initialize all the register values.  Do the initial setup
 * calculations for interpolants.
 */
static void init_registers( struct brw_wm_compile *c )
{
   struct brw_context *brw = c->func.brw;
   struct intel_context *intel = &brw->intel;
   GLuint nr_interp_regs = 0;
   GLuint i = 0;
   GLuint j;

   for (j = 0; j < c->grf_limit; j++) 
      c->pass2_grf[j].nextuse = BRW_WM_MAX_INSN;

   for (j = 0; j < (c->nr_payload_regs + 1) / 2; j++)
      prealloc_reg(c, &c->payload.depth[j], i++);

   for (j = 0; j < c->nr_creg; j++) 
      prealloc_reg(c, &c->creg[j], i++);

   if (intel->gen >= 6) {
      for (unsigned int j = 0; j < FRAG_ATTRIB_MAX; j++) {
	 if (c->fp->program.Base.InputsRead & BITFIELD64_BIT(j)) {
	    nr_interp_regs++;
	    prealloc_reg(c, &c->payload.input_interp[j], i++);
	 }
      }
   } else {
      for (j = 0; j < VERT_RESULT_MAX; j++) {
         /* Point size is packed into the header, not as a general attribute */
         if (j == VERT_RESULT_PSIZ)
            continue;

	 if (c->key.vp_outputs_written & BITFIELD64_BIT(j)) {
	    int fp_index = _mesa_vert_result_to_frag_attrib(j);

	    nr_interp_regs++;

	    /* The back color slot is skipped when the front color is
	     * also written to.  In addition, some slots can be
	     * written in the vertex shader and not read in the
	     * fragment shader.  So the register number must always be
	     * incremented, mapped or not.
	     */
	    if (fp_index >= 0)
	       prealloc_reg(c, &c->payload.input_interp[fp_index], i);
            i++;
	 }
      }
      assert(nr_interp_regs >= 1);
   }


   c->prog_data.first_curbe_grf = ALIGN(c->nr_payload_regs, 2);
   c->prog_data.urb_read_length = nr_interp_regs * 2;
   c->prog_data.curb_read_length = c->nr_creg * 2;

   c->max_wm_grf = i * 2;
}
开发者ID:jay8muel,项目名称:Renderfusion,代码行数:59,代码来源:brw_wm_pass2.c

示例7: set_io_mask

static void
set_io_mask(nir_shader *shader, nir_variable *var, int offset, int len,
            bool is_output_read)
{
   for (int i = 0; i < len; i++) {
      assert(var->data.location != -1);

      int idx = var->data.location + offset + i;
      bool is_patch_generic = var->data.patch &&
                              idx != VARYING_SLOT_TESS_LEVEL_INNER &&
                              idx != VARYING_SLOT_TESS_LEVEL_OUTER &&
                              idx != VARYING_SLOT_BOUNDING_BOX0 &&
                              idx != VARYING_SLOT_BOUNDING_BOX1;
      uint64_t bitfield;

      if (is_patch_generic) {
         assert(idx >= VARYING_SLOT_PATCH0 && idx < VARYING_SLOT_TESS_MAX);
         bitfield = BITFIELD64_BIT(idx - VARYING_SLOT_PATCH0);
      }
      else {
         assert(idx < VARYING_SLOT_MAX);
         bitfield = BITFIELD64_BIT(idx);
      }

      if (var->data.mode == nir_var_shader_in) {
         if (is_patch_generic)
            shader->info.patch_inputs_read |= bitfield;
         else
            shader->info.inputs_read |= bitfield;

         if (shader->info.stage == MESA_SHADER_FRAGMENT) {
            shader->info.fs.uses_sample_qualifier |= var->data.sample;
         }
      } else {
         assert(var->data.mode == nir_var_shader_out);
         if (is_output_read) {
            if (is_patch_generic) {
               shader->info.patch_outputs_read |= bitfield;
            } else {
               shader->info.outputs_read |= bitfield;
            }
         } else {
	    if (is_patch_generic) {
	       shader->info.patch_outputs_written |= bitfield;
	    } else if (!var->data.read_only) {
	       shader->info.outputs_written |= bitfield;
	    }
	 }


         if (var->data.fb_fetch_output)
            shader->info.outputs_read |= bitfield;
      }
   }
}
开发者ID:chadversary,项目名称:mesa,代码行数:55,代码来源:nir_gather_info.c

示例8: run_program

/**
 * Run fragment program on the pixels in span from 'start' to 'end' - 1.
 */
static void
run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end)
{
   SWcontext *swrast = SWRAST_CONTEXT(ctx);
   const struct gl_fragment_program *program = ctx->FragmentProgram._Current;
   const GLbitfield64 outputsWritten = program->Base.OutputsWritten;
   struct gl_program_machine *machine = &swrast->FragProgMachine;
   GLuint i;

   for (i = start; i < end; i++) {
      if (span->array->mask[i]) {
         init_machine(ctx, machine, program, span, i);

         if (_mesa_execute_program(ctx, &program->Base, machine)) {

            /* Store result color */
	    if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) {
               COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i],
                       machine->Outputs[FRAG_RESULT_COLOR]);
            }
            else {
               /* Multiple drawbuffers / render targets
                * Note that colors beyond 0 and 1 will overwrite other
                * attributes, such as FOGC, TEX0, TEX1, etc.  That's OK.
                */
               GLuint buf;
               for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) {
                  if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + buf)) {
                     COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0 + buf][i],
                             machine->Outputs[FRAG_RESULT_DATA0 + buf]);
                  }
               }
            }

            /* Store result depth/z */
            if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) {
               const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2];
               if (depth <= 0.0)
                  span->array->z[i] = 0;
               else if (depth >= 1.0)
                  span->array->z[i] = ctx->DrawBuffer->_DepthMax;
               else
                  span->array->z[i] =
                     (GLuint) (depth * ctx->DrawBuffer->_DepthMaxF + 0.5F);
            }
         }
         else {
            /* killed fragment */
            span->array->mask[i] = GL_FALSE;
            span->writeAll = GL_FALSE;
         }
      }
   }
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:57,代码来源:s_fragprog.c

示例9: calculate_masks

static bool
calculate_masks(struct brw_sf_compile *c,
	        GLuint reg,
		GLushort *pc,
		GLushort *pc_persp,
		GLushort *pc_linear)
{
   bool is_last_attr = (reg == c->nr_setup_regs - 1);
   GLbitfield64 persp_mask;
   GLbitfield64 linear_mask;

   if (c->key.do_flat_shading)
      persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_HPOS) |
                                    BITFIELD64_BIT(VERT_RESULT_COL0) |
                                    BITFIELD64_BIT(VERT_RESULT_COL1));
   else
      persp_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_HPOS));

   if (c->key.do_flat_shading)
      linear_mask = c->key.attrs & ~(BITFIELD64_BIT(VERT_RESULT_COL0) |
                                     BITFIELD64_BIT(VERT_RESULT_COL1));
   else
      linear_mask = c->key.attrs;

   *pc_persp = 0;
   *pc_linear = 0;
   *pc = 0xf;
      
   if (persp_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 0)))
      *pc_persp = 0xf;

   if (linear_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 0)))
      *pc_linear = 0xf;

   /* Maybe only processs one attribute on the final round:
    */
   if (vert_reg_to_vert_result(c, reg, 1) != BRW_VERT_RESULT_MAX) {
      *pc |= 0xf0;

      if (persp_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 1)))
	 *pc_persp |= 0xf0;

      if (linear_mask & BITFIELD64_BIT(vert_reg_to_vert_result(c, reg, 1)))
	 *pc_linear |= 0xf0;
   }

   return is_last_attr;
}
开发者ID:ChillyWillyGuru,项目名称:RSXGL,代码行数:48,代码来源:brw_sf_emit.c

示例10: mark

static void
mark(struct gl_program *prog, ir_variable *var, int offset, int len,
     bool is_fragment_shader)
{
   /* As of GLSL 1.20, varyings can only be floats, floating-point
    * vectors or matrices, or arrays of them.  For Mesa programs using
    * InputsRead/OutputsWritten, everything but matrices uses one
    * slot, while matrices use a slot per column.  Presumably
    * something doing a more clever packing would use something other
    * than InputsRead/OutputsWritten.
    */

   for (int i = 0; i < len; i++) {
      GLbitfield64 bitfield = BITFIELD64_BIT(var->location + var->index + offset + i);
      if (var->mode == ir_var_in) {
	 prog->InputsRead |= bitfield;
         if (is_fragment_shader) {
            gl_fragment_program *fprog = (gl_fragment_program *) prog;
            fprog->InterpQualifier[var->location + var->index + offset + i] =
               (glsl_interp_qualifier) var->interpolation;
         }
      } else if (var->mode == ir_var_system_value) {
         prog->SystemValuesRead |= bitfield;
      } else {
	 prog->OutputsWritten |= bitfield;
      }
   }
}
开发者ID:james026yeah,项目名称:mesa,代码行数:28,代码来源:ir_set_program_inouts.cpp

示例11: init_array

static void
init_array(struct gl_context *ctx,
           struct gl_vertex_array_object *obj, GLuint index, GLint size, GLint type)
{
   struct gl_vertex_attrib_array *array = &obj->VertexAttrib[index];
   struct gl_vertex_buffer_binding *binding = &obj->VertexBinding[index];

   array->Size = size;
   array->Type = type;
   array->Format = GL_RGBA; /* only significant for GL_EXT_vertex_array_bgra */
   array->Stride = 0;
   array->Ptr = NULL;
   array->RelativeOffset = 0;
   array->Enabled = GL_FALSE;
   array->Normalized = GL_FALSE;
   array->Integer = GL_FALSE;
   array->Doubles = GL_FALSE;
   array->_ElementSize = size * _mesa_sizeof_type(type);
   array->VertexBinding = index;

   binding->Offset = 0;
   binding->Stride = array->_ElementSize;
   binding->BufferObj = NULL;
   binding->_BoundArrays = BITFIELD64_BIT(index);

   /* Vertex array buffers */
   _mesa_reference_buffer_object(ctx, &binding->BufferObj,
                                 ctx->Shared->NullBufferObj);
}
开发者ID:Kalamatee,项目名称:mesa,代码行数:29,代码来源:arrayobj.c

示例12: _mesa_program_fragment_position_to_sysval

void
_mesa_program_fragment_position_to_sysval(struct gl_program *prog)
{
   GLuint i;

   if (prog->Target != GL_FRAGMENT_PROGRAM_ARB ||
       !(prog->InputsRead & BITFIELD64_BIT(VARYING_SLOT_POS)))
      return;

   prog->InputsRead &= ~BITFIELD64_BIT(VARYING_SLOT_POS);
   prog->SystemValuesRead |= 1 << SYSTEM_VALUE_FRAG_COORD;

   for (i = 0; i < prog->NumInstructions; i++) {
      struct prog_instruction *inst = prog->Instructions + i;
      const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode);
      GLuint j;

      for (j = 0; j < numSrc; j++) {
         if (inst->SrcReg[j].File == PROGRAM_INPUT &&
             inst->SrcReg[j].Index == VARYING_SLOT_POS) {
            inst->SrcReg[j].File = PROGRAM_SYSTEM_VALUE;
            inst->SrcReg[j].Index = SYSTEM_VALUE_FRAG_COORD;
         }
      }
   }
}
开发者ID:KidGundam,项目名称:Image-Synthesis,代码行数:26,代码来源:programopt.c

示例13: get_attr_override

static uint32_t
get_attr_override(struct brw_context *brw, int fs_attr)
{
   int attr_index = 0, i, vs_attr;

   if (fs_attr <= FRAG_ATTRIB_TEX7)
      vs_attr = fs_attr;
   else if (fs_attr == FRAG_ATTRIB_FACE)
      vs_attr = 0; /* XXX */
   else if (fs_attr == FRAG_ATTRIB_PNTC)
      vs_attr = 0; /* XXX */
   else {
      assert(fs_attr >= FRAG_ATTRIB_VAR0);
      vs_attr = fs_attr - FRAG_ATTRIB_VAR0 + VERT_RESULT_VAR0;
   }

   /* Find the source index (0 = first attribute after the 4D position)
    * for this output attribute.  attr is currently a VERT_RESULT_* but should
    * be FRAG_ATTRIB_*.
    */
   for (i = 0; i < vs_attr; i++) {
      if (brw->vs.prog_data->outputs_written & BITFIELD64_BIT(i))
	 attr_index++;
   }

   return attr_index;
}
开发者ID:AchironOS,项目名称:chromium.src,代码行数:27,代码来源:gen6_sf_state.c

示例14: calculate_masks

static GLboolean calculate_masks( struct brw_sf_compile *c,
                                  GLuint reg,
                                  GLushort *pc,
                                  GLushort *pc_persp,
                                  GLushort *pc_linear)
{
    GLboolean is_last_attr = (reg == c->nr_setup_regs - 1);
    GLbitfield64 persp_mask;
    GLbitfield64 linear_mask;

    if (c->key.do_flat_shading)
        persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS |
                                      FRAG_BIT_COL0 |
                                      FRAG_BIT_COL1);
    else
        persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS);

    if (c->key.do_flat_shading)
        linear_mask = c->key.attrs & ~(FRAG_BIT_COL0|FRAG_BIT_COL1);
    else
        linear_mask = c->key.attrs;

    *pc_persp = 0;
    *pc_linear = 0;
    *pc = 0xf;

    if (persp_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2]))
        *pc_persp = 0xf;

    if (linear_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2]))
        *pc_linear = 0xf;

    /* Maybe only processs one attribute on the final round:
     */
    if (reg*2+1 < c->nr_setup_attrs) {
        *pc |= 0xf0;

        if (persp_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2+1]))
            *pc_persp |= 0xf0;

        if (linear_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2+1]))
            *pc_linear |= 0xf0;
    }

    return is_last_attr;
}
开发者ID:nikai3d,项目名称:mesa,代码行数:46,代码来源:brw_sf_emit.c

示例15: brw_merge_inputs

static void
brw_merge_inputs(struct brw_context *brw,
                 const struct gl_client_array *arrays[])
{
   const struct gl_context *ctx = &brw->ctx;
   GLuint i;

   for (i = 0; i < brw->vb.nr_buffers; i++) {
      drm_intel_bo_unreference(brw->vb.buffers[i].bo);
      brw->vb.buffers[i].bo = NULL;
   }
   brw->vb.nr_buffers = 0;

   for (i = 0; i < VERT_ATTRIB_MAX; i++) {
      brw->vb.inputs[i].buffer = -1;
      brw->vb.inputs[i].glarray = arrays[i];
   }

   if (brw->gen < 8 && !brw->is_haswell) {
      struct gl_program *vp = &ctx->VertexProgram._Current->Base;
      /* Prior to Haswell, the hardware can't natively support GL_FIXED or
       * 2_10_10_10_REV vertex formats.  Set appropriate workaround flags.
       */
      for (i = 0; i < VERT_ATTRIB_MAX; i++) {
         if (!(vp->InputsRead & BITFIELD64_BIT(i)))
            continue;

         uint8_t wa_flags = 0;

         switch (brw->vb.inputs[i].glarray->Type) {

         case GL_FIXED:
            wa_flags = brw->vb.inputs[i].glarray->Size;
            break;

         case GL_INT_2_10_10_10_REV:
            wa_flags |= BRW_ATTRIB_WA_SIGN;
            /* fallthough */

         case GL_UNSIGNED_INT_2_10_10_10_REV:
            if (brw->vb.inputs[i].glarray->Format == GL_BGRA)
               wa_flags |= BRW_ATTRIB_WA_BGRA;

            if (brw->vb.inputs[i].glarray->Normalized)
               wa_flags |= BRW_ATTRIB_WA_NORMALIZE;
            else if (!brw->vb.inputs[i].glarray->Integer)
               wa_flags |= BRW_ATTRIB_WA_SCALE;

            break;
         }

         if (brw->vb.attrib_wa_flags[i] != wa_flags) {
            brw->vb.attrib_wa_flags[i] = wa_flags;
            brw->ctx.NewDriverState |= BRW_NEW_VS_ATTRIB_WORKAROUNDS;
         }
      }
   }
}
开发者ID:alesegdia,项目名称:mesa,代码行数:58,代码来源:brw_draw.c


注:本文中的BITFIELD64_BIT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。