mesa: remove whitespace
This commit is contained in:
parent
cea259f039
commit
6dfb89e4a0
|
@ -1,8 +1,8 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
*
|
||||
* Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
|
@ -10,11 +10,11 @@
|
|||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
|
@ -22,7 +22,7 @@
|
|||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ struct state_key {
|
|||
unsigned light_enabled:1;
|
||||
unsigned light_eyepos3_is_zero:1;
|
||||
unsigned light_spotcutoff_is_180:1;
|
||||
unsigned light_attenuated:1;
|
||||
unsigned light_attenuated:1;
|
||||
unsigned texunit_really_enabled:1;
|
||||
unsigned texmat_enabled:1;
|
||||
unsigned texgen_enabled:4;
|
||||
|
@ -171,7 +171,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
|||
|
||||
if (light->EyePosition[3] == 0.0)
|
||||
key->unit[i].light_eyepos3_is_zero = 1;
|
||||
|
||||
|
||||
if (light->SpotCutoff == 180.0)
|
||||
key->unit[i].light_spotcutoff_is_180 = 1;
|
||||
|
||||
|
@ -215,29 +215,29 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
|||
ctx->Texture._TexMatEnabled ||
|
||||
ctx->Texture._EnabledUnits)
|
||||
key->texture_enabled_global = 1;
|
||||
|
||||
|
||||
for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) {
|
||||
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
|
||||
|
||||
if (texUnit->_ReallyEnabled)
|
||||
key->unit[i].texunit_really_enabled = 1;
|
||||
|
||||
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
|
||||
if (ctx->Texture._TexMatEnabled & ENABLE_TEXMAT(i))
|
||||
key->unit[i].texmat_enabled = 1;
|
||||
|
||||
|
||||
if (texUnit->TexGenEnabled) {
|
||||
key->unit[i].texgen_enabled = 1;
|
||||
|
||||
key->unit[i].texgen_mode0 =
|
||||
|
||||
key->unit[i].texgen_mode0 =
|
||||
translate_texgen( texUnit->TexGenEnabled & (1<<0),
|
||||
texUnit->GenS.Mode );
|
||||
key->unit[i].texgen_mode1 =
|
||||
key->unit[i].texgen_mode1 =
|
||||
translate_texgen( texUnit->TexGenEnabled & (1<<1),
|
||||
texUnit->GenT.Mode );
|
||||
key->unit[i].texgen_mode2 =
|
||||
key->unit[i].texgen_mode2 =
|
||||
translate_texgen( texUnit->TexGenEnabled & (1<<2),
|
||||
texUnit->GenR.Mode );
|
||||
key->unit[i].texgen_mode3 =
|
||||
key->unit[i].texgen_mode3 =
|
||||
translate_texgen( texUnit->TexGenEnabled & (1<<3),
|
||||
texUnit->GenQ.Mode );
|
||||
}
|
||||
|
@ -245,7 +245,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Very useful debugging tool - produces annotated listing of
|
||||
* generated program with line/function references for each
|
||||
* instruction back into this file:
|
||||
|
@ -254,7 +254,7 @@ static void make_state_key( GLcontext *ctx, struct state_key *key )
|
|||
|
||||
|
||||
/* Use uregs to represent registers internally, translate to Mesa's
|
||||
* expected formats on emit.
|
||||
* expected formats on emit.
|
||||
*
|
||||
* NOTE: These are passed by value extensively in this file rather
|
||||
* than as usual by pointer reference. If this disturbs you, try
|
||||
|
@ -280,10 +280,10 @@ struct tnl_program {
|
|||
struct gl_vertex_program *program;
|
||||
GLint max_inst; /** number of instructions allocated for program */
|
||||
GLboolean mvp_with_dp4;
|
||||
|
||||
|
||||
GLuint temp_in_use;
|
||||
GLuint temp_reserved;
|
||||
|
||||
|
||||
struct ureg eye_position;
|
||||
struct ureg eye_position_z;
|
||||
struct ureg eye_position_normalized;
|
||||
|
@ -387,7 +387,7 @@ static void release_temps( struct tnl_program *p )
|
|||
}
|
||||
|
||||
|
||||
static struct ureg register_param5(struct tnl_program *p,
|
||||
static struct ureg register_param5(struct tnl_program *p,
|
||||
GLint s0,
|
||||
GLint s1,
|
||||
GLint s2,
|
||||
|
@ -440,7 +440,7 @@ static struct ureg register_output( struct tnl_program *p, GLuint output )
|
|||
}
|
||||
|
||||
|
||||
static struct ureg register_const4f( struct tnl_program *p,
|
||||
static struct ureg register_const4f( struct tnl_program *p,
|
||||
GLfloat s0,
|
||||
GLfloat s1,
|
||||
GLfloat s2,
|
||||
|
@ -472,7 +472,7 @@ static GLboolean is_undef( struct ureg reg )
|
|||
|
||||
static struct ureg get_identity_param( struct tnl_program *p )
|
||||
{
|
||||
if (is_undef(p->identity))
|
||||
if (is_undef(p->identity))
|
||||
p->identity = register_const4f(p, 0,0,0,1);
|
||||
|
||||
return p->identity;
|
||||
|
@ -491,7 +491,7 @@ static void register_matrix_param5( struct tnl_program *p,
|
|||
/* This is a bit sad as the support is there to pull the whole
|
||||
* matrix out in one go:
|
||||
*/
|
||||
for (i = 0; i <= s3 - s2; i++)
|
||||
for (i = 0; i <= s3 - s2; i++)
|
||||
matrix[i] = register_param5( p, s0, s1, i, i, s4 );
|
||||
}
|
||||
|
||||
|
@ -516,7 +516,7 @@ static void emit_dst( struct prog_dst_register *dst,
|
|||
dst->File = reg.file;
|
||||
dst->Index = reg.idx;
|
||||
/* allow zero as a shorthand for xyzw */
|
||||
dst->WriteMask = mask ? mask : WRITEMASK_XYZW;
|
||||
dst->WriteMask = mask ? mask : WRITEMASK_XYZW;
|
||||
dst->CondMask = COND_TR; /* always pass cond test */
|
||||
dst->CondSwizzle = SWIZZLE_NOOP;
|
||||
dst->CondSrc = 0;
|
||||
|
@ -531,12 +531,12 @@ static void debug_insn( struct prog_instruction *inst, const char *fn,
|
|||
{
|
||||
if (DISASSEM) {
|
||||
static const char *last_fn;
|
||||
|
||||
|
||||
if (fn != last_fn) {
|
||||
last_fn = fn;
|
||||
_mesa_printf("%s:\n", fn);
|
||||
}
|
||||
|
||||
|
||||
_mesa_printf("%d:\t", line);
|
||||
_mesa_print_instruction(inst);
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ static void emit_op3fn(struct tnl_program *p,
|
|||
{
|
||||
GLuint nr;
|
||||
struct prog_instruction *inst;
|
||||
|
||||
|
||||
assert((GLint) p->program->Base.NumInstructions <= p->max_inst);
|
||||
|
||||
if (p->program->Base.NumInstructions == p->max_inst) {
|
||||
|
@ -580,16 +580,16 @@ static void emit_op3fn(struct tnl_program *p,
|
|||
|
||||
p->program->Base.Instructions = newInst;
|
||||
}
|
||||
|
||||
|
||||
nr = p->program->Base.NumInstructions++;
|
||||
|
||||
inst = &p->program->Base.Instructions[nr];
|
||||
inst->Opcode = (enum prog_opcode) op;
|
||||
inst->Opcode = (enum prog_opcode) op;
|
||||
inst->Data = 0;
|
||||
|
||||
|
||||
emit_arg( &inst->SrcReg[0], src0 );
|
||||
emit_arg( &inst->SrcReg[1], src1 );
|
||||
emit_arg( &inst->SrcReg[2], src2 );
|
||||
emit_arg( &inst->SrcReg[2], src2 );
|
||||
|
||||
emit_dst( &inst->DstReg, dest, mask );
|
||||
|
||||
|
@ -609,7 +609,7 @@ static void emit_op3fn(struct tnl_program *p,
|
|||
|
||||
static struct ureg make_temp( struct tnl_program *p, struct ureg reg )
|
||||
{
|
||||
if (reg.file == PROGRAM_TEMPORARY &&
|
||||
if (reg.file == PROGRAM_TEMPORARY &&
|
||||
!(p->temp_reserved & (1<<reg.idx)))
|
||||
return reg;
|
||||
else {
|
||||
|
@ -690,19 +690,19 @@ static void emit_normalize_vec3( struct tnl_program *p,
|
|||
}
|
||||
|
||||
|
||||
static void emit_passthrough( struct tnl_program *p,
|
||||
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));
|
||||
emit_op1(p, OPCODE_MOV, out, 0, register_input(p, input));
|
||||
}
|
||||
|
||||
|
||||
static struct ureg get_eye_position( struct tnl_program *p )
|
||||
{
|
||||
if (is_undef(p->eye_position)) {
|
||||
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
||||
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
||||
struct ureg modelview[4];
|
||||
|
||||
p->eye_position = reserve_temp(p);
|
||||
|
@ -720,18 +720,18 @@ static struct ureg get_eye_position( struct tnl_program *p )
|
|||
emit_transpose_matrix_transform_vec4(p, p->eye_position, modelview, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return p->eye_position;
|
||||
}
|
||||
|
||||
|
||||
static struct ureg get_eye_position_z( struct tnl_program *p )
|
||||
{
|
||||
if (!is_undef(p->eye_position))
|
||||
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 pos = register_input( p, VERT_ATTRIB_POS );
|
||||
struct ureg modelview[4];
|
||||
|
||||
p->eye_position_z = reserve_temp(p);
|
||||
|
@ -741,10 +741,10 @@ static struct ureg get_eye_position_z( struct tnl_program *p )
|
|||
|
||||
emit_op2(p, OPCODE_DP4, p->eye_position_z, 0, pos, modelview[2]);
|
||||
}
|
||||
|
||||
|
||||
return p->eye_position_z;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static struct ureg get_eye_position_normalized( struct tnl_program *p )
|
||||
{
|
||||
|
@ -753,7 +753,7 @@ static struct ureg get_eye_position_normalized( struct tnl_program *p )
|
|||
p->eye_position_normalized = reserve_temp(p);
|
||||
emit_normalize_vec3(p, p->eye_position_normalized, eye);
|
||||
}
|
||||
|
||||
|
||||
return p->eye_position_normalized;
|
||||
}
|
||||
|
||||
|
@ -767,7 +767,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
|
|||
{
|
||||
p->transformed_normal = register_input(p, VERT_ATTRIB_NORMAL );
|
||||
}
|
||||
else if (is_undef(p->transformed_normal))
|
||||
else if (is_undef(p->transformed_normal))
|
||||
{
|
||||
struct ureg normal = register_input(p, VERT_ATTRIB_NORMAL );
|
||||
struct ureg mvinv[3];
|
||||
|
@ -798,7 +798,7 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
|
|||
emit_op2( p, OPCODE_MUL, transformed_normal, 0, normal, rescale );
|
||||
normal = transformed_normal;
|
||||
}
|
||||
|
||||
|
||||
assert(normal.file == PROGRAM_TEMPORARY);
|
||||
p->transformed_normal = normal;
|
||||
}
|
||||
|
@ -809,17 +809,17 @@ static struct ureg get_transformed_normal( struct tnl_program *p )
|
|||
|
||||
static void build_hpos( struct tnl_program *p )
|
||||
{
|
||||
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
||||
struct ureg pos = register_input( p, VERT_ATTRIB_POS );
|
||||
struct ureg hpos = register_output( p, VERT_RESULT_HPOS );
|
||||
struct ureg mvp[4];
|
||||
|
||||
if (p->mvp_with_dp4) {
|
||||
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
||||
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
||||
0, mvp );
|
||||
emit_matrix_transform_vec4( p, hpos, mvp, pos );
|
||||
}
|
||||
else {
|
||||
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
||||
register_matrix_param5( p, STATE_MVP_MATRIX, 0, 0, 3,
|
||||
STATE_MATRIX_TRANSPOSE, mvp );
|
||||
emit_transpose_matrix_transform_vec4( p, hpos, mvp, pos );
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ static void set_material_flags( struct tnl_program *p )
|
|||
}
|
||||
|
||||
|
||||
static struct ureg get_material( struct tnl_program *p, GLuint side,
|
||||
static struct ureg get_material( struct tnl_program *p, GLuint side,
|
||||
GLuint property )
|
||||
{
|
||||
GLuint attrib = material_attrib(side, property);
|
||||
|
@ -890,7 +890,7 @@ static struct ureg get_scenecolor( struct tnl_program *p, GLuint side )
|
|||
struct ureg material_ambient = get_material(p, side, STATE_AMBIENT);
|
||||
struct ureg material_diffuse = get_material(p, side, STATE_DIFFUSE);
|
||||
struct ureg tmp = make_temp(p, material_diffuse);
|
||||
emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient,
|
||||
emit_op3(p, OPCODE_MAD, tmp, WRITEMASK_XYZ, lm_ambient,
|
||||
material_ambient, material_emission);
|
||||
return tmp;
|
||||
}
|
||||
|
@ -899,12 +899,12 @@ static struct ureg get_scenecolor( struct tnl_program *p, GLuint side )
|
|||
}
|
||||
|
||||
|
||||
static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
|
||||
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 =
|
||||
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);
|
||||
|
@ -917,7 +917,7 @@ static struct ureg get_lightprod( struct tnl_program *p, GLuint light,
|
|||
|
||||
|
||||
static struct ureg calculate_light_attenuation( struct tnl_program *p,
|
||||
GLuint i,
|
||||
GLuint i,
|
||||
struct ureg VPpli,
|
||||
struct ureg dist )
|
||||
{
|
||||
|
@ -946,27 +946,27 @@ static struct ureg calculate_light_attenuation( struct tnl_program *p,
|
|||
*/
|
||||
if (p->state->unit[i].light_attenuated) {
|
||||
/* 1/d,d,d,1/d */
|
||||
emit_op1(p, OPCODE_RCP, dist, WRITEMASK_YZ, dist);
|
||||
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));
|
||||
emit_op2(p, OPCODE_MUL, dist, WRITEMASK_XZ, dist, swizzle1(dist,Y));
|
||||
/* 1/dist-atten */
|
||||
emit_op2(p, OPCODE_DP3, dist, 0, attenuation, dist);
|
||||
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);
|
||||
emit_op1(p, OPCODE_RCP, dist, 0, dist);
|
||||
/* spot-atten * dist-atten */
|
||||
emit_op2(p, OPCODE_MUL, att, 0, dist, att);
|
||||
emit_op2(p, OPCODE_MUL, att, 0, dist, att);
|
||||
}
|
||||
else {
|
||||
/* dist-atten */
|
||||
emit_op1(p, OPCODE_RCP, att, 0, dist);
|
||||
emit_op1(p, OPCODE_RCP, att, 0, dist);
|
||||
}
|
||||
}
|
||||
|
||||
return att;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Compute:
|
||||
|
@ -985,7 +985,7 @@ static void emit_degenerate_lit( struct tnl_program *p,
|
|||
|
||||
/* MAX lit, id, dots;
|
||||
*/
|
||||
emit_op2(p, OPCODE_MAX, lit, WRITEMASK_XYZW, 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
|
||||
|
@ -1018,10 +1018,10 @@ static void build_lighting( struct tnl_program *p )
|
|||
* dots.w = front.shininess
|
||||
*/
|
||||
|
||||
for (i = 0; i < MAX_LIGHTS; i++)
|
||||
for (i = 0; i < MAX_LIGHTS; i++)
|
||||
if (p->state->unit[i].light_enabled)
|
||||
nr_lights++;
|
||||
|
||||
|
||||
set_material_flags(p);
|
||||
|
||||
{
|
||||
|
@ -1044,7 +1044,7 @@ static void build_lighting( struct tnl_program *p )
|
|||
* The negation will be un-done later in the back-face code below.
|
||||
*/
|
||||
struct ureg shininess = get_material(p, 1, STATE_SHININESS);
|
||||
emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
|
||||
emit_op1(p, OPCODE_MOV, dots, WRITEMASK_Z,
|
||||
negate(swizzle1(shininess,X)));
|
||||
release_temp(p, shininess);
|
||||
}
|
||||
|
@ -1072,12 +1072,12 @@ static void build_lighting( struct tnl_program *p )
|
|||
struct ureg res0 = register_output( p, VERT_RESULT_BFC0 );
|
||||
emit_op1(p, OPCODE_MOV, res0, 0, _bfc0);
|
||||
}
|
||||
|
||||
|
||||
if (twoside && separate) {
|
||||
struct ureg res1 = register_output( p, VERT_RESULT_BFC1 );
|
||||
emit_op1(p, OPCODE_MOV, res1, 0, _bfc1);
|
||||
}
|
||||
|
||||
|
||||
if (nr_lights == 0) {
|
||||
release_temps(p);
|
||||
return;
|
||||
|
@ -1087,16 +1087,16 @@ static void build_lighting( struct tnl_program *p )
|
|||
if (p->state->unit[i].light_enabled) {
|
||||
struct ureg half = undef;
|
||||
struct ureg att = undef, VPpli = undef;
|
||||
|
||||
|
||||
count++;
|
||||
|
||||
if (p->state->unit[i].light_eyepos3_is_zero) {
|
||||
/* Can used precomputed constants in this case.
|
||||
* Attenuation never applies to infinite lights.
|
||||
*/
|
||||
VPpli = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_POSITION_NORMALIZED, i);
|
||||
|
||||
VPpli = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_POSITION_NORMALIZED, i);
|
||||
|
||||
if (!p->state->material_shininess_is_zero) {
|
||||
if (p->state->light_local_viewer) {
|
||||
struct ureg eye_hat = get_eye_position_normalized(p);
|
||||
|
@ -1105,22 +1105,22 @@ static void build_lighting( struct tnl_program *p )
|
|||
emit_normalize_vec3(p, half, half);
|
||||
}
|
||||
else {
|
||||
half = register_param3(p, STATE_INTERNAL,
|
||||
half = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_HALF_VECTOR, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
struct ureg Ppli = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_POSITION, i);
|
||||
struct ureg Ppli = register_param3(p, STATE_INTERNAL,
|
||||
STATE_LIGHT_POSITION, i);
|
||||
struct ureg V = get_eye_position(p);
|
||||
struct ureg dist = get_temp(p);
|
||||
|
||||
VPpli = get_temp(p);
|
||||
|
||||
VPpli = get_temp(p);
|
||||
|
||||
/* Calculate VPpli vector
|
||||
*/
|
||||
emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V);
|
||||
emit_op2(p, OPCODE_SUB, VPpli, 0, Ppli, V);
|
||||
|
||||
/* Normalize VPpli. The dist value also used in
|
||||
* attenuation below.
|
||||
|
@ -1130,7 +1130,7 @@ static void build_lighting( struct tnl_program *p )
|
|||
emit_op2(p, OPCODE_MUL, VPpli, 0, VPpli, dist);
|
||||
|
||||
/* Calculate attenuation:
|
||||
*/
|
||||
*/
|
||||
if (!p->state->unit[i].light_spotcutoff_is_180 ||
|
||||
p->state->unit[i].light_attenuated) {
|
||||
att = calculate_light_attenuation(p, i, VPpli, dist);
|
||||
|
@ -1146,7 +1146,7 @@ static void build_lighting( struct tnl_program *p )
|
|||
emit_op2(p, OPCODE_SUB, half, 0, VPpli, eye_hat);
|
||||
}
|
||||
else {
|
||||
struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
|
||||
struct ureg z_dir = swizzle(get_identity_param(p),X,Y,W,Z);
|
||||
emit_op2(p, OPCODE_ADD, half, 0, VPpli, z_dir);
|
||||
}
|
||||
|
||||
|
@ -1215,7 +1215,7 @@ static void build_lighting( struct tnl_program *p )
|
|||
|
||||
emit_op3(p, OPCODE_MAD, res0, mask0, swizzle1(lit,Y), diffuse, _col0);
|
||||
emit_op3(p, OPCODE_MAD, res1, mask1, swizzle1(lit,Z), specular, _col1);
|
||||
|
||||
|
||||
release_temp(p, ambient);
|
||||
release_temp(p, diffuse);
|
||||
release_temp(p, specular);
|
||||
|
@ -1229,7 +1229,7 @@ static void build_lighting( struct tnl_program *p )
|
|||
struct ureg specular = get_lightprod(p, i, 1, STATE_SPECULAR);
|
||||
struct ureg res0, res1;
|
||||
GLuint mask0, mask1;
|
||||
|
||||
|
||||
if (count == nr_lights) {
|
||||
if (separate) {
|
||||
mask0 = WRITEMASK_XYZ;
|
||||
|
@ -1319,9 +1319,9 @@ static void build_reflect_texgen( struct tnl_program *p,
|
|||
struct ureg tmp = get_temp(p);
|
||||
|
||||
/* n.u */
|
||||
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
||||
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
||||
/* 2n.u */
|
||||
emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
|
||||
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);
|
||||
|
||||
|
@ -1350,22 +1350,22 @@ static void build_sphere_texgen( struct tnl_program *p,
|
|||
*/
|
||||
|
||||
/* n.u */
|
||||
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
||||
emit_op2(p, OPCODE_DP3, tmp, 0, normal, eye_hat);
|
||||
/* 2n.u */
|
||||
emit_op2(p, OPCODE_ADD, tmp, 0, tmp, tmp);
|
||||
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);
|
||||
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));
|
||||
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);
|
||||
emit_op2(p, OPCODE_DP3, tmp, 0, tmp, tmp);
|
||||
/* 2/m */
|
||||
emit_op1(p, OPCODE_RSQ, tmp, 0, tmp);
|
||||
emit_op1(p, OPCODE_RSQ, tmp, 0, tmp);
|
||||
/* 1/m */
|
||||
emit_op2(p, OPCODE_MUL, inv_m, 0, tmp, half);
|
||||
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);
|
||||
|
||||
emit_op3(p, OPCODE_MAD, dest, writemask, r, inv_m, half);
|
||||
|
||||
release_temp(p, tmp);
|
||||
release_temp(p, r);
|
||||
release_temp(p, inv_m);
|
||||
|
@ -1380,10 +1380,10 @@ static void build_texture_transform( struct tnl_program *p )
|
|||
|
||||
if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i)))
|
||||
continue;
|
||||
|
||||
if (p->state->unit[i].texgen_enabled ||
|
||||
|
||||
if (p->state->unit[i].texgen_enabled ||
|
||||
p->state->unit[i].texmat_enabled) {
|
||||
|
||||
|
||||
GLuint texmat_enabled = p->state->unit[i].texmat_enabled;
|
||||
struct ureg out = register_output(p, VERT_RESULT_TEX0 + i);
|
||||
struct ureg out_texgen = undef;
|
||||
|
@ -1394,8 +1394,8 @@ static void build_texture_transform( struct tnl_program *p )
|
|||
GLuint reflect_mask = 0;
|
||||
GLuint normal_mask = 0;
|
||||
GLuint modes[4];
|
||||
|
||||
if (texmat_enabled)
|
||||
|
||||
if (texmat_enabled)
|
||||
out_texgen = get_temp(p);
|
||||
else
|
||||
out_texgen = out;
|
||||
|
@ -1409,31 +1409,31 @@ static void build_texture_transform( struct tnl_program *p )
|
|||
switch (modes[j]) {
|
||||
case TXG_OBJ_LINEAR: {
|
||||
struct ureg obj = register_input(p, VERT_ATTRIB_POS);
|
||||
struct ureg plane =
|
||||
struct ureg plane =
|
||||
register_param3(p, STATE_TEXGEN, i,
|
||||
STATE_TEXGEN_OBJECT_S + j);
|
||||
|
||||
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
||||
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
||||
obj, plane );
|
||||
break;
|
||||
}
|
||||
case TXG_EYE_LINEAR: {
|
||||
struct ureg eye = get_eye_position(p);
|
||||
struct ureg plane =
|
||||
register_param3(p, STATE_TEXGEN, i,
|
||||
struct ureg plane =
|
||||
register_param3(p, STATE_TEXGEN, i,
|
||||
STATE_TEXGEN_EYE_S + j);
|
||||
|
||||
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
||||
emit_op2(p, OPCODE_DP4, out_texgen, WRITEMASK_X << j,
|
||||
eye, plane );
|
||||
break;
|
||||
}
|
||||
case TXG_SPHERE_MAP:
|
||||
case TXG_SPHERE_MAP:
|
||||
sphere_mask |= WRITEMASK_X << j;
|
||||
break;
|
||||
case TXG_REFLECTION_MAP:
|
||||
reflect_mask |= WRITEMASK_X << j;
|
||||
break;
|
||||
case TXG_NORMAL_MAP:
|
||||
case TXG_NORMAL_MAP:
|
||||
normal_mask |= WRITEMASK_X << j;
|
||||
break;
|
||||
case TXG_NONE:
|
||||
|
@ -1462,8 +1462,8 @@ static void build_texture_transform( struct tnl_program *p )
|
|||
|
||||
if (texmat_enabled) {
|
||||
struct ureg texmat[4];
|
||||
struct ureg in = (!is_undef(out_texgen) ?
|
||||
out_texgen :
|
||||
struct ureg in = (!is_undef(out_texgen) ?
|
||||
out_texgen :
|
||||
register_input(p, VERT_ATTRIB_TEX0+i));
|
||||
if (p->mvp_with_dp4) {
|
||||
register_matrix_param5( p, STATE_TEXTURE_MATRIX, i, 0, 3,
|
||||
|
@ -1596,7 +1596,7 @@ create_new_program( const struct state_key *key,
|
|||
p.identity = undef;
|
||||
p.temp_in_use = 0;
|
||||
p.mvp_with_dp4 = mvp_with_dp4;
|
||||
|
||||
|
||||
if (max_temps >= sizeof(int) * 8)
|
||||
p.temp_reserved = 0;
|
||||
else
|
||||
|
@ -1639,14 +1639,14 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx)
|
|||
*/
|
||||
prog = (struct gl_vertex_program *)
|
||||
_mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key));
|
||||
|
||||
|
||||
if (!prog) {
|
||||
/* OK, we'll have to build a new one */
|
||||
if (0)
|
||||
_mesa_printf("Build new TNL program\n");
|
||||
|
||||
|
||||
prog = (struct gl_vertex_program *)
|
||||
ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
|
||||
ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
|
||||
if (!prog)
|
||||
return NULL;
|
||||
|
||||
|
@ -1656,7 +1656,7 @@ _mesa_get_fixed_func_vertex_program(GLcontext *ctx)
|
|||
|
||||
#if 0
|
||||
if (ctx->Driver.ProgramStringNotify)
|
||||
ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
|
||||
ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
|
||||
&prog->Base );
|
||||
#endif
|
||||
_mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache,
|
||||
|
|
Loading…
Reference in New Issue