diff options
Diffstat (limited to 'src')
72 files changed, 728 insertions, 791 deletions
diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 531effd6a32..b0c7a203548 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -52,13 +52,13 @@ static const builtin_variable builtin_core_vs_variables[] = { }; static const builtin_variable builtin_core_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_shader_in, VARYING_SLOT_POS, "vec4", "gl_FragCoord" }, + { ir_var_shader_in, VARYING_SLOT_FACE, "bool", "gl_FrontFacing" }, { ir_var_shader_out, FRAG_RESULT_COLOR, "vec4", "gl_FragColor" }, }; static const builtin_variable builtin_100ES_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_300ES_vs_variables[] = { @@ -66,10 +66,10 @@ static const builtin_variable builtin_300ES_vs_variables[] = { }; static const builtin_variable builtin_300ES_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_WPOS, "vec4", "gl_FragCoord" }, - { ir_var_shader_in, FRAG_ATTRIB_FACE, "bool", "gl_FrontFacing" }, + { ir_var_shader_in, VARYING_SLOT_POS, "vec4", "gl_FragCoord" }, + { ir_var_shader_in, VARYING_SLOT_FACE, "bool", "gl_FrontFacing" }, { ir_var_shader_out, FRAG_RESULT_DEPTH, "float", "gl_FragDepth" }, - { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_110_fs_variables[] = { @@ -77,9 +77,9 @@ static const builtin_variable builtin_110_fs_variables[] = { }; static const builtin_variable builtin_110_deprecated_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_COL0, "vec4", "gl_Color" }, - { ir_var_shader_in, FRAG_ATTRIB_COL1, "vec4", "gl_SecondaryColor" }, - { ir_var_shader_in, FRAG_ATTRIB_FOGC, "float", "gl_FogFragCoord" }, + { ir_var_shader_in, VARYING_SLOT_COL0, "vec4", "gl_Color" }, + { ir_var_shader_in, VARYING_SLOT_COL1, "vec4", "gl_SecondaryColor" }, + { ir_var_shader_in, VARYING_SLOT_FOGC, "float", "gl_FogFragCoord" }, }; static const builtin_variable builtin_110_deprecated_vs_variables[] = { @@ -105,7 +105,7 @@ static const builtin_variable builtin_110_deprecated_vs_variables[] = { }; static const builtin_variable builtin_120_fs_variables[] = { - { ir_var_shader_in, FRAG_ATTRIB_PNTC, "vec2", "gl_PointCoord" }, + { ir_var_shader_in, VARYING_SLOT_PNTC, "vec2", "gl_PointCoord" }, }; static const builtin_variable builtin_130_vs_variables[] = { @@ -681,7 +681,7 @@ generate_110_uniforms(exec_list *instructions, glsl_type::get_array_instance(glsl_type::vec4_type, VERT_ATTRIB_MAX); add_uniform(instructions, symtab, "gl_CurrentAttribVertMESA", vert_attribs); const glsl_type *const frag_attribs = - glsl_type::get_array_instance(glsl_type::vec4_type, FRAG_ATTRIB_MAX); + glsl_type::get_array_instance(glsl_type::vec4_type, VARYING_SLOT_MAX); add_uniform(instructions, symtab, "gl_CurrentAttribFragMESA", frag_attribs); } @@ -942,7 +942,7 @@ generate_110_fs_variables(exec_list *instructions, add_variable(instructions, state->symbols, "gl_TexCoord", vec4_array_type, ir_var_shader_in, - FRAG_ATTRIB_TEX0); + VARYING_SLOT_TEX0); generate_ARB_draw_buffers_variables(instructions, state, false, fragment_shader); @@ -1089,7 +1089,7 @@ generate_fs_clipdistance(exec_list *instructions, add_variable(instructions, state->symbols, "gl_ClipDistance", clip_distance_array_type, ir_var_shader_in, - FRAG_ATTRIB_CLIP_DIST0); + VARYING_SLOT_CLIP_DIST0); } static void diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 2eb3af6959c..60ef8b95a60 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -1553,7 +1553,7 @@ ir_variable::determine_interpolation_mode(bool flat_shade) return (glsl_interp_qualifier) this->interpolation; int location = this->location; bool is_gl_Color = - location == FRAG_ATTRIB_COL0 || location == FRAG_ATTRIB_COL1; + location == VARYING_SLOT_COL0 || location == VARYING_SLOT_COL1; if (flat_shade && is_gl_Color) return INTERP_QUALIFIER_FLAT; else diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 4d9e8a7ee0b..bbfec695f73 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -506,7 +506,7 @@ public: * * - Vertex shader input: one of the values from \c gl_vert_attrib. * - Vertex shader output: one of the values from \c gl_varying_slot. - * - Fragment shader input: one of the values from \c gl_frag_attrib. + * - Fragment shader input: one of the values from \c gl_varying_slot. * - Fragment shader output: one of the values from \c gl_frag_result. * - Uniforms: Per-stage uniform slot number for default uniform block. * - Uniforms: Index within the uniform block definition for UBO members. diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp index 4da28e9854c..04c9fdd7cc6 100644 --- a/src/glsl/link_varyings.cpp +++ b/src/glsl/link_varyings.cpp @@ -604,8 +604,8 @@ private: /** * The location which has been assigned for this varying. This is * expressed in multiples of a float, with the first generic varying - * (i.e. the one referred to by VARYING_SLOT_VAR0 or FRAG_ATTRIB_VAR0) - * represented by the value 0. + * (i.e. the one referred to by VARYING_SLOT_VAR0) represented by the + * value 0. */ unsigned generic_location; } *matches; @@ -842,9 +842,9 @@ is_varying_var(GLenum shaderType, const ir_variable *var) if (shaderType == GL_FRAGMENT_SHADER && var->mode == ir_var_shader_in) { switch (var->location) { - case FRAG_ATTRIB_WPOS: - case FRAG_ATTRIB_FACE: - case FRAG_ATTRIB_PNTC: + case VARYING_SLOT_POS: + case VARYING_SLOT_FACE: + case VARYING_SLOT_PNTC: return false; default: return true; @@ -958,9 +958,8 @@ assign_varying_locations(struct gl_context *ctx, unsigned num_tfeedback_decls, tfeedback_decl *tfeedback_decls) { - /* FINISHME: Set dynamically when geometry shader support is added. */ const unsigned producer_base = VARYING_SLOT_VAR0; - const unsigned consumer_base = FRAG_ATTRIB_VAR0; + const unsigned consumer_base = VARYING_SLOT_VAR0; varying_matches matches(ctx->Const.DisableVaryingPacking); hash_table *tfeedback_candidates = hash_table_ctor(0, hash_table_string_hash, hash_table_string_compare); diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp index adcfda8a9d2..29856b08015 100644 --- a/src/glsl/linker.cpp +++ b/src/glsl/linker.cpp @@ -1783,7 +1783,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog) if (prog->_LinkedShaders[MESA_SHADER_FRAGMENT] != NULL) { link_invalidate_variable_locations( prog->_LinkedShaders[MESA_SHADER_FRAGMENT], - FRAG_ATTRIB_VAR0, FRAG_RESULT_DATA0); + VARYING_SLOT_VAR0, FRAG_RESULT_DATA0); } /* FINISHME: The value of the max_attribute_index parameter is diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 23f2f0f9da0..930c2b876bc 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -97,43 +97,43 @@ src_vector(struct i915_fragment_program *p, break; case PROGRAM_INPUT: switch (source->Index) { - case FRAG_ATTRIB_WPOS: + case VARYING_SLOT_POS: src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL); break; - case FRAG_ATTRIB_COL0: + case VARYING_SLOT_COL0: src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL); break; - case FRAG_ATTRIB_COL1: + case VARYING_SLOT_COL1: src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ); src = swizzle(src, X, Y, Z, ONE); break; - case FRAG_ATTRIB_FOGC: + case VARYING_SLOT_FOGC: src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W); src = swizzle(src, W, ZERO, ZERO, ONE); break; - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: + case VARYING_SLOT_TEX0: + case VARYING_SLOT_TEX1: + case VARYING_SLOT_TEX2: + case VARYING_SLOT_TEX3: + case VARYING_SLOT_TEX4: + case VARYING_SLOT_TEX5: + case VARYING_SLOT_TEX6: + case VARYING_SLOT_TEX7: src = i915_emit_decl(p, REG_TYPE_T, - T_TEX0 + (source->Index - FRAG_ATTRIB_TEX0), + T_TEX0 + (source->Index - VARYING_SLOT_TEX0), D0_CHANNEL_ALL); break; - case FRAG_ATTRIB_VAR0: - case FRAG_ATTRIB_VAR0 + 1: - case FRAG_ATTRIB_VAR0 + 2: - case FRAG_ATTRIB_VAR0 + 3: - case FRAG_ATTRIB_VAR0 + 4: - case FRAG_ATTRIB_VAR0 + 5: - case FRAG_ATTRIB_VAR0 + 6: - case FRAG_ATTRIB_VAR0 + 7: + case VARYING_SLOT_VAR0: + case VARYING_SLOT_VAR0 + 1: + case VARYING_SLOT_VAR0 + 2: + case VARYING_SLOT_VAR0 + 3: + case VARYING_SLOT_VAR0 + 4: + case VARYING_SLOT_VAR0 + 5: + case VARYING_SLOT_VAR0 + 6: + case VARYING_SLOT_VAR0 + 7: src = i915_emit_decl(p, REG_TYPE_T, - T_TEX0 + (source->Index - FRAG_ATTRIB_VAR0), + T_TEX0 + (source->Index - VARYING_SLOT_VAR0), D0_CHANNEL_ALL); break; @@ -1152,15 +1152,15 @@ check_wpos(struct i915_fragment_program *p) p->wpos_tex = -1; for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) { - if (inputs & (FRAG_BIT_TEX(i) | FRAG_BIT_VAR(i))) + if (inputs & (VARYING_BIT_TEX(i) | VARYING_BIT_VAR(i))) continue; - else if (inputs & FRAG_BIT_WPOS) { + else if (inputs & VARYING_BIT_POS) { p->wpos_tex = i; - inputs &= ~FRAG_BIT_WPOS; + inputs &= ~VARYING_BIT_POS; } } - if (inputs & FRAG_BIT_WPOS) { + if (inputs & VARYING_BIT_POS) { i915_program_error(p, "No free texcoord for wpos value"); } } @@ -1359,7 +1359,7 @@ i915ValidateFragmentProgram(struct i915_context *i915) intel->coloroffset = 0; intel->specoffset = 0; - if (inputsRead & FRAG_BITS_TEX_ANY || p->wpos_tex != -1) { + if (inputsRead & VARYING_BITS_TEX_ANY || p->wpos_tex != -1) { EMIT_ATTR(_TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, S4_VFMT_XYZW, 16); } else { @@ -1370,22 +1370,22 @@ i915ValidateFragmentProgram(struct i915_context *i915) if (ctx->Point._Attenuated || ctx->VertexProgram.PointSizeEnabled) EMIT_ATTR(_TNL_ATTRIB_POINTSIZE, EMIT_1F, S4_VFMT_POINT_WIDTH, 4); - if (inputsRead & FRAG_BIT_COL0) { + if (inputsRead & VARYING_BIT_COL0) { intel->coloroffset = offset / 4; EMIT_ATTR(_TNL_ATTRIB_COLOR0, EMIT_4UB_4F_BGRA, S4_VFMT_COLOR, 4); } - if (inputsRead & FRAG_BIT_COL1) { + if (inputsRead & VARYING_BIT_COL1) { intel->specoffset = offset / 4; EMIT_ATTR(_TNL_ATTRIB_COLOR1, EMIT_4UB_4F_BGRA, S4_VFMT_SPEC_FOG, 4); } - if ((inputsRead & FRAG_BIT_FOGC)) { + if ((inputsRead & VARYING_BIT_FOGC)) { EMIT_ATTR(_TNL_ATTRIB_FOG, EMIT_1F, S4_VFMT_FOG_PARAM, 4); } for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) { - if (inputsRead & FRAG_BIT_TEX(i)) { + if (inputsRead & VARYING_BIT_TEX(i)) { int sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size; s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK); @@ -1393,7 +1393,7 @@ i915ValidateFragmentProgram(struct i915_context *i915) EMIT_ATTR(_TNL_ATTRIB_TEX0 + i, EMIT_SZ(sz), 0, sz * 4); } - else if (inputsRead & FRAG_BIT_VAR(i)) { + else if (inputsRead & VARYING_BIT_VAR(i)) { int sz = VB->AttribPtr[_TNL_ATTRIB_GENERIC0 + i]->size; s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK); diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index b4557570202..98eac8df089 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -671,7 +671,7 @@ i915_update_sprite_point_enable(struct gl_context *ctx) /* _NEW_POINT */ if (ctx->Point.CoordReplace[i] && ctx->Point.PointSprite) coord_replace_bits |= (1 << i); - if (inputsRead & FRAG_BIT_TEX(i)) + if (inputsRead & VARYING_BIT_TEX(i)) tex_coord_unit_bits |= (1 << i); } diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index 549af5e07aa..b97fc98d945 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -955,7 +955,7 @@ intelChooseRenderState(struct gl_context * ctx) struct intel_context *intel = intel_context(ctx); GLuint flags = ctx->_TriangleCaps; const struct gl_fragment_program *fprog = ctx->FragmentProgram._Current; - bool have_wpos = (fprog && (fprog->Base.InputsRead & FRAG_BIT_WPOS)); + bool have_wpos = (fprog && (fprog->Base.InputsRead & VARYING_BIT_POS)); GLuint index = 0; if (INTEL_DEBUG & DEBUG_STATE) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 3d6a8f5a602..d0f5fea3d32 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -953,7 +953,7 @@ fs_visitor::emit_fragcoord_interpolation(ir_variable *ir) emit(FS_OPCODE_LINTERP, wpos, this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC], this->delta_y[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC], - interp_reg(FRAG_ATTRIB_WPOS, 2)); + interp_reg(VARYING_SLOT_POS, 2)); } wpos.reg_offset++; @@ -1042,8 +1042,8 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) * attribute, as well as making brw_vs_constval.c * handle varyings other than gl_TexCoord. */ - if (location >= FRAG_ATTRIB_TEX0 && - location <= FRAG_ATTRIB_TEX7 && + if (location >= VARYING_SLOT_TEX0 && + location <= VARYING_SLOT_TEX7 && k == 3 && !(c->key.proj_attrib_mask & BITFIELD64_BIT(location))) { emit(BRW_OPCODE_MOV, attr, fs_reg(1.0f)); @@ -1245,14 +1245,14 @@ fs_visitor::assign_curb_setup() void fs_visitor::calculate_urb_setup() { - for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) { urb_setup[i] = -1; } int urb_next = 0; /* Figure out where each of the incoming setup attributes lands. */ if (intel->gen >= 6) { - for (unsigned int i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (unsigned int i = 0; i < VARYING_SLOT_MAX; i++) { if (fp->Base.InputsRead & BITFIELD64_BIT(i)) { urb_setup[i] = urb_next++; } @@ -1283,8 +1283,8 @@ fs_visitor::calculate_urb_setup() * * See compile_sf_prog() for more info. */ - if (fp->Base.InputsRead & BITFIELD64_BIT(FRAG_ATTRIB_PNTC)) - urb_setup[FRAG_ATTRIB_PNTC] = urb_next++; + if (fp->Base.InputsRead & BITFIELD64_BIT(VARYING_SLOT_PNTC)) + urb_setup[VARYING_SLOT_PNTC] = urb_next++; } /* Each attribute is 4 setup channels, each of which is half a reg. */ @@ -2690,7 +2690,7 @@ fs_visitor::setup_payload_gen6() { struct intel_context *intel = &brw->intel; bool uses_depth = - (fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0; + (fp->Base.InputsRead & (1 << VARYING_SLOT_POS)) != 0; unsigned barycentric_interp_modes = c->prog_data.barycentric_interp_modes; assert(intel->gen >= 6); @@ -2989,9 +2989,9 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) key.proj_attrib_mask = ~(GLbitfield64) 0; if (intel->gen < 6) - key.vp_outputs_written |= BITFIELD64_BIT(FRAG_ATTRIB_WPOS); + key.vp_outputs_written |= BITFIELD64_BIT(VARYING_SLOT_POS); - for (int i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (int i = 0; i < VARYING_SLOT_MAX; i++) { if (!(fp->Base.InputsRead & BITFIELD64_BIT(i))) continue; @@ -3017,11 +3017,11 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) } } - if (fp->Base.InputsRead & FRAG_BIT_WPOS) { + if (fp->Base.InputsRead & VARYING_BIT_POS) { key.drawable_height = ctx->DrawBuffer->Height; } - if ((fp->Base.InputsRead & FRAG_BIT_WPOS) || program_uses_dfdy) { + if ((fp->Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) { key.render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); } diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index febd56bfe2e..254a53432c8 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -452,7 +452,7 @@ public: int first_non_payload_grf; /** Either BRW_MAX_GRF or GEN7_MRF_HACK_START */ int max_grf; - int urb_setup[FRAG_ATTRIB_MAX]; + int urb_setup[VARYING_SLOT_MAX]; fs_reg *fp_temp_regs; fs_reg *fp_input_regs; diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp index 3c0ba245536..5f92955bc7b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp @@ -599,8 +599,8 @@ fs_visitor::setup_fp_regs() } } - fp_input_regs = rzalloc_array(mem_ctx, fs_reg, FRAG_ATTRIB_MAX); - for (int i = 0; i < FRAG_ATTRIB_MAX; i++) { + fp_input_regs = rzalloc_array(mem_ctx, fs_reg, VARYING_SLOT_MAX); + for (int i = 0; i < VARYING_SLOT_MAX; i++) { if (fp->Base.InputsRead & BITFIELD64_BIT(i)) { /* Make up a dummy instruction to reuse code for emitting * interpolation. @@ -614,18 +614,18 @@ fs_visitor::setup_fp_regs() i); switch (i) { - case FRAG_ATTRIB_WPOS: + case VARYING_SLOT_POS: ir->pixel_center_integer = fp->PixelCenterInteger; ir->origin_upper_left = fp->OriginUpperLeft; fp_input_regs[i] = *emit_fragcoord_interpolation(ir); break; - case FRAG_ATTRIB_FACE: + case VARYING_SLOT_FACE: fp_input_regs[i] = *emit_frontfacing_interpolation(ir); break; default: fp_input_regs[i] = *emit_general_interpolation(ir); - if (i == FRAG_ATTRIB_FOGC) { + if (i == VARYING_SLOT_FOGC) { emit(MOV(regoffset(fp_input_regs[i], 1), fs_reg(0.0f))); emit(MOV(regoffset(fp_input_regs[i], 2), fs_reg(0.0f))); emit(MOV(regoffset(fp_input_regs[i], 3), fs_reg(1.0f))); diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 92bc621a5bd..735a33d856b 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -2034,7 +2034,7 @@ fs_visitor::emit_interpolation_setup_gen4() emit(FS_OPCODE_LINTERP, wpos_w, this->delta_x[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC], this->delta_y[BRW_WM_PERSPECTIVE_PIXEL_BARYCENTRIC], - interp_reg(FRAG_ATTRIB_WPOS, 3)); + interp_reg(VARYING_SLOT_POS, 3)); /* Compute the pixel 1/W value from wpos.w. */ this->pixel_w = fs_reg(this, glsl_type::float_type); emit_math(SHADER_OPCODE_RCP, this->pixel_w, wpos_w); diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index 1132c9a4c00..fdc6bd741c7 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -181,7 +181,7 @@ brw_upload_sf_prog(struct brw_context *brw) key.point_sprite_coord_replace |= (1 << i); } } - if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(FRAG_ATTRIB_PNTC)) + if (brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(VARYING_SLOT_PNTC)) key.do_point_coord = 1; /* * Window coordinates in a FBO are inverted, which means point diff --git a/src/mesa/drivers/dri/i965/brw_vs_constval.c b/src/mesa/drivers/dri/i965/brw_vs_constval.c index 782f9d734d8..13e8f70e381 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_constval.c +++ b/src/mesa/drivers/dri/i965/brw_vs_constval.c @@ -244,10 +244,10 @@ static void calc_wm_input_sizes( struct brw_context *brw ) if (ctx->Point.PointSprite) { for (int i = 0; i < 8; i++) { if (ctx->Point.CoordReplace[i]) { - t.size_masks[4-1] |= FRAG_BIT_TEX(i); - t.size_masks[3-1] |= FRAG_BIT_TEX(i); - t.size_masks[2-1] |= FRAG_BIT_TEX(i); - t.size_masks[1-1] |= FRAG_BIT_TEX(i); + t.size_masks[4-1] |= VARYING_BIT_TEX(i); + t.size_masks[3-1] |= VARYING_BIT_TEX(i); + t.size_masks[2-1] |= VARYING_BIT_TEX(i); + t.size_masks[1-1] |= VARYING_BIT_TEX(i); } } } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index e9ef5c7f9d5..39cbbb756ff 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -55,18 +55,18 @@ brw_compute_barycentric_interp_modes(struct brw_context *brw, * modes are in use, and set the appropriate bits in * barycentric_interp_modes. */ - for (attr = 0; attr < FRAG_ATTRIB_MAX; ++attr) { + 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 == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1; + 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 == FRAG_ATTRIB_WPOS || attr == FRAG_ATTRIB_FACE) + if (attr == VARYING_SLOT_POS || attr == VARYING_SLOT_FACE) continue; /* Determine the set (or sets) of barycentric coordinates needed to @@ -462,11 +462,11 @@ static void brw_wm_populate_key( struct brw_context *brw, * For DRI2 the origin_x/y will always be (0,0) but we still need the * drawable height in order to invert the Y axis. */ - if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) { + if (fp->program.Base.InputsRead & VARYING_BIT_POS) { key->drawable_height = ctx->DrawBuffer->Height; } - if ((fp->program.Base.InputsRead & FRAG_BIT_WPOS) || program_uses_dfdy) { + if ((fp->program.Base.InputsRead & VARYING_BIT_POS) || program_uses_dfdy) { key->render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_iz.cpp b/src/mesa/drivers/dri/i965/brw_wm_iz.cpp index 2fd1655267b..f1dc5747b5f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_iz.cpp +++ b/src/mesa/drivers/dri/i965/brw_wm_iz.cpp @@ -126,7 +126,7 @@ void fs_visitor::setup_payload_gen4() bool kill_stats_promoted_workaround = false; int lookup = c->key.iz_lookup; bool uses_depth = - (fp->Base.InputsRead & (1 << FRAG_ATTRIB_WPOS)) != 0; + (fp->Base.InputsRead & (1 << VARYING_SLOT_POS)) != 0; assert(lookup < IZ_BIT_MAX); diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index ea2dea92a70..342a0366257 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -150,7 +150,7 @@ brw_upload_wm_unit(struct brw_context *brw) /* BRW_NEW_FRAGMENT_PROGRAM */ wm->wm5.program_uses_depth = (fp->Base.InputsRead & - (1 << FRAG_ATTRIB_WPOS)) != 0; + (1 << VARYING_SLOT_POS)) != 0; wm->wm5.program_computes_depth = (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) != 0; /* _NEW_BUFFERS diff --git a/src/mesa/drivers/dri/i965/gen6_sf_state.c b/src/mesa/drivers/dri/i965/gen6_sf_state.c index 74b232f008c..7fe1dca50c5 100644 --- a/src/mesa/drivers/dri/i965/gen6_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen6_sf_state.c @@ -56,7 +56,7 @@ uint32_t get_attr_override(struct brw_vue_map *vue_map, int urb_entry_read_offset, int fs_attr, bool two_side_color, uint32_t *max_source_attr) { - if (fs_attr == FRAG_ATTRIB_WPOS) { + if (fs_attr == VARYING_SLOT_POS) { /* This attribute will be overwritten by the fragment shader's * interpolation code (see emit_interp() in brw_wm_fp.c), so just let it * reference the first available attribute. @@ -141,7 +141,7 @@ upload_sf_state(struct brw_context *brw) int attr = 0, input_index = 0; int urb_entry_read_offset = 1; float point_size; - uint16_t attr_overrides[FRAG_ATTRIB_MAX]; + uint16_t attr_overrides[VARYING_SLOT_MAX]; uint32_t point_sprite_origin; dw1 = GEN6_SF_SWIZZLE_ENABLE | num_outputs << GEN6_SF_NUM_OUTPUTS_SHIFT; @@ -281,22 +281,22 @@ upload_sf_state(struct brw_context *brw) * they source from. */ uint32_t max_source_attr = 0; - for (; attr < FRAG_ATTRIB_MAX; attr++) { + for (; attr < VARYING_SLOT_MAX; attr++) { enum glsl_interp_qualifier interp_qualifier = brw->fragment_program->InterpQualifier[attr]; - bool is_gl_Color = attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1; + bool is_gl_Color = attr == VARYING_SLOT_COL0 || attr == VARYING_SLOT_COL1; if (!(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr))) continue; /* _NEW_POINT */ if (ctx->Point.PointSprite && - (attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7) && - ctx->Point.CoordReplace[attr - FRAG_ATTRIB_TEX0]) { + (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) && + ctx->Point.CoordReplace[attr - VARYING_SLOT_TEX0]) { dw16 |= (1 << input_index); } - if (attr == FRAG_ATTRIB_PNTC) + if (attr == VARYING_SLOT_PNTC) dw16 |= (1 << input_index); /* flat shading */ @@ -320,7 +320,7 @@ upload_sf_state(struct brw_context *brw) &max_source_attr); } - for (; input_index < FRAG_ATTRIB_MAX; input_index++) + for (; input_index < VARYING_SLOT_MAX; input_index++) attr_overrides[input_index] = 0; /* From the Sandy Bridge PRM, Volume 2, Part 1, documentation for diff --git a/src/mesa/drivers/dri/i965/gen6_wm_state.c b/src/mesa/drivers/dri/i965/gen6_wm_state.c index bd28f97add4..5cc0a61a403 100644 --- a/src/mesa/drivers/dri/i965/gen6_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen6_wm_state.c @@ -171,7 +171,7 @@ upload_wm_state(struct brw_context *brw) dw5 |= GEN6_WM_POLYGON_STIPPLE_ENABLE; /* BRW_NEW_FRAGMENT_PROGRAM */ - if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) + if (fp->program.Base.InputsRead & VARYING_BIT_POS) dw5 |= GEN6_WM_USES_SOURCE_DEPTH | GEN6_WM_USES_SOURCE_W; if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) dw5 |= GEN6_WM_COMPUTED_DEPTH; diff --git a/src/mesa/drivers/dri/i965/gen7_sf_state.c b/src/mesa/drivers/dri/i965/gen7_sf_state.c index 9171eff7e7b..86809a1b0a3 100644 --- a/src/mesa/drivers/dri/i965/gen7_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sf_state.c @@ -42,7 +42,7 @@ upload_sbe_state(struct brw_context *brw) int i; int attr = 0, input_index = 0; int urb_entry_read_offset = 1; - uint16_t attr_overrides[FRAG_ATTRIB_MAX]; + uint16_t attr_overrides[VARYING_SLOT_MAX]; /* _NEW_BUFFERS */ bool render_to_fbo = _mesa_is_user_fbo(ctx->DrawBuffer); uint32_t point_sprite_origin; @@ -70,21 +70,21 @@ upload_sbe_state(struct brw_context *brw) * they source from. */ uint32_t max_source_attr = 0; - for (; attr < FRAG_ATTRIB_MAX; attr++) { + for (; attr < VARYING_SLOT_MAX; attr++) { enum glsl_interp_qualifier interp_qualifier = brw->fragment_program->InterpQualifier[attr]; - bool is_gl_Color = attr == FRAG_ATTRIB_COL0 || attr == FRAG_ATTRIB_COL1; + bool is_gl_Color = attr == VARYING_SLOT_COL0 || attr == VARYING_SLOT_COL1; if (!(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr))) continue; if (ctx->Point.PointSprite && - attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7 && - ctx->Point.CoordReplace[attr - FRAG_ATTRIB_TEX0]) { + attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7 && + ctx->Point.CoordReplace[attr - VARYING_SLOT_TEX0]) { dw10 |= (1 << input_index); } - if (attr == FRAG_ATTRIB_PNTC) + if (attr == VARYING_SLOT_PNTC) dw10 |= (1 << input_index); /* flat shading */ @@ -123,7 +123,7 @@ upload_sbe_state(struct brw_context *brw) dw1 |= urb_entry_read_length << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT | urb_entry_read_offset << GEN7_SBE_URB_ENTRY_READ_OFFSET_SHIFT; - for (; input_index < FRAG_ATTRIB_MAX; input_index++) + for (; input_index < VARYING_SLOT_MAX; input_index++) attr_overrides[input_index] = 0; BEGIN_BATCH(14); diff --git a/src/mesa/drivers/dri/i965/gen7_wm_state.c b/src/mesa/drivers/dri/i965/gen7_wm_state.c index e0c69113ada..b0255513cf4 100644 --- a/src/mesa/drivers/dri/i965/gen7_wm_state.c +++ b/src/mesa/drivers/dri/i965/gen7_wm_state.c @@ -58,7 +58,7 @@ upload_wm_state(struct brw_context *brw) dw1 |= GEN7_WM_POLYGON_STIPPLE_ENABLE; /* BRW_NEW_FRAGMENT_PROGRAM */ - if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) + if (fp->program.Base.InputsRead & VARYING_BIT_POS) dw1 |= GEN7_WM_USES_SOURCE_DEPTH | GEN7_WM_USES_SOURCE_W; if (fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { writes_depth = true; diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index dc2687df242..b3f6390e0aa 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -423,10 +423,10 @@ xor_line(struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1) vert1->color[0], vert1->color[1], vert1->color[2], vert1->color[3], xmesa->pixelformat); - int x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0]; - int y0 = YFLIP(xrb, (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]); - int x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0]; - int y1 = YFLIP(xrb, (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]); + int x0 = (GLint) vert0->attrib[VARYING_SLOT_POS][0]; + int y0 = YFLIP(xrb, (GLint) vert0->attrib[VARYING_SLOT_POS][1]); + int x1 = (GLint) vert1->attrib[VARYING_SLOT_POS][0]; + int y1 = YFLIP(xrb, (GLint) vert1->attrib[VARYING_SLOT_POS][1]); XMesaSetForeground(dpy, gc, pixel); XMesaSetFunction(dpy, gc, GXxor); XSetLineAttributes(dpy, gc, (int) ctx->Line.Width, diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 40950ccc63a..05399342153 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -344,7 +344,6 @@ dummy_enum_func(void) { gl_buffer_index bi = BUFFER_FRONT_LEFT; gl_face_index fi = FACE_POS_X; - gl_frag_attrib fa = FRAG_ATTRIB_WPOS; gl_frag_result fr = FRAG_RESULT_DEPTH; gl_texture_index ti = TEXTURE_2D_ARRAY_INDEX; gl_vert_attrib va = VERT_ATTRIB_POS; @@ -352,7 +351,6 @@ dummy_enum_func(void) (void) bi; (void) fi; - (void) fa; (void) fr; (void) ti; (void) va; @@ -675,7 +673,7 @@ check_context_limits(struct gl_context *ctx) /* check that we don't exceed the size of various bitfields */ assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); - assert(FRAG_ATTRIB_MAX <= + assert(VARYING_SLOT_MAX <= (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); assert(MAX_COMBINED_TEXTURE_IMAGE_UNITS <= 8 * sizeof(GLbitfield)); diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 1aea6e36d60..186988bbd70 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -333,7 +333,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) } else if (ctx->RenderMode == GL_FEEDBACK) { /* _NEW_RENDERMODE */ - fp_inputs = (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + fp_inputs = (VARYING_BIT_COL0 | VARYING_BIT_TEX0); } else if (!(vertexProgram || vertexShader)) { /* Fixed function vertex logic */ @@ -345,33 +345,33 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) */ /* _NEW_POINT */ if (ctx->Point.PointSprite) - varying_inputs |= FRAG_BITS_TEX_ANY; + varying_inputs |= VARYING_BITS_TEX_ANY; /* First look at what values may be computed by the generated * vertex program: */ /* _NEW_LIGHT */ if (ctx->Light.Enabled) { - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (texenv_doing_secondary_color(ctx)) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; } /* _NEW_TEXTURE */ fp_inputs |= (ctx->Texture._TexGenEnabled | - ctx->Texture._TexMatEnabled) << FRAG_ATTRIB_TEX0; + ctx->Texture._TexMatEnabled) << VARYING_SLOT_TEX0; /* Then look at what might be varying as a result of enabled * arrays, etc: */ if (varying_inputs & VERT_BIT_COLOR0) - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (varying_inputs & VERT_BIT_COLOR1) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; fp_inputs |= (((varying_inputs & VERT_BIT_TEX_ANY) >> VERT_ATTRIB_TEX0) - << FRAG_ATTRIB_TEX0); + << VARYING_SLOT_TEX0); } else { @@ -395,15 +395,15 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) */ /* _NEW_POINT */ if (ctx->Point.PointSprite) - vp_outputs |= FRAG_BITS_TEX_ANY; + vp_outputs |= VARYING_BITS_TEX_ANY; if (vp_outputs & (1 << VARYING_SLOT_COL0)) - fp_inputs |= FRAG_BIT_COL0; + fp_inputs |= VARYING_BIT_COL0; if (vp_outputs & (1 << VARYING_SLOT_COL1)) - fp_inputs |= FRAG_BIT_COL1; + fp_inputs |= VARYING_BIT_COL1; fp_inputs |= (((vp_outputs & VARYING_BITS_TEX_ANY) >> VARYING_SLOT_TEX0) - << FRAG_ATTRIB_TEX0); + << VARYING_SLOT_TEX0); } return fp_inputs; @@ -417,7 +417,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx ) static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) { GLuint i, j; - GLbitfield inputs_referenced = FRAG_BIT_COL0; + GLbitfield inputs_referenced = VARYING_BIT_COL0; const GLbitfield inputs_available = get_fp_input_mask( ctx ); GLuint keySize; @@ -440,7 +440,7 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) key->unit[i].enabled = 1; key->enabled_units |= (1<<i); key->nr_enabled_units = i + 1; - inputs_referenced |= FRAG_BIT_TEX(i); + inputs_referenced |= VARYING_BIT_TEX(i); key->unit[i].source_index = translate_tex_src_bit(texUnit->_ReallyEnabled); @@ -482,14 +482,14 @@ static GLuint make_state_key( struct gl_context *ctx, struct state_key *key ) /* _NEW_LIGHT | _NEW_FOG */ if (texenv_doing_secondary_color(ctx)) { key->separate_specular = 1; - inputs_referenced |= FRAG_BIT_COL1; + inputs_referenced |= VARYING_BIT_COL1; } /* _NEW_FOG */ if (ctx->Fog.Enabled) { key->fog_enabled = 1; key->fog_mode = translate_fog_mode(ctx->Fog.Mode); - inputs_referenced |= FRAG_BIT_FOGC; /* maybe */ + inputs_referenced |= VARYING_BIT_FOGC; /* maybe */ } /* _NEW_BUFFERS */ @@ -553,7 +553,7 @@ get_current_attrib(texenv_fragment_program *p, GLuint attrib) static ir_rvalue * get_gl_Color(texenv_fragment_program *p) { - if (p->state->inputs_available & FRAG_BIT_COL0) { + if (p->state->inputs_available & VARYING_BIT_COL0) { ir_variable *var = p->shader->symbols->get_variable("gl_Color"); assert(var); return new(p->mem_ctx) ir_dereference_variable(var); @@ -918,7 +918,7 @@ static void load_texture( texenv_fragment_program *p, GLuint unit ) const GLuint texTarget = p->state->unit[unit].source_index; ir_rvalue *texcoord; - if (!(p->state->inputs_available & (FRAG_BIT_TEX0 << unit))) { + if (!(p->state->inputs_available & (VARYING_BIT_TEX0 << unit))) { texcoord = get_current_attrib(p, VERT_ATTRIB_TEX0 + unit); } else if (p->texcoord_tex[unit]) { texcoord = new(p->mem_ctx) ir_dereference_variable(p->texcoord_tex[unit]); @@ -1253,7 +1253,7 @@ emit_instructions(texenv_fragment_program *p) p->emit(assign(spec_result, cf)); ir_rvalue *secondary; - if (p->state->inputs_available & FRAG_BIT_COL1) { + if (p->state->inputs_available & VARYING_BIT_COL1) { ir_variable *var = p->shader->symbols->get_variable("gl_SecondaryColor"); assert(var); diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 3f08b098469..093bc6651a9 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -165,7 +165,7 @@ static void make_state_key( struct gl_context *ctx, struct state_key *key ) if (ctx->RenderMode == GL_FEEDBACK) { /* make sure the vertprog emits color and tex0 */ - key->fragprog_inputs_read |= (FRAG_BIT_COL0 | FRAG_BIT_TEX0); + key->fragprog_inputs_read |= (VARYING_BIT_COL0 | VARYING_BIT_TEX0); } key->separate_specular = (ctx->Light.Model.ColorControl == @@ -1407,7 +1407,7 @@ static void build_texture_transform( struct tnl_program *p ) for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { - if (!(p->state->fragprog_inputs_read & FRAG_BIT_TEX(i))) + if (!(p->state->fragprog_inputs_read & VARYING_BIT_TEX(i))) continue; if (p->state->unit[i].coord_replace) @@ -1575,22 +1575,22 @@ static void build_tnl_program( struct tnl_program *p ) /* Lighting calculations: */ - if (p->state->fragprog_inputs_read & (FRAG_BIT_COL0|FRAG_BIT_COL1)) { + if (p->state->fragprog_inputs_read & (VARYING_BIT_COL0|VARYING_BIT_COL1)) { if (p->state->light_global_enabled) build_lighting(p); else { - if (p->state->fragprog_inputs_read & FRAG_BIT_COL0) + if (p->state->fragprog_inputs_read & VARYING_BIT_COL0) emit_passthrough(p, VERT_ATTRIB_COLOR0, VARYING_SLOT_COL0); - if (p->state->fragprog_inputs_read & FRAG_BIT_COL1) + if (p->state->fragprog_inputs_read & VARYING_BIT_COL1) emit_passthrough(p, VERT_ATTRIB_COLOR1, VARYING_SLOT_COL1); } } - if (p->state->fragprog_inputs_read & FRAG_BIT_FOGC) + if (p->state->fragprog_inputs_read & VARYING_BIT_FOGC) build_fog(p); - if (p->state->fragprog_inputs_read & FRAG_BITS_TEX_ANY) + if (p->state->fragprog_inputs_read & VARYING_BITS_TEX_ANY) build_texture_transform(p); if (p->state->point_attenuated) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 9c431af74d6..83b6c898466 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -286,32 +286,6 @@ typedef enum /*********************************************/ /** - * Indexes for fragment program input attributes. - */ -typedef enum -{ - FRAG_ATTRIB_WPOS = VARYING_SLOT_POS, - FRAG_ATTRIB_COL0 = VARYING_SLOT_COL0, - FRAG_ATTRIB_COL1 = VARYING_SLOT_COL1, - FRAG_ATTRIB_FOGC = VARYING_SLOT_FOGC, - FRAG_ATTRIB_TEX0 = VARYING_SLOT_TEX0, - FRAG_ATTRIB_TEX1 = VARYING_SLOT_TEX1, - FRAG_ATTRIB_TEX2 = VARYING_SLOT_TEX2, - FRAG_ATTRIB_TEX3 = VARYING_SLOT_TEX3, - FRAG_ATTRIB_TEX4 = VARYING_SLOT_TEX4, - FRAG_ATTRIB_TEX5 = VARYING_SLOT_TEX5, - FRAG_ATTRIB_TEX6 = VARYING_SLOT_TEX6, - FRAG_ATTRIB_TEX7 = VARYING_SLOT_TEX7, - FRAG_ATTRIB_FACE = VARYING_SLOT_FACE, /**< front/back face */ - FRAG_ATTRIB_PNTC = VARYING_SLOT_PNTC, /**< sprite/point coord */ - FRAG_ATTRIB_CLIP_DIST0 = VARYING_SLOT_CLIP_DIST0, - FRAG_ATTRIB_CLIP_DIST1 = VARYING_SLOT_CLIP_DIST1, - FRAG_ATTRIB_VAR0 = VARYING_SLOT_VAR0, /**< shader varying */ - FRAG_ATTRIB_MAX = VARYING_SLOT_MAX -} gl_frag_attrib; - - -/** * Determine if the given gl_varying_slot appears in the fragment shader. */ static inline GLboolean @@ -332,40 +306,6 @@ _mesa_varying_slot_in_fs(gl_varying_slot slot) /** - * Bitflags for fragment program input attributes. - */ -/*@{*/ -#define FRAG_BIT_WPOS (1 << FRAG_ATTRIB_WPOS) -#define FRAG_BIT_COL0 (1 << FRAG_ATTRIB_COL0) -#define FRAG_BIT_COL1 (1 << FRAG_ATTRIB_COL1) -#define FRAG_BIT_FOGC (1 << FRAG_ATTRIB_FOGC) -#define FRAG_BIT_FACE (1 << FRAG_ATTRIB_FACE) -#define FRAG_BIT_PNTC (1 << FRAG_ATTRIB_PNTC) -#define FRAG_BIT_TEX0 (1 << FRAG_ATTRIB_TEX0) -#define FRAG_BIT_TEX1 (1 << FRAG_ATTRIB_TEX1) -#define FRAG_BIT_TEX2 (1 << FRAG_ATTRIB_TEX2) -#define FRAG_BIT_TEX3 (1 << FRAG_ATTRIB_TEX3) -#define FRAG_BIT_TEX4 (1 << FRAG_ATTRIB_TEX4) -#define FRAG_BIT_TEX5 (1 << FRAG_ATTRIB_TEX5) -#define FRAG_BIT_TEX6 (1 << FRAG_ATTRIB_TEX6) -#define FRAG_BIT_TEX7 (1 << FRAG_ATTRIB_TEX7) -#define FRAG_BIT_VAR0 (1 << FRAG_ATTRIB_VAR0) - -#define FRAG_BIT_TEX(U) (FRAG_BIT_TEX0 << (U)) -#define FRAG_BIT_VAR(V) (FRAG_BIT_VAR0 << (V)) - -#define FRAG_BITS_TEX_ANY (FRAG_BIT_TEX0| \ - FRAG_BIT_TEX1| \ - FRAG_BIT_TEX2| \ - FRAG_BIT_TEX3| \ - FRAG_BIT_TEX4| \ - FRAG_BIT_TEX5| \ - FRAG_BIT_TEX6| \ - FRAG_BIT_TEX7) -/*@}*/ - - -/** * Fragment program results */ typedef enum @@ -2016,7 +1956,7 @@ struct gl_fragment_program * For inputs that do not have an interpolation qualifier specified in * GLSL, the value is INTERP_QUALIFIER_NONE. */ - enum glsl_interp_qualifier InterpQualifier[FRAG_ATTRIB_MAX]; + enum glsl_interp_qualifier InterpQualifier[VARYING_SLOT_MAX]; /** * Bitfield indicating, for each fragment shader input, 1 if that input diff --git a/src/mesa/main/state.h b/src/mesa/main/state.h index 29a25409268..7b3121b4e33 100644 --- a/src/mesa/main/state.h +++ b/src/mesa/main/state.h @@ -66,7 +66,7 @@ _mesa_need_secondary_color(const struct gl_context *ctx) if (ctx->FragmentProgram._Current && (ctx->FragmentProgram._Current != ctx->FragmentProgram._TexEnvProgram) && - (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL1)) + (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL1)) return GL_TRUE; return GL_FALSE; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 1bd9f911f9e..d44cd7cf9a6 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -661,7 +661,7 @@ update_texture_state( struct gl_context *ctx ) if (fprog) { const GLuint coordMask = (1 << MAX_TEXTURE_COORD_UNITS) - 1; ctx->Texture._EnabledCoordUnits - = (fprog->InputsRead >> FRAG_ATTRIB_TEX0) & coordMask; + = (fprog->InputsRead >> VARYING_SLOT_TEX0) & coordMask; } else { ctx->Texture._EnabledCoordUnits = enabledFragUnits; diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp index 486cf4639ce..2cb5f02f498 100644 --- a/src/mesa/program/ir_to_mesa.cpp +++ b/src/mesa/program/ir_to_mesa.cpp @@ -93,7 +93,7 @@ public: explicit src_reg(dst_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ int negate; /**< NEGATE_XYZW mask from mesa */ /** Register index should be offset by the integer in this reg. */ @@ -123,7 +123,7 @@ public: explicit dst_reg(src_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ GLuint cond_mask:4; /** Register index should be offset by the integer in this reg. */ diff --git a/src/mesa/program/prog_execute.c b/src/mesa/program/prog_execute.c index fe2359bc24f..d205cdbbe77 100644 --- a/src/mesa/program/prog_execute.c +++ b/src/mesa/program/prog_execute.c @@ -108,7 +108,7 @@ get_src_register_pointer(const struct prog_src_register *source, return machine->VertAttribs[reg]; } else { - if (reg >= FRAG_ATTRIB_MAX) + if (reg >= VARYING_SLOT_MAX) return ZeroVec; return machine->Attribs[reg][machine->CurElement]; } @@ -283,7 +283,7 @@ fetch_vector4_deriv(struct gl_context * ctx, if (source->File == PROGRAM_INPUT && source->Index < (GLint) machine->NumDeriv) { const GLint col = machine->CurElement; - const GLfloat w = machine->Attribs[FRAG_ATTRIB_WPOS][col][3]; + const GLfloat w = machine->Attribs[VARYING_SLOT_POS][col][3]; const GLfloat invQ = 1.0f / w; GLfloat deriv[4]; @@ -371,7 +371,7 @@ fetch_texel(struct gl_context *ctx, */ if (machine->NumDeriv > 0 && inst->SrcReg[0].File == PROGRAM_INPUT && - inst->SrcReg[0].Index == FRAG_ATTRIB_TEX0 + inst->TexSrcUnit) { + inst->SrcReg[0].Index == VARYING_SLOT_TEX0 + inst->TexSrcUnit) { /* simple texture fetch for which we should have derivatives */ GLuint attr = inst->SrcReg[0].Index; machine->FetchTexelDeriv(ctx, texcoord, diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index d740bf7d985..c73f10df5cf 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -89,7 +89,7 @@ static const char * arb_input_attrib_string(GLint index, GLenum progType) { /* - * These strings should match the VERT_ATTRIB_x and FRAG_ATTRIB_x tokens. + * These strings should match the VERT_ATTRIB_x and VARYING_SLOT_x tokens. */ static const char *const vertAttribs[] = { "vertex.position", @@ -144,12 +144,12 @@ arb_input_attrib_string(GLint index, GLenum progType) "fragment.(fourteen)", /* VARYING_SLOT_BFC1 */ "fragment.(fifteen)", /* VARYING_SLOT_EDGE */ "fragment.(sixteen)", /* VARYING_SLOT_CLIP_VERTEX */ - "fragment.(seventeen)", /* FRAG_ATTRIB_CLIP_DIST0 */ - "fragment.(eighteen)", /* FRAG_ATTRIB_CLIP_DIST1 */ + "fragment.(seventeen)", /* VARYING_SLOT_CLIP_DIST0 */ + "fragment.(eighteen)", /* VARYING_SLOT_CLIP_DIST1 */ "fragment.(nineteen)", /* VARYING_SLOT_PRIMITIVE_ID */ "fragment.(twenty)", /* VARYING_SLOT_LAYER */ - "fragment.(twenty-one)", /* FRAG_ATTRIB_FACE */ - "fragment.(twenty-two)", /* FRAG_ATTRIB_PNTC */ + "fragment.(twenty-one)", /* VARYING_SLOT_FACE */ + "fragment.(twenty-two)", /* VARYING_SLOT_PNTC */ "fragment.varying[0]", "fragment.varying[1]", "fragment.varying[2]", @@ -186,11 +186,11 @@ arb_input_attrib_string(GLint index, GLenum progType) /* sanity checks */ STATIC_ASSERT(Elements(vertAttribs) == VERT_ATTRIB_MAX); - STATIC_ASSERT(Elements(fragAttribs) == FRAG_ATTRIB_MAX); + STATIC_ASSERT(Elements(fragAttribs) == VARYING_SLOT_MAX); assert(strcmp(vertAttribs[VERT_ATTRIB_TEX0], "vertex.texcoord[0]") == 0); assert(strcmp(vertAttribs[VERT_ATTRIB_GENERIC15], "vertex.attrib[15]") == 0); - assert(strcmp(fragAttribs[FRAG_ATTRIB_TEX0], "fragment.texcoord[0]") == 0); - assert(strcmp(fragAttribs[FRAG_ATTRIB_VAR0+15], "fragment.varying[15]") == 0); + assert(strcmp(fragAttribs[VARYING_SLOT_TEX0], "fragment.texcoord[0]") == 0); + assert(strcmp(fragAttribs[VARYING_SLOT_VAR0+15], "fragment.varying[15]") == 0); if (progType == GL_VERTEX_PROGRAM_ARB) { assert(index < Elements(vertAttribs)); diff --git a/src/mesa/program/program.c b/src/mesa/program/program.c index bc7ab1ef814..2ef969ff77b 100644 --- a/src/mesa/program/program.c +++ b/src/mesa/program/program.c @@ -738,7 +738,7 @@ _mesa_combine_programs(struct gl_context *ctx, * of progB_colorFile/progB_colorIndex below... */ progB_colorFile = PROGRAM_INPUT; - progB_colorIndex = FRAG_ATTRIB_COL0; + progB_colorIndex = VARYING_SLOT_COL0; /* * The fragment program may get color from a state var rather than @@ -754,7 +754,7 @@ _mesa_combine_programs(struct gl_context *ctx, p->StateIndexes[0] == STATE_INTERNAL && p->StateIndexes[1] == STATE_CURRENT_ATTRIB && (int) p->StateIndexes[2] == (int) VERT_ATTRIB_COLOR0) { - progB_inputsRead |= FRAG_BIT_COL0; + progB_inputsRead |= VARYING_BIT_COL0; progB_colorFile = PROGRAM_STATE_VAR; progB_colorIndex = i; break; @@ -765,7 +765,7 @@ _mesa_combine_programs(struct gl_context *ctx, * new temporary register. */ if ((progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) && - (progB_inputsRead & FRAG_BIT_COL0)) { + (progB_inputsRead & VARYING_BIT_COL0)) { GLint tempReg = _mesa_find_free_register(usedTemps, MAX_PROGRAM_TEMPS, firstTemp); if (tempReg < 0) { @@ -788,7 +788,7 @@ _mesa_combine_programs(struct gl_context *ctx, /* compute combined program's InputsRead */ inputsB = progB_inputsRead; if (progA->OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { - inputsB &= ~(1 << FRAG_ATTRIB_COL0); + inputsB &= ~(1 << VARYING_SLOT_COL0); } newProg->InputsRead = progA->InputsRead | inputsB; newProg->OutputsWritten = progB->OutputsWritten; @@ -934,7 +934,7 @@ _mesa_valid_register_index(const struct gl_context *ctx, case MESA_SHADER_VERTEX: return index < VERT_ATTRIB_GENERIC0 + (GLint) c->MaxAttribs; case MESA_SHADER_FRAGMENT: - return index < FRAG_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying; + return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; case MESA_SHADER_GEOMETRY: return index < VARYING_SLOT_VAR0 + (GLint) ctx->Const.MaxVarying; default: diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index c9df3e64f90..81d85f9fb1b 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -1187,19 +1187,19 @@ vtxWeightNum: INTEGER; fragAttribItem: POSITION { - $$ = FRAG_ATTRIB_WPOS; + $$ = VARYING_SLOT_POS; } | COLOR optColorType { - $$ = FRAG_ATTRIB_COL0 + $2; + $$ = VARYING_SLOT_COL0 + $2; } | FOGCOORD { - $$ = FRAG_ATTRIB_FOGC; + $$ = VARYING_SLOT_FOGC; } | TEXCOORD optTexCoordUnitNum { - $$ = FRAG_ATTRIB_TEX0 + $2; + $$ = VARYING_SLOT_TEX0 + $2; } ; diff --git a/src/mesa/program/programopt.c b/src/mesa/program/programopt.c index 19890802b79..d40ffd543a9 100644 --- a/src/mesa/program/programopt.c +++ b/src/mesa/program/programopt.c @@ -240,7 +240,7 @@ _mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog) * \param saturate True if writes to color outputs should be clamped to [0, 1] * * \note - * This function sets \c FRAG_BIT_FOGC in \c fprog->Base.InputsRead. + * This function sets \c VARYING_BIT_FOGC in \c fprog->Base.InputsRead. * * \todo With a little work, this function could be adapted to add fog code * to vertex programs too. @@ -323,7 +323,7 @@ _mesa_append_fog_code(struct gl_context *ctx, inst->DstReg.Index = fogFactorTemp; inst->DstReg.WriteMask = WRITEMASK_X; inst->SrcReg[0].File = PROGRAM_INPUT; - inst->SrcReg[0].Index = FRAG_ATTRIB_FOGC; + inst->SrcReg[0].Index = VARYING_SLOT_FOGC; inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; inst->SrcReg[1].File = PROGRAM_STATE_VAR; inst->SrcReg[1].Index = fogPRefOpt; @@ -348,7 +348,7 @@ _mesa_append_fog_code(struct gl_context *ctx, inst->SrcReg[0].Swizzle = (fog_mode == GL_EXP) ? SWIZZLE_ZZZZ : SWIZZLE_WWWW; inst->SrcReg[1].File = PROGRAM_INPUT; - inst->SrcReg[1].Index = FRAG_ATTRIB_FOGC; + inst->SrcReg[1].Index = VARYING_SLOT_FOGC; inst->SrcReg[1].Swizzle = SWIZZLE_XXXX; inst++; if (fog_mode == GL_EXP2) { @@ -411,7 +411,7 @@ _mesa_append_fog_code(struct gl_context *ctx, /* install new instructions */ fprog->Base.Instructions = newInst; fprog->Base.NumInstructions = inst - newInst; - fprog->Base.InputsRead |= FRAG_BIT_FOGC; + fprog->Base.InputsRead |= VARYING_BIT_FOGC; assert(fprog->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)); } @@ -615,10 +615,10 @@ _mesa_nop_fragment_program(struct gl_context *ctx, struct gl_fragment_program *p inst[0].DstReg.File = PROGRAM_OUTPUT; inst[0].DstReg.Index = FRAG_RESULT_COLOR; inst[0].SrcReg[0].File = PROGRAM_INPUT; - if (prog->Base.InputsRead & FRAG_BIT_COL0) - inputAttr = FRAG_ATTRIB_COL0; + if (prog->Base.InputsRead & VARYING_BIT_COL0) + inputAttr = VARYING_SLOT_COL0; else - inputAttr = FRAG_ATTRIB_TEX0; + inputAttr = VARYING_SLOT_TEX0; inst[0].SrcReg[0].Index = inputAttr; inst[1].Opcode = OPCODE_END; diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index b612f784630..7e3997ef243 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -161,11 +161,11 @@ get_pixel_transfer_program(struct gl_context *ctx, const struct state_key *key) inst[ic].DstReg.File = PROGRAM_TEMPORARY; inst[ic].DstReg.Index = colorTemp; inst[ic].SrcReg[0].File = PROGRAM_INPUT; - inst[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + inst[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; inst[ic].TexSrcUnit = 0; inst[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; - fp->Base.InputsRead = BITFIELD64_BIT(FRAG_ATTRIB_TEX0); + fp->Base.InputsRead = BITFIELD64_BIT(VARYING_SLOT_TEX0); fp->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR); fp->Base.SamplersUsed = 0x1; /* sampler 0 (bit 0) is used */ diff --git a/src/mesa/state_tracker/st_atom_rasterizer.c b/src/mesa/state_tracker/st_atom_rasterizer.c index c4b95e83b47..866e5627d7f 100644 --- a/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/src/mesa/state_tracker/st_atom_rasterizer.c @@ -171,9 +171,9 @@ static void update_raster_state( struct st_context *st ) raster->sprite_coord_enable |= 1 << i; } } - if (fragProg->Base.InputsRead & FRAG_BIT_PNTC) { + if (fragProg->Base.InputsRead & VARYING_BIT_PNTC) { raster->sprite_coord_enable |= - 1 << (FRAG_ATTRIB_PNTC - FRAG_ATTRIB_TEX0); + 1 << (VARYING_SLOT_PNTC - VARYING_SLOT_TEX0); } raster->point_quad_rasterization = 1; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 36fffe90dc5..bae9ff85823 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -139,7 +139,7 @@ make_bitmap_fragment_program(struct gl_context *ctx, GLuint samplerIndex) p->Instructions[ic].DstReg.File = PROGRAM_TEMPORARY; p->Instructions[ic].DstReg.Index = 0; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; p->Instructions[ic].TexSrcUnit = samplerIndex; p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; @@ -160,7 +160,7 @@ make_bitmap_fragment_program(struct gl_context *ctx, GLuint samplerIndex) assert(ic == p->NumInstructions); - p->InputsRead = FRAG_BIT_TEX0; + p->InputsRead = VARYING_BIT_TEX0; p->OutputsWritten = 0x0; p->SamplersUsed = (1 << samplerIndex); diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index e282bf98dbf..f0baa343566 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -87,7 +87,7 @@ is_passthrough_program(const struct gl_fragment_program *prog) inst[0].DstReg.Index == FRAG_RESULT_COLOR && inst[0].DstReg.WriteMask == WRITEMASK_XYZW && inst[0].SrcReg[0].File == PROGRAM_INPUT && - inst[0].SrcReg[0].Index == FRAG_ATTRIB_COL0 && + inst[0].SrcReg[0].Index == VARYING_SLOT_COL0 && inst[0].SrcReg[0].Swizzle == SWIZZLE_XYZW) { return GL_TRUE; } @@ -233,7 +233,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->Instructions[ic].DstReg.Index = FRAG_RESULT_DEPTH; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Z; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; p->Instructions[ic].TexSrcUnit = 0; p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; @@ -242,7 +242,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; p->Instructions[ic].DstReg.Index = FRAG_RESULT_COLOR; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_COL0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_COL0; ic++; } @@ -253,7 +253,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, p->Instructions[ic].DstReg.Index = FRAG_RESULT_STENCIL; p->Instructions[ic].DstReg.WriteMask = WRITEMASK_Y; p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = FRAG_ATTRIB_TEX0; + p->Instructions[ic].SrcReg[0].Index = VARYING_SLOT_TEX0; p->Instructions[ic].TexSrcUnit = 1; p->Instructions[ic].TexSrcTarget = TEXTURE_2D_INDEX; ic++; @@ -264,7 +264,7 @@ st_make_drawpix_z_stencil_program(struct st_context *st, assert(ic == p->NumInstructions); - p->InputsRead = FRAG_BIT_TEX0 | FRAG_BIT_COL0; + p->InputsRead = VARYING_BIT_TEX0 | VARYING_BIT_COL0; p->OutputsWritten = 0; if (write_depth) { p->OutputsWritten |= BITFIELD64_BIT(FRAG_RESULT_DEPTH); diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 5ca09700453..a8806c91edd 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -116,7 +116,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, st_validate_state(st); /* determine if we need vertex color */ - if (ctx->FragmentProgram._Current->Base.InputsRead & FRAG_BIT_COL0) + if (ctx->FragmentProgram._Current->Base.InputsRead & VARYING_BIT_COL0) emitColor = GL_TRUE; else emitColor = GL_FALSE; diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index b4f94657ed1..0cef092d387 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -148,7 +148,7 @@ public: explicit st_src_reg(st_dst_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ int index2D; GLuint swizzle; /**< SWIZZLE_XYZWONEZERO swizzles from Mesa. */ int negate; /**< NEGATE_XYZW mask from mesa */ @@ -182,7 +182,7 @@ public: explicit st_dst_reg(st_src_reg reg); gl_register_file file; /**< PROGRAM_* from Mesa */ - int index; /**< temporary index, VERT_ATTRIB_*, FRAG_ATTRIB_*, etc. */ + int index; /**< temporary index, VERT_ATTRIB_*, VARYING_SLOT_*, etc. */ int writemask; /**< Bitfield of WRITEMASK_[XYZW] */ GLuint cond_mask:4; int type; /** GLSL_TYPE_* from GLSL IR (enum glsl_base_type) */ @@ -3830,14 +3830,14 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, * Get initial pixel color from the texture. * TEX colorTemp, fragment.texcoord[0], texture[0], 2D; */ - coord = st_src_reg(PROGRAM_INPUT, FRAG_ATTRIB_TEX0, glsl_type::vec2_type); + coord = st_src_reg(PROGRAM_INPUT, VARYING_SLOT_TEX0, glsl_type::vec2_type); src0 = v->get_temp(glsl_type::vec4_type); dst0 = st_dst_reg(src0); inst = v->emit(NULL, TGSI_OPCODE_TEX, dst0, coord); inst->sampler = 0; inst->tex_target = TEXTURE_2D_INDEX; - prog->InputsRead |= FRAG_BIT_TEX0; + prog->InputsRead |= VARYING_BIT_TEX0; prog->SamplersUsed |= (1 << 0); /* mark sampler 0 as used */ v->samplers_used |= (1 << 0); @@ -3903,7 +3903,7 @@ get_pixel_transfer_visitor(struct st_fragment_program *fp, for (int i=0; i<3; i++) { src_regs[i] = inst->src[i]; if (src_regs[i].file == PROGRAM_INPUT && - src_regs[i].index == FRAG_ATTRIB_COL0) + src_regs[i].index == VARYING_SLOT_COL0) { src_regs[i].file = PROGRAM_TEMPORARY; src_regs[i].index = src0.index; @@ -3958,14 +3958,14 @@ get_bitmap_visitor(struct st_fragment_program *fp, v->num_immediates = original->num_immediates; /* TEX tmp0, fragment.texcoord[0], texture[0], 2D; */ - coord = st_src_reg(PROGRAM_INPUT, FRAG_ATTRIB_TEX0, glsl_type::vec2_type); + coord = st_src_reg(PROGRAM_INPUT, VARYING_SLOT_TEX0, glsl_type::vec2_type); src0 = v->get_temp(glsl_type::vec4_type); dst0 = st_dst_reg(src0); inst = v->emit(NULL, TGSI_OPCODE_TEX, dst0, coord); inst->sampler = samplerIndex; inst->tex_target = TEXTURE_2D_INDEX; - prog->InputsRead |= FRAG_BIT_TEX0; + prog->InputsRead |= VARYING_BIT_TEX0; prog->SamplersUsed |= (1 << samplerIndex); /* mark sampler as used */ v->samplers_used |= (1 << samplerIndex); @@ -4441,7 +4441,7 @@ emit_wpos_adjustment( struct st_translate *t, struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst ); struct ureg_dst wpos_temp = ureg_DECL_temporary( ureg ); - struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]]; + struct ureg_src wpos_input = t->inputs[t->inputMapping[VARYING_SLOT_POS]]; /* First, apply the coordinate shift: */ if (adjX || adjY[0] || adjY[1]) { @@ -4492,7 +4492,7 @@ emit_wpos_adjustment( struct st_translate *t, /* Use wpos_temp as position input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp); + t->inputs[t->inputMapping[VARYING_SLOT_POS]] = ureg_src(wpos_temp); } @@ -4610,14 +4610,14 @@ emit_face_var(struct st_translate *t) { struct ureg_program *ureg = t->ureg; struct ureg_dst face_temp = ureg_DECL_temporary(ureg); - struct ureg_src face_input = t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]]; + struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]]; /* MOV_SAT face_temp, input[face] */ face_temp = ureg_saturate(face_temp); ureg_MOV(ureg, face_temp, face_input); /* Use face_temp as face input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp); + t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp); } static void @@ -4710,14 +4710,14 @@ st_translate_program( is_centroid[i]); } - if (proginfo->InputsRead & FRAG_BIT_WPOS) { + if (proginfo->InputsRead & VARYING_BIT_POS) { /* Must do this after setting up t->inputs, and before * emitting constant references, below: */ emit_wpos(st_context(ctx), t, proginfo, ureg); } - if (proginfo->InputsRead & FRAG_BIT_FACE) + if (proginfo->InputsRead & VARYING_BIT_FACE) emit_face_var(t); /* diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index a874e2610e9..3831a0a793b 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -790,7 +790,7 @@ emit_wpos_adjustment( struct st_translate *t, struct ureg_src wpostrans = ureg_DECL_constant( ureg, wposTransConst ); struct ureg_dst wpos_temp = ureg_DECL_temporary( ureg ); - struct ureg_src wpos_input = t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]]; + struct ureg_src wpos_input = t->inputs[t->inputMapping[VARYING_SLOT_POS]]; /* First, apply the coordinate shift: */ if (adjX || adjY[0] || adjY[1]) { @@ -841,7 +841,7 @@ emit_wpos_adjustment( struct st_translate *t, /* Use wpos_temp as position input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_WPOS]] = ureg_src(wpos_temp); + t->inputs[t->inputMapping[VARYING_SLOT_POS]] = ureg_src(wpos_temp); } @@ -961,7 +961,7 @@ emit_face_var( struct st_translate *t, { struct ureg_program *ureg = t->ureg; struct ureg_dst face_temp = ureg_DECL_temporary( ureg ); - struct ureg_src face_input = t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]]; + struct ureg_src face_input = t->inputs[t->inputMapping[VARYING_SLOT_FACE]]; /* MOV_SAT face_temp, input[face] */ @@ -970,7 +970,7 @@ emit_face_var( struct st_translate *t, /* Use face_temp as face input from here on: */ - t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp); + t->inputs[t->inputMapping[VARYING_SLOT_FACE]] = ureg_src(face_temp); } @@ -1051,14 +1051,14 @@ st_translate_mesa_program( interpMode[i]); } - if (program->InputsRead & FRAG_BIT_WPOS) { + if (program->InputsRead & VARYING_BIT_POS) { /* Must do this after setting up t->inputs, and before * emitting constant references, below: */ emit_wpos(st_context(ctx), t, program, ureg); } - if (program->InputsRead & FRAG_BIT_FACE) { + if (program->InputsRead & VARYING_BIT_FACE) { emit_face_var( t, program ); } diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 6afad9b4155..6af8df31641 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -275,8 +275,8 @@ st_prepare_vertex_program(struct gl_context *ctx, default: assert(attr < VARYING_SLOT_MAX); stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stvp->output_semantic_index[slot] = (FRAG_ATTRIB_VAR0 - - FRAG_ATTRIB_TEX0 + + stvp->output_semantic_index[slot] = (VARYING_SLOT_VAR0 - + VARYING_SLOT_TEX0 + attr - VARYING_SLOT_VAR0); break; @@ -472,7 +472,7 @@ st_translate_fragment_program(struct st_context *st, GLboolean deleteFP = GL_FALSE; GLuint outputMapping[FRAG_RESULT_MAX]; - GLuint inputMapping[FRAG_ATTRIB_MAX]; + GLuint inputMapping[VARYING_SLOT_MAX]; GLuint interpMode[PIPE_MAX_SHADER_INPUTS]; /* XXX size? */ GLuint attr; GLbitfield64 inputsRead; @@ -529,7 +529,7 @@ st_translate_fragment_program(struct st_context *st, * Convert Mesa program inputs to TGSI input register semantics. */ inputsRead = stfp->Base.Base.InputsRead; - for (attr = 0; attr < FRAG_ATTRIB_MAX; attr++) { + for (attr = 0; attr < VARYING_SLOT_MAX; attr++) { if ((inputsRead & BITFIELD64_BIT(attr)) != 0) { const GLuint slot = fs_num_inputs++; @@ -537,46 +537,46 @@ st_translate_fragment_program(struct st_context *st, is_centroid[slot] = (stfp->Base.IsCentroid & BITFIELD64_BIT(attr)) != 0; switch (attr) { - case FRAG_ATTRIB_WPOS: + case VARYING_SLOT_POS: input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_LINEAR; break; - case FRAG_ATTRIB_COL0: + case VARYING_SLOT_COL0: input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; input_semantic_index[slot] = 0; interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr], TRUE); break; - case FRAG_ATTRIB_COL1: + case VARYING_SLOT_COL1: input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; input_semantic_index[slot] = 1; interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr], TRUE); break; - case FRAG_ATTRIB_FOGC: + case VARYING_SLOT_FOGC: input_semantic_name[slot] = TGSI_SEMANTIC_FOG; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; - case FRAG_ATTRIB_FACE: + case VARYING_SLOT_FACE: input_semantic_name[slot] = TGSI_SEMANTIC_FACE; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; break; - case FRAG_ATTRIB_CLIP_DIST0: + case VARYING_SLOT_CLIP_DIST0: input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; - case FRAG_ATTRIB_CLIP_DIST1: + case VARYING_SLOT_CLIP_DIST1: input_semantic_name[slot] = TGSI_SEMANTIC_CLIPDIST; input_semantic_index[slot] = 1; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; break; /* In most cases, there is nothing special about these * inputs, so adopt a convention to use the generic - * semantic name and the mesa FRAG_ATTRIB_ number as the + * semantic name and the mesa VARYING_SLOT_ number as the * index. * * All that is required is that the vertex shader labels @@ -589,24 +589,24 @@ st_translate_fragment_program(struct st_context *st, * zero or be restricted to a particular range -- nobody * should be building tables based on semantic index. */ - case FRAG_ATTRIB_PNTC: - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: - case FRAG_ATTRIB_VAR0: + case VARYING_SLOT_PNTC: + case VARYING_SLOT_TEX0: + case VARYING_SLOT_TEX1: + case VARYING_SLOT_TEX2: + case VARYING_SLOT_TEX3: + case VARYING_SLOT_TEX4: + case VARYING_SLOT_TEX5: + case VARYING_SLOT_TEX6: + case VARYING_SLOT_TEX7: + case VARYING_SLOT_VAR0: default: /* Actually, let's try and zero-base this just for * readability of the generated TGSI. */ - assert(attr >= FRAG_ATTRIB_TEX0); - input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); + assert(attr >= VARYING_SLOT_TEX0); + input_semantic_index[slot] = (attr - VARYING_SLOT_TEX0); input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - if (attr == FRAG_ATTRIB_PNTC) + if (attr == VARYING_SLOT_PNTC) interpMode[slot] = TGSI_INTERPOLATE_LINEAR; else interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr], diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c index d36d876974e..dcc9e3a5c59 100644 --- a/src/mesa/swrast/s_aaline.c +++ b/src/mesa/swrast/s_aaline.c @@ -63,10 +63,10 @@ struct LineInfo GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; /* DO_ATTRIBS */ GLfloat wPlane[4]; - GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4]; - GLfloat lambda[FRAG_ATTRIB_MAX]; - GLfloat texWidth[FRAG_ATTRIB_MAX]; - GLfloat texHeight[FRAG_ATTRIB_MAX]; + GLfloat attrPlane[VARYING_SLOT_MAX][4][4]; + GLfloat lambda[VARYING_SLOT_MAX]; + GLfloat texWidth[VARYING_SLOT_MAX]; + GLfloat texHeight[VARYING_SLOT_MAX]; SWspan span; }; diff --git a/src/mesa/swrast/s_aalinetemp.h b/src/mesa/swrast/s_aalinetemp.h index 6cfd3bc28a4..75e28f4174a 100644 --- a/src/mesa/swrast/s_aalinetemp.h +++ b/src/mesa/swrast/s_aalinetemp.h @@ -66,10 +66,10 @@ NAME(plot)(struct gl_context *ctx, struct LineInfo *line, int ix, int iy) #if defined(DO_ATTRIBS) ATTRIB_LOOP_BEGIN GLfloat (*attribArray)[4] = line->span.array->attribs[attr]; - if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0 + if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0 && !_swrast_use_fragment_program(ctx)) { /* texcoord w/ divide by Q */ - const GLuint unit = attr - FRAG_ATTRIB_TEX0; + const GLuint unit = attr - VARYING_SLOT_TEX0; const GLfloat invQ = solve_plane_recip(fx, fy, line->attrPlane[attr][3]); GLuint c; for (c = 0; c < 3; c++) { @@ -112,10 +112,10 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) /* Init the LineInfo struct */ struct LineInfo line; - line.x0 = v0->attrib[FRAG_ATTRIB_WPOS][0]; - line.y0 = v0->attrib[FRAG_ATTRIB_WPOS][1]; - line.x1 = v1->attrib[FRAG_ATTRIB_WPOS][0]; - line.y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; + line.x0 = v0->attrib[VARYING_SLOT_POS][0]; + line.y0 = v0->attrib[VARYING_SLOT_POS][1]; + line.x1 = v1->attrib[VARYING_SLOT_POS][0]; + line.y1 = v1->attrib[VARYING_SLOT_POS][1]; line.dx = line.x1 - line.x0; line.dy = line.y1 - line.y0; line.len = sqrtf(line.dx * line.dx + line.dy * line.dy); @@ -135,7 +135,7 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) #ifdef DO_Z line.span.arrayMask |= SPAN_Z; compute_plane(line.x0, line.y0, line.x1, line.y1, - v0->attrib[FRAG_ATTRIB_WPOS][2], v1->attrib[FRAG_ATTRIB_WPOS][2], line.zPlane); + v0->attrib[VARYING_SLOT_POS][2], v1->attrib[VARYING_SLOT_POS][2], line.zPlane); #endif line.span.arrayMask |= SPAN_RGBA; if (ctx->Light.ShadeModel == GL_SMOOTH) { @@ -156,8 +156,8 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) } #if defined(DO_ATTRIBS) { - const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3]; line.span.arrayMask |= SPAN_LAMBDA; compute_plane(line.x0, line.y0, line.x1, line.y1, invW0, invW1, line.wPlane); ATTRIB_LOOP_BEGIN @@ -176,8 +176,8 @@ NAME(line)(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) } } line.span.arrayAttribs |= BITFIELD64_BIT(attr); - if (attr >= FRAG_ATTRIB_TEX0 && attr < FRAG_ATTRIB_VAR0) { - const GLuint u = attr - FRAG_ATTRIB_TEX0; + if (attr >= VARYING_SLOT_TEX0 && attr < VARYING_SLOT_VAR0) { + const GLuint u = attr - VARYING_SLOT_TEX0; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; const struct gl_texture_image *texImage = obj->Image[0][obj->BaseLevel]; line.texWidth[attr] = (GLfloat) texImage->Width; diff --git a/src/mesa/swrast/s_aatritemp.h b/src/mesa/swrast/s_aatritemp.h index 9cdb35fd29d..4581248fd0d 100644 --- a/src/mesa/swrast/s_aatritemp.h +++ b/src/mesa/swrast/s_aatritemp.h @@ -39,9 +39,9 @@ /*void triangle( struct gl_context *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint pv )*/ { const SWcontext *swrast = SWRAST_CONTEXT(ctx); - const GLfloat *p0 = v0->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *p1 = v1->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *p2 = v2->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *p0 = v0->attrib[VARYING_SLOT_POS]; + const GLfloat *p1 = v1->attrib[VARYING_SLOT_POS]; + const GLfloat *p2 = v2->attrib[VARYING_SLOT_POS]; const SWvertex *vMin, *vMid, *vMax; GLint iyMin, iyMax; GLfloat yMin, yMax; @@ -55,7 +55,7 @@ #endif GLfloat rPlane[4], gPlane[4], bPlane[4], aPlane[4]; #if defined(DO_ATTRIBS) - GLfloat attrPlane[FRAG_ATTRIB_MAX][4][4]; + GLfloat attrPlane[VARYING_SLOT_MAX][4][4]; GLfloat wPlane[4]; /* win[3] */ #endif GLfloat bf = SWRAST_CONTEXT(ctx)->_BackfaceCullSign; @@ -67,9 +67,9 @@ /* determine bottom to top order of vertices */ { - GLfloat y0 = v0->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat y1 = v1->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat y2 = v2->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat y0 = v0->attrib[VARYING_SLOT_POS][1]; + GLfloat y1 = v1->attrib[VARYING_SLOT_POS][1]; + GLfloat y2 = v2->attrib[VARYING_SLOT_POS][1]; if (y0 <= y1) { if (y1 <= y2) { vMin = v0; vMid = v1; vMax = v2; /* y0<=y1<=y2 */ @@ -94,13 +94,13 @@ } } - majDx = vMax->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0]; - majDy = vMax->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1]; + majDx = vMax->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0]; + majDy = vMax->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1]; /* front/back-face determination and cullling */ { - const GLfloat botDx = vMid->attrib[FRAG_ATTRIB_WPOS][0] - vMin->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat botDy = vMid->attrib[FRAG_ATTRIB_WPOS][1] - vMin->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat botDx = vMid->attrib[VARYING_SLOT_POS][0] - vMin->attrib[VARYING_SLOT_POS][0]; + const GLfloat botDy = vMid->attrib[VARYING_SLOT_POS][1] - vMin->attrib[VARYING_SLOT_POS][1]; const GLfloat area = majDx * botDy - botDx * majDy; /* Do backface culling */ if (area * bf < 0 || area == 0 || IS_INF_OR_NAN(area)) @@ -134,12 +134,12 @@ span.arrayMask |= SPAN_RGBA; #if defined(DO_ATTRIBS) { - const GLfloat invW0 = v0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW1 = v1->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invW2 = v2->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW0 = v0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW1 = v1->attrib[VARYING_SLOT_POS][3]; + const GLfloat invW2 = v2->attrib[VARYING_SLOT_POS][3]; compute_plane(p0, p1, p2, invW0, invW1, invW2, wPlane); - span.attrStepX[FRAG_ATTRIB_WPOS][3] = plane_dx(wPlane); - span.attrStepY[FRAG_ATTRIB_WPOS][3] = plane_dy(wPlane); + span.attrStepX[VARYING_SLOT_POS][3] = plane_dx(wPlane); + span.attrStepY[VARYING_SLOT_POS][3] = plane_dy(wPlane); ATTRIB_LOOP_BEGIN GLuint c; if (swrast->_InterpMode[attr] == GL_FLAT) { @@ -169,16 +169,16 @@ * edges, stopping when we find that coverage = 0. If the long edge * is on the left we scan left-to-right. Else, we scan right-to-left. */ - yMin = vMin->attrib[FRAG_ATTRIB_WPOS][1]; - yMax = vMax->attrib[FRAG_ATTRIB_WPOS][1]; + yMin = vMin->attrib[VARYING_SLOT_POS][1]; + yMax = vMax->attrib[VARYING_SLOT_POS][1]; iyMin = (GLint) yMin; iyMax = (GLint) yMax + 1; if (ltor) { /* scan left to right */ - const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS]; + const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS]; + const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS]; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy < 0.0F ? -dxdy : 0.0F; GLint iy; @@ -208,7 +208,7 @@ #if defined(DO_ATTRIBS) /* compute attributes at left-most fragment */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane); + span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 0.5F, iy + 0.5F, wPlane); ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { @@ -245,9 +245,9 @@ } else { /* scan right to left */ - const GLfloat *pMin = vMin->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMid = vMid->attrib[FRAG_ATTRIB_WPOS]; - const GLfloat *pMax = vMax->attrib[FRAG_ATTRIB_WPOS]; + const GLfloat *pMin = vMin->attrib[VARYING_SLOT_POS]; + const GLfloat *pMid = vMid->attrib[VARYING_SLOT_POS]; + const GLfloat *pMax = vMax->attrib[VARYING_SLOT_POS]; const GLfloat dxdy = majDx / majDy; const GLfloat xAdj = dxdy > 0 ? dxdy : 0.0F; GLint iy; @@ -300,7 +300,7 @@ #if defined(DO_ATTRIBS) /* compute attributes at left-most fragment */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane); + span.attrStart[VARYING_SLOT_POS][3] = solve_plane(ix + 1.5F, iy + 0.5F, wPlane); ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { diff --git a/src/mesa/swrast/s_alpha.c b/src/mesa/swrast/s_alpha.c index df2181ba968..1ceda531cab 100644 --- a/src/mesa/swrast/s_alpha.c +++ b/src/mesa/swrast/s_alpha.c @@ -123,7 +123,7 @@ _swrast_alpha_test(const struct gl_context *ctx, SWspan *span) ALPHA_TEST(rgba[i][ACOMP], ;); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; const GLfloat ref = ctx->Color.AlphaRef; ALPHA_TEST(rgba[i][ACOMP], ;); } diff --git a/src/mesa/swrast/s_atifragshader.c b/src/mesa/swrast/s_atifragshader.c index c5abaa0d475..1e91e2bee42 100644 --- a/src/mesa/swrast/s_atifragshader.c +++ b/src/mesa/swrast/s_atifragshader.c @@ -248,7 +248,7 @@ handle_pass_op(struct atifs_machine *machine, struct atifs_setupinst *texinst, if (pass_tex >= GL_TEXTURE0_ARB && pass_tex <= GL_TEXTURE7_ARB) { pass_tex -= GL_TEXTURE0_ARB; COPY_4V(machine->Registers[idx], - span->array->attribs[FRAG_ATTRIB_TEX0 + pass_tex][column]); + span->array->attribs[VARYING_SLOT_TEX0 + pass_tex][column]); } else if (pass_tex >= GL_REG_0_ATI && pass_tex <= GL_REG_5_ATI) { pass_tex -= GL_REG_0_ATI; @@ -271,7 +271,7 @@ handle_sample_op(struct gl_context * ctx, struct atifs_machine *machine, if (coord_source >= GL_TEXTURE0_ARB && coord_source <= GL_TEXTURE7_ARB) { coord_source -= GL_TEXTURE0_ARB; COPY_4V(tex_coords, - span->array->attribs[FRAG_ATTRIB_TEX0 + coord_source][column]); + span->array->attribs[VARYING_SLOT_TEX0 + coord_source][column]); } else if (coord_source >= GL_REG_0_ATI && coord_source <= GL_REG_5_ATI) { coord_source -= GL_REG_0_ATI; @@ -554,8 +554,8 @@ init_machine(struct gl_context * ctx, struct atifs_machine *machine, machine->Registers[i][j] = 0.0; } - COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[FRAG_ATTRIB_COL0][col]); - COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[FRAG_ATTRIB_COL1][col]); + COPY_4V(inputs[ATI_FS_INPUT_PRIMARY], span->array->attribs[VARYING_SLOT_COL0][col]); + COPY_4V(inputs[ATI_FS_INPUT_SECONDARY], span->array->attribs[VARYING_SLOT_COL1][col]); } @@ -584,7 +584,7 @@ _swrast_exec_fragment_shader(struct gl_context * ctx, SWspan *span) const GLfloat *colOut = machine.Registers[0]; /*fprintf(stderr,"outputs %f %f %f %f\n", colOut[0], colOut[1], colOut[2], colOut[3]); */ - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], colOut); + COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i], colOut); } } } diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index ef7ca2e1593..11e90643694 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -502,7 +502,7 @@ _swrast_update_active_attribs(struct gl_context *ctx) if (_swrast_use_fragment_program(ctx)) { /* fragment program/shader */ attribsMask = ctx->FragmentProgram._Current->Base.InputsRead; - attribsMask &= ~FRAG_BIT_WPOS; /* WPOS is always handled specially */ + attribsMask &= ~VARYING_BIT_POS; /* WPOS is always handled specially */ } else if (ctx->ATIFragmentShader._Enabled) { attribsMask = ~0; /* XXX fix me */ @@ -512,19 +512,19 @@ _swrast_update_active_attribs(struct gl_context *ctx) attribsMask = 0x0; #if CHAN_TYPE == GL_FLOAT - attribsMask |= FRAG_BIT_COL0; + attribsMask |= VARYING_BIT_COL0; #endif if (ctx->Fog.ColorSumEnabled || (ctx->Light.Enabled && ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)) { - attribsMask |= FRAG_BIT_COL1; + attribsMask |= VARYING_BIT_COL1; } if (swrast->_FogEnabled) - attribsMask |= FRAG_BIT_FOGC; + attribsMask |= VARYING_BIT_FOGC; - attribsMask |= (ctx->Texture._EnabledUnits << FRAG_ATTRIB_TEX0); + attribsMask |= (ctx->Texture._EnabledUnits << VARYING_SLOT_TEX0); } swrast->_ActiveAttribMask = attribsMask; @@ -532,11 +532,11 @@ _swrast_update_active_attribs(struct gl_context *ctx) /* Update _ActiveAttribs[] list */ { GLuint i, num = 0; - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (attribsMask & BITFIELD64_BIT(i)) { swrast->_ActiveAttribs[num++] = i; /* how should this attribute be interpolated? */ - if (i == FRAG_ATTRIB_COL0 || i == FRAG_ATTRIB_COL1) + if (i == VARYING_SLOT_COL0 || i == VARYING_SLOT_COL1) swrast->_InterpMode[i] = ctx->Light.ShadeModel; else swrast->_InterpMode[i] = GL_SMOOTH; @@ -785,7 +785,7 @@ _swrast_CreateContext( struct gl_context *ctx ) #elif CHAN_TYPE == GL_UNSIGNED_SHORT swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].rgba16; #else - swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[FRAG_ATTRIB_COL0]; + swrast->SpanArrays[i].rgba = swrast->SpanArrays[i].attribs[VARYING_SLOT_COL0]; #endif } @@ -918,18 +918,18 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ) if (SWRAST_DEBUG_VERTICES) { _mesa_debug(ctx, "win %f %f %f %f\n", - v->attrib[FRAG_ATTRIB_WPOS][0], - v->attrib[FRAG_ATTRIB_WPOS][1], - v->attrib[FRAG_ATTRIB_WPOS][2], - v->attrib[FRAG_ATTRIB_WPOS][3]); + v->attrib[VARYING_SLOT_POS][0], + v->attrib[VARYING_SLOT_POS][1], + v->attrib[VARYING_SLOT_POS][2], + v->attrib[VARYING_SLOT_POS][3]); for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) if (ctx->Texture.Unit[i]._ReallyEnabled) _mesa_debug(ctx, "texcoord[%d] %f %f %f %f\n", i, - v->attrib[FRAG_ATTRIB_TEX0 + i][0], - v->attrib[FRAG_ATTRIB_TEX0 + i][1], - v->attrib[FRAG_ATTRIB_TEX0 + i][2], - v->attrib[FRAG_ATTRIB_TEX0 + i][3]); + v->attrib[VARYING_SLOT_TEX0 + i][0], + v->attrib[VARYING_SLOT_TEX0 + i][1], + v->attrib[VARYING_SLOT_TEX0 + i][2], + v->attrib[VARYING_SLOT_TEX0 + i][3]); #if CHAN_TYPE == GL_FLOAT _mesa_debug(ctx, "color %f %f %f %f\n", @@ -939,12 +939,12 @@ _swrast_print_vertex( struct gl_context *ctx, const SWvertex *v ) v->color[0], v->color[1], v->color[2], v->color[3]); #endif _mesa_debug(ctx, "spec %g %g %g %g\n", - v->attrib[FRAG_ATTRIB_COL1][0], - v->attrib[FRAG_ATTRIB_COL1][1], - v->attrib[FRAG_ATTRIB_COL1][2], - v->attrib[FRAG_ATTRIB_COL1][3]); - _mesa_debug(ctx, "fog %f\n", v->attrib[FRAG_ATTRIB_FOGC][0]); - _mesa_debug(ctx, "index %f\n", v->attrib[FRAG_ATTRIB_CI][0]); + v->attrib[VARYING_SLOT_COL1][0], + v->attrib[VARYING_SLOT_COL1][1], + v->attrib[VARYING_SLOT_COL1][2], + v->attrib[VARYING_SLOT_COL1][3]); + _mesa_debug(ctx, "fog %f\n", v->attrib[VARYING_SLOT_FOGC][0]); + _mesa_debug(ctx, "index %f\n", v->attrib[VARYING_SLOT_CI][0]); _mesa_debug(ctx, "pointsize %f\n", v->pointSize); _mesa_debug(ctx, "\n"); } diff --git a/src/mesa/swrast/s_context.h b/src/mesa/swrast/s_context.h index f3f188e470f..2f7a2b53197 100644 --- a/src/mesa/swrast/s_context.h +++ b/src/mesa/swrast/s_context.h @@ -224,13 +224,13 @@ typedef struct GLboolean _DeferredTexture; /** List/array of the fragment attributes to interpolate */ - GLuint _ActiveAttribs[FRAG_ATTRIB_MAX]; - /** Same info, but as a bitmask of FRAG_BIT_x bits */ + GLuint _ActiveAttribs[VARYING_SLOT_MAX]; + /** Same info, but as a bitmask of VARYING_BIT_x bits */ GLbitfield64 _ActiveAttribMask; /** Number of fragment attributes to interpolate */ GLuint _NumActiveAttribs; /** Indicates how each attrib is to be interpolated (lines/tris) */ - GLenum _InterpMode[FRAG_ATTRIB_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ + GLenum _InterpMode[VARYING_SLOT_MAX]; /* GL_FLAT or GL_SMOOTH (for now) */ /* Working values: */ diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index bbd1f228c39..1d892617938 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -136,7 +136,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, INIT_SPAN(span, GL_BITMAP); _swrast_span_default_attribs(ctx, &span); span.arrayMask = SPAN_RGBA; - span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */ + span.arrayAttribs = VARYING_BIT_COL0; /* we'll fill in COL0 attrib values */ if (overlapping) { tmpImage = malloc(width * height * sizeof(GLfloat) * 4); @@ -161,7 +161,7 @@ copy_rgba_pixels(struct gl_context *ctx, GLint srcx, GLint srcy, ASSERT(width < SWRAST_MAX_WIDTH); for (row = 0; row < height; row++, sy += stepy, dy += stepy) { - GLvoid *rgba = span.array->attribs[FRAG_ATTRIB_COL0]; + GLvoid *rgba = span.array->attribs[VARYING_SLOT_COL0]; /* Get row/span of source pixels */ if (overlapping) { diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 7665408fd13..3d23f912fe8 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -429,7 +429,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, INIT_SPAN(span, GL_BITMAP); _swrast_span_default_attribs(ctx, &span); span.arrayMask = SPAN_RGBA; - span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */ + span.arrayAttribs = VARYING_BIT_COL0; /* we're fill in COL0 attrib values */ if (ctx->DrawBuffer->_NumColorDrawBuffers > 0) { GLenum datatype = _mesa_get_format_datatype( @@ -451,7 +451,7 @@ draw_rgba_pixels( struct gl_context *ctx, GLint x, GLint y, = _mesa_image_row_stride(unpack, width, format, type); GLint skipPixels = 0; /* use span array for temp color storage */ - GLfloat *rgba = (GLfloat *) span.array->attribs[FRAG_ATTRIB_COL0]; + GLfloat *rgba = (GLfloat *) span.array->attribs[VARYING_SLOT_COL0]; /* if the span is wider than SWRAST_MAX_WIDTH we have to do it in chunks */ while (skipPixels < width) { diff --git a/src/mesa/swrast/s_feedback.c b/src/mesa/swrast/s_feedback.c index 00f92d463c3..00467e54f71 100644 --- a/src/mesa/swrast/s_feedback.c +++ b/src/mesa/swrast/s_feedback.c @@ -37,13 +37,13 @@ static void feedback_vertex(struct gl_context * ctx, const SWvertex * v, const SWvertex * pv) { GLfloat win[4]; - const GLfloat *vtc = v->attrib[FRAG_ATTRIB_TEX0]; - const GLfloat *color = v->attrib[FRAG_ATTRIB_COL0]; + const GLfloat *vtc = v->attrib[VARYING_SLOT_TEX0]; + const GLfloat *color = v->attrib[VARYING_SLOT_COL0]; - win[0] = v->attrib[FRAG_ATTRIB_WPOS][0]; - win[1] = v->attrib[FRAG_ATTRIB_WPOS][1]; - win[2] = v->attrib[FRAG_ATTRIB_WPOS][2] / ctx->DrawBuffer->_DepthMaxF; - win[3] = 1.0F / v->attrib[FRAG_ATTRIB_WPOS][3]; + win[0] = v->attrib[VARYING_SLOT_POS][0]; + win[1] = v->attrib[VARYING_SLOT_POS][1]; + win[2] = v->attrib[VARYING_SLOT_POS][2] / ctx->DrawBuffer->_DepthMaxF; + win[3] = 1.0F / v->attrib[VARYING_SLOT_POS][3]; _mesa_feedback_vertex(ctx, win, color, vtc); } @@ -114,9 +114,9 @@ _swrast_select_triangle(struct gl_context *ctx, const SWvertex *v0, if (!_swrast_culltriangle(ctx, v0, v1, v2)) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v2->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v2->attrib[VARYING_SLOT_POS][2] * zs ); } } @@ -125,8 +125,8 @@ void _swrast_select_line(struct gl_context *ctx, const SWvertex *v0, const SWvertex *v1) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v0->attrib[FRAG_ATTRIB_WPOS][2] * zs ); - _mesa_update_hitflag( ctx, v1->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v0->attrib[VARYING_SLOT_POS][2] * zs ); + _mesa_update_hitflag( ctx, v1->attrib[VARYING_SLOT_POS][2] * zs ); } @@ -134,5 +134,5 @@ void _swrast_select_point(struct gl_context *ctx, const SWvertex *v) { const GLfloat zs = 1.0F / ctx->DrawBuffer->_DepthMaxF; - _mesa_update_hitflag( ctx, v->attrib[FRAG_ATTRIB_WPOS][2] * zs ); + _mesa_update_hitflag( ctx, v->attrib[VARYING_SLOT_POS][2] * zs ); } diff --git a/src/mesa/swrast/s_fog.c b/src/mesa/swrast/s_fog.c index ea59de16020..57a6a8e6181 100644 --- a/src/mesa/swrast/s_fog.c +++ b/src/mesa/swrast/s_fog.c @@ -87,10 +87,10 @@ do { \ * \param COMPUTE_F code to compute the fog blend factor, f. */ #define FOG_LOOP(TYPE, FOG_FUNC) \ -if (span->arrayAttribs & FRAG_BIT_FOGC) { \ +if (span->arrayAttribs & VARYING_BIT_FOGC) { \ GLuint i; \ for (i = 0; i < span->end; i++) { \ - const GLfloat fogCoord = span->array->attribs[FRAG_ATTRIB_FOGC][i][0]; \ + const GLfloat fogCoord = span->array->attribs[VARYING_SLOT_FOGC][i][0]; \ const GLfloat c = FABSF(fogCoord); \ GLfloat f, oneMinusF; \ FOG_FUNC(f, c); \ @@ -102,10 +102,10 @@ if (span->arrayAttribs & FRAG_BIT_FOGC) { \ } \ } \ else { \ - const GLfloat fogStep = span->attrStepX[FRAG_ATTRIB_FOGC][0]; \ - GLfloat fogCoord = span->attrStart[FRAG_ATTRIB_FOGC][0]; \ - const GLfloat wStep = span->attrStepX[FRAG_ATTRIB_WPOS][3]; \ - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; \ + const GLfloat fogStep = span->attrStepX[VARYING_SLOT_FOGC][0]; \ + GLfloat fogCoord = span->attrStart[VARYING_SLOT_FOGC][0]; \ + const GLfloat wStep = span->attrStepX[VARYING_SLOT_POS][3]; \ + GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; \ GLuint i; \ for (i = 0; i < span->end; i++) { \ const GLfloat c = FABSF(fogCoord) / w; \ @@ -173,7 +173,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, LINEAR_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, LINEAR_FOG); } @@ -192,7 +192,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, EXP_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, EXP_FOG); } @@ -211,7 +211,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, EXP2_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, EXP2_FOG); } @@ -236,7 +236,7 @@ _swrast_fog_rgba_span( const struct gl_context *ctx, SWspan *span ) FOG_LOOP(GLushort, BLEND_FOG); } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; ASSERT(span->array->ChanType == GL_FLOAT); FOG_LOOP(GLfloat, BLEND_FOG); } diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 9b60893db3f..1ce2ee45276 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -162,7 +162,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, const struct gl_fragment_program *program, const SWspan *span, GLuint col) { - GLfloat *wpos = span->array->attribs[FRAG_ATTRIB_WPOS][col]; + GLfloat *wpos = span->array->attribs[VARYING_SLOT_POS][col]; /* ARB_fragment_coord_conventions */ if (program->OriginUpperLeft) @@ -177,14 +177,14 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine, machine->DerivX = (GLfloat (*)[4]) span->attrStepX; machine->DerivY = (GLfloat (*)[4]) span->attrStepY; - machine->NumDeriv = FRAG_ATTRIB_MAX; + machine->NumDeriv = VARYING_SLOT_MAX; machine->Samplers = program->Base.SamplerUnits; /* if running a GLSL program (not ARB_fragment_program) */ if (ctx->Shader.CurrentFragmentProgram) { /* Store front/back facing value */ - machine->Attribs[FRAG_ATTRIB_FACE][col][0] = 1.0F - span->facing; + machine->Attribs[VARYING_SLOT_FACE][col][0] = 1.0F - span->facing; } machine->CurElement = col; @@ -223,7 +223,7 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) /* Store result color */ if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { - COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], + COPY_4V(span->array->attribs[VARYING_SLOT_COL0][i], machine->Outputs[FRAG_RESULT_COLOR]); } else { @@ -234,7 +234,7 @@ run_program(struct gl_context *ctx, SWspan *span, GLuint start, GLuint end) 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], + COPY_4V(span->array->attribs[VARYING_SLOT_COL0 + buf][i], machine->Outputs[FRAG_RESULT_DATA0 + buf]); } } @@ -272,7 +272,7 @@ _swrast_exec_fragment_program( struct gl_context *ctx, SWspan *span ) const struct gl_fragment_program *program = ctx->FragmentProgram._Current; /* incoming colors should be floats */ - if (program->Base.InputsRead & FRAG_BIT_COL0) { + if (program->Base.InputsRead & VARYING_BIT_COL0) { ASSERT(span->array->ChanType == GL_FLOAT); } diff --git a/src/mesa/swrast/s_lines.c b/src/mesa/swrast/s_lines.c index cfd3e6fa9f6..7364dd9655e 100644 --- a/src/mesa/swrast/s_lines.c +++ b/src/mesa/swrast/s_lines.c @@ -172,16 +172,16 @@ _swrast_add_spec_terms_line(struct gl_context *ctx, COPY_CHAN4(cSave[0], ncv0->color); COPY_CHAN4(cSave[1], ncv1->color); /* sum v0 */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); /* sum v1 */ - rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum); diff --git a/src/mesa/swrast/s_linetemp.h b/src/mesa/swrast/s_linetemp.h index 1668f7db914..8feb8b12087 100644 --- a/src/mesa/swrast/s_linetemp.h +++ b/src/mesa/swrast/s_linetemp.h @@ -68,10 +68,10 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) const SWcontext *swrast = SWRAST_CONTEXT(ctx); SWspan span; GLuint interpFlags = 0; - GLint x0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][0]; - GLint x1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][0]; - GLint y0 = (GLint) vert0->attrib[FRAG_ATTRIB_WPOS][1]; - GLint y1 = (GLint) vert1->attrib[FRAG_ATTRIB_WPOS][1]; + GLint x0 = (GLint) vert0->attrib[VARYING_SLOT_POS][0]; + GLint x1 = (GLint) vert1->attrib[VARYING_SLOT_POS][0]; + GLint y0 = (GLint) vert0->attrib[VARYING_SLOT_POS][1]; + GLint y1 = (GLint) vert1->attrib[VARYING_SLOT_POS][1]; GLint dx, dy; GLint numPixels; GLint xstep, ystep; @@ -99,8 +99,8 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* Cull primitives with malformed coordinates. */ { - GLfloat tmp = vert0->attrib[FRAG_ATTRIB_WPOS][0] + vert0->attrib[FRAG_ATTRIB_WPOS][1] - + vert1->attrib[FRAG_ATTRIB_WPOS][0] + vert1->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat tmp = vert0->attrib[VARYING_SLOT_POS][0] + vert0->attrib[VARYING_SLOT_POS][1] + + vert1->attrib[VARYING_SLOT_POS][0] + vert1->attrib[VARYING_SLOT_POS][1]; if (IS_INF_OR_NAN(tmp)) return; } @@ -108,12 +108,12 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* printf("%s():\n", __FUNCTION__); printf(" (%f, %f, %f) -> (%f, %f, %f)\n", - vert0->attrib[FRAG_ATTRIB_WPOS][0], - vert0->attrib[FRAG_ATTRIB_WPOS][1], - vert0->attrib[FRAG_ATTRIB_WPOS][2], - vert1->attrib[FRAG_ATTRIB_WPOS][0], - vert1->attrib[FRAG_ATTRIB_WPOS][1], - vert1->attrib[FRAG_ATTRIB_WPOS][2]); + vert0->attrib[VARYING_SLOT_POS][0], + vert0->attrib[VARYING_SLOT_POS][1], + vert0->attrib[VARYING_SLOT_POS][2], + vert1->attrib[VARYING_SLOT_POS][0], + vert1->attrib[VARYING_SLOT_POS][1], + vert1->attrib[VARYING_SLOT_POS][2]); printf(" (%d, %d, %d) -> (%d, %d, %d)\n", vert0->color[0], vert0->color[1], vert0->color[2], vert1->color[0], vert1->color[1], vert1->color[2]); @@ -155,14 +155,14 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) /* printf("%s %d,%d %g %g %g %g %g %g %g %g\n", __FUNCTION__, dx, dy, - vert0->attrib[FRAG_ATTRIB_COL1][0], - vert0->attrib[FRAG_ATTRIB_COL1][1], - vert0->attrib[FRAG_ATTRIB_COL1][2], - vert0->attrib[FRAG_ATTRIB_COL1][3], - vert1->attrib[FRAG_ATTRIB_COL1][0], - vert1->attrib[FRAG_ATTRIB_COL1][1], - vert1->attrib[FRAG_ATTRIB_COL1][2], - vert1->attrib[FRAG_ATTRIB_COL1][3]); + vert0->attrib[VARYING_SLOT_COL1][0], + vert0->attrib[VARYING_SLOT_COL1][1], + vert0->attrib[VARYING_SLOT_COL1][2], + vert0->attrib[VARYING_SLOT_COL1][3], + vert1->attrib[VARYING_SLOT_COL1][0], + vert1->attrib[VARYING_SLOT_COL1][1], + vert1->attrib[VARYING_SLOT_COL1][2], + vert1->attrib[VARYING_SLOT_COL1][3]); */ #ifdef DEPTH_TYPE @@ -245,27 +245,27 @@ NAME( struct gl_context *ctx, const SWvertex *vert0, const SWvertex *vert1 ) interpFlags |= SPAN_Z; { if (depthBits <= 16) { - span.z = FloatToFixed(vert0->attrib[FRAG_ATTRIB_WPOS][2]) + FIXED_HALF; - span.zStep = FloatToFixed( vert1->attrib[FRAG_ATTRIB_WPOS][2] - - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels; + span.z = FloatToFixed(vert0->attrib[VARYING_SLOT_POS][2]) + FIXED_HALF; + span.zStep = FloatToFixed( vert1->attrib[VARYING_SLOT_POS][2] + - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels; } else { /* don't use fixed point */ - span.z = (GLuint) vert0->attrib[FRAG_ATTRIB_WPOS][2]; - span.zStep = (GLint) (( vert1->attrib[FRAG_ATTRIB_WPOS][2] - - vert0->attrib[FRAG_ATTRIB_WPOS][2]) / numPixels); + span.z = (GLuint) vert0->attrib[VARYING_SLOT_POS][2]; + span.zStep = (GLint) (( vert1->attrib[VARYING_SLOT_POS][2] + - vert0->attrib[VARYING_SLOT_POS][2]) / numPixels); } } #endif #if defined(INTERP_ATTRIBS) { const GLfloat invLen = 1.0F / numPixels; - const GLfloat invw0 = vert0->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat invw1 = vert1->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invw0 = vert0->attrib[VARYING_SLOT_POS][3]; + const GLfloat invw1 = vert1->attrib[VARYING_SLOT_POS][3]; - span.attrStart[FRAG_ATTRIB_WPOS][3] = invw0; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = (invw1 - invw0) * invLen; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0; + span.attrStart[VARYING_SLOT_POS][3] = invw0; + span.attrStepX[VARYING_SLOT_POS][3] = (invw1 - invw0) * invLen; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0; ATTRIB_LOOP_BEGIN if (swrast->_InterpMode[attr] == GL_FLAT) { diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c index 8791630a43b..93388d720b6 100644 --- a/src/mesa/swrast/s_logic.c +++ b/src/mesa/swrast/s_logic.c @@ -212,7 +212,7 @@ _swrast_logicop_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, } else { logicop_uint4(ctx, 4 * span->end, - (GLuint *) span->array->attribs[FRAG_ATTRIB_COL0], + (GLuint *) span->array->attribs[VARYING_SLOT_COL0], (const GLuint *) rbPixels, span->array->mask); } } diff --git a/src/mesa/swrast/s_masking.c b/src/mesa/swrast/s_masking.c index 4f262fa976b..8f53446500b 100644 --- a/src/mesa/swrast/s_masking.c +++ b/src/mesa/swrast/s_masking.c @@ -90,7 +90,7 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb, const GLuint bMask = ctx->Color.ColorMask[buf][BCOMP] ? ~0x0 : 0x0; const GLuint aMask = ctx->Color.ColorMask[buf][ACOMP] ? ~0x0 : 0x0; const GLuint (*dst)[4] = (const GLuint (*)[4]) rbPixels; - GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[FRAG_ATTRIB_COL0]; + GLuint (*src)[4] = (GLuint (*)[4]) span->array->attribs[VARYING_SLOT_COL0]; GLuint i; for (i = 0; i < n; i++) { src[i][RCOMP] = (src[i][RCOMP] & rMask) | (dst[i][RCOMP] & ~rMask); diff --git a/src/mesa/swrast/s_points.c b/src/mesa/swrast/s_points.c index acbdb2d42dd..80693be8e85 100644 --- a/src/mesa/swrast/s_points.c +++ b/src/mesa/swrast/s_points.c @@ -37,8 +37,8 @@ */ #define CULL_INVALID(V) \ do { \ - float tmp = (V)->attrib[FRAG_ATTRIB_WPOS][0] \ - + (V)->attrib[FRAG_ATTRIB_WPOS][1]; \ + float tmp = (V)->attrib[VARYING_SLOT_POS][0] \ + + (V)->attrib[VARYING_SLOT_POS][1]; \ if (IS_INF_OR_NAN(tmp)) \ return; \ } while(0) @@ -93,9 +93,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_FALSE); @@ -116,9 +116,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; { GLfloat s, r, dsdx; @@ -137,9 +137,9 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) } ATTRIB_LOOP_BEGIN - if (attr >= FRAG_ATTRIB_TEX0 && attr <= FRAG_ATTRIB_TEX7) { + if (attr >= VARYING_SLOT_TEX0 && attr <= VARYING_SLOT_TEX7) { /* a texcoord attribute */ - const GLuint u = attr - FRAG_ATTRIB_TEX0; + const GLuint u = attr - VARYING_SLOT_TEX0; ASSERT(u < Elements(ctx->Point.CoordReplace)); if (ctx->Point.CoordReplace[u]) { tCoords[numTcoords++] = attr; @@ -169,15 +169,15 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) continue; } } - else if (attr == FRAG_ATTRIB_PNTC) { + else if (attr == VARYING_SLOT_PNTC) { /* GLSL gl_PointCoord.xy (.zw undefined) */ - span.attrStart[FRAG_ATTRIB_PNTC][0] = 0.0; - span.attrStart[FRAG_ATTRIB_PNTC][1] = 0.0; /* t0 set below */ - span.attrStepX[FRAG_ATTRIB_PNTC][0] = dsdx; - span.attrStepX[FRAG_ATTRIB_PNTC][1] = 0.0; - span.attrStepY[FRAG_ATTRIB_PNTC][0] = 0.0; - span.attrStepY[FRAG_ATTRIB_PNTC][1] = dtdy; - tCoords[numTcoords++] = FRAG_ATTRIB_PNTC; + span.attrStart[VARYING_SLOT_PNTC][0] = 0.0; + span.attrStart[VARYING_SLOT_PNTC][1] = 0.0; /* t0 set below */ + span.attrStepX[VARYING_SLOT_PNTC][0] = dsdx; + span.attrStepX[VARYING_SLOT_PNTC][1] = 0.0; + span.attrStepY[VARYING_SLOT_PNTC][0] = 0.0; + span.attrStepY[VARYING_SLOT_PNTC][1] = dtdy; + tCoords[numTcoords++] = VARYING_SLOT_PNTC; continue; } /* use vertex's texcoord/attrib */ @@ -189,8 +189,8 @@ sprite_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; GLint iSize = (GLint) (size + 0.5F); GLint xmin, xmax, ymin, ymax, iy; GLint iRadius; @@ -250,9 +250,9 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_TRUE); @@ -289,9 +289,9 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; ATTRIB_LOOP_BEGIN COPY_4V(span.attrStart[attr], vert->attrib[attr]); @@ -301,8 +301,8 @@ smooth_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; const GLfloat radius = 0.5F * size; const GLfloat rmin = radius - 0.7071F; /* 0.7071 = sqrt(2)/2 */ const GLfloat rmax = radius + 0.7071F; @@ -370,9 +370,9 @@ large_point(struct gl_context *ctx, const SWvertex *vert) /* z coord */ if (ctx->DrawBuffer->Visual.depthBits <= 16) - span.z = FloatToFixed(vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = FloatToFixed(vert->attrib[VARYING_SLOT_POS][2] + 0.5F); else - span.z = (GLuint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span.z = (GLuint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span.zStep = 0; size = get_size(ctx, vert, GL_FALSE); @@ -393,9 +393,9 @@ large_point(struct gl_context *ctx, const SWvertex *vert) span.alphaStep = 0; /* need these for fragment programs */ - span.attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span.attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span.attrStart[VARYING_SLOT_POS][3] = 1.0F; + span.attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span.attrStepY[VARYING_SLOT_POS][3] = 0.0F; ATTRIB_LOOP_BEGIN COPY_4V(span.attrStart[attr], vert->attrib[attr]); @@ -405,8 +405,8 @@ large_point(struct gl_context *ctx, const SWvertex *vert) /* compute pos, bounds and render */ { - const GLfloat x = vert->attrib[FRAG_ATTRIB_WPOS][0]; - const GLfloat y = vert->attrib[FRAG_ATTRIB_WPOS][1]; + const GLfloat x = vert->attrib[VARYING_SLOT_POS][0]; + const GLfloat y = vert->attrib[VARYING_SLOT_POS][1]; GLint iSize = (GLint) (size + 0.5F); GLint xmin, xmax, ymin, ymax, ix, iy; GLint iRadius; @@ -470,9 +470,9 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert) span->arrayAttribs = swrast->_ActiveAttribMask; /* we'll produce these vals */ /* need these for fragment programs */ - span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0F; - span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0F; - span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0F; + span->attrStart[VARYING_SLOT_POS][3] = 1.0F; + span->attrStepX[VARYING_SLOT_POS][3] = 0.0F; + span->attrStepY[VARYING_SLOT_POS][3] = 0.0F; /* check if we need to flush */ if (span->end >= SWRAST_MAX_WIDTH || @@ -499,9 +499,9 @@ pixel_point(struct gl_context *ctx, const SWvertex *vert) ATTRIB_LOOP_END /* fragment position */ - span->array->x[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][0]; - span->array->y[count] = (GLint) vert->attrib[FRAG_ATTRIB_WPOS][1]; - span->array->z[count] = (GLint) (vert->attrib[FRAG_ATTRIB_WPOS][2] + 0.5F); + span->array->x[count] = (GLint) vert->attrib[VARYING_SLOT_POS][0]; + span->array->y[count] = (GLint) vert->attrib[VARYING_SLOT_POS][1]; + span->array->z[count] = (GLint) (vert->attrib[VARYING_SLOT_POS][2] + 0.5F); span->end = count + 1; ASSERT(span->end <= SWRAST_MAX_WIDTH); @@ -522,9 +522,9 @@ _swrast_add_spec_terms_point(struct gl_context *ctx, const SWvertex *v0) /* save */ COPY_CHAN4(cSave, ncv0->color); /* sum */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index ff653a62257..7bb3b1f2b9f 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -79,9 +79,9 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) } /* W (for perspective correction) */ - span->attrStart[FRAG_ATTRIB_WPOS][3] = 1.0; - span->attrStepX[FRAG_ATTRIB_WPOS][3] = 0.0; - span->attrStepY[FRAG_ATTRIB_WPOS][3] = 0.0; + span->attrStart[VARYING_SLOT_POS][3] = 1.0; + span->attrStepX[VARYING_SLOT_POS][3] = 0.0; + span->attrStepY[VARYING_SLOT_POS][3] = 0.0; /* primary color, or color index */ UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterColor[0]); @@ -105,16 +105,16 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) span->alphaStep = 0; span->interpMask |= SPAN_RGBA; - COPY_4V(span->attrStart[FRAG_ATTRIB_COL0], ctx->Current.RasterColor); - ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0); - ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL0], 0.0, 0.0, 0.0, 0.0); + COPY_4V(span->attrStart[VARYING_SLOT_COL0], ctx->Current.RasterColor); + ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL0], 0.0, 0.0, 0.0, 0.0); /* Secondary color */ if (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled) { - COPY_4V(span->attrStart[FRAG_ATTRIB_COL1], ctx->Current.RasterSecondaryColor); - ASSIGN_4V(span->attrStepX[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0); - ASSIGN_4V(span->attrStepY[FRAG_ATTRIB_COL1], 0.0, 0.0, 0.0, 0.0); + COPY_4V(span->attrStart[VARYING_SLOT_COL1], ctx->Current.RasterSecondaryColor); + ASSIGN_4V(span->attrStepX[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0); + ASSIGN_4V(span->attrStepY[VARYING_SLOT_COL1], 0.0, 0.0, 0.0, 0.0); } /* fog */ @@ -129,16 +129,16 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) /* fog blend factor should be computed from fogcoord now */ fogVal = _swrast_z_to_fogfactor(ctx, ctx->Current.RasterDistance); } - span->attrStart[FRAG_ATTRIB_FOGC][0] = fogVal; - span->attrStepX[FRAG_ATTRIB_FOGC][0] = 0.0; - span->attrStepY[FRAG_ATTRIB_FOGC][0] = 0.0; + span->attrStart[VARYING_SLOT_FOGC][0] = fogVal; + span->attrStepX[VARYING_SLOT_FOGC][0] = 0.0; + span->attrStepY[VARYING_SLOT_FOGC][0] = 0.0; } /* texcoords */ { GLuint i; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - const GLuint attr = FRAG_ATTRIB_TEX0 + i; + const GLuint attr = VARYING_SLOT_TEX0 + i; const GLfloat *tc = ctx->Current.RasterTexCoords[i]; if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { @@ -165,7 +165,7 @@ _swrast_span_default_attribs(struct gl_context *ctx, SWspan *span) * Interpolate the active attributes (and'd with attrMask) to * fill in span->array->attribs[]. * Perspective correction will be done. The point/line/triangle function - * should have computed attrStart/Step values for FRAG_ATTRIB_WPOS[3]! + * should have computed attrStart/Step values for VARYING_SLOT_POS[3]! */ static inline void interpolate_active_attribs(struct gl_context *ctx, SWspan *span, @@ -181,8 +181,8 @@ interpolate_active_attribs(struct gl_context *ctx, SWspan *span, ATTRIB_LOOP_BEGIN if (attrMask & BITFIELD64_BIT(attr)) { - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3]; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3]; const GLfloat dv0dx = span->attrStepX[attr][0]; const GLfloat dv1dx = span->attrStepX[attr][1]; const GLfloat dv2dx = span->attrStepX[attr][2]; @@ -302,7 +302,7 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span) break; #endif case GL_FLOAT: - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); break; default: _mesa_problem(ctx, "bad datatype 0x%x in interpolate_int_colors", @@ -313,16 +313,16 @@ interpolate_int_colors(struct gl_context *ctx, SWspan *span) /** - * Populate the FRAG_ATTRIB_COL0 array. + * Populate the VARYING_SLOT_COL0 array. */ static inline void interpolate_float_colors(SWspan *span) { - GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0]; const GLuint n = span->end; GLuint i; - assert(!(span->arrayAttribs & FRAG_BIT_COL0)); + assert(!(span->arrayAttribs & VARYING_BIT_COL0)); if (span->arrayMask & SPAN_RGBA) { /* convert array of int colors */ @@ -367,7 +367,7 @@ interpolate_float_colors(SWspan *span) } } - span->arrayAttribs |= FRAG_BIT_COL0; + span->arrayAttribs |= VARYING_BIT_COL0; span->array->ChanType = GL_FLOAT; } @@ -456,7 +456,7 @@ _swrast_compute_lambda(GLfloat dsdx, GLfloat dsdy, GLfloat dtdx, GLfloat dtdy, /** - * Fill in the span.array->attrib[FRAG_ATTRIB_TEXn] arrays from the + * Fill in the span.array->attrib[VARYING_SLOT_TEXn] arrays from the * using the attrStart/Step values. * * This function only used during fixed-function fragment processing. @@ -476,7 +476,7 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) /* XXX CoordUnits vs. ImageUnits */ for (u = 0; u < maxUnit; u++) { if (ctx->Texture._EnabledCoordUnits & (1 << u)) { - const GLuint attr = FRAG_ATTRIB_TEX0 + u; + const GLuint attr = VARYING_SLOT_TEX0 + u; const struct gl_texture_object *obj = ctx->Texture.Unit[u]._Current; GLfloat texW, texH; GLboolean needLambda; @@ -524,8 +524,8 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -565,8 +565,8 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) if (_swrast_use_fragment_program(ctx) || ctx->ATIFragmentShader._Enabled) { /* do perspective correction but don't divide s, t, r by q */ - const GLfloat dwdx = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - GLfloat w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dwdx; + const GLfloat dwdx = span->attrStepX[VARYING_SLOT_POS][3]; + GLfloat w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dwdx; for (i = 0; i < span->end; i++) { const GLfloat invW = 1.0F / w; texcoord[i][0] = s * invW; @@ -616,12 +616,12 @@ interpolate_texcoords(struct gl_context *ctx, SWspan *span) /** - * Fill in the arrays->attribs[FRAG_ATTRIB_WPOS] array. + * Fill in the arrays->attribs[VARYING_SLOT_POS] array. */ static inline void interpolate_wpos(struct gl_context *ctx, SWspan *span) { - GLfloat (*wpos)[4] = span->array->attribs[FRAG_ATTRIB_WPOS]; + GLfloat (*wpos)[4] = span->array->attribs[VARYING_SLOT_POS]; GLuint i; const GLfloat zScale = 1.0F / ctx->DrawBuffer->_DepthMaxF; GLfloat w, dw; @@ -639,8 +639,8 @@ interpolate_wpos(struct gl_context *ctx, SWspan *span) } } - dw = span->attrStepX[FRAG_ATTRIB_WPOS][3]; - w = span->attrStart[FRAG_ATTRIB_WPOS][3] + span->leftClip * dw; + dw = span->attrStepX[VARYING_SLOT_POS][3]; + w = span->attrStart[VARYING_SLOT_POS][3] + span->leftClip * dw; for (i = 0; i < span->end; i++) { wpos[i][2] = (GLfloat) span->array->z[i] * zScale; wpos[i][3] = w; @@ -764,7 +764,7 @@ clip_span( struct gl_context *ctx, SWspan *span ) * fragment attributes. * For arrays of values, shift them left. */ - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (span->interpMask & (1 << i)) { GLuint j; for (j = 0; j < 4; j++) { @@ -785,7 +785,7 @@ clip_span( struct gl_context *ctx, SWspan *span ) #define SHIFT_ARRAY(ARRAY, SHIFT, LEN) \ memmove(ARRAY, ARRAY + (SHIFT), (LEN) * sizeof(ARRAY[0])) - for (i = 0; i < FRAG_ATTRIB_MAX; i++) { + for (i = 0; i < VARYING_SLOT_MAX; i++) { if (span->arrayAttribs & (1 << i)) { /* shift array elements left by 'leftClip' */ SHIFT_ARRAY(span->array->attribs[i], leftClip, n - leftClip); @@ -825,41 +825,41 @@ clip_span( struct gl_context *ctx, SWspan *span ) /** * Add specular colors to primary colors. * Only called during fixed-function operation. - * Result is float color array (FRAG_ATTRIB_COL0). + * Result is float color array (VARYING_SLOT_COL0). */ static inline void add_specular(struct gl_context *ctx, SWspan *span) { const SWcontext *swrast = SWRAST_CONTEXT(ctx); const GLubyte *mask = span->array->mask; - GLfloat (*col0)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; - GLfloat (*col1)[4] = span->array->attribs[FRAG_ATTRIB_COL1]; + GLfloat (*col0)[4] = span->array->attribs[VARYING_SLOT_COL0]; + GLfloat (*col1)[4] = span->array->attribs[VARYING_SLOT_COL1]; GLuint i; ASSERT(!_swrast_use_fragment_program(ctx)); ASSERT(span->arrayMask & SPAN_RGBA); - ASSERT(swrast->_ActiveAttribMask & FRAG_BIT_COL1); + ASSERT(swrast->_ActiveAttribMask & VARYING_BIT_COL1); (void) swrast; /* silence warning */ if (span->array->ChanType == GL_FLOAT) { - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); } } else { /* need float colors */ - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { interpolate_float_colors(span); } } - if ((span->arrayAttribs & FRAG_BIT_COL1) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL1) == 0) { /* XXX could avoid this and interpolate COL1 in the loop below */ - interpolate_active_attribs(ctx, span, FRAG_BIT_COL1); + interpolate_active_attribs(ctx, span, VARYING_BIT_COL1); } - ASSERT(span->arrayAttribs & FRAG_BIT_COL0); - ASSERT(span->arrayAttribs & FRAG_BIT_COL1); + ASSERT(span->arrayAttribs & VARYING_BIT_COL0); + ASSERT(span->arrayAttribs & VARYING_BIT_COL1); for (i = 0; i < span->end; i++) { if (mask[i]) { @@ -898,7 +898,7 @@ apply_aa_coverage(SWspan *span) } } else { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; for (i = 0; i < span->end; i++) { rgba[i][ACOMP] = rgba[i][ACOMP] * coverage[i]; /* clamp later */ @@ -913,7 +913,7 @@ apply_aa_coverage(SWspan *span) static inline void clamp_colors(SWspan *span) { - GLfloat (*rgba)[4] = span->array->attribs[FRAG_ATTRIB_COL0]; + GLfloat (*rgba)[4] = span->array->attribs[VARYING_SLOT_COL0]; GLuint i; ASSERT(span->array->ChanType == GL_FLOAT); for (i = 0; i < span->end; i++) { @@ -937,7 +937,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output) GLvoid *src, *dst; if (output > 0 || span->array->ChanType == GL_FLOAT) { - src = span->array->attribs[FRAG_ATTRIB_COL0 + output]; + src = span->array->attribs[VARYING_SLOT_COL0 + output]; span->array->ChanType = GL_FLOAT; } else if (span->array->ChanType == GL_UNSIGNED_BYTE) { @@ -955,7 +955,7 @@ convert_color_type(SWspan *span, GLenum newType, GLuint output) dst = span->array->rgba16; } else { - dst = span->array->attribs[FRAG_ATTRIB_COL0]; + dst = span->array->attribs[VARYING_SLOT_COL0]; } _mesa_convert_colors(span->array->ChanType, src, @@ -981,7 +981,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) convert_color_type(span, GL_FLOAT, 0); } else { - span->array->rgba = (void *) span->array->attribs[FRAG_ATTRIB_COL0]; + span->array->rgba = (void *) span->array->attribs[VARYING_SLOT_COL0]; } if (span->primitive != GL_POINT || @@ -996,7 +996,7 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) _swrast_span_interpolate_z (ctx, span); #if 0 - if (inputsRead & FRAG_BIT_WPOS) + if (inputsRead & VARYING_BIT_POS) #else /* XXX always interpolate wpos so that DDX/DDY work */ #endif @@ -1015,14 +1015,14 @@ shade_texture_span(struct gl_context *ctx, SWspan *span) /* conventional texturing */ #if CHAN_BITS == 32 - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { interpolate_int_colors(ctx, span); } #else if (!(span->arrayMask & SPAN_RGBA)) interpolate_int_colors(ctx, span); #endif - if ((span->arrayAttribs & FRAG_BITS_TEX_ANY) == 0x0) + if ((span->arrayAttribs & VARYING_BITS_TEX_ANY) == 0x0) interpolate_texcoords(ctx, span); _swrast_texture_span(ctx, span); @@ -1262,8 +1262,8 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) } #if CHAN_BITS == 32 - if ((span->arrayAttribs & FRAG_BIT_COL0) == 0) { - interpolate_active_attribs(ctx, span, FRAG_BIT_COL0); + if ((span->arrayAttribs & VARYING_BIT_COL0) == 0) { + interpolate_active_attribs(ctx, span, VARYING_BIT_COL0); } #else if ((span->arrayMask & SPAN_RGBA) == 0) { @@ -1339,7 +1339,7 @@ _swrast_write_rgba_span( struct gl_context *ctx, SWspan *span) } else { span->array->rgba = (void *) - span->array->attribs[FRAG_ATTRIB_COL0]; + span->array->attribs[VARYING_SLOT_COL0]; } } @@ -1574,7 +1574,7 @@ _swrast_get_dest_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, void *rbPixels; /* Point rbPixels to a temporary space */ - rbPixels = span->array->attribs[FRAG_ATTRIB_MAX - 1]; + rbPixels = span->array->attribs[VARYING_SLOT_MAX - 1]; /* Get destination values from renderbuffer */ if (span->arrayMask & SPAN_XY) { diff --git a/src/mesa/swrast/s_span.h b/src/mesa/swrast/s_span.h index 0763c7161b9..6f710c533ca 100644 --- a/src/mesa/swrast/s_span.h +++ b/src/mesa/swrast/s_span.h @@ -68,11 +68,11 @@ struct gl_renderbuffer; */ typedef struct sw_span_arrays { - /** Per-fragment attributes (indexed by FRAG_ATTRIB_* tokens) */ + /** Per-fragment attributes (indexed by VARYING_SLOT_* tokens) */ /* XXX someday look at transposing first two indexes for better memory * access pattern. */ - GLfloat attribs[FRAG_ATTRIB_MAX][SWRAST_MAX_WIDTH][4]; + GLfloat attribs[VARYING_SLOT_MAX][SWRAST_MAX_WIDTH][4]; /** This mask indicates which fragments are alive or culled */ GLubyte mask[SWRAST_MAX_WIDTH]; @@ -133,9 +133,9 @@ typedef struct sw_span GLbitfield interpMask; /** Fragment attribute interpolants */ - GLfloat attrStart[FRAG_ATTRIB_MAX][4]; /**< initial value */ - GLfloat attrStepX[FRAG_ATTRIB_MAX][4]; /**< dvalue/dx */ - GLfloat attrStepY[FRAG_ATTRIB_MAX][4]; /**< dvalue/dy */ + GLfloat attrStart[VARYING_SLOT_MAX][4]; /**< initial value */ + GLfloat attrStepX[VARYING_SLOT_MAX][4]; /**< dvalue/dx */ + GLfloat attrStepY[VARYING_SLOT_MAX][4]; /**< dvalue/dy */ /* XXX the rest of these will go away eventually... */ @@ -156,7 +156,7 @@ typedef struct sw_span */ GLbitfield arrayMask; - /** Mask of FRAG_BIT_x bits */ + /** Mask of VARYING_BIT_x bits */ GLbitfield64 arrayAttribs; /** diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 1a2db35e286..c24807cb77e 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -648,9 +648,9 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) if (texUnit->_ReallyEnabled && texUnit->_CurrentCombine->ModeRGB == GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) - span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; + span->array->attribs[VARYING_SLOT_TEX0 + unit]; float4_array targetcoords = - span->array->attribs[FRAG_ATTRIB_TEX0 + + span->array->attribs[VARYING_SLOT_TEX0 + ctx->Texture.Unit[unit].BumpTarget - GL_TEXTURE0]; const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit); @@ -714,7 +714,7 @@ _swrast_texture_span( struct gl_context *ctx, SWspan *span ) if (texUnit->_ReallyEnabled && texUnit->_CurrentCombine->ModeRGB != GL_BUMP_ENVMAP_ATI) { const GLfloat (*texcoords)[4] = (const GLfloat (*)[4]) - span->array->attribs[FRAG_ATTRIB_TEX0 + unit]; + span->array->attribs[VARYING_SLOT_TEX0 + unit]; const struct gl_texture_object *curObj = texUnit->_Current; const struct gl_sampler_object *samp = _mesa_get_samplerobj(ctx, unit); GLfloat *lambda = span->array->lambda[unit]; diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 953300f655d..ae3ffe5f460 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1880,7 +1880,7 @@ sample_lambda_2d_aniso(struct gl_context *ctx, * from the context list of available texture objects. */ const GLuint u = texture_unit_index(ctx, tObj); - const GLuint attr = FRAG_ATTRIB_TEX0 + u; + const GLuint attr = VARYING_SLOT_TEX0 + u; GLfloat texW, texH; const GLfloat dsdx = span->attrStepX[attr][0]; diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 893859db083..f0b1d383dba 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -57,10 +57,10 @@ _swrast_culltriangle( struct gl_context *ctx, const SWvertex *v2 ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - GLfloat ex = v1->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat ey = v1->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat fx = v2->attrib[FRAG_ATTRIB_WPOS][0] - v0->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat fy = v2->attrib[FRAG_ATTRIB_WPOS][1] - v0->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat ex = v1->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0]; + GLfloat ey = v1->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1]; + GLfloat fx = v2->attrib[VARYING_SLOT_POS][0] - v0->attrib[VARYING_SLOT_POS][0]; + GLfloat fy = v2->attrib[VARYING_SLOT_POS][1] - v0->attrib[VARYING_SLOT_POS][1]; GLfloat c = ex*fy-ey*fx; if (c * swrast->_BackfaceSign * swrast->_BackfaceCullSign <= 0.0F) @@ -678,13 +678,13 @@ fast_persp_span(struct gl_context *ctx, SWspan *span, const GLuint texEnableSave = ctx->Texture._EnabledCoordUnits; ctx->Texture._EnabledCoordUnits = 0; - tex_coord[0] = span->attrStart[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); - tex_step[0] = span->attrStepX[FRAG_ATTRIB_TEX0][0] * (info->smask + 1); - tex_coord[1] = span->attrStart[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); - tex_step[1] = span->attrStepX[FRAG_ATTRIB_TEX0][1] * (info->tmask + 1); - /* span->attrStart[FRAG_ATTRIB_TEX0][2] only if 3D-texturing, here only 2D */ - tex_coord[2] = span->attrStart[FRAG_ATTRIB_TEX0][3]; - tex_step[2] = span->attrStepX[FRAG_ATTRIB_TEX0][3]; + tex_coord[0] = span->attrStart[VARYING_SLOT_TEX0][0] * (info->smask + 1); + tex_step[0] = span->attrStepX[VARYING_SLOT_TEX0][0] * (info->smask + 1); + tex_coord[1] = span->attrStart[VARYING_SLOT_TEX0][1] * (info->tmask + 1); + tex_step[1] = span->attrStepX[VARYING_SLOT_TEX0][1] * (info->tmask + 1); + /* span->attrStart[VARYING_SLOT_TEX0][2] only if 3D-texturing, here only 2D */ + tex_coord[2] = span->attrStart[VARYING_SLOT_TEX0][3]; + tex_step[2] = span->attrStepX[VARYING_SLOT_TEX0][3]; switch (info->filter) { case GL_NEAREST: @@ -939,23 +939,23 @@ _swrast_add_spec_terms_triangle(struct gl_context *ctx, const SWvertex *v0, COPY_CHAN4( cSave[1], ncv1->color ); COPY_CHAN4( cSave[2], ncv2->color ); /* sum v0 */ - rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv0->color[0]) + ncv0->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv0->color[1]) + ncv0->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv0->color[2]) + ncv0->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv0->color[2], bSum); /* sum v1 */ - rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv1->color[0]) + ncv1->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv1->color[1]) + ncv1->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv1->color[2]) + ncv1->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv1->color[2], bSum); /* sum v2 */ - rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[FRAG_ATTRIB_COL1][0]; - gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[FRAG_ATTRIB_COL1][1]; - bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[FRAG_ATTRIB_COL1][2]; + rSum = CHAN_TO_FLOAT(ncv2->color[0]) + ncv2->attrib[VARYING_SLOT_COL1][0]; + gSum = CHAN_TO_FLOAT(ncv2->color[1]) + ncv2->attrib[VARYING_SLOT_COL1][1]; + bSum = CHAN_TO_FLOAT(ncv2->color[2]) + ncv2->attrib[VARYING_SLOT_COL1][2]; UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[0], rSum); UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[1], gSum); UNCLAMPED_FLOAT_TO_CHAN(ncv2->color[2], bSum); diff --git a/src/mesa/swrast/s_tritemp.h b/src/mesa/swrast/s_tritemp.h index 061759d26d2..797afc41a62 100644 --- a/src/mesa/swrast/s_tritemp.h +++ b/src/mesa/swrast/s_tritemp.h @@ -153,26 +153,26 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, /* printf("%s()\n", __FUNCTION__); printf(" %g, %g, %g\n", - v0->attrib[FRAG_ATTRIB_WPOS][0], - v0->attrib[FRAG_ATTRIB_WPOS][1], - v0->attrib[FRAG_ATTRIB_WPOS][2]); + v0->attrib[VARYING_SLOT_POS][0], + v0->attrib[VARYING_SLOT_POS][1], + v0->attrib[VARYING_SLOT_POS][2]); printf(" %g, %g, %g\n", - v1->attrib[FRAG_ATTRIB_WPOS][0], - v1->attrib[FRAG_ATTRIB_WPOS][1], - v1->attrib[FRAG_ATTRIB_WPOS][2]); + v1->attrib[VARYING_SLOT_POS][0], + v1->attrib[VARYING_SLOT_POS][1], + v1->attrib[VARYING_SLOT_POS][2]); printf(" %g, %g, %g\n", - v2->attrib[FRAG_ATTRIB_WPOS][0], - v2->attrib[FRAG_ATTRIB_WPOS][1], - v2->attrib[FRAG_ATTRIB_WPOS][2]); + v2->attrib[VARYING_SLOT_POS][0], + v2->attrib[VARYING_SLOT_POS][1], + v2->attrib[VARYING_SLOT_POS][2]); */ /* Compute fixed point x,y coords w/ half-pixel offsets and snapping. * And find the order of the 3 vertices along the Y axis. */ { - const GLfixed fy0 = FloatToFixed(v0->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; - const GLfixed fy1 = FloatToFixed(v1->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; - const GLfixed fy2 = FloatToFixed(v2->attrib[FRAG_ATTRIB_WPOS][1] - 0.5F) & snapMask; + const GLfixed fy0 = FloatToFixed(v0->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; + const GLfixed fy1 = FloatToFixed(v1->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; + const GLfixed fy2 = FloatToFixed(v2->attrib[VARYING_SLOT_POS][1] - 0.5F) & snapMask; if (fy0 <= fy1) { if (fy1 <= fy2) { /* y0 <= y1 <= y2 */ @@ -212,9 +212,9 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, } /* fixed point X coords */ - vMin_fx = FloatToFixed(vMin->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; - vMid_fx = FloatToFixed(vMid->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; - vMax_fx = FloatToFixed(vMax->attrib[FRAG_ATTRIB_WPOS][0] + 0.5F) & snapMask; + vMin_fx = FloatToFixed(vMin->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; + vMid_fx = FloatToFixed(vMid->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; + vMax_fx = FloatToFixed(vMax->attrib[VARYING_SLOT_POS][0] + 0.5F) & snapMask; } /* vertex/edge relationship */ @@ -333,22 +333,22 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_Z span.interpMask |= SPAN_Z; { - GLfloat eMaj_dz = vMax->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2]; - GLfloat eBot_dz = vMid->attrib[FRAG_ATTRIB_WPOS][2] - vMin->attrib[FRAG_ATTRIB_WPOS][2]; - span.attrStepX[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); - if (span.attrStepX[FRAG_ATTRIB_WPOS][2] > maxDepth || - span.attrStepX[FRAG_ATTRIB_WPOS][2] < -maxDepth) { + GLfloat eMaj_dz = vMax->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2]; + GLfloat eBot_dz = vMid->attrib[VARYING_SLOT_POS][2] - vMin->attrib[VARYING_SLOT_POS][2]; + span.attrStepX[VARYING_SLOT_POS][2] = oneOverArea * (eMaj_dz * eBot.dy - eMaj.dy * eBot_dz); + if (span.attrStepX[VARYING_SLOT_POS][2] > maxDepth || + span.attrStepX[VARYING_SLOT_POS][2] < -maxDepth) { /* probably a sliver triangle */ - span.attrStepX[FRAG_ATTRIB_WPOS][2] = 0.0; - span.attrStepY[FRAG_ATTRIB_WPOS][2] = 0.0; + span.attrStepX[VARYING_SLOT_POS][2] = 0.0; + span.attrStepY[VARYING_SLOT_POS][2] = 0.0; } else { - span.attrStepY[FRAG_ATTRIB_WPOS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); + span.attrStepY[VARYING_SLOT_POS][2] = oneOverArea * (eMaj.dx * eBot_dz - eMaj_dz * eBot.dx); } if (depthBits <= 16) - span.zStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_WPOS][2]); + span.zStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_POS][2]); else - span.zStep = (GLint) span.attrStepX[FRAG_ATTRIB_WPOS][2]; + span.zStep = (GLint) span.attrStepX[VARYING_SLOT_POS][2]; } #endif #ifdef INTERP_RGB @@ -364,61 +364,61 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, GLfloat eMaj_da = (GLfloat) (vMax->color[ACOMP] - vMin->color[ACOMP]); GLfloat eBot_da = (GLfloat) (vMid->color[ACOMP] - vMin->color[ACOMP]); # endif - span.attrStepX[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); - span.attrStepY[FRAG_ATTRIB_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); - span.attrStepX[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); - span.attrStepY[FRAG_ATTRIB_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); - span.attrStepX[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); - span.attrStepY[FRAG_ATTRIB_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); - span.redStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][0]); - span.greenStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][1]); - span.blueStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][2]); + span.attrStepX[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj_dr * eBot.dy - eMaj.dy * eBot_dr); + span.attrStepY[VARYING_SLOT_COL0][0] = oneOverArea * (eMaj.dx * eBot_dr - eMaj_dr * eBot.dx); + span.attrStepX[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj_dg * eBot.dy - eMaj.dy * eBot_dg); + span.attrStepY[VARYING_SLOT_COL0][1] = oneOverArea * (eMaj.dx * eBot_dg - eMaj_dg * eBot.dx); + span.attrStepX[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj_db * eBot.dy - eMaj.dy * eBot_db); + span.attrStepY[VARYING_SLOT_COL0][2] = oneOverArea * (eMaj.dx * eBot_db - eMaj_db * eBot.dx); + span.redStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][0]); + span.greenStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][1]); + span.blueStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][2]); # ifdef INTERP_ALPHA - span.attrStepX[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); - span.attrStepY[FRAG_ATTRIB_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); - span.alphaStep = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_COL0][3]); + span.attrStepX[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj_da * eBot.dy - eMaj.dy * eBot_da); + span.attrStepY[VARYING_SLOT_COL0][3] = oneOverArea * (eMaj.dx * eBot_da - eMaj_da * eBot.dx); + span.alphaStep = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_COL0][3]); # endif /* INTERP_ALPHA */ } else { ASSERT(ctx->Light.ShadeModel == GL_FLAT); span.interpMask |= SPAN_FLAT; - span.attrStepX[FRAG_ATTRIB_COL0][0] = span.attrStepY[FRAG_ATTRIB_COL0][0] = 0.0F; - span.attrStepX[FRAG_ATTRIB_COL0][1] = span.attrStepY[FRAG_ATTRIB_COL0][1] = 0.0F; - span.attrStepX[FRAG_ATTRIB_COL0][2] = span.attrStepY[FRAG_ATTRIB_COL0][2] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][0] = span.attrStepY[VARYING_SLOT_COL0][0] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][1] = span.attrStepY[VARYING_SLOT_COL0][1] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][2] = span.attrStepY[VARYING_SLOT_COL0][2] = 0.0F; span.redStep = 0; span.greenStep = 0; span.blueStep = 0; # ifdef INTERP_ALPHA - span.attrStepX[FRAG_ATTRIB_COL0][3] = span.attrStepY[FRAG_ATTRIB_COL0][3] = 0.0F; + span.attrStepX[VARYING_SLOT_COL0][3] = span.attrStepY[VARYING_SLOT_COL0][3] = 0.0F; span.alphaStep = 0; # endif } #endif /* INTERP_RGB */ #ifdef INTERP_INT_TEX { - GLfloat eMaj_ds = (vMax->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; - GLfloat eBot_ds = (vMid->attrib[FRAG_ATTRIB_TEX0][0] - vMin->attrib[FRAG_ATTRIB_TEX0][0]) * S_SCALE; - GLfloat eMaj_dt = (vMax->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; - GLfloat eBot_dt = (vMid->attrib[FRAG_ATTRIB_TEX0][1] - vMin->attrib[FRAG_ATTRIB_TEX0][1]) * T_SCALE; - span.attrStepX[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); - span.attrStepY[FRAG_ATTRIB_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); - span.attrStepX[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); - span.attrStepY[FRAG_ATTRIB_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); - span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][0]); - span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[FRAG_ATTRIB_TEX0][1]); + GLfloat eMaj_ds = (vMax->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE; + GLfloat eBot_ds = (vMid->attrib[VARYING_SLOT_TEX0][0] - vMin->attrib[VARYING_SLOT_TEX0][0]) * S_SCALE; + GLfloat eMaj_dt = (vMax->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE; + GLfloat eBot_dt = (vMid->attrib[VARYING_SLOT_TEX0][1] - vMin->attrib[VARYING_SLOT_TEX0][1]) * T_SCALE; + span.attrStepX[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj_ds * eBot.dy - eMaj.dy * eBot_ds); + span.attrStepY[VARYING_SLOT_TEX0][0] = oneOverArea * (eMaj.dx * eBot_ds - eMaj_ds * eBot.dx); + span.attrStepX[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj_dt * eBot.dy - eMaj.dy * eBot_dt); + span.attrStepY[VARYING_SLOT_TEX0][1] = oneOverArea * (eMaj.dx * eBot_dt - eMaj_dt * eBot.dx); + span.intTexStep[0] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][0]); + span.intTexStep[1] = SignedFloatToFixed(span.attrStepX[VARYING_SLOT_TEX0][1]); } #endif #ifdef INTERP_ATTRIBS { - /* attrib[FRAG_ATTRIB_WPOS][3] is 1/W */ - const GLfloat wMax = vMax->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat wMin = vMin->attrib[FRAG_ATTRIB_WPOS][3]; - const GLfloat wMid = vMid->attrib[FRAG_ATTRIB_WPOS][3]; + /* attrib[VARYING_SLOT_POS][3] is 1/W */ + const GLfloat wMax = vMax->attrib[VARYING_SLOT_POS][3]; + const GLfloat wMin = vMin->attrib[VARYING_SLOT_POS][3]; + const GLfloat wMid = vMid->attrib[VARYING_SLOT_POS][3]; { const GLfloat eMaj_dw = wMax - wMin; const GLfloat eBot_dw = wMid - wMin; - span.attrStepX[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); - span.attrStepY[FRAG_ATTRIB_WPOS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); + span.attrStepX[VARYING_SLOT_POS][3] = oneOverArea * (eMaj_dw * eBot.dy - eMaj.dy * eBot_dw); + span.attrStepY[VARYING_SLOT_POS][3] = oneOverArea * (eMaj.dx * eBot_dw - eMaj_dw * eBot.dx); } ATTRIB_LOOP_BEGIN if (swrast->_InterpMode[attr] == GL_FLAT) { @@ -518,8 +518,8 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #endif #ifdef INTERP_ATTRIBS GLfloat wLeft = 0, dwOuter = 0, dwInner; - GLfloat attrLeft[FRAG_ATTRIB_MAX][4]; - GLfloat daOuter[FRAG_ATTRIB_MAX][4], daInner[FRAG_ATTRIB_MAX][4]; + GLfloat attrLeft[VARYING_SLOT_MAX][4]; + GLfloat daOuter[VARYING_SLOT_MAX][4], daInner[VARYING_SLOT_MAX][4]; #endif for (subTriangle=0; subTriangle<=1; subTriangle++) { @@ -609,25 +609,25 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_Z { - GLfloat z0 = vLower->attrib[FRAG_ATTRIB_WPOS][2]; + GLfloat z0 = vLower->attrib[VARYING_SLOT_POS][2]; if (depthBits <= 16) { /* interpolate fixed-pt values */ GLfloat tmp = (z0 * FIXED_SCALE - + span.attrStepX[FRAG_ATTRIB_WPOS][2] * adjx - + span.attrStepY[FRAG_ATTRIB_WPOS][2] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_POS][2] * adjx + + span.attrStepY[VARYING_SLOT_POS][2] * adjy) + FIXED_HALF; if (tmp < MAX_GLUINT / 2) zLeft = (GLfixed) tmp; else zLeft = MAX_GLUINT / 2; - fdzOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_WPOS][2] + - dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); + fdzOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_POS][2] + + dxOuter * span.attrStepX[VARYING_SLOT_POS][2]); } else { /* interpolate depth values w/out scaling */ - zLeft = (GLuint) (z0 + span.attrStepX[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjx) - + span.attrStepY[FRAG_ATTRIB_WPOS][2] * FixedToFloat(adjy)); - fdzOuter = (GLint) (span.attrStepY[FRAG_ATTRIB_WPOS][2] + - dxOuter * span.attrStepX[FRAG_ATTRIB_WPOS][2]); + zLeft = (GLuint) (z0 + span.attrStepX[VARYING_SLOT_POS][2] * FixedToFloat(adjx) + + span.attrStepY[VARYING_SLOT_POS][2] * FixedToFloat(adjy)); + fdzOuter = (GLint) (span.attrStepY[VARYING_SLOT_POS][2] + + dxOuter * span.attrStepX[VARYING_SLOT_POS][2]); } # ifdef DEPTH_TYPE zRow = (DEPTH_TYPE *) @@ -639,26 +639,26 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_RGB if (ctx->Light.ShadeModel == GL_SMOOTH) { rLeft = (GLint)(ChanToFixed(vLower->color[RCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][0] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][0] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_COL0][0] * adjx + + span.attrStepY[VARYING_SLOT_COL0][0] * adjy) + FIXED_HALF; gLeft = (GLint)(ChanToFixed(vLower->color[GCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][1] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][1] * adjy) + FIXED_HALF; + + span.attrStepX[VARYING_SLOT_COL0][1] * adjx + + span.attrStepY[VARYING_SLOT_COL0][1] * adjy) + FIXED_HALF; bLeft = (GLint)(ChanToFixed(vLower->color[BCOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][2] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][2] * adjy) + FIXED_HALF; - fdrOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][0] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][0]); - fdgOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][1] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][1]); - fdbOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][2] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][2]); + + span.attrStepX[VARYING_SLOT_COL0][2] * adjx + + span.attrStepY[VARYING_SLOT_COL0][2] * adjy) + FIXED_HALF; + fdrOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][0] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][0]); + fdgOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][1] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][1]); + fdbOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][2] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][2]); # ifdef INTERP_ALPHA aLeft = (GLint)(ChanToFixed(vLower->color[ACOMP]) - + span.attrStepX[FRAG_ATTRIB_COL0][3] * adjx - + span.attrStepY[FRAG_ATTRIB_COL0][3] * adjy) + FIXED_HALF; - fdaOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_COL0][3] - + dxOuter * span.attrStepX[FRAG_ATTRIB_COL0][3]); + + span.attrStepX[VARYING_SLOT_COL0][3] * adjx + + span.attrStepY[VARYING_SLOT_COL0][3] * adjy) + FIXED_HALF; + fdaOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_COL0][3] + + dxOuter * span.attrStepX[VARYING_SLOT_COL0][3]); # endif } else { @@ -678,29 +678,29 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #ifdef INTERP_INT_TEX { GLfloat s0, t0; - s0 = vLower->attrib[FRAG_ATTRIB_TEX0][0] * S_SCALE; - sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][0] * adjx - + span.attrStepY[FRAG_ATTRIB_TEX0][0] * adjy) + FIXED_HALF; - dsOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][0] - + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][0]); - - t0 = vLower->attrib[FRAG_ATTRIB_TEX0][1] * T_SCALE; - tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[FRAG_ATTRIB_TEX0][1] * adjx - + span.attrStepY[FRAG_ATTRIB_TEX0][1] * adjy) + FIXED_HALF; - dtOuter = SignedFloatToFixed(span.attrStepY[FRAG_ATTRIB_TEX0][1] - + dxOuter * span.attrStepX[FRAG_ATTRIB_TEX0][1]); + s0 = vLower->attrib[VARYING_SLOT_TEX0][0] * S_SCALE; + sLeft = (GLfixed)(s0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][0] * adjx + + span.attrStepY[VARYING_SLOT_TEX0][0] * adjy) + FIXED_HALF; + dsOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][0] + + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][0]); + + t0 = vLower->attrib[VARYING_SLOT_TEX0][1] * T_SCALE; + tLeft = (GLfixed)(t0 * FIXED_SCALE + span.attrStepX[VARYING_SLOT_TEX0][1] * adjx + + span.attrStepY[VARYING_SLOT_TEX0][1] * adjy) + FIXED_HALF; + dtOuter = SignedFloatToFixed(span.attrStepY[VARYING_SLOT_TEX0][1] + + dxOuter * span.attrStepX[VARYING_SLOT_TEX0][1]); } #endif #ifdef INTERP_ATTRIBS { - const GLuint attr = FRAG_ATTRIB_WPOS; - wLeft = vLower->attrib[FRAG_ATTRIB_WPOS][3] + const GLuint attr = VARYING_SLOT_POS; + wLeft = vLower->attrib[VARYING_SLOT_POS][3] + (span.attrStepX[attr][3] * adjx + span.attrStepY[attr][3] * adjy) * (1.0F/FIXED_SCALE); dwOuter = span.attrStepY[attr][3] + dxOuter * span.attrStepX[attr][3]; } ATTRIB_LOOP_BEGIN - const GLfloat invW = vLower->attrib[FRAG_ATTRIB_WPOS][3]; + const GLfloat invW = vLower->attrib[VARYING_SLOT_POS][3]; if (swrast->_InterpMode[attr] == GL_FLAT) { GLuint c; for (c = 0; c < 4; c++) { @@ -755,7 +755,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, dtInner = dtOuter + span.intTexStep[1]; #endif #ifdef INTERP_ATTRIBS - dwInner = dwOuter + span.attrStepX[FRAG_ATTRIB_WPOS][3]; + dwInner = dwOuter + span.attrStepX[VARYING_SLOT_POS][3]; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { @@ -791,7 +791,7 @@ static void NAME(struct gl_context *ctx, const SWvertex *v0, #endif #ifdef INTERP_ATTRIBS - span.attrStart[FRAG_ATTRIB_WPOS][3] = wLeft; + span.attrStart[VARYING_SLOT_POS][3] = wLeft; ATTRIB_LOOP_BEGIN GLuint c; for (c = 0; c < 4; c++) { diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index 828374f68b1..3b309a25148 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -166,15 +166,15 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, else if (zoomed.array->ChanType == GL_UNSIGNED_SHORT) zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->rgba16; else - zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[FRAG_ATTRIB_COL0]; + zoomed.array->rgba = (GLchan (*)[4]) zoomed.array->attribs[VARYING_SLOT_COL0]; - COPY_4V(zoomed.attrStart[FRAG_ATTRIB_WPOS], span->attrStart[FRAG_ATTRIB_WPOS]); - COPY_4V(zoomed.attrStepX[FRAG_ATTRIB_WPOS], span->attrStepX[FRAG_ATTRIB_WPOS]); - COPY_4V(zoomed.attrStepY[FRAG_ATTRIB_WPOS], span->attrStepY[FRAG_ATTRIB_WPOS]); + COPY_4V(zoomed.attrStart[VARYING_SLOT_POS], span->attrStart[VARYING_SLOT_POS]); + COPY_4V(zoomed.attrStepX[VARYING_SLOT_POS], span->attrStepX[VARYING_SLOT_POS]); + COPY_4V(zoomed.attrStepY[VARYING_SLOT_POS], span->attrStepY[VARYING_SLOT_POS]); - zoomed.attrStart[FRAG_ATTRIB_FOGC][0] = span->attrStart[FRAG_ATTRIB_FOGC][0]; - zoomed.attrStepX[FRAG_ATTRIB_FOGC][0] = span->attrStepX[FRAG_ATTRIB_FOGC][0]; - zoomed.attrStepY[FRAG_ATTRIB_FOGC][0] = span->attrStepY[FRAG_ATTRIB_FOGC][0]; + zoomed.attrStart[VARYING_SLOT_FOGC][0] = span->attrStart[VARYING_SLOT_FOGC][0]; + zoomed.attrStepX[VARYING_SLOT_FOGC][0] = span->attrStepX[VARYING_SLOT_FOGC][0]; + zoomed.attrStepY[VARYING_SLOT_FOGC][0] = span->attrStepY[VARYING_SLOT_FOGC][0]; if (format == GL_RGBA || format == GL_RGB) { /* copy Z info */ @@ -183,7 +183,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, /* we'll generate an array of colorss */ zoomed.interpMask = span->interpMask & ~SPAN_RGBA; zoomed.arrayMask |= SPAN_RGBA; - zoomed.arrayAttribs |= FRAG_BIT_COL0; /* we'll produce these values */ + zoomed.arrayAttribs |= VARYING_BIT_COL0; /* we'll produce these values */ ASSERT(span->arrayMask & SPAN_RGBA); } else if (format == GL_DEPTH_COMPONENT) { @@ -235,7 +235,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - COPY_4V(zoomed.array->attribs[FRAG_ATTRIB_COL0][i], rgba[j]); + COPY_4V(zoomed.array->attribs[VARYING_SLOT_COL0][i], rgba[j]); } } } @@ -273,10 +273,10 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span, GLint j = unzoom_x(ctx->Pixel.ZoomX, imgX, x0 + i) - span->x; ASSERT(j >= 0); ASSERT(j < (GLint) span->end); - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][0] = rgb[j][0]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][1] = rgb[j][1]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][2] = rgb[j][2]; - zoomed.array->attribs[FRAG_ATTRIB_COL0][i][3] = 1.0F; + zoomed.array->attribs[VARYING_SLOT_COL0][i][0] = rgb[j][0]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][1] = rgb[j][1]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][2] = rgb[j][2]; + zoomed.array->attribs[VARYING_SLOT_COL0][i][3] = 1.0F; } } } diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 97cc5ee6313..82555ae6a88 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -74,7 +74,7 @@ * improve its usefulness as a fallback mechanism for hardware * drivers. * - * wpos = attr[FRAG_ATTRIB_WPOS] and MUST BE THE FIRST values in the + * wpos = attr[VARYING_SLOT_POS] and MUST BE THE FIRST values in the * vertex because of the tnl clipping code. * wpos[0] and [1] are the screen-coords of SWvertex. @@ -98,13 +98,13 @@ * primitives unaccelerated), hook in swrast_setup instead. */ typedef struct { - GLfloat attrib[FRAG_ATTRIB_MAX][4]; + GLfloat attrib[VARYING_SLOT_MAX][4]; GLchan color[4]; /** integer color */ GLfloat pointSize; } SWvertex; -#define FRAG_ATTRIB_CI FRAG_ATTRIB_COL0 +#define VARYING_SLOT_CI VARYING_SLOT_COL0 struct swrast_device_driver; diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index 9444611f1ae..5847a768255 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -125,22 +125,22 @@ setup_vertex_format(struct gl_context *ctx) swsetup->intColors = intColors; - EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[FRAG_ATTRIB_WPOS] ); + EMIT_ATTR( _TNL_ATTRIB_POS, EMIT_4F_VIEWPORT, attrib[VARYING_SLOT_POS] ); if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR0)) { if (swsetup->intColors) EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4CHAN_4F_RGBA, color ); else - EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[FRAG_ATTRIB_COL0]); + EMIT_ATTR( _TNL_ATTRIB_COLOR0, EMIT_4F, attrib[VARYING_SLOT_COL0]); } if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_COLOR1)) { - EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[FRAG_ATTRIB_COL1]); + EMIT_ATTR( _TNL_ATTRIB_COLOR1, EMIT_4F, attrib[VARYING_SLOT_COL1]); } if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_FOG)) { const GLint emit = ctx->FragmentProgram._Current ? EMIT_4F : EMIT_1F; - EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[FRAG_ATTRIB_FOGC]); + EMIT_ATTR( _TNL_ATTRIB_FOG, emit, attrib[VARYING_SLOT_FOGC]); } if (index_bitset & BITFIELD64_RANGE(_TNL_ATTRIB_TEX0, _TNL_NUM_TEX)) @@ -148,7 +148,7 @@ setup_vertex_format(struct gl_context *ctx) for (i = 0; i < MAX_TEXTURE_COORD_UNITS; i++) { if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_TEX(i))) { EMIT_ATTR( _TNL_ATTRIB_TEX(i), EMIT_4F, - attrib[FRAG_ATTRIB_TEX0 + i] ); + attrib[VARYING_SLOT_TEX0 + i] ); } } } @@ -158,7 +158,7 @@ setup_vertex_format(struct gl_context *ctx) for (i = 0; i < ctx->Const.MaxVarying; i++) { if (index_bitset & BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i))) { EMIT_ATTR( _TNL_ATTRIB_GENERIC(i), VARYING_EMIT_STYLE, - attrib[FRAG_ATTRIB_VAR0 + i] ); + attrib[VARYING_SLOT_VAR0 + i] ); } } } @@ -271,29 +271,29 @@ _swsetup_Translate( struct gl_context *ctx, const void *vertex, SWvertex *dest ) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POS, tmp ); - dest->attrib[FRAG_ATTRIB_WPOS][0] = m[0] * tmp[0] + m[12]; - dest->attrib[FRAG_ATTRIB_WPOS][1] = m[5] * tmp[1] + m[13]; - dest->attrib[FRAG_ATTRIB_WPOS][2] = m[10] * tmp[2] + m[14]; - dest->attrib[FRAG_ATTRIB_WPOS][3] = tmp[3]; + dest->attrib[VARYING_SLOT_POS][0] = m[0] * tmp[0] + m[12]; + dest->attrib[VARYING_SLOT_POS][1] = m[5] * tmp[1] + m[13]; + dest->attrib[VARYING_SLOT_POS][2] = m[10] * tmp[2] + m[14]; + dest->attrib[VARYING_SLOT_POS][3] = tmp[3]; /** XXX try to limit these loops someday */ for (i = 0 ; i < ctx->Const.MaxTextureCoordUnits ; i++) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_TEX0 + i, - dest->attrib[FRAG_ATTRIB_TEX0 + i] ); + dest->attrib[VARYING_SLOT_TEX0 + i] ); for (i = 0 ; i < ctx->Const.MaxVarying ; i++) _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_GENERIC0 + i, - dest->attrib[FRAG_ATTRIB_VAR0 + i] ); + dest->attrib[VARYING_SLOT_VAR0 + i] ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR0, - dest->attrib[FRAG_ATTRIB_COL0] ); + dest->attrib[VARYING_SLOT_COL0] ); UNCLAMPED_FLOAT_TO_RGBA_CHAN( dest->color, tmp ); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_COLOR1, - dest->attrib[FRAG_ATTRIB_COL1]); + dest->attrib[VARYING_SLOT_COL1]); _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_FOG, tmp ); - dest->attrib[FRAG_ATTRIB_FOGC][0] = tmp[0]; + dest->attrib[VARYING_SLOT_FOGC][0] = tmp[0]; /* XXX See _tnl_get_attr about pointsize ... */ _tnl_get_attr( ctx, vertex, _TNL_ATTRIB_POINTSIZE, tmp ); diff --git a/src/mesa/swrast_setup/ss_triangle.c b/src/mesa/swrast_setup/ss_triangle.c index 5d1c70e9481..5f4a997eece 100644 --- a/src/mesa/swrast_setup/ss_triangle.c +++ b/src/mesa/swrast_setup/ss_triangle.c @@ -137,21 +137,21 @@ static void _swsetup_render_tri(struct gl_context *ctx, /* save colors/indexes for v0, v1 vertices */ COPY_CHAN4(c[0], v0->color); COPY_CHAN4(c[1], v1->color); - COPY_4V(s[0], v0->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(s[1], v1->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(s[0], v0->attrib[VARYING_SLOT_COL1]); + COPY_4V(s[1], v1->attrib[VARYING_SLOT_COL1]); /* copy v2 color/indexes to v0, v1 indexes */ COPY_CHAN4(v0->color, v2->color); COPY_CHAN4(v1->color, v2->color); - COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], v2->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(v0->attrib[VARYING_SLOT_COL1], v2->attrib[VARYING_SLOT_COL1]); + COPY_4V(v1->attrib[VARYING_SLOT_COL1], v2->attrib[VARYING_SLOT_COL1]); render(ctx, ef, e0, e1, e2, v0, v1, v2); COPY_CHAN4(v0->color, c[0]); COPY_CHAN4(v1->color, c[1]); - COPY_4V(v0->attrib[FRAG_ATTRIB_COL1], s[0]); - COPY_4V(v1->attrib[FRAG_ATTRIB_COL1], s[1]); + COPY_4V(v0->attrib[VARYING_SLOT_COL1], s[0]); + COPY_4V(v1->attrib[VARYING_SLOT_COL1], s[1]); } else { render(ctx, ef, e0, e1, e2, v0, v1, v2); diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 5844ad594cd..11742067fb6 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -50,10 +50,10 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e if (IND & (SS_TWOSIDE_BIT | SS_OFFSET_BIT | SS_UNFILLED_BIT)) { - GLfloat ex = v[0]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat ey = v[0]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; - GLfloat fx = v[1]->attrib[FRAG_ATTRIB_WPOS][0] - v[2]->attrib[FRAG_ATTRIB_WPOS][0]; - GLfloat fy = v[1]->attrib[FRAG_ATTRIB_WPOS][1] - v[2]->attrib[FRAG_ATTRIB_WPOS][1]; + GLfloat ex = v[0]->attrib[VARYING_SLOT_POS][0] - v[2]->attrib[VARYING_SLOT_POS][0]; + GLfloat ey = v[0]->attrib[VARYING_SLOT_POS][1] - v[2]->attrib[VARYING_SLOT_POS][1]; + GLfloat fx = v[1]->attrib[VARYING_SLOT_POS][0] - v[2]->attrib[VARYING_SLOT_POS][0]; + GLfloat fy = v[1]->attrib[VARYING_SLOT_POS][1] - v[2]->attrib[VARYING_SLOT_POS][1]; GLfloat cc = ex*fy - ey*fx; if (IND & (SS_TWOSIDE_BIT | SS_UNFILLED_BIT)) @@ -74,9 +74,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e COPY_CHAN4(saved_color[2], v[2]->color); } else { - COPY_4V(saved_col0[0], v[0]->attrib[FRAG_ATTRIB_COL0]); - COPY_4V(saved_col0[1], v[1]->attrib[FRAG_ATTRIB_COL0]); - COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]); + COPY_4V(saved_col0[0], v[0]->attrib[VARYING_SLOT_COL0]); + COPY_4V(saved_col0[1], v[1]->attrib[VARYING_SLOT_COL0]); + COPY_4V(saved_col0[2], v[2]->attrib[VARYING_SLOT_COL0]); } if (VB->BackfaceColorPtr->stride) { @@ -86,9 +86,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e SS_COLOR(v[2]->color, vbcolor[e2]); } else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[e0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[e1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[e2]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], vbcolor[e0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], vbcolor[e1]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], vbcolor[e2]); } } else { @@ -99,9 +99,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e SS_COLOR(v[2]->color, vbcolor[0]); } else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], vbcolor[0]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], vbcolor[0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], vbcolor[0]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], vbcolor[0]); } } } @@ -109,19 +109,19 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e if (VB->BackfaceSecondaryColorPtr) { GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data; - COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]); - COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]); + COPY_4V(saved_spec[0], v[0]->attrib[VARYING_SLOT_COL1]); + COPY_4V(saved_spec[1], v[1]->attrib[VARYING_SLOT_COL1]); + COPY_4V(saved_spec[2], v[2]->attrib[VARYING_SLOT_COL1]); if (VB->BackfaceSecondaryColorPtr->stride) { - SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]); - SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]); - SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]); + SS_SPEC(v[0]->attrib[VARYING_SLOT_COL1], vbspec[e0]); + SS_SPEC(v[1]->attrib[VARYING_SLOT_COL1], vbspec[e1]); + SS_SPEC(v[2]->attrib[VARYING_SLOT_COL1], vbspec[e2]); } else { - SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); - SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); - SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[0]); + SS_SPEC(v[0]->attrib[VARYING_SLOT_COL1], vbspec[0]); + SS_SPEC(v[1]->attrib[VARYING_SLOT_COL1], vbspec[0]); + SS_SPEC(v[2]->attrib[VARYING_SLOT_COL1], vbspec[0]); } } } @@ -131,9 +131,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e if (IND & SS_OFFSET_BIT) { const GLfloat max = ctx->DrawBuffer->_DepthMaxF; /* save original Z values (restored later) */ - z[0] = v[0]->attrib[FRAG_ATTRIB_WPOS][2]; - z[1] = v[1]->attrib[FRAG_ATTRIB_WPOS][2]; - z[2] = v[2]->attrib[FRAG_ATTRIB_WPOS][2]; + z[0] = v[0]->attrib[VARYING_SLOT_POS][2]; + z[1] = v[1]->attrib[VARYING_SLOT_POS][2]; + z[2] = v[2]->attrib[VARYING_SLOT_POS][2]; /* Note that Z values are already scaled to [0,65535] (for example) * so no MRD value is used here. */ @@ -147,31 +147,31 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e offset += MAX2(dzdx, dzdy) * ctx->Polygon.OffsetFactor; } /* new Z values */ - oz0 = CLAMP(v[0]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); - oz1 = CLAMP(v[1]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); - oz2 = CLAMP(v[2]->attrib[FRAG_ATTRIB_WPOS][2] + offset, 0.0F, max); + oz0 = CLAMP(v[0]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max); + oz1 = CLAMP(v[1]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max); + oz2 = CLAMP(v[2]->attrib[VARYING_SLOT_POS][2] + offset, 0.0F, max); } } if (mode == GL_POINT) { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetPoint) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + v[0]->attrib[VARYING_SLOT_POS][2] = oz0; + v[1]->attrib[VARYING_SLOT_POS][2] = oz1; + v[2]->attrib[VARYING_SLOT_POS][2] = oz2; } _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_point_tri); } else if (mode == GL_LINE) { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetLine) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + v[0]->attrib[VARYING_SLOT_POS][2] = oz0; + v[1]->attrib[VARYING_SLOT_POS][2] = oz1; + v[2]->attrib[VARYING_SLOT_POS][2] = oz2; } _swsetup_render_tri(ctx, e0, e1, e2, facing, _swsetup_edge_render_line_tri); } else { if ((IND & SS_OFFSET_BIT) && ctx->Polygon.OffsetFill) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = oz0; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = oz1; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = oz2; + v[0]->attrib[VARYING_SLOT_POS][2] = oz0; + v[1]->attrib[VARYING_SLOT_POS][2] = oz1; + v[2]->attrib[VARYING_SLOT_POS][2] = oz2; } _swrast_Triangle( ctx, v[0], v[1], v[2] ); } @@ -180,9 +180,9 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e * Restore original vertex colors, etc. */ if (IND & SS_OFFSET_BIT) { - v[0]->attrib[FRAG_ATTRIB_WPOS][2] = z[0]; - v[1]->attrib[FRAG_ATTRIB_WPOS][2] = z[1]; - v[2]->attrib[FRAG_ATTRIB_WPOS][2] = z[2]; + v[0]->attrib[VARYING_SLOT_POS][2] = z[0]; + v[1]->attrib[VARYING_SLOT_POS][2] = z[1]; + v[2]->attrib[VARYING_SLOT_POS][2] = z[2]; } if (IND & SS_TWOSIDE_BIT) { @@ -194,16 +194,16 @@ static void TAG(triangle)(struct gl_context *ctx, GLuint e0, GLuint e1, GLuint e COPY_CHAN4(v[2]->color, saved_color[2]); } else { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL0], saved_col0[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL0], saved_col0[1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL0], saved_col0[2]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL0], saved_col0[0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL0], saved_col0[1]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL0], saved_col0[2]); } } if (VB->BackfaceSecondaryColorPtr) { - COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]); - COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]); - COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]); + COPY_4V(v[0]->attrib[VARYING_SLOT_COL1], saved_spec[0]); + COPY_4V(v[1]->attrib[VARYING_SLOT_COL1], saved_spec[1]); + COPY_4V(v[2]->attrib[VARYING_SLOT_COL1], saved_spec[2]); } } } diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index d7b62fa415e..ed31b9c4593 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -142,7 +142,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) */ tnl->render_inputs_bitset = BITFIELD64_BIT(_TNL_ATTRIB_POS); - if (!fp || (fp->Base.InputsRead & FRAG_BIT_COL0)) { + if (!fp || (fp->Base.InputsRead & VARYING_BIT_COL0)) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_COLOR0); } @@ -151,13 +151,13 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state ) for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { if (ctx->Texture._EnabledCoordUnits & (1 << i) || - (fp && fp->Base.InputsRead & FRAG_BIT_TEX(i))) { + (fp && fp->Base.InputsRead & VARYING_BIT_TEX(i))) { tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_TEX(i)); } } if (ctx->Fog.Enabled - || (fp != NULL && (fp->Base.InputsRead & FRAG_BIT_FOGC) != 0)) { + || (fp != NULL && (fp->Base.InputsRead & VARYING_BIT_FOGC) != 0)) { /* Either fixed-function fog or a fragment program needs fog coord. */ tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_FOG); diff --git a/src/mesa/tnl_dd/t_dd_vb.c b/src/mesa/tnl_dd/t_dd_vb.c index 543b0a56858..aea4e6746aa 100644 --- a/src/mesa/tnl_dd/t_dd_vb.c +++ b/src/mesa/tnl_dd/t_dd_vb.c @@ -89,15 +89,15 @@ void TAG(translate_vertex)(struct gl_context *ctx, if (format == TINY_VERTEX_FORMAT) { if (HAVE_HW_VIEWPORT) { - dst->attrib[FRAG_ATTRIB_WPOS][0] = s[0] * src->v.x + s[12]; - dst->attrib[FRAG_ATTRIB_WPOS][1] = s[5] * src->v.y + s[13]; - dst->attrib[FRAG_ATTRIB_WPOS][2] = s[10] * src->v.z + s[14]; - dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0; + dst->attrib[VARYING_SLOT_POS][0] = s[0] * src->v.x + s[12]; + dst->attrib[VARYING_SLOT_POS][1] = s[5] * src->v.y + s[13]; + dst->attrib[VARYING_SLOT_POS][2] = s[10] * src->v.z + s[14]; + dst->attrib[VARYING_SLOT_POS][3] = 1.0; } else { - dst->attrib[FRAG_ATTRIB_WPOS][0] = UNVIEWPORT_X( src->v.x ); - dst->attrib[FRAG_ATTRIB_WPOS][1] = UNVIEWPORT_Y( src->v.y ); - dst->attrib[FRAG_ATTRIB_WPOS][2] = UNVIEWPORT_Z( src->v.z ); - dst->attrib[FRAG_ATTRIB_WPOS][3] = 1.0; + dst->attrib[VARYING_SLOT_POS][0] = UNVIEWPORT_X( src->v.x ); + dst->attrib[VARYING_SLOT_POS][1] = UNVIEWPORT_Y( src->v.y ); + dst->attrib[VARYING_SLOT_POS][2] = UNVIEWPORT_Z( src->v.z ); + dst->attrib[VARYING_SLOT_POS][3] = 1.0; } dst->color[0] = src->tv.color.red; @@ -109,21 +109,21 @@ void TAG(translate_vertex)(struct gl_context *ctx, if (HAVE_HW_VIEWPORT) { if (HAVE_HW_DIVIDE && CHECK_HW_DIVIDE) { GLfloat oow = 1.0 / src->v.w; - dst->attrib[FRAG_ATTRIB_WPOS][0] = s[0] * src->v.x * oow + s[12]; - dst->attrib[FRAG_ATTRIB_WPOS][1] = s[5] * src->v.y * oow + s[13]; - dst->attrib[FRAG_ATTRIB_WPOS][2] = s[10] * src->v.z * oow + s[14]; - dst->attrib[FRAG_ATTRIB_WPOS][3] = oow; + dst->attrib[VARYING_SLOT_POS][0] = s[0] * src->v.x * oow + s[12]; + dst->attrib[VARYING_SLOT_POS][1] = s[5] * src->v.y * oow + s[13]; + dst->attrib[VARYING_SLOT_POS][2] = s[10] * src->v.z * oow + s[14]; + dst->attrib[VARYING_SLOT_POS][3] = oow; } else { - dst->attrib[FRAG_ATTRIB_WPOS][0] = s[0] * src->v.x + s[12]; - dst->attrib[FRAG_ATTRIB_WPOS][1] = s[5] * src->v.y + s[13]; - dst->attrib[FRAG_ATTRIB_WPOS][2] = s[10] * src->v.z + s[14]; - dst->attrib[FRAG_ATTRIB_WPOS][3] = src->v.w; + dst->attrib[VARYING_SLOT_POS][0] = s[0] * src->v.x + s[12]; + dst->attrib[VARYING_SLOT_POS][1] = s[5] * src->v.y + s[13]; + dst->attrib[VARYING_SLOT_POS][2] = s[10] * src->v.z + s[14]; + dst->attrib[VARYING_SLOT_POS][3] = src->v.w; } } else { - dst->attrib[FRAG_ATTRIB_WPOS][0] = UNVIEWPORT_X( src->v.x ); - dst->attrib[FRAG_ATTRIB_WPOS][1] = UNVIEWPORT_Y( src->v.y ); - dst->attrib[FRAG_ATTRIB_WPOS][2] = UNVIEWPORT_Z( src->v.z ); - dst->attrib[FRAG_ATTRIB_WPOS][3] = src->v.w; + dst->attrib[VARYING_SLOT_POS][0] = UNVIEWPORT_X( src->v.x ); + dst->attrib[VARYING_SLOT_POS][1] = UNVIEWPORT_Y( src->v.y ); + dst->attrib[VARYING_SLOT_POS][2] = UNVIEWPORT_Z( src->v.z ); + dst->attrib[VARYING_SLOT_POS][3] = src->v.w; } dst->color[0] = src->v.color.red; @@ -131,55 +131,55 @@ void TAG(translate_vertex)(struct gl_context *ctx, dst->color[2] = src->v.color.blue; dst->color[3] = src->v.color.alpha; - dst->attrib[FRAG_ATTRIB_COL1][0] = UBYTE_TO_FLOAT(src->v.specular.red); - dst->attrib[FRAG_ATTRIB_COL1][1] = UBYTE_TO_FLOAT(src->v.specular.green); - dst->attrib[FRAG_ATTRIB_COL1][2] = UBYTE_TO_FLOAT(src->v.specular.blue); + dst->attrib[VARYING_SLOT_COL1][0] = UBYTE_TO_FLOAT(src->v.specular.red); + dst->attrib[VARYING_SLOT_COL1][1] = UBYTE_TO_FLOAT(src->v.specular.green); + dst->attrib[VARYING_SLOT_COL1][2] = UBYTE_TO_FLOAT(src->v.specular.blue); - dst->attrib[FRAG_ATTRIB_FOGC][0] = UBYTE_TO_FLOAT(src->v.specular.alpha); + dst->attrib[VARYING_SLOT_FOGC][0] = UBYTE_TO_FLOAT(src->v.specular.alpha); if (HAVE_PTEX_VERTICES && ((HAVE_TEX2_VERTICES && format == PROJ_TEX3_VERTEX_FORMAT) || (format == PROJ_TEX1_VERTEX_FORMAT))) { - dst->attrib[FRAG_ATTRIB_TEX0][0] = src->pv.u0; - dst->attrib[FRAG_ATTRIB_TEX0][1] = src->pv.v0; - dst->attrib[FRAG_ATTRIB_TEX0][3] = src->pv.q0; + dst->attrib[VARYING_SLOT_TEX0][0] = src->pv.u0; + dst->attrib[VARYING_SLOT_TEX0][1] = src->pv.v0; + dst->attrib[VARYING_SLOT_TEX0][3] = src->pv.q0; - dst->attrib[FRAG_ATTRIB_TEX1][0] = src->pv.u1; - dst->attrib[FRAG_ATTRIB_TEX1][1] = src->pv.v1; - dst->attrib[FRAG_ATTRIB_TEX1][3] = src->pv.q1; + dst->attrib[VARYING_SLOT_TEX1][0] = src->pv.u1; + dst->attrib[VARYING_SLOT_TEX1][1] = src->pv.v1; + dst->attrib[VARYING_SLOT_TEX1][3] = src->pv.q1; if (HAVE_TEX2_VERTICES) { - dst->attrib[FRAG_ATTRIB_TEX2][0] = src->pv.u2; - dst->attrib[FRAG_ATTRIB_TEX2][1] = src->pv.v2; - dst->attrib[FRAG_ATTRIB_TEX2][3] = src->pv.q2; + dst->attrib[VARYING_SLOT_TEX2][0] = src->pv.u2; + dst->attrib[VARYING_SLOT_TEX2][1] = src->pv.v2; + dst->attrib[VARYING_SLOT_TEX2][3] = src->pv.q2; } if (HAVE_TEX3_VERTICES) { - dst->attrib[FRAG_ATTRIB_TEX3][0] = src->pv.u3; - dst->attrib[FRAG_ATTRIB_TEX3][1] = src->pv.v3; - dst->attrib[FRAG_ATTRIB_TEX3][3] = src->pv.q3; + dst->attrib[VARYING_SLOT_TEX3][0] = src->pv.u3; + dst->attrib[VARYING_SLOT_TEX3][1] = src->pv.v3; + dst->attrib[VARYING_SLOT_TEX3][3] = src->pv.q3; } } else { - dst->attrib[FRAG_ATTRIB_TEX0][0] = src->v.u0; - dst->attrib[FRAG_ATTRIB_TEX0][1] = src->v.v0; - dst->attrib[FRAG_ATTRIB_TEX0][3] = 1.0; + dst->attrib[VARYING_SLOT_TEX0][0] = src->v.u0; + dst->attrib[VARYING_SLOT_TEX0][1] = src->v.v0; + dst->attrib[VARYING_SLOT_TEX0][3] = 1.0; - dst->attrib[FRAG_ATTRIB_TEX1][0] = src->v.u1; - dst->attrib[FRAG_ATTRIB_TEX1][1] = src->v.v1; - dst->attrib[FRAG_ATTRIB_TEX1][3] = 1.0; + dst->attrib[VARYING_SLOT_TEX1][0] = src->v.u1; + dst->attrib[VARYING_SLOT_TEX1][1] = src->v.v1; + dst->attrib[VARYING_SLOT_TEX1][3] = 1.0; if (HAVE_TEX2_VERTICES) { - dst->attrib[FRAG_ATTRIB_TEX2][0] = src->v.u2; - dst->attrib[FRAG_ATTRIB_TEX2][1] = src->v.v2; - dst->attrib[FRAG_ATTRIB_TEX2][3] = 1.0; + dst->attrib[VARYING_SLOT_TEX2][0] = src->v.u2; + dst->attrib[VARYING_SLOT_TEX2][1] = src->v.v2; + dst->attrib[VARYING_SLOT_TEX2][3] = 1.0; } if (HAVE_TEX3_VERTICES) { - dst->attrib[FRAG_ATTRIB_TEX3][0] = src->v.u3; - dst->attrib[FRAG_ATTRIB_TEX3][1] = src->v.v3; - dst->attrib[FRAG_ATTRIB_TEX3][3] = 1.0; + dst->attrib[VARYING_SLOT_TEX3][0] = src->v.u3; + dst->attrib[VARYING_SLOT_TEX3][1] = src->v.v3; + dst->attrib[VARYING_SLOT_TEX3][3] = 1.0; } } } |