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


C++ emit_op1函数代码示例

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


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

示例1: build_atten_pointsize

/**
 * Point size attenuation computation.
 */
static void build_atten_pointsize( struct tnl_program *p )
{
   struct ureg eye = get_eye_position_z(p);
   struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
   struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
   struct ureg out = register_output(p, VERT_RESULT_PSIZ);
   struct ureg ut = get_temp(p);

   /* dist = |eyez| */
   emit_op1(p, OPCODE_ABS, ut, WRITEMASK_Y, swizzle1(eye, Z));
   /* p1 + dist * (p2 + dist * p3); */
   emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y),
		swizzle1(state_attenuation, Z), swizzle1(state_attenuation, Y));
   emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y),
		ut, swizzle1(state_attenuation, X));

   /* 1 / sqrt(factor) */
   emit_op1(p, OPCODE_RSQ, ut, WRITEMASK_X, ut );

#if 0
   /* out = pointSize / sqrt(factor) */
   emit_op2(p, OPCODE_MUL, out, WRITEMASK_X, ut, state_size);
#else
   /* this is a good place to clamp the point size since there's likely
    * no hardware registers to clamp point size at rasterization time.
    */
   emit_op2(p, OPCODE_MUL, ut, WRITEMASK_X, ut, state_size);
   emit_op2(p, OPCODE_MAX, ut, WRITEMASK_X, ut, swizzle1(state_size, Y));
   emit_op2(p, OPCODE_MIN, out, WRITEMASK_X, ut, swizzle1(state_size, Z));
#endif

   release_temp(p, ut);
}
开发者ID:toastpp,项目名称:toastpp,代码行数:36,代码来源:ffvertex_prog.c

示例2: build_pointsize

/* Seems like it could be tighter:
 */
static void build_pointsize( struct tnl_program *p )
{
   struct ureg eye = get_eye_position(p);
   struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
   struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
   struct ureg out = register_output(p, VERT_RESULT_PSIZ);
   struct ureg ut = get_temp(p);

   /* 1, Z, Z * Z, 1 */      
   emit_op1(p, OPCODE_MOV, ut, WRITEMASK_XW, swizzle1(get_identity_param(p), W));
   emit_op1(p, OPCODE_ABS, ut, WRITEMASK_YZ, swizzle1(eye, Z));
   emit_op2(p, OPCODE_MUL, ut, WRITEMASK_Z, ut, ut);


   /* p1 +  p2 * dist + p3 * dist * dist, 0 */
   emit_op2(p, OPCODE_DP3, ut, WRITEMASK_X, ut, state_attenuation);

   /* 1 / sqrt(factor) */
   emit_op1(p, OPCODE_RSQ, ut, WRITEMASK_X, ut ); 

   /* ut = pointSize / factor */
   emit_op2(p, OPCODE_MUL, ut, WRITEMASK_X, ut, state_size); 

   /* Clamp to min/max - state_size.[yz]
    */
   emit_op2(p, OPCODE_MAX, ut, WRITEMASK_X, ut, swizzle1(state_size, Y)); 
   emit_op2(p, OPCODE_MIN, out, 0, swizzle1(ut, X), swizzle1(state_size, Z)); 
   
   release_temp(p, ut);
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:32,代码来源:brw_vs_tnl.c

示例3: build_pointsize

static void build_pointsize( struct tnl_program *p )
{
   struct ureg eye = get_eye_position(p);
   struct ureg state_size = register_param1(p, STATE_POINT_SIZE);
   struct ureg state_attenuation = register_param1(p, STATE_POINT_ATTENUATION);
   struct ureg out = register_output(p, VERT_RESULT_PSIZ);
   struct ureg ut = get_temp(p);

   /* dist = |eyez| */
   emit_op1(p, OPCODE_ABS, ut, WRITEMASK_Y, swizzle1(eye, Z));
   /* p1 + dist * (p2 + dist * p3); */
   emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y),
		swizzle1(state_attenuation, Z), swizzle1(state_attenuation, Y));
   emit_op3(p, OPCODE_MAD, ut, WRITEMASK_X, swizzle1(ut, Y),
		ut, swizzle1(state_attenuation, X));

   /* 1 / sqrt(factor) */
   emit_op1(p, OPCODE_RSQ, ut, WRITEMASK_X, ut );

#if 1
   /* out = pointSize / sqrt(factor) */
   emit_op2(p, OPCODE_MUL, out, WRITEMASK_X, ut, state_size);
#else
   /* not sure, might make sense to do clamping here,
      but it's not done in t_vb_points neither */
   emit_op2(p, OPCODE_MUL, ut, WRITEMASK_X, ut, state_size);
   emit_op2(p, OPCODE_MAX, ut, WRITEMASK_X, ut, swizzle1(state_size, Y));
   emit_op2(p, OPCODE_MIN, out, WRITEMASK_X, ut, swizzle1(state_size, Z));
