• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ emit_op2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了emit_op2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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


示例5: emit_matrix_transform_vec3

static void emit_matrix_transform_vec3( struct tnl_program *p,
					struct ureg dest,
					const struct ureg *mat,
					struct ureg src)
{
   emit_op2(p, OPCODE_DP3, dest, WRITEMASK_X, src, mat[0]);
   emit_op2(p, OPCODE_DP3, dest, WRITEMASK_Y, src, mat[1]);
   emit_op2(p, OPCODE_DP3, dest, WRITEMASK_Z, src, mat[2]);
}
开发者ID:toastpp,项目名称:toastpp,代码行数:9,代码来源: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;
   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


示例7: 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


示例8: 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


示例9: 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


示例10: get_eye_normal

static struct ureg get_eye_normal( struct tnl_program *p )
{
   if (is_undef(p->eye_normal)) {
      struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
      struct ureg mvinv[3];

      register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2,
			      STATE_MATRIX_INVTRANS, mvinv );

      p->eye_normal = reserve_temp(p);

      /* Transform to eye space:
       */
      emit_matrix_transform_vec3( p, p->eye_normal, mvinv, normal );

      /* Normalize/Rescale:
       */
      if (p->state->normalize) {
	 emit_normalize_vec3( p, p->eye_normal, p->eye_normal );
      }
      else if (p->state->rescale_normals) {
	 struct ureg rescale = register_param2(p, STATE_INTERNAL,
					       STATE_NORMAL_SCALE);

	 emit_op2( p, OPCODE_MUL, p->eye_normal, 0, p->eye_normal, 
		   swizzle1(rescale, X));
      }
   }

   return p->eye_normal;
}
开发者ID:astrofimov,项目名称:vgallium,代码行数:31,代码来源:brw_vs_tnl.c


示例11: 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


示例12: build_reflect_texgen

static void build_reflect_texgen( struct tnl_program *p,
				  struct ureg dest,
				  GLuint writemask )
{
   struct ureg normal = get_transformed_normal(p);
   struct ureg eye_hat = get_eye_position_normalized(p);
   struct ureg tmp = get_temp(p);

   /* n.u */
   emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
   /* 2n.u */
   emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
   /* (-2n.u)n + u */
   emit_op3(p, OPCODE_MAD, dest, writemask, negate(tmp), normal, eye_hat);

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


示例13: emit_degenerate_lit

/**
 * Compute:
 *   lit.y = MAX(0, dots.x)
 *   lit.z = SLT(0, dots.x)
 */
static void emit_degenerate_lit( struct tnl_program *p,
                                 struct ureg lit,
                                 struct ureg dots )
{
   struct ureg id = get_identity_param(p);  /* id = {0,0,0,1} */

   /* Note that lit.x & lit.w will not be examined.  Note also that
    * dots.xyzw == dots.xxxx.
    */

   /* MAX lit, id, dots;
    */
   emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, id, dots);

   /* result[2] = (in > 0 ? 1 : 0)
    * SLT lit.z, id.z, dots;   # lit.z = (0 < dots.z) ? 1 : 0
    */
   emit_op2(p, OPCODE_SLT, lit, WRITEMASK_Z, swizzle1(id,Z), dots);
}
开发者ID:toastpp,项目名称:toastpp,代码行数:24,代码来源:ffvertex_prog.c


示例14: 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


示例15: build_sphere_texgen

static void build_sphere_texgen( struct tnl_program *p,
				 struct ureg dest,
				 GLuint writemask )
{
   struct ureg normal = get_transformed_normal(p);
   struct ureg eye_hat = get_eye_position_normalized(p);
   struct ureg tmp = get_temp(p);
   struct ureg half = register_scalar_const(p, .5);
   struct ureg r = get_temp(p);
   struct ureg inv_m = get_temp(p);
   struct ureg id = get_identity_param(p);

   /* Could share the above calculations, but it would be
    * a fairly odd state for someone to set (both sphere and
    * reflection active for different texture coordinate
    * components.  Of course - if two texture units enable
    * reflect and/or sphere, things start to tilt in favour
    * of seperating this out:
    */

   /* n.u */
   emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
   /* 2n.u */
   emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
   /* (-2n.u)n + u */
   emit_op3(p, OPCODE_MAD, r, 0, negate(tmp), normal, eye_hat);
   /* r + 0,0,1 */
   emit_op2(p, OPCODE_ADD, tmp, 0, r, swizzle(id,X,Y,W,Z));
   /* rx^2 + ry^2 + (rz+1)^2 */
   emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp);
   /* 2/m */
   emit_op1(p, OPCODE_RSQ, tmp, 0, tmp);
   /* 1/m */
   emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half);
   /* r/m + 1/2 */
   emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half);

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


