本文整理汇总了C++中emit_op1函数的典型用法代码示例。如果您正苦于以下问题:C++ emit_op1函数的具体用法?C++ emit_op1怎么用?C++ emit_op1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emit_op1函数的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: 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
示例16: precalc_dst
/***********************************************************************
* Expand various instructions here to simpler forms.
*/
static void precalc_dst( struct brw_wm_compile *c,
struct brw_fp_dst dst,
struct brw_fp_src src0,
struct brw_fp_src src1 )
{
if (dst.writemask & BRW_WRITEMASK_Y) {
/* dst.y = mul src0.y, src1.y
*/
emit_op2(c,
TGSI_OPCODE_MUL,
dst_mask(dst, BRW_WRITEMASK_Y),
src0,
src1);
}
if (dst.writemask & BRW_WRITEMASK_XZ) {
/* dst.z = mov src0.zzzz
*/
emit_op1(c,
TGSI_OPCODE_MOV,
dst_mask(dst, BRW_WRITEMASK_Z),
src_scalar(src0, Z));
/* dst.x = imm1f(1.0)
*/
emit_op1(c,
TGSI_OPCODE_MOV,
dst_saturate(dst_mask(dst, BRW_WRITEMASK_X), 0),
src_imm1f(c, 1.0));
}
if (dst.writemask & BRW_WRITEMASK_W) {
/* dst.w = mov src1.w
*/
emit_op1(c,
TGSI_OPCODE_MOV,
dst_mask(dst, BRW_WRITEMASK_W),
src1);
}
}
开发者ID:nikai3d,项目名称:mesa,代码行数:42,代码来源:brw_wm_fp.c
示例17: 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
示例18: build_tnl_program
static void build_tnl_program( struct tnl_program *p )
{
/* Emit the program, starting with modelviewproject:
*/
build_hpos(p);
/* Lighting calculations:
*/
if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) {
if (p->state->light_global_enabled)
build_lighting(p);
else {
if (p->state->fragprog_inputs_read & FRAG_BIT_COL0)
emit_passthrough(p, VERT_ATTRIB_COLOR0, VERT_RESULT_COL0);
if (p->state->fragprog_inputs_read & FRAG_BIT_COL1)
emit_passthrough(p, VERT_ATTRIB_COLOR1, VERT_RESULT_COL1);
}
}
if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC)
build_fog(p);
if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY)
build_texture_transform(p);
if (p->state->point_attenuated)
build_atten_pointsize(p);
else if (p->state->point_array)
build_array_pointsize(p);
/* Finish up:
*/
emit_op1(p, OPCODE_END, undef, 0, undef);
/* Disassemble:
*/
if (DISASSEM) {
_mesa_printf ("\n");
}
}
开发者ID:toastpp,项目名称:toastpp,代码行数:41,代码来源:ffvertex_prog.c
示例19: 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
示例20: get_pixel_xy
static struct brw_fp_src get_pixel_xy( struct brw_wm_compile *c )
{
if (src_is_undef(c->fp_pixel_xy)) {
struct brw_fp_dst pixel_xy = get_temp(c);
struct brw_fp_src payload_r0_depth = src_reg(BRW_FILE_PAYLOAD, PAYLOAD_DEPTH);
/* Emit the out calculations, and hold onto the results. Use
* two instructions as a temporary is required.
*/
/* pixel_xy.xy = PIXELXY payload[0];
*/
emit_op1(c,
WM_PIXELXY,
dst_mask(pixel_xy, BRW_WRITEMASK_XY),
payload_r0_depth);
c->fp_pixel_xy = src_reg_from_dst(pixel_xy);
}
return c->fp_pixel_xy;
}
开发者ID:nikai3d,项目名称:mesa,代码行数:22,代码来源:brw_wm_fp.c
注:本文中的emit_op1函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论