#endif

   release_temp(p, ut);
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:32,代码来源:t_vp_build.c

示例4: build_fog

static void build_fog( struct tnl_program *p )
{
   struct ureg fog = register_output(p, VERT_RESULT_FOGC);
   struct ureg input;
   GLuint useabs = p->state->fog_source_is_depth && p->state->fog_option &&
		   (p->state->fog_option != FOG_EXP2);

   if (p->state->fog_source_is_depth) {
      input = swizzle1(get_eye_position(p), Z);
   }
   else {
      input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
   }

   if (p->state->fog_option &&
       p->state->tnl_do_vertex_fog) {
      struct ureg params = register_param2(p, STATE_INTERNAL,
					   STATE_FOG_PARAMS_OPTIMIZED);
      struct ureg tmp = get_temp(p);
      struct ureg id = get_identity_param(p);

      emit_op1(p, OPCODE_MOV, fog, 0, id);

      if (useabs) {
	 emit_op1(p, OPCODE_ABS, tmp, 0, input);
      }

      switch (p->state->fog_option) {
      case FOG_LINEAR: {
	 emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input,
			swizzle1(params,X), swizzle1(params,Y));
	 emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */
	 emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W));
	 break;
      }
      case FOG_EXP:
	 emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input,
			swizzle1(params,Z));
	 emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, ureg_negate(tmp));
	 break;
      case FOG_EXP2:
	 emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W));
	 emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp);
	 emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, ureg_negate(tmp));
	 break;
      }

      release_temp(p, tmp);
   }
   else {
      /* results = incoming fog coords (compute fog per-fragment later) 
       *
       * KW:  Is it really necessary to do anything in this case?
       */
      emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, 0, input);
   }
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:57,代码来源:brw_vs_tnl.c

示例5: calculate_light_attenuation

static struct ureg calculate_light_attenuation( struct tnl_program *p,
						GLuint i,
						struct ureg VPpli,
						struct ureg dist )
{
   struct ureg attenuation = register_param3(p, STATE_LIGHT, i,
					     STATE_ATTENUATION);
   struct ureg att = undef;

   /* Calculate spot attenuation:
    */
   if (!p->state->unit[i].light_spotcutoff_is_180) {
      struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL,
						  STATE_LIGHT_SPOT_DIR_NORMALIZED, i);
      struct ureg spot = get_temp(p);
      struct ureg slt = get_temp(p);

      att = get_temp(p);

      emit_op2(p, OPCODE_DP3, spot, 0, negate(VPpli), spot_dir_norm);
      emit_op2(p, OPCODE_SLT, slt, 0, swizzle1(spot_dir_norm,W), spot);
      emit_op1(p, OPCODE_ABS, spot, 0, spot);
      emit_op2(p, OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W));
      emit_op2(p, OPCODE_MUL, att, 0, slt, spot);

      release_temp(p, spot);
      release_temp(p, slt);
   }

   /* Calculate distance attenuation(See formula (2.4) at glspec 2.1 page 62):
    *
    * Skip the calucation when _dist_ is undefined(light_eyepos3_is_zero)
    */
   if (p->state->unit[i].light_attenuated && !is_undef(dist)) {
      if (is_undef(att))
         att = get_temp(p);
      /* 1/d,d,d,1/d */
      emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist);
      /* 1,d,d*d,1/d */
      emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y));
      /* 1/dist-atten */
      emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist);

      if (!p->state->unit[i].light_spotcutoff_is_180) {
	 /* dist-atten */
	 emit_op1(p, OPCODE_RCP, dist, 0, dist);
	 /* spot-atten * dist-atten */
	 emit_op2(p, OPCODE_MUL, att, 0, dist, att);
      }
      else {
	 /* dist-atten */
	 emit_op1(p, OPCODE_RCP, att, 0, dist);
      }
   }

   return att;
}
开发者ID:Echelon9,项目名称:mesa,代码行数:57,代码来源:ffvertex_prog.c

示例6: build_fog

static void build_fog( struct tnl_program *p )
{
   struct ureg fog = register_output(p, VERT_RESULT_FOGC);
   struct ureg input;

   if (p->state->fog_source_is_depth) {
      input = swizzle1(get_eye_position(p), Z);
   }
   else {
      input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
   }

   if (p->state->fog_mode && p->state->tnl_do_vertex_fog) {
      struct ureg params = register_param2(p, STATE_INTERNAL,
					   STATE_FOG_PARAMS_OPTIMIZED);
      struct ureg tmp = get_temp(p);
      GLboolean useabs = (p->state->fog_mode != FOG_EXP2);

      if (useabs) {
	 emit_op1(p, OPCODE_ABS, tmp, 0, input);
      }

      switch (p->state->fog_mode) {
      case FOG_LINEAR: {
	 struct ureg id = get_identity_param(p);
	 emit_op3(p, OPCODE_MAD, tmp, 0, useabs ? tmp : input,
			swizzle1(params,X), swizzle1(params,Y));
	 emit_op2(p, OPCODE_MAX, tmp, 0, tmp, swizzle1(id,X)); /* saturate */
	 emit_op2(p, OPCODE_MIN, fog, WRITEMASK_X, tmp, swizzle1(id,W));
	 break;
      }
      case FOG_EXP:
	 emit_op2(p, OPCODE_MUL, tmp, 0, useabs ? tmp : input,
			swizzle1(params,Z));
	 emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp));
	 break;
      case FOG_EXP2:
	 emit_op2(p, OPCODE_MUL, tmp, 0, input, swizzle1(params,W));
	 emit_op2(p, OPCODE_MUL, tmp, 0, tmp, tmp);
	 emit_op1(p, OPCODE_EX2, fog, WRITEMASK_X, negate(tmp));
	 break;
      }

      release_temp(p, tmp);
   }
   else {
      /* results = incoming fog coords (compute fog per-fragment later) 
       *
       * KW:  Is it really necessary to do anything in this case?
       * BP: Yes, we always need to compute the absolute value, unless
       * we want to push that down into the fragment program...
       */
      GLboolean useabs = GL_TRUE;
      emit_op1(p, useabs ? OPCODE_ABS : OPCODE_MOV, fog, WRITEMASK_X, input);
   }
}
开发者ID:Multi2Sim,项目名称:m2s-bench-parsec-3.0-src,代码行数:56,代码来源:t_vp_build.c

示例7: calculate_light_attenuation

static struct ureg calculate_light_attenuation( struct tnl_program *p,
						GLuint i,
						struct ureg VPpli,
						struct ureg dist )
{
   struct ureg attenuation = register_param3(p, STATE_LIGHT, i,
					     STATE_ATTENUATION);
   struct ureg att = get_temp(p);

   /* Calculate spot attenuation:
    */
   if (!p->state->unit[i].light_spotcutoff_is_180) {
      struct ureg spot_dir_norm = register_param3(p, STATE_INTERNAL,
						  STATE_LIGHT_SPOT_DIR_NORMALIZED, i);
      struct ureg spot = get_temp(p);
      struct ureg slt = get_temp(p);

      emit_op2(p, OPCODE_DP3, spot, 0, negate(VPpli), spot_dir_norm);
      emit_op2(p, OPCODE_SLT, slt, 0, swizzle1(spot_dir_norm,W), spot);
      emit_op2(p, OPCODE_POW, spot, 0, spot, swizzle1(attenuation, W));
      emit_op2(p, OPCODE_MUL, att, 0, slt, spot);

      release_temp(p, spot);
      release_temp(p, slt);
   }

   /* Calculate distance attenuation:
    */
   if (p->state->unit[i].light_attenuated) {
      /* 1/d,d,d,1/d */
      emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist);
      /* 1,d,d*d,1/d */
      emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y));
      /* 1/dist-atten */
      emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist);

      if (!p->state->unit[i].light_spotcutoff_is_180) {
	 /* dist-atten */
	 emit_op1(p, OPCODE_RCP, dist, 0, dist);
	 /* spot-atten * dist-atten */
	 emit_op2(p, OPCODE_MUL, att, 0, dist, att);
      }
      else {
	 /* dist-atten */
	 emit_op1(p, OPCODE_RCP, att, 0, dist);
      }
   }

   return att;
}
开发者ID:toastpp,项目名称:toastpp,代码行数:50,代码来源:ffvertex_prog.c

示例8: emit_normalize_vec3

static void emit_normalize_vec3( struct tnl_program *p,
				 struct ureg dest,
				 struct ureg src )
{
#if 0
   /* XXX use this when drivers are ready for NRM3 */
   emit_op1(p, OPCODE_NRM3, dest, WRITEMASK_XYZ, src);
#else
   struct ureg tmp = get_temp(p);
   emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src);
   emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp);
   emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X));
   release_temp(p, tmp);
#endif
}
开发者ID:toastpp,项目名称:toastpp,代码行数:15,代码来源:ffvertex_prog.c

示例9: build_fog

static void build_fog( struct tnl_program *p )
{
   struct ureg fog = register_output(p, VERT_RESULT_FOGC);
   struct ureg input;

   if (p->state->fog_source_is_depth) {
      input = get_eye_position_z(p);
   }
   else {
      input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
   }

   /* result.fog = {abs(f),0,0,1}; */
   emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input);
   emit_op1(p, OPCODE_MOV, fog, WRITEMASK_YZW, get_identity_param(p));
}
开发者ID:toastpp,项目名称:toastpp,代码行数:16,代码来源:ffvertex_prog.c

示例10: emit_passthrough

static void emit_passthrough( struct tnl_program *p,
			      GLuint input,
			      GLuint output )
{
   struct ureg out = register_output(p, output);
   emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input));
}
开发者ID:toastpp,项目名称:toastpp,代码行数:7,代码来源:ffvertex_prog.c

示例11: emit_normalize_vec3

static void emit_normalize_vec3( struct tnl_program *p,
				 struct ureg dest,
				 struct ureg src )
{
   emit_op2(p, OPCODE_DP3, dest, WRITEMASK_W, src, src);
   emit_op1(p, OPCODE_RSQ, dest, WRITEMASK_W, swizzle1(dest,W));
   emit_op2(p, OPCODE_MUL, dest, WRITEMASK_XYZ, src, swizzle1(dest,W));
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:8,代码来源:brw_vs_tnl.c

示例12: emit_normalize_vec3

static void emit_normalize_vec3( struct tnl_program *p,
				 struct ureg dest,
				 struct ureg src )
{
   struct ureg tmp = get_temp(p);
   emit_op2(p, OPCODE_DP3, tmp, WRITEMASK_X, src, src);
   emit_op1(p, OPCODE_RSQ, tmp, WRITEMASK_X, tmp);
   emit_op2(p, OPCODE_MUL, dest, 0, src, swizzle1(tmp, X));
   release_temp(p, tmp);
}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:10,代码来源:ffvertex_prog.c

示例13: precalc_lit

static void precalc_lit( struct brw_wm_compile *c,
			 struct brw_fp_dst dst,
			 struct brw_fp_src src0 )
{
   if (dst.writemask & BRW_WRITEMASK_XW) {
      /* dst.xw = imm(1.0f)
       */
      emit_op1(c,
	       TGSI_OPCODE_MOV,
	       dst_saturate(dst_mask(dst, BRW_WRITEMASK_XW), 0),
	       src_imm1f(c, 1.0f));
   }

   if (dst.writemask & BRW_WRITEMASK_YZ) {
      emit_op1(c,
	       TGSI_OPCODE_LIT,
	       dst_mask(dst, BRW_WRITEMASK_YZ),
	       src0);
   }
}
开发者ID:nikai3d,项目名称:mesa,代码行数:20,代码来源:brw_wm_fp.c

示例14: make_temp

static struct ureg make_temp( struct tnl_program *p, struct ureg reg )
{
   if (reg.file == PROGRAM_TEMPORARY &&
       !(p->temp_reserved & (1<<reg.idx)))
      return reg;
   else {
      struct ureg temp = get_temp(p);
      emit_op1(p, OPCODE_MOV, temp, 0, reg);
      return temp;
   }
}
开发者ID:toastpp,项目名称:toastpp,代码行数:11,代码来源:ffvertex_prog.c

示例15: build_fog

static void build_fog( struct tnl_program *p )
{
   struct ureg fog = register_output(p, VARYING_SLOT_FOGC);
   struct ureg input;

   if (p->state->fog_source_is_depth) {

      switch (p->state->fog_distance_mode) {
      case FDM_EYE_RADIAL: /* Z = sqrt(Xe*Xe + Ye*Ye + Ze*Ze) */
	input = get_eye_position(p);
	emit_op2(p, OPCODE_DP3, fog, WRITEMASK_X, input, input);
	emit_op1(p, OPCODE_RSQ, fog, WRITEMASK_X, fog);
	emit_op1(p, OPCODE_RCP, fog, WRITEMASK_X, fog);
	break;
      case FDM_EYE_PLANE: /* Z = Ze */
	input = get_eye_position_z(p);
	emit_op1(p, OPCODE_MOV, fog, WRITEMASK_X, input);
	break;
      case FDM_EYE_PLANE_ABS: /* Z = abs(Ze) */
	input = get_eye_position_z(p);
	emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input);
	break;
      default: assert(0); break; /* can't happen */
      }

   }
   else {
      input = swizzle1(register_input(p, VERT_ATTRIB_FOG), X);
      emit_op1(p, OPCODE_ABS, fog, WRITEMASK_X, input);
   }

   emit_op1(p, OPCODE_MOV, fog, WRITEMASK_YZW, get_identity_param(p));
}
开发者ID:CSRedRat,项目名称:mesa-1,代码行数:33,代码来源:ffvertex_prog.c


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