示例16: get_lightprod

static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
				  GLuint side, GLuint property )
{
   GLuint attrib = material_attrib(side, property);
   if (p->materials & (1<<attrib)) {
      struct ureg light_value =
	 register_param3(p, STATE_LIGHT, light, property);
      struct ureg material_value = get_material(p, side, property);
      struct ureg tmp = get_temp(p);
      emit_op2(p, OPCODE_MUL, tmp, 0, light_value, material_value);
      return tmp;
   }
   else
      return register_param4(p, STATE_LIGHTPROD, light, side, property);
}
开发者ID:toastpp,项目名称:toastpp,代码行数:15,代码来源:ffvertex_prog.c


示例17: 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


示例18: get_transformed_normal

static struct ureg get_transformed_normal( struct tnl_program *p )
{
   if (is_undef(p->transformed_normal) &&
       !p->state->need_eye_coords &&
       !p->state->normalize &&
       !(p->state->need_eye_coords == p->state->rescale_normals))
   {
      p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL );
   }
   else if (is_undef(p->transformed_normal))
   {
      struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
      struct ureg mvinv[3];
      struct ureg transformed_normal = reserve_temp(p);

      if (p->state->need_eye_coords) {
         register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 2,
                                 STATE_MATRIX_INVTRANS, mvinv );

         /* Transform to eye space:
          */
         emit_matrix_transform_vec3( p, transformed_normal, mvinv, normal );
         normal = transformed_normal;
      }

      /* Normalize/Rescale:
       */
      if (p->state->normalize) {
	 emit_normalize_vec3( p, transformed_normal, normal );
         normal = transformed_normal;
      }
      else if (p->state->need_eye_coords == p->state->rescale_normals) {
         /* This is already adjusted for eye/non-eye rendering:
          */
	 struct ureg rescale = register_param2(p, STATE_INTERNAL,
                                               STATE_NORMAL_SCALE);

	 emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale );
         normal = transformed_normal;
      }

      assert(normal.file == PROGRAM_TEMPORARY);
      p->transformed_normal = normal;
   }

   return p->transformed_normal;
}
开发者ID:toastpp,项目名称:toastpp,代码行数:47,代码来源:ffvertex_prog.c


示例19: get_eye_position_z

static struct ureg get_eye_position_z( struct tnl_program *p )
{
   if (!is_undef(p->eye_position))
      return swizzle1(p->eye_position, Z);

   if (is_undef(p->eye_position_z)) {
      struct ureg pos = register_input( p, VERT_ATTRIB_POS );
      struct ureg modelview[4];

      p->eye_position_z = reserve_temp(p);

      register_matrix_param5( p, STATE_MODELVIEW_MATRIX, 0, 0, 3,
                              0, modelview );

      emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]);
   }

   return p->eye_position_z;
}
开发者ID:toastpp,项目名称:toastpp,代码行数:19,代码来源:ffvertex_prog.c


示例20: precalc_txp

/**
 * Emit code for TXP.
 */
static void precalc_txp( struct brw_wm_compile *c,
			 struct brw_fp_dst dst,
			 unsigned target,
			 unsigned unit,
			 struct brw_fp_src src0,
                         struct brw_fp_src sampler )
{
   if (projtex(c, target, src0)) {
      struct brw_fp_dst tmp = get_temp(c);

      /* tmp0.w = RCP inst.arg[0][3]
       */
      emit_op1(c,
	      TGSI_OPCODE_RCP,
	      dst_mask(tmp, BRW_WRITEMASK_W),
	      src_scalar(src0, W));

      /* tmp0.xyz =  MUL inst.arg[0], tmp0.wwww
       */
      emit_op2(c,
	       TGSI_OPCODE_MUL,
	       dst_mask(tmp, BRW_WRITEMASK_XYZ),
	       src0,
	       src_scalar(src_reg_from_dst(tmp), W));

      /* dst = TEX tmp0
       */
      precalc_tex(c, 
		  dst,
		  target,
		  unit,
		  src_reg_from_dst(tmp),
                  sampler );

      release_temp(c, tmp);
   }
   else
   {
      /* dst = TEX src0
       */
      precalc_tex(c, dst, target, unit, src0, sampler);
   }
}
开发者ID:nikai3d,项目名称:mesa,代码行数:46,代码来源:brw_wm_fp.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ emit_signal函数代码示例发布时间:2022-05-30
下一篇:
C++ emit_op1函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap