mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
mesa/i965/i915/r200: eliminate gl_vertex_program
Here we move the only field in gl_vertex_program to the ARB program fields in gl_program. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
This commit is contained in:
parent
0ab51f8e16
commit
81faead818
46 changed files with 268 additions and 310 deletions
|
|
@ -566,8 +566,8 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
|
||||||
|
|
||||||
if (ctx->Extensions.ARB_vertex_program) {
|
if (ctx->Extensions.ARB_vertex_program) {
|
||||||
save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
|
save->VertexProgramEnabled = ctx->VertexProgram.Enabled;
|
||||||
_mesa_reference_vertprog(ctx, &save->VertexProgram,
|
_mesa_reference_program(ctx, &save->VertexProgram,
|
||||||
ctx->VertexProgram.Current);
|
ctx->VertexProgram.Current);
|
||||||
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
|
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB, GL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -945,9 +945,9 @@ _mesa_meta_end(struct gl_context *ctx)
|
||||||
if (ctx->Extensions.ARB_vertex_program) {
|
if (ctx->Extensions.ARB_vertex_program) {
|
||||||
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB,
|
_mesa_set_enable(ctx, GL_VERTEX_PROGRAM_ARB,
|
||||||
save->VertexProgramEnabled);
|
save->VertexProgramEnabled);
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
|
_mesa_reference_program(ctx, &ctx->VertexProgram.Current,
|
||||||
save->VertexProgram);
|
save->VertexProgram);
|
||||||
_mesa_reference_vertprog(ctx, &save->VertexProgram, NULL);
|
_mesa_reference_program(ctx, &save->VertexProgram, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->Extensions.ARB_fragment_program) {
|
if (ctx->Extensions.ARB_fragment_program) {
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ struct save_state
|
||||||
|
|
||||||
/** MESA_META_SHADER */
|
/** MESA_META_SHADER */
|
||||||
GLboolean VertexProgramEnabled;
|
GLboolean VertexProgramEnabled;
|
||||||
struct gl_vertex_program *VertexProgram;
|
struct gl_program *VertexProgram;
|
||||||
GLboolean FragmentProgramEnabled;
|
GLboolean FragmentProgramEnabled;
|
||||||
struct gl_fragment_program *FragmentProgram;
|
struct gl_fragment_program *FragmentProgram;
|
||||||
GLboolean ATIFragmentShaderEnabled;
|
GLboolean ATIFragmentShaderEnabled;
|
||||||
|
|
|
||||||
|
|
@ -1148,8 +1148,8 @@ i915NewProgram(struct gl_context * ctx, GLenum target, GLuint id)
|
||||||
{
|
{
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case GL_VERTEX_PROGRAM_ARB: {
|
case GL_VERTEX_PROGRAM_ARB: {
|
||||||
struct gl_vertex_program *prog = CALLOC_STRUCT(gl_vertex_program);
|
struct gl_program *prog = CALLOC_STRUCT(gl_program);
|
||||||
return _mesa_init_gl_program(&prog->Base, target, id);
|
return _mesa_init_gl_program(prog, target, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
case GL_FRAGMENT_PROGRAM_ARB:{
|
case GL_FRAGMENT_PROGRAM_ARB:{
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ struct brw_state_flags {
|
||||||
|
|
||||||
/** Subclass of Mesa vertex program */
|
/** Subclass of Mesa vertex program */
|
||||||
struct brw_vertex_program {
|
struct brw_vertex_program {
|
||||||
struct gl_vertex_program program;
|
struct gl_program program;
|
||||||
GLuint id;
|
GLuint id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1006,7 +1006,7 @@ struct brw_context
|
||||||
|
|
||||||
/* Active vertex program:
|
/* Active vertex program:
|
||||||
*/
|
*/
|
||||||
const struct gl_vertex_program *vertex_program;
|
const struct gl_program *vertex_program;
|
||||||
const struct gl_program *geometry_program;
|
const struct gl_program *geometry_program;
|
||||||
const struct gl_program *tess_ctrl_program;
|
const struct gl_program *tess_ctrl_program;
|
||||||
const struct gl_program *tess_eval_program;
|
const struct gl_program *tess_eval_program;
|
||||||
|
|
@ -1718,13 +1718,13 @@ brw_context( struct gl_context *ctx )
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline struct brw_vertex_program *
|
static inline struct brw_vertex_program *
|
||||||
brw_vertex_program(struct gl_vertex_program *p)
|
brw_vertex_program(struct gl_program *p)
|
||||||
{
|
{
|
||||||
return (struct brw_vertex_program *) p;
|
return (struct brw_vertex_program *) p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline const struct brw_vertex_program *
|
static inline const struct brw_vertex_program *
|
||||||
brw_vertex_program_const(const struct gl_vertex_program *p)
|
brw_vertex_program_const(const struct gl_program *p)
|
||||||
{
|
{
|
||||||
return (const struct brw_vertex_program *) p;
|
return (const struct brw_vertex_program *) p;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -256,7 +256,7 @@ brw_upload_constant_buffer(struct brw_context *brw)
|
||||||
|
|
||||||
/* vertex shader constants */
|
/* vertex shader constants */
|
||||||
if (brw->curbe.vs_size) {
|
if (brw->curbe.vs_size) {
|
||||||
_mesa_load_state_parameters(ctx, brw->vertex_program->Base.Parameters);
|
_mesa_load_state_parameters(ctx, brw->vertex_program->Parameters);
|
||||||
|
|
||||||
GLuint offset = brw->curbe.vs_start * 16;
|
GLuint offset = brw->curbe.vs_start * 16;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ brw_merge_inputs(struct brw_context *brw,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (brw->gen < 8 && !brw->is_haswell) {
|
if (brw->gen < 8 && !brw->is_haswell) {
|
||||||
uint64_t mask = ctx->VertexProgram._Current->Base.info.inputs_read;
|
uint64_t mask = ctx->VertexProgram._Current->info.inputs_read;
|
||||||
/* Prior to Haswell, the hardware can't natively support GL_FIXED or
|
/* Prior to Haswell, the hardware can't natively support GL_FIXED or
|
||||||
* 2_10_10_10_REV vertex formats. Set appropriate workaround flags.
|
* 2_10_10_10_REV vertex formats. Set appropriate workaround flags.
|
||||||
*/
|
*/
|
||||||
|
|
@ -460,7 +460,7 @@ brw_try_draw_prims(struct gl_context *ctx,
|
||||||
brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?
|
brw->tcs.base.sampler_count = ctx->TessCtrlProgram._Current ?
|
||||||
util_last_bit(ctx->TessCtrlProgram._Current->SamplersUsed) : 0;
|
util_last_bit(ctx->TessCtrlProgram._Current->SamplersUsed) : 0;
|
||||||
brw->vs.base.sampler_count =
|
brw->vs.base.sampler_count =
|
||||||
util_last_bit(ctx->VertexProgram._Current->Base.SamplersUsed);
|
util_last_bit(ctx->VertexProgram._Current->SamplersUsed);
|
||||||
|
|
||||||
intel_prepare_render(brw);
|
intel_prepare_render(brw);
|
||||||
brw_predraw_set_aux_buffers(brw);
|
brw_predraw_set_aux_buffers(brw);
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ static struct gl_program *brwNewProgram( struct gl_context *ctx,
|
||||||
if (prog) {
|
if (prog) {
|
||||||
prog->id = get_new_program_id(brw->screen);
|
prog->id = get_new_program_id(brw->screen);
|
||||||
|
|
||||||
return _mesa_init_gl_program(&prog->program.Base, target, id);
|
return _mesa_init_gl_program(&prog->program, target, id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
@ -213,6 +213,8 @@ brwProgramStringNotify(struct gl_context *ctx,
|
||||||
GLenum target,
|
GLenum target,
|
||||||
struct gl_program *prog)
|
struct gl_program *prog)
|
||||||
{
|
{
|
||||||
|
assert(target == GL_VERTEX_PROGRAM_ARB || !prog->IsPositionInvariant);
|
||||||
|
|
||||||
struct brw_context *brw = brw_context(ctx);
|
struct brw_context *brw = brw_context(ctx);
|
||||||
const struct brw_compiler *compiler = brw->screen->compiler;
|
const struct brw_compiler *compiler = brw->screen->compiler;
|
||||||
|
|
||||||
|
|
@ -235,8 +237,7 @@ brwProgramStringNotify(struct gl_context *ctx,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GL_VERTEX_PROGRAM_ARB: {
|
case GL_VERTEX_PROGRAM_ARB: {
|
||||||
struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog;
|
struct brw_vertex_program *newVP = brw_vertex_program(prog);
|
||||||
struct brw_vertex_program *newVP = brw_vertex_program(vprog);
|
|
||||||
const struct brw_vertex_program *curVP =
|
const struct brw_vertex_program *curVP =
|
||||||
brw_vertex_program_const(brw->vertex_program);
|
brw_vertex_program_const(brw->vertex_program);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,16 +112,15 @@ brw_codegen_vs_prog(struct brw_context *brw,
|
||||||
|
|
||||||
mem_ctx = ralloc_context(NULL);
|
mem_ctx = ralloc_context(NULL);
|
||||||
|
|
||||||
brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX,
|
brw_assign_common_binding_table_offsets(MESA_SHADER_VERTEX, devinfo, prog,
|
||||||
devinfo,
|
&vp->program, &prog_data.base.base,
|
||||||
prog, &vp->program.Base,
|
0);
|
||||||
&prog_data.base.base, 0);
|
|
||||||
|
|
||||||
/* Allocate the references to the uniforms that will end up in the
|
/* Allocate the references to the uniforms that will end up in the
|
||||||
* prog_data associated with the compiled program, and which will be freed
|
* prog_data associated with the compiled program, and which will be freed
|
||||||
* by the state cache.
|
* by the state cache.
|
||||||
*/
|
*/
|
||||||
int param_count = vp->program.Base.nir->num_uniforms / 4;
|
int param_count = vp->program.nir->num_uniforms / 4;
|
||||||
|
|
||||||
if (vs)
|
if (vs)
|
||||||
prog_data.base.base.nr_image_params = vs->base.NumImages;
|
prog_data.base.base.nr_image_params = vs->base.NumImages;
|
||||||
|
|
@ -141,25 +140,25 @@ brw_codegen_vs_prog(struct brw_context *brw,
|
||||||
stage_prog_data->nr_params = param_count;
|
stage_prog_data->nr_params = param_count;
|
||||||
|
|
||||||
if (prog) {
|
if (prog) {
|
||||||
brw_nir_setup_glsl_uniforms(vp->program.Base.nir, prog, &vp->program.Base,
|
brw_nir_setup_glsl_uniforms(vp->program.nir, prog, &vp->program,
|
||||||
&prog_data.base.base,
|
&prog_data.base.base,
|
||||||
compiler->scalar_stage[MESA_SHADER_VERTEX]);
|
compiler->scalar_stage[MESA_SHADER_VERTEX]);
|
||||||
} else {
|
} else {
|
||||||
brw_nir_setup_arb_uniforms(vp->program.Base.nir, &vp->program.Base,
|
brw_nir_setup_arb_uniforms(vp->program.nir, &vp->program,
|
||||||
&prog_data.base.base);
|
&prog_data.base.base);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t outputs_written =
|
uint64_t outputs_written =
|
||||||
brw_vs_outputs_written(brw, key, vp->program.Base.info.outputs_written);
|
brw_vs_outputs_written(brw, key, vp->program.info.outputs_written);
|
||||||
prog_data.inputs_read = vp->program.Base.info.inputs_read;
|
prog_data.inputs_read = vp->program.info.inputs_read;
|
||||||
|
|
||||||
if (key->copy_edgeflag) {
|
if (key->copy_edgeflag) {
|
||||||
prog_data.inputs_read |= VERT_BIT_EDGEFLAG;
|
prog_data.inputs_read |= VERT_BIT_EDGEFLAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
prog_data.base.cull_distance_mask =
|
prog_data.base.cull_distance_mask =
|
||||||
((1 << vp->program.Base.CullDistanceArraySize) - 1) <<
|
((1 << vp->program.CullDistanceArraySize) - 1) <<
|
||||||
vp->program.Base.ClipDistanceArraySize;
|
vp->program.ClipDistanceArraySize;
|
||||||
|
|
||||||
brw_compute_vue_map(devinfo,
|
brw_compute_vue_map(devinfo,
|
||||||
&prog_data.base.vue_map, outputs_written,
|
&prog_data.base.vue_map, outputs_written,
|
||||||
|
|
@ -168,8 +167,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
|
||||||
: false);
|
: false);
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
_mesa_fprint_program_opt(stderr, &vp->program.Base, PROG_PRINT_DEBUG,
|
_mesa_fprint_program_opt(stderr, &vp->program, PROG_PRINT_DEBUG, true);
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(brw->perf_debug)) {
|
if (unlikely(brw->perf_debug)) {
|
||||||
|
|
@ -179,7 +177,7 @@ brw_codegen_vs_prog(struct brw_context *brw,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
|
if (unlikely(INTEL_DEBUG & DEBUG_VS)) {
|
||||||
brw_dump_ir("vertex", prog, vs ? &vs->base : NULL, &vp->program.Base);
|
brw_dump_ir("vertex", prog, vs ? &vs->base : NULL, &vp->program);
|
||||||
|
|
||||||
fprintf(stderr, "VS Output ");
|
fprintf(stderr, "VS Output ");
|
||||||
brw_print_vue_map(stderr, &prog_data.base.vue_map);
|
brw_print_vue_map(stderr, &prog_data.base.vue_map);
|
||||||
|
|
@ -187,13 +185,13 @@ brw_codegen_vs_prog(struct brw_context *brw,
|
||||||
|
|
||||||
int st_index = -1;
|
int st_index = -1;
|
||||||
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
|
if (INTEL_DEBUG & DEBUG_SHADER_TIME)
|
||||||
st_index = brw_get_shader_time_index(brw, prog, &vp->program.Base, ST_VS);
|
st_index = brw_get_shader_time_index(brw, prog, &vp->program, ST_VS);
|
||||||
|
|
||||||
/* Emit GEN4 code.
|
/* Emit GEN4 code.
|
||||||
*/
|
*/
|
||||||
char *error_str;
|
char *error_str;
|
||||||
program = brw_compile_vs(compiler, brw, mem_ctx, key,
|
program = brw_compile_vs(compiler, brw, mem_ctx, key, &prog_data,
|
||||||
&prog_data, vp->program.Base.nir,
|
vp->program.nir,
|
||||||
brw_select_clip_planes(&brw->ctx),
|
brw_select_clip_planes(&brw->ctx),
|
||||||
!_mesa_is_gles3(&brw->ctx),
|
!_mesa_is_gles3(&brw->ctx),
|
||||||
st_index, &program_size, &error_str);
|
st_index, &program_size, &error_str);
|
||||||
|
|
@ -321,9 +319,8 @@ brw_vs_populate_key(struct brw_context *brw,
|
||||||
key->program_string_id = vp->id;
|
key->program_string_id = vp->id;
|
||||||
|
|
||||||
if (ctx->Transform.ClipPlanesEnabled != 0 &&
|
if (ctx->Transform.ClipPlanesEnabled != 0 &&
|
||||||
(ctx->API == API_OPENGL_COMPAT ||
|
(ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) &&
|
||||||
ctx->API == API_OPENGLES) &&
|
vp->program.ClipDistanceArraySize == 0) {
|
||||||
vp->program.Base.ClipDistanceArraySize == 0) {
|
|
||||||
key->nr_userclip_plane_consts =
|
key->nr_userclip_plane_consts =
|
||||||
_mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
|
_mesa_logbase2(ctx->Transform.ClipPlanesEnabled) + 1;
|
||||||
}
|
}
|
||||||
|
|
@ -392,8 +389,7 @@ brw_vs_precompile(struct gl_context *ctx,
|
||||||
struct brw_stage_prog_data *old_prog_data = brw->vs.base.prog_data;
|
struct brw_stage_prog_data *old_prog_data = brw->vs.base.prog_data;
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
struct gl_vertex_program *vp = (struct gl_vertex_program *) prog;
|
struct brw_vertex_program *bvp = brw_vertex_program(prog);
|
||||||
struct brw_vertex_program *bvp = brw_vertex_program(vp);
|
|
||||||
|
|
||||||
memset(&key, 0, sizeof(key));
|
memset(&key, 0, sizeof(key));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ brw_upload_vs_pull_constants(struct brw_context *brw)
|
||||||
|
|
||||||
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_VERTEX);
|
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_VERTEX);
|
||||||
/* _NEW_PROGRAM_CONSTANTS */
|
/* _NEW_PROGRAM_CONSTANTS */
|
||||||
brw_upload_pull_constants(brw, BRW_NEW_VS_CONSTBUF, &vp->program.Base,
|
brw_upload_pull_constants(brw, BRW_NEW_VS_CONSTBUF, &vp->program,
|
||||||
stage_state, prog_data);
|
stage_state, prog_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,8 @@ gen6_upload_vs_push_constants(struct brw_context *brw)
|
||||||
const struct brw_stage_prog_data *prog_data = brw->vs.base.prog_data;
|
const struct brw_stage_prog_data *prog_data = brw->vs.base.prog_data;
|
||||||
|
|
||||||
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_VERTEX);
|
_mesa_shader_write_subroutine_indices(&brw->ctx, MESA_SHADER_VERTEX);
|
||||||
gen6_upload_push_constants(brw, &vp->program.Base, prog_data,
|
gen6_upload_push_constants(brw, &vp->program, prog_data, stage_state,
|
||||||
stage_state, AUB_TRACE_VS_CONSTANTS);
|
AUB_TRACE_VS_CONSTANTS);
|
||||||
|
|
||||||
if (brw->gen >= 7) {
|
if (brw->gen >= 7) {
|
||||||
if (brw->gen == 7 && !brw->is_haswell && !brw->is_baytrail)
|
if (brw->gen == 7 && !brw->is_haswell && !brw->is_baytrail)
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ typedef struct r200_context *r200ContextPtr;
|
||||||
#include "main/mm.h"
|
#include "main/mm.h"
|
||||||
|
|
||||||
struct r200_vertex_program {
|
struct r200_vertex_program {
|
||||||
struct gl_vertex_program mesa_program; /* Must be first */
|
struct gl_program mesa_program; /* Must be first */
|
||||||
int translated;
|
int translated;
|
||||||
/* need excess instr: 1 for late loop checking, 2 for
|
/* need excess instr: 1 for late loop checking, 2 for
|
||||||
additional instr due to instr/attr, 3 for fog */
|
additional instr due to instr/attr, 3 for fog */
|
||||||
|
|
|
||||||
|
|
@ -271,8 +271,8 @@ TCL_OR_VP_CHECK( tcl_or_vp, GL_TRUE, 0 )
|
||||||
TCL_OR_VP_CHECK( tcl_or_vp_add2, GL_TRUE, 2 )
|
TCL_OR_VP_CHECK( tcl_or_vp_add2, GL_TRUE, 2 )
|
||||||
VP_CHECK( tcl_vp, GL_TRUE, 0 )
|
VP_CHECK( tcl_vp, GL_TRUE, 0 )
|
||||||
VP_CHECK( tcl_vp_add4, GL_TRUE, 4 )
|
VP_CHECK( tcl_vp_add4, GL_TRUE, 4 )
|
||||||
VP_CHECK( tcl_vp_size_add4, ctx->VertexProgram.Current->Base.NumNativeInstructions > 64, 4 )
|
VP_CHECK( tcl_vp_size_add4, ctx->VertexProgram.Current->NumNativeInstructions > 64, 4 )
|
||||||
VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->Base.NumNativeParameters > 96, 4 )
|
VP_CHECK( tcl_vpp_size_add4, ctx->VertexProgram.Current->NumNativeParameters > 96, 4 )
|
||||||
|
|
||||||
#define OUT_VEC(hdr, data) do { \
|
#define OUT_VEC(hdr, data) do { \
|
||||||
drm_radeon_cmd_header_t h; \
|
drm_radeon_cmd_header_t h; \
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,7 @@ static GLboolean r200_run_tcl_render( struct gl_context *ctx,
|
||||||
We only need to change compsel. */
|
We only need to change compsel. */
|
||||||
GLuint out_compsel = 0;
|
GLuint out_compsel = 0;
|
||||||
const GLbitfield64 vp_out =
|
const GLbitfield64 vp_out =
|
||||||
rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten;
|
rmesa->curr_vp_hw->mesa_program.OutputsWritten;
|
||||||
|
|
||||||
vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0];
|
vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0];
|
||||||
assert(vp_out & BITFIELD64_BIT(VARYING_SLOT_POS));
|
assert(vp_out & BITFIELD64_BIT(VARYING_SLOT_POS));
|
||||||
|
|
|
||||||
|
|
@ -104,15 +104,15 @@ static GLboolean r200VertexProgUpdateParams(struct gl_context *ctx, struct r200_
|
||||||
r200ContextPtr rmesa = R200_CONTEXT( ctx );
|
r200ContextPtr rmesa = R200_CONTEXT( ctx );
|
||||||
GLfloat *fcmd = (GLfloat *)&rmesa->hw.vpp[0].cmd[VPP_CMD_0 + 1];
|
GLfloat *fcmd = (GLfloat *)&rmesa->hw.vpp[0].cmd[VPP_CMD_0 + 1];
|
||||||
int pi;
|
int pi;
|
||||||
struct gl_vertex_program *mesa_vp = &vp->mesa_program;
|
struct gl_program *mesa_vp = &vp->mesa_program;
|
||||||
struct gl_program_parameter_list *paramList;
|
struct gl_program_parameter_list *paramList;
|
||||||
drm_radeon_cmd_header_t tmp;
|
drm_radeon_cmd_header_t tmp;
|
||||||
|
|
||||||
R200_STATECHANGE( rmesa, vpp[0] );
|
R200_STATECHANGE( rmesa, vpp[0] );
|
||||||
R200_STATECHANGE( rmesa, vpp[1] );
|
R200_STATECHANGE( rmesa, vpp[1] );
|
||||||
assert(mesa_vp->Base.Parameters);
|
assert(mesa_vp->Parameters);
|
||||||
_mesa_load_state_parameters(ctx, mesa_vp->Base.Parameters);
|
_mesa_load_state_parameters(ctx, mesa_vp->Parameters);
|
||||||
paramList = mesa_vp->Base.Parameters;
|
paramList = mesa_vp->Parameters;
|
||||||
|
|
||||||
if(paramList->NumParameters > R200_VSF_MAX_PARAM){
|
if(paramList->NumParameters > R200_VSF_MAX_PARAM){
|
||||||
fprintf(stderr, "%s:Params exhausted\n", __func__);
|
fprintf(stderr, "%s:Params exhausted\n", __func__);
|
||||||
|
|
@ -392,7 +392,7 @@ static unsigned long op_operands(enum prog_opcode opcode)
|
||||||
*/
|
*/
|
||||||
static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r200_vertex_program *vp)
|
static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r200_vertex_program *vp)
|
||||||
{
|
{
|
||||||
struct gl_vertex_program *mesa_vp = &vp->mesa_program;
|
struct gl_program *mesa_vp = &vp->mesa_program;
|
||||||
struct prog_instruction *vpi;
|
struct prog_instruction *vpi;
|
||||||
int i;
|
int i;
|
||||||
VERTEX_SHADER_INSTRUCTION *o_inst;
|
VERTEX_SHADER_INSTRUCTION *o_inst;
|
||||||
|
|
@ -409,30 +409,30 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
|
||||||
vp->translated = GL_TRUE;
|
vp->translated = GL_TRUE;
|
||||||
vp->fogmode = ctx->Fog.Mode;
|
vp->fogmode = ctx->Fog.Mode;
|
||||||
|
|
||||||
if (mesa_vp->Base.NumInstructions == 0)
|
if (mesa_vp->NumInstructions == 0)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
if ((mesa_vp->Base.InputsRead &
|
if ((mesa_vp->InputsRead &
|
||||||
~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 |
|
~(VERT_BIT_POS | VERT_BIT_NORMAL | VERT_BIT_COLOR0 | VERT_BIT_COLOR1 |
|
||||||
VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 |
|
VERT_BIT_FOG | VERT_BIT_TEX0 | VERT_BIT_TEX1 | VERT_BIT_TEX2 |
|
||||||
VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) != 0) {
|
VERT_BIT_TEX3 | VERT_BIT_TEX4 | VERT_BIT_TEX5)) != 0) {
|
||||||
if (R200_DEBUG & RADEON_FALLBACKS) {
|
if (R200_DEBUG & RADEON_FALLBACKS) {
|
||||||
fprintf(stderr, "can't handle vert prog inputs 0x%x\n",
|
fprintf(stderr, "can't handle vert prog inputs 0x%x\n",
|
||||||
mesa_vp->Base.InputsRead);
|
mesa_vp->InputsRead);
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((mesa_vp->Base.OutputsWritten &
|
if ((mesa_vp->OutputsWritten &
|
||||||
~((1 << VARYING_SLOT_POS) | (1 << VARYING_SLOT_COL0) | (1 << VARYING_SLOT_COL1) |
|
~((1 << VARYING_SLOT_POS) | (1 << VARYING_SLOT_COL0) | (1 << VARYING_SLOT_COL1) |
|
||||||
(1 << VARYING_SLOT_FOGC) | (1 << VARYING_SLOT_TEX0) | (1 << VARYING_SLOT_TEX1) |
|
(1 << VARYING_SLOT_FOGC) | (1 << VARYING_SLOT_TEX0) | (1 << VARYING_SLOT_TEX1) |
|
||||||
(1 << VARYING_SLOT_TEX2) | (1 << VARYING_SLOT_TEX3) | (1 << VARYING_SLOT_TEX4) |
|
(1 << VARYING_SLOT_TEX2) | (1 << VARYING_SLOT_TEX3) | (1 << VARYING_SLOT_TEX4) |
|
||||||
(1 << VARYING_SLOT_TEX5) | (1 << VARYING_SLOT_PSIZ))) != 0) {
|
(1 << VARYING_SLOT_TEX5) | (1 << VARYING_SLOT_PSIZ))) != 0) {
|
||||||
if (R200_DEBUG & RADEON_FALLBACKS) {
|
if (R200_DEBUG & RADEON_FALLBACKS) {
|
||||||
fprintf(stderr, "can't handle vert prog outputs 0x%llx\n",
|
fprintf(stderr, "can't handle vert prog outputs 0x%llx\n",
|
||||||
(unsigned long long) mesa_vp->Base.OutputsWritten);
|
(unsigned long long) mesa_vp->OutputsWritten);
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -447,25 +447,25 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
|
||||||
/* FIXME: is changing the prog safe to do here? */
|
/* FIXME: is changing the prog safe to do here? */
|
||||||
if (mesa_vp->IsPositionInvariant &&
|
if (mesa_vp->IsPositionInvariant &&
|
||||||
/* make sure we only do this once */
|
/* make sure we only do this once */
|
||||||
!(mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_POS))) {
|
!(mesa_vp->OutputsWritten & (1 << VARYING_SLOT_POS))) {
|
||||||
_mesa_insert_mvp_code(ctx, mesa_vp);
|
_mesa_insert_mvp_code(ctx, mesa_vp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for fogc, can't change mesa_vp, as it would hose swtnl, and exp with
|
/* for fogc, can't change mesa_vp, as it would hose swtnl, and exp with
|
||||||
base e isn't directly available neither. */
|
base e isn't directly available neither. */
|
||||||
if ((mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_FOGC)) && !vp->fogpidx) {
|
if ((mesa_vp->OutputsWritten & (1 << VARYING_SLOT_FOGC)) && !vp->fogpidx) {
|
||||||
struct gl_program_parameter_list *paramList;
|
struct gl_program_parameter_list *paramList;
|
||||||
gl_state_index tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 };
|
gl_state_index tokens[STATE_LENGTH] = { STATE_FOG_PARAMS, 0, 0, 0, 0 };
|
||||||
paramList = mesa_vp->Base.Parameters;
|
paramList = mesa_vp->Parameters;
|
||||||
vp->fogpidx = _mesa_add_state_reference(paramList, tokens);
|
vp->fogpidx = _mesa_add_state_reference(paramList, tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
vp->pos_end = 0;
|
vp->pos_end = 0;
|
||||||
mesa_vp->Base.NumNativeInstructions = 0;
|
mesa_vp->NumNativeInstructions = 0;
|
||||||
if (mesa_vp->Base.Parameters)
|
if (mesa_vp->Parameters)
|
||||||
mesa_vp->Base.NumNativeParameters = mesa_vp->Base.Parameters->NumParameters;
|
mesa_vp->NumNativeParameters = mesa_vp->Parameters->NumParameters;
|
||||||
else
|
else
|
||||||
mesa_vp->Base.NumNativeParameters = 0;
|
mesa_vp->NumNativeParameters = 0;
|
||||||
|
|
||||||
for(i = 0; i < VERT_ATTRIB_MAX; i++)
|
for(i = 0; i < VERT_ATTRIB_MAX; i++)
|
||||||
vp->inputs[i] = -1;
|
vp->inputs[i] = -1;
|
||||||
|
|
@ -491,42 +491,42 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
|
||||||
Haven't seen attr 14 used, maybe that's for the hw pointsize vec1 (which is
|
Haven't seen attr 14 used, maybe that's for the hw pointsize vec1 (which is
|
||||||
not possibe to use with vertex progs as it is lacking in vert prog specification) */
|
not possibe to use with vertex progs as it is lacking in vert prog specification) */
|
||||||
/* may look different when using idx buf / input_route instead of se_vtx_fmt? */
|
/* may look different when using idx buf / input_route instead of se_vtx_fmt? */
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_POS) {
|
if (mesa_vp->InputsRead & VERT_BIT_POS) {
|
||||||
vp->inputs[VERT_ATTRIB_POS] = 0;
|
vp->inputs[VERT_ATTRIB_POS] = 0;
|
||||||
vp->inputmap_rev[0] = VERT_ATTRIB_POS;
|
vp->inputmap_rev[0] = VERT_ATTRIB_POS;
|
||||||
free_inputs &= ~(1 << 0);
|
free_inputs &= ~(1 << 0);
|
||||||
array_count++;
|
array_count++;
|
||||||
}
|
}
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_WEIGHT) {
|
if (mesa_vp->InputsRead & VERT_BIT_WEIGHT) {
|
||||||
vp->inputs[VERT_ATTRIB_WEIGHT] = 12;
|
vp->inputs[VERT_ATTRIB_WEIGHT] = 12;
|
||||||
vp->inputmap_rev[1] = VERT_ATTRIB_WEIGHT;
|
vp->inputmap_rev[1] = VERT_ATTRIB_WEIGHT;
|
||||||
array_count++;
|
array_count++;
|
||||||
}
|
}
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_NORMAL) {
|
if (mesa_vp->InputsRead & VERT_BIT_NORMAL) {
|
||||||
vp->inputs[VERT_ATTRIB_NORMAL] = 1;
|
vp->inputs[VERT_ATTRIB_NORMAL] = 1;
|
||||||
vp->inputmap_rev[2] = VERT_ATTRIB_NORMAL;
|
vp->inputmap_rev[2] = VERT_ATTRIB_NORMAL;
|
||||||
array_count++;
|
array_count++;
|
||||||
}
|
}
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_COLOR0) {
|
if (mesa_vp->InputsRead & VERT_BIT_COLOR0) {
|
||||||
vp->inputs[VERT_ATTRIB_COLOR0] = 2;
|
vp->inputs[VERT_ATTRIB_COLOR0] = 2;
|
||||||
vp->inputmap_rev[4] = VERT_ATTRIB_COLOR0;
|
vp->inputmap_rev[4] = VERT_ATTRIB_COLOR0;
|
||||||
free_inputs &= ~(1 << 2);
|
free_inputs &= ~(1 << 2);
|
||||||
array_count++;
|
array_count++;
|
||||||
}
|
}
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_COLOR1) {
|
if (mesa_vp->InputsRead & VERT_BIT_COLOR1) {
|
||||||
vp->inputs[VERT_ATTRIB_COLOR1] = 3;
|
vp->inputs[VERT_ATTRIB_COLOR1] = 3;
|
||||||
vp->inputmap_rev[5] = VERT_ATTRIB_COLOR1;
|
vp->inputmap_rev[5] = VERT_ATTRIB_COLOR1;
|
||||||
free_inputs &= ~(1 << 3);
|
free_inputs &= ~(1 << 3);
|
||||||
array_count++;
|
array_count++;
|
||||||
}
|
}
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_FOG) {
|
if (mesa_vp->InputsRead & VERT_BIT_FOG) {
|
||||||
vp->inputs[VERT_ATTRIB_FOG] = 15; array_count++;
|
vp->inputs[VERT_ATTRIB_FOG] = 15; array_count++;
|
||||||
vp->inputmap_rev[3] = VERT_ATTRIB_FOG;
|
vp->inputmap_rev[3] = VERT_ATTRIB_FOG;
|
||||||
array_count++;
|
array_count++;
|
||||||
}
|
}
|
||||||
/* VERT_ATTRIB_TEX0-5 */
|
/* VERT_ATTRIB_TEX0-5 */
|
||||||
for (i = 0; i <= 5; i++) {
|
for (i = 0; i <= 5; i++) {
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_TEX(i)) {
|
if (mesa_vp->InputsRead & VERT_BIT_TEX(i)) {
|
||||||
vp->inputs[VERT_ATTRIB_TEX(i)] = i + 6;
|
vp->inputs[VERT_ATTRIB_TEX(i)] = i + 6;
|
||||||
vp->inputmap_rev[8 + i] = VERT_ATTRIB_TEX(i);
|
vp->inputmap_rev[8 + i] = VERT_ATTRIB_TEX(i);
|
||||||
free_inputs &= ~(1 << (i + 6));
|
free_inputs &= ~(1 << (i + 6));
|
||||||
|
|
@ -535,7 +535,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
|
||||||
}
|
}
|
||||||
/* using VERT_ATTRIB_TEX6/7 would be illegal */
|
/* using VERT_ATTRIB_TEX6/7 would be illegal */
|
||||||
for (; i < VERT_ATTRIB_TEX_MAX; i++) {
|
for (; i < VERT_ATTRIB_TEX_MAX; i++) {
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_TEX(i)) {
|
if (mesa_vp->InputsRead & VERT_BIT_TEX(i)) {
|
||||||
if (R200_DEBUG & RADEON_FALLBACKS) {
|
if (R200_DEBUG & RADEON_FALLBACKS) {
|
||||||
fprintf(stderr, "texture attribute %d in vert prog\n", i);
|
fprintf(stderr, "texture attribute %d in vert prog\n", i);
|
||||||
}
|
}
|
||||||
|
|
@ -546,7 +546,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
|
||||||
for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
|
for (i = 0; i < VERT_ATTRIB_GENERIC_MAX; i++) {
|
||||||
int j;
|
int j;
|
||||||
/* completely ignore aliasing? */
|
/* completely ignore aliasing? */
|
||||||
if (mesa_vp->Base.InputsRead & VERT_BIT_GENERIC(i)) {
|
if (mesa_vp->InputsRead & VERT_BIT_GENERIC(i)) {
|
||||||
array_count++;
|
array_count++;
|
||||||
if (array_count > 12) {
|
if (array_count > 12) {
|
||||||
if (R200_DEBUG & RADEON_FALLBACKS) {
|
if (R200_DEBUG & RADEON_FALLBACKS) {
|
||||||
|
|
@ -575,7 +575,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(mesa_vp->Base.OutputsWritten & (1 << VARYING_SLOT_POS))) {
|
if (!(mesa_vp->OutputsWritten & (1 << VARYING_SLOT_POS))) {
|
||||||
if (R200_DEBUG & RADEON_FALLBACKS) {
|
if (R200_DEBUG & RADEON_FALLBACKS) {
|
||||||
fprintf(stderr, "can't handle vert prog without position output\n");
|
fprintf(stderr, "can't handle vert prog without position output\n");
|
||||||
}
|
}
|
||||||
|
|
@ -589,7 +589,7 @@ static GLboolean r200_translate_vertex_program(struct gl_context *ctx, struct r2
|
||||||
}
|
}
|
||||||
|
|
||||||
o_inst = vp->instr;
|
o_inst = vp->instr;
|
||||||
for (vpi = mesa_vp->Base.Instructions; vpi->Opcode != OPCODE_END; vpi++, o_inst++){
|
for (vpi = mesa_vp->Instructions; vpi->Opcode != OPCODE_END; vpi++, o_inst++){
|
||||||
operands = op_operands(vpi->Opcode);
|
operands = op_operands(vpi->Opcode);
|
||||||
are_srcs_scalar = operands & SCALAR_FLAG;
|
are_srcs_scalar = operands & SCALAR_FLAG;
|
||||||
operands &= OP_MASK;
|
operands &= OP_MASK;
|
||||||
|
|
@ -1069,20 +1069,20 @@ else {
|
||||||
}
|
}
|
||||||
|
|
||||||
u_temp_used = (R200_VSF_MAX_TEMPS - 1) - u_temp_i;
|
u_temp_used = (R200_VSF_MAX_TEMPS - 1) - u_temp_i;
|
||||||
if (mesa_vp->Base.NumNativeTemporaries <
|
if (mesa_vp->NumNativeTemporaries <
|
||||||
(mesa_vp->Base.NumTemporaries + u_temp_used)) {
|
(mesa_vp->NumTemporaries + u_temp_used)) {
|
||||||
mesa_vp->Base.NumNativeTemporaries =
|
mesa_vp->NumNativeTemporaries =
|
||||||
mesa_vp->Base.NumTemporaries + u_temp_used;
|
mesa_vp->NumTemporaries + u_temp_used;
|
||||||
}
|
}
|
||||||
if ((mesa_vp->Base.NumTemporaries + u_temp_used) > R200_VSF_MAX_TEMPS) {
|
if ((mesa_vp->NumTemporaries + u_temp_used) > R200_VSF_MAX_TEMPS) {
|
||||||
if (R200_DEBUG & RADEON_FALLBACKS) {
|
if (R200_DEBUG & RADEON_FALLBACKS) {
|
||||||
fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->Base.NumTemporaries, u_temp_used);
|
fprintf(stderr, "Ran out of temps, num temps %d, us %d\n", mesa_vp->NumTemporaries, u_temp_used);
|
||||||
}
|
}
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
}
|
}
|
||||||
u_temp_i = R200_VSF_MAX_TEMPS - 1;
|
u_temp_i = R200_VSF_MAX_TEMPS - 1;
|
||||||
if(o_inst - vp->instr >= R200_VSF_MAX_INST) {
|
if(o_inst - vp->instr >= R200_VSF_MAX_INST) {
|
||||||
mesa_vp->Base.NumNativeInstructions = 129;
|
mesa_vp->NumNativeInstructions = 129;
|
||||||
if (R200_DEBUG & RADEON_FALLBACKS) {
|
if (R200_DEBUG & RADEON_FALLBACKS) {
|
||||||
fprintf(stderr, "more than 128 native instructions\n");
|
fprintf(stderr, "more than 128 native instructions\n");
|
||||||
}
|
}
|
||||||
|
|
@ -1094,7 +1094,7 @@ else {
|
||||||
}
|
}
|
||||||
|
|
||||||
vp->native = GL_TRUE;
|
vp->native = GL_TRUE;
|
||||||
mesa_vp->Base.NumNativeInstructions = (o_inst - vp->instr);
|
mesa_vp->NumNativeInstructions = (o_inst - vp->instr);
|
||||||
#if 0
|
#if 0
|
||||||
fprintf(stderr, "hw program:\n");
|
fprintf(stderr, "hw program:\n");
|
||||||
for(i=0; i < vp->program.length; i++)
|
for(i=0; i < vp->program.length; i++)
|
||||||
|
|
@ -1126,10 +1126,10 @@ void r200SetupVertexProg( struct gl_context *ctx ) {
|
||||||
R200_STATECHANGE( rmesa, pvs );
|
R200_STATECHANGE( rmesa, pvs );
|
||||||
|
|
||||||
rmesa->hw.pvs.cmd[PVS_CNTL_1] = (0 << R200_PVS_CNTL_1_PROGRAM_START_SHIFT) |
|
rmesa->hw.pvs.cmd[PVS_CNTL_1] = (0 << R200_PVS_CNTL_1_PROGRAM_START_SHIFT) |
|
||||||
((vp->mesa_program.Base.NumNativeInstructions - 1) << R200_PVS_CNTL_1_PROGRAM_END_SHIFT) |
|
((vp->mesa_program.NumNativeInstructions - 1) << R200_PVS_CNTL_1_PROGRAM_END_SHIFT) |
|
||||||
(vp->pos_end << R200_PVS_CNTL_1_POS_END_SHIFT);
|
(vp->pos_end << R200_PVS_CNTL_1_POS_END_SHIFT);
|
||||||
rmesa->hw.pvs.cmd[PVS_CNTL_2] = (0 << R200_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
|
rmesa->hw.pvs.cmd[PVS_CNTL_2] = (0 << R200_PVS_CNTL_2_PARAM_OFFSET_SHIFT) |
|
||||||
(vp->mesa_program.Base.NumNativeParameters << R200_PVS_CNTL_2_PARAM_COUNT_SHIFT);
|
(vp->mesa_program.NumNativeParameters << R200_PVS_CNTL_2_PARAM_COUNT_SHIFT);
|
||||||
|
|
||||||
/* maybe user clip planes just work with vertex progs... untested */
|
/* maybe user clip planes just work with vertex progs... untested */
|
||||||
if (ctx->Transform.ClipPlanesEnabled) {
|
if (ctx->Transform.ClipPlanesEnabled) {
|
||||||
|
|
@ -1143,7 +1143,7 @@ void r200SetupVertexProg( struct gl_context *ctx ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vp != rmesa->curr_vp_hw) {
|
if (vp != rmesa->curr_vp_hw) {
|
||||||
GLuint count = vp->mesa_program.Base.NumNativeInstructions;
|
GLuint count = vp->mesa_program.NumNativeInstructions;
|
||||||
drm_radeon_cmd_header_t tmp;
|
drm_radeon_cmd_header_t tmp;
|
||||||
|
|
||||||
R200_STATECHANGE( rmesa, vpi[0] );
|
R200_STATECHANGE( rmesa, vpi[0] );
|
||||||
|
|
@ -1203,7 +1203,7 @@ r200NewProgram(struct gl_context *ctx, GLenum target, GLuint id)
|
||||||
switch(target){
|
switch(target){
|
||||||
case GL_VERTEX_PROGRAM_ARB: {
|
case GL_VERTEX_PROGRAM_ARB: {
|
||||||
struct r200_vertex_program *vp = CALLOC_STRUCT(r200_vertex_program);
|
struct r200_vertex_program *vp = CALLOC_STRUCT(r200_vertex_program);
|
||||||
return _mesa_init_gl_program(&vp->mesa_program.Base, target, id);
|
return _mesa_init_gl_program(&vp->mesa_program, target, id);
|
||||||
}
|
}
|
||||||
case GL_FRAGMENT_PROGRAM_ARB: {
|
case GL_FRAGMENT_PROGRAM_ARB: {
|
||||||
struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
|
struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
|
||||||
|
|
@ -1232,7 +1232,7 @@ r200ProgramStringNotify(struct gl_context *ctx, GLenum target, struct gl_program
|
||||||
case GL_VERTEX_PROGRAM_ARB:
|
case GL_VERTEX_PROGRAM_ARB:
|
||||||
vp->translated = GL_FALSE;
|
vp->translated = GL_FALSE;
|
||||||
vp->fogpidx = 0;
|
vp->fogpidx = 0;
|
||||||
/* memset(&vp->translated, 0, sizeof(struct r200_vertex_program) - sizeof(struct gl_vertex_program));*/
|
/* memset(&vp->translated, 0, sizeof(struct r200_vertex_program) - sizeof(struct gl_program));*/
|
||||||
r200_translate_vertex_program(ctx, vp);
|
r200_translate_vertex_program(ctx, vp);
|
||||||
rmesa->curr_vp_hw = NULL;
|
rmesa->curr_vp_hw = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
|
||||||
|
|
||||||
/* Error-check target and get curProg */
|
/* Error-check target and get curProg */
|
||||||
if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
|
if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
|
||||||
curProg = &ctx->VertexProgram.Current->Base;
|
curProg = ctx->VertexProgram.Current;
|
||||||
}
|
}
|
||||||
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
||||||
&& ctx->Extensions.ARB_fragment_program) {
|
&& ctx->Extensions.ARB_fragment_program) {
|
||||||
|
|
@ -79,7 +79,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
|
||||||
/* Bind a default program */
|
/* Bind a default program */
|
||||||
newProg = NULL;
|
newProg = NULL;
|
||||||
if (target == GL_VERTEX_PROGRAM_ARB)
|
if (target == GL_VERTEX_PROGRAM_ARB)
|
||||||
newProg = &ctx->Shared->DefaultVertexProgram->Base;
|
newProg = ctx->Shared->DefaultVertexProgram;
|
||||||
else
|
else
|
||||||
newProg = &ctx->Shared->DefaultFragmentProgram->Base;
|
newProg = &ctx->Shared->DefaultFragmentProgram->Base;
|
||||||
}
|
}
|
||||||
|
|
@ -114,8 +114,7 @@ _mesa_BindProgramARB(GLenum target, GLuint id)
|
||||||
|
|
||||||
/* bind newProg */
|
/* bind newProg */
|
||||||
if (target == GL_VERTEX_PROGRAM_ARB) {
|
if (target == GL_VERTEX_PROGRAM_ARB) {
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
|
_mesa_reference_program(ctx, &ctx->VertexProgram.Current, newProg);
|
||||||
gl_vertex_program(newProg));
|
|
||||||
}
|
}
|
||||||
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||||
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
|
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
|
||||||
|
|
@ -160,7 +159,7 @@ _mesa_DeleteProgramsARB(GLsizei n, const GLuint *ids)
|
||||||
switch (prog->Target) {
|
switch (prog->Target) {
|
||||||
case GL_VERTEX_PROGRAM_ARB:
|
case GL_VERTEX_PROGRAM_ARB:
|
||||||
if (ctx->VertexProgram.Current &&
|
if (ctx->VertexProgram.Current &&
|
||||||
ctx->VertexProgram.Current->Base.Id == ids[i]) {
|
ctx->VertexProgram.Current->Id == ids[i]) {
|
||||||
/* unbind this currently bound program */
|
/* unbind this currently bound program */
|
||||||
_mesa_BindProgramARB(prog->Target, 0);
|
_mesa_BindProgramARB(prog->Target, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +256,7 @@ get_local_param_pointer(struct gl_context *ctx, const char *func,
|
||||||
|
|
||||||
if (target == GL_VERTEX_PROGRAM_ARB
|
if (target == GL_VERTEX_PROGRAM_ARB
|
||||||
&& ctx->Extensions.ARB_vertex_program) {
|
&& ctx->Extensions.ARB_vertex_program) {
|
||||||
prog = &(ctx->VertexProgram.Current->Base);
|
prog = ctx->VertexProgram.Current;
|
||||||
maxParams = ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams;
|
maxParams = ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams;
|
||||||
}
|
}
|
||||||
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
||||||
|
|
@ -336,10 +335,10 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
|
if (target == GL_VERTEX_PROGRAM_ARB && ctx->Extensions.ARB_vertex_program) {
|
||||||
struct gl_vertex_program *prog = ctx->VertexProgram.Current;
|
struct gl_program *prog = ctx->VertexProgram.Current;
|
||||||
_mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
|
_mesa_parse_arb_vertex_program(ctx, target, string, len, prog);
|
||||||
|
|
||||||
base = & prog->Base;
|
base = prog;
|
||||||
}
|
}
|
||||||
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
||||||
&& ctx->Extensions.ARB_fragment_program) {
|
&& ctx->Extensions.ARB_fragment_program) {
|
||||||
|
|
@ -657,7 +656,7 @@ _mesa_GetProgramivARB(GLenum target, GLenum pname, GLint *params)
|
||||||
|
|
||||||
if (target == GL_VERTEX_PROGRAM_ARB
|
if (target == GL_VERTEX_PROGRAM_ARB
|
||||||
&& ctx->Extensions.ARB_vertex_program) {
|
&& ctx->Extensions.ARB_vertex_program) {
|
||||||
prog = &(ctx->VertexProgram.Current->Base);
|
prog = ctx->VertexProgram.Current;
|
||||||
limits = &ctx->Const.Program[MESA_SHADER_VERTEX];
|
limits = &ctx->Const.Program[MESA_SHADER_VERTEX];
|
||||||
}
|
}
|
||||||
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
else if (target == GL_FRAGMENT_PROGRAM_ARB
|
||||||
|
|
@ -838,7 +837,7 @@ _mesa_GetProgramStringARB(GLenum target, GLenum pname, GLvoid *string)
|
||||||
GET_CURRENT_CONTEXT(ctx);
|
GET_CURRENT_CONTEXT(ctx);
|
||||||
|
|
||||||
if (target == GL_VERTEX_PROGRAM_ARB) {
|
if (target == GL_VERTEX_PROGRAM_ARB) {
|
||||||
prog = &(ctx->VertexProgram.Current->Base);
|
prog = ctx->VertexProgram.Current;
|
||||||
}
|
}
|
||||||
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
else if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||||
prog = &(ctx->FragmentProgram.Current->Base);
|
prog = &(ctx->FragmentProgram.Current->Base);
|
||||||
|
|
|
||||||
|
|
@ -741,7 +741,7 @@ check_context_limits(struct gl_context *ctx)
|
||||||
|
|
||||||
/* check that we don't exceed the size of various bitfields */
|
/* check that we don't exceed the size of various bitfields */
|
||||||
assert(VARYING_SLOT_MAX <=
|
assert(VARYING_SLOT_MAX <=
|
||||||
(8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten)));
|
(8 * sizeof(ctx->VertexProgram._Current->OutputsWritten)));
|
||||||
assert(VARYING_SLOT_MAX <=
|
assert(VARYING_SLOT_MAX <=
|
||||||
(8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
|
(8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead)));
|
||||||
|
|
||||||
|
|
@ -1293,9 +1293,9 @@ _mesa_free_context_data( struct gl_context *ctx )
|
||||||
_mesa_reference_framebuffer(&ctx->DrawBuffer, NULL);
|
_mesa_reference_framebuffer(&ctx->DrawBuffer, NULL);
|
||||||
_mesa_reference_framebuffer(&ctx->ReadBuffer, NULL);
|
_mesa_reference_framebuffer(&ctx->ReadBuffer, NULL);
|
||||||
|
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
|
_mesa_reference_program(ctx, &ctx->VertexProgram.Current, NULL);
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
|
_mesa_reference_program(ctx, &ctx->VertexProgram._Current, NULL);
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, NULL);
|
_mesa_reference_program(ctx, &ctx->VertexProgram._TnlProgram, NULL);
|
||||||
|
|
||||||
_mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current, NULL);
|
_mesa_reference_program(ctx, &ctx->TessCtrlProgram._Current, NULL);
|
||||||
_mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
|
_mesa_reference_program(ctx, &ctx->TessEvalProgram._Current, NULL);
|
||||||
|
|
|
||||||
|
|
@ -368,7 +368,7 @@ static GLbitfield get_fp_input_mask( struct gl_context *ctx )
|
||||||
if (vertexShader)
|
if (vertexShader)
|
||||||
vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
|
vprog = ctx->_Shader->CurrentProgram[MESA_SHADER_VERTEX]->_LinkedShaders[MESA_SHADER_VERTEX]->Program;
|
||||||
else
|
else
|
||||||
vprog = &ctx->VertexProgram.Current->Base;
|
vprog = ctx->VertexProgram.Current;
|
||||||
|
|
||||||
vp_outputs = vprog->OutputsWritten;
|
vp_outputs = vprog->OutputsWritten;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ struct ureg {
|
||||||
|
|
||||||
struct tnl_program {
|
struct tnl_program {
|
||||||
const struct state_key *state;
|
const struct state_key *state;
|
||||||
struct gl_vertex_program *program;
|
struct gl_program *program;
|
||||||
GLuint max_inst; /** number of instructions allocated for program */
|
GLuint max_inst; /** number of instructions allocated for program */
|
||||||
GLboolean mvp_with_dp4;
|
GLboolean mvp_with_dp4;
|
||||||
|
|
||||||
|
|
@ -384,8 +384,8 @@ static struct ureg get_temp( struct tnl_program *p )
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((GLuint) bit > p->program->Base.NumTemporaries)
|
if ((GLuint) bit > p->program->NumTemporaries)
|
||||||
p->program->Base.NumTemporaries = bit;
|
p->program->NumTemporaries = bit;
|
||||||
|
|
||||||
p->temp_in_use |= 1<<(bit-1);
|
p->temp_in_use |= 1<<(bit-1);
|
||||||
return make_ureg(PROGRAM_TEMPORARY, bit-1);
|
return make_ureg(PROGRAM_TEMPORARY, bit-1);
|
||||||
|
|
@ -428,7 +428,7 @@ static struct ureg register_param5(struct tnl_program *p,
|
||||||
tokens[2] = s2;
|
tokens[2] = s2;
|
||||||
tokens[3] = s3;
|
tokens[3] = s3;
|
||||||
tokens[4] = s4;
|
tokens[4] = s4;
|
||||||
idx = _mesa_add_state_reference( p->program->Base.Parameters, tokens );
|
idx = _mesa_add_state_reference(p->program->Parameters, tokens );
|
||||||
return make_ureg(PROGRAM_STATE_VAR, idx);
|
return make_ureg(PROGRAM_STATE_VAR, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -448,7 +448,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
|
||||||
assert(input < VERT_ATTRIB_MAX);
|
assert(input < VERT_ATTRIB_MAX);
|
||||||
|
|
||||||
if (p->state->varying_vp_inputs & VERT_BIT(input)) {
|
if (p->state->varying_vp_inputs & VERT_BIT(input)) {
|
||||||
p->program->Base.InputsRead |= VERT_BIT(input);
|
p->program->InputsRead |= VERT_BIT(input);
|
||||||
return make_ureg(PROGRAM_INPUT, input);
|
return make_ureg(PROGRAM_INPUT, input);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -462,7 +462,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input )
|
||||||
*/
|
*/
|
||||||
static struct ureg register_output( struct tnl_program *p, GLuint output )
|
static struct ureg register_output( struct tnl_program *p, GLuint output )
|
||||||
{
|
{
|
||||||
p->program->Base.OutputsWritten |= BITFIELD64_BIT(output);
|
p->program->OutputsWritten |= BITFIELD64_BIT(output);
|
||||||
return make_ureg(PROGRAM_OUTPUT, output);
|
return make_ureg(PROGRAM_OUTPUT, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -480,8 +480,8 @@ static struct ureg register_const4f( struct tnl_program *p,
|
||||||
values[1].f = s1;
|
values[1].f = s1;
|
||||||
values[2].f = s2;
|
values[2].f = s2;
|
||||||
values[3].f = s3;
|
values[3].f = s3;
|
||||||
idx = _mesa_add_unnamed_constant( p->program->Base.Parameters, values, 4,
|
idx = _mesa_add_unnamed_constant(p->program->Parameters, values, 4,
|
||||||
&swizzle );
|
&swizzle );
|
||||||
assert(swizzle == SWIZZLE_NOOP);
|
assert(swizzle == SWIZZLE_NOOP);
|
||||||
return make_ureg(PROGRAM_CONSTANT, idx);
|
return make_ureg(PROGRAM_CONSTANT, idx);
|
||||||
}
|
}
|
||||||
|
|
@ -578,9 +578,9 @@ static void emit_op3fn(struct tnl_program *p,
|
||||||
GLuint nr;
|
GLuint nr;
|
||||||
struct prog_instruction *inst;
|
struct prog_instruction *inst;
|
||||||
|
|
||||||
assert(p->program->Base.NumInstructions <= p->max_inst);
|
assert(p->program->NumInstructions <= p->max_inst);
|
||||||
|
|
||||||
if (p->program->Base.NumInstructions == p->max_inst) {
|
if (p->program->NumInstructions == p->max_inst) {
|
||||||
/* need to extend the program's instruction array */
|
/* need to extend the program's instruction array */
|
||||||
struct prog_instruction *newInst;
|
struct prog_instruction *newInst;
|
||||||
|
|
||||||
|
|
@ -593,19 +593,18 @@ static void emit_op3fn(struct tnl_program *p,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_mesa_copy_instructions(newInst,
|
_mesa_copy_instructions(newInst, p->program->Instructions,
|
||||||
p->program->Base.Instructions,
|
p->program->NumInstructions);
|
||||||
p->program->Base.NumInstructions);
|
|
||||||
|
|
||||||
_mesa_free_instructions(p->program->Base.Instructions,
|
_mesa_free_instructions(p->program->Instructions,
|
||||||
p->program->Base.NumInstructions);
|
p->program->NumInstructions);
|
||||||
|
|
||||||
p->program->Base.Instructions = newInst;
|
p->program->Instructions = newInst;
|
||||||
}
|
}
|
||||||
|
|
||||||
nr = p->program->Base.NumInstructions++;
|
nr = p->program->NumInstructions++;
|
||||||
|
|
||||||
inst = &p->program->Base.Instructions[nr];
|
inst = &p->program->Instructions[nr];
|
||||||
inst->Opcode = (enum prog_opcode) op;
|
inst->Opcode = (enum prog_opcode) op;
|
||||||
|
|
||||||
emit_arg( &inst->SrcReg[0], src0 );
|
emit_arg( &inst->SrcReg[0], src0 );
|
||||||
|
|
@ -1608,7 +1607,7 @@ static void build_tnl_program( struct tnl_program *p )
|
||||||
|
|
||||||
static void
|
static void
|
||||||
create_new_program( const struct state_key *key,
|
create_new_program( const struct state_key *key,
|
||||||
struct gl_vertex_program *program,
|
struct gl_program *program,
|
||||||
GLboolean mvp_with_dp4,
|
GLboolean mvp_with_dp4,
|
||||||
GLuint max_temps)
|
GLuint max_temps)
|
||||||
{
|
{
|
||||||
|
|
@ -1634,15 +1633,15 @@ create_new_program( const struct state_key *key,
|
||||||
* If we need more, we'll grow the instruction array as needed.
|
* If we need more, we'll grow the instruction array as needed.
|
||||||
*/
|
*/
|
||||||
p.max_inst = 32;
|
p.max_inst = 32;
|
||||||
p.program->Base.Instructions = _mesa_alloc_instructions(p.max_inst);
|
p.program->Instructions = _mesa_alloc_instructions(p.max_inst);
|
||||||
p.program->Base.String = NULL;
|
p.program->String = NULL;
|
||||||
p.program->Base.NumInstructions =
|
p.program->NumInstructions =
|
||||||
p.program->Base.NumTemporaries =
|
p.program->NumTemporaries =
|
||||||
p.program->Base.NumParameters =
|
p.program->NumParameters =
|
||||||
p.program->Base.NumAttributes = p.program->Base.NumAddressRegs = 0;
|
p.program->NumAttributes = p.program->NumAddressRegs = 0;
|
||||||
p.program->Base.Parameters = _mesa_new_parameter_list();
|
p.program->Parameters = _mesa_new_parameter_list();
|
||||||
p.program->Base.InputsRead = 0;
|
p.program->InputsRead = 0;
|
||||||
p.program->Base.OutputsWritten = 0;
|
p.program->OutputsWritten = 0;
|
||||||
|
|
||||||
build_tnl_program( &p );
|
build_tnl_program( &p );
|
||||||
}
|
}
|
||||||
|
|
@ -1652,10 +1651,10 @@ create_new_program( const struct state_key *key,
|
||||||
* Return a vertex program which implements the current fixed-function
|
* Return a vertex program which implements the current fixed-function
|
||||||
* transform/lighting/texgen operations.
|
* transform/lighting/texgen operations.
|
||||||
*/
|
*/
|
||||||
struct gl_vertex_program *
|
struct gl_program *
|
||||||
_mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
|
_mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
struct gl_vertex_program *prog;
|
struct gl_program *prog;
|
||||||
struct state_key key;
|
struct state_key key;
|
||||||
|
|
||||||
/* Grab all the relevant state and put it in a single structure:
|
/* Grab all the relevant state and put it in a single structure:
|
||||||
|
|
@ -1664,15 +1663,15 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
|
||||||
|
|
||||||
/* Look for an already-prepared program for this state:
|
/* Look for an already-prepared program for this state:
|
||||||
*/
|
*/
|
||||||
prog = gl_vertex_program(
|
prog = _mesa_search_program_cache(ctx->VertexProgram.Cache, &key,
|
||||||
_mesa_search_program_cache(ctx->VertexProgram.Cache, &key, sizeof(key)));
|
sizeof(key));
|
||||||
|
|
||||||
if (!prog) {
|
if (!prog) {
|
||||||
/* OK, we'll have to build a new one */
|
/* OK, we'll have to build a new one */
|
||||||
if (0)
|
if (0)
|
||||||
printf("Build new TNL program\n");
|
printf("Build new TNL program\n");
|
||||||
|
|
||||||
prog = gl_vertex_program(ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0));
|
prog = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
|
||||||
if (!prog)
|
if (!prog)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
@ -1681,11 +1680,10 @@ _mesa_get_fixed_func_vertex_program(struct gl_context *ctx)
|
||||||
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps );
|
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps );
|
||||||
|
|
||||||
if (ctx->Driver.ProgramStringNotify)
|
if (ctx->Driver.ProgramStringNotify)
|
||||||
ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
|
ctx->Driver.ProgramStringNotify(ctx, GL_VERTEX_PROGRAM_ARB, prog);
|
||||||
&prog->Base );
|
|
||||||
|
|
||||||
_mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache,
|
_mesa_program_cache_insert(ctx, ctx->VertexProgram.Cache, &key,
|
||||||
&key, sizeof(key), &prog->Base);
|
sizeof(key), prog);
|
||||||
}
|
}
|
||||||
|
|
||||||
return prog;
|
return prog;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
struct gl_context;
|
struct gl_context;
|
||||||
|
|
||||||
struct gl_vertex_program *
|
struct gl_program *
|
||||||
_mesa_get_fixed_func_vertex_program(struct gl_context *ctx);
|
_mesa_get_fixed_func_vertex_program(struct gl_context *ctx);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1987,13 +1987,10 @@ struct gl_program
|
||||||
GLuint NumNativeTexInstructions;
|
GLuint NumNativeTexInstructions;
|
||||||
GLuint NumNativeTexIndirections;
|
GLuint NumNativeTexIndirections;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
};
|
|
||||||
|
|
||||||
|
/** Used by ARB assembly-style programs. Can only be true for vertex
|
||||||
/** Vertex program object */
|
* programs.
|
||||||
struct gl_vertex_program
|
*/
|
||||||
{
|
|
||||||
struct gl_program Base; /**< base class */
|
|
||||||
GLboolean IsPositionInvariant;
|
GLboolean IsPositionInvariant;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2066,13 +2063,13 @@ struct gl_vertex_program_state
|
||||||
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
|
GLboolean TwoSideEnabled; /**< GL_VERTEX_PROGRAM_TWO_SIDE_ARB/NV */
|
||||||
/** Computed two sided lighting for fixed function/programs. */
|
/** Computed two sided lighting for fixed function/programs. */
|
||||||
GLboolean _TwoSideEnabled;
|
GLboolean _TwoSideEnabled;
|
||||||
struct gl_vertex_program *Current; /**< User-bound vertex program */
|
struct gl_program *Current; /**< User-bound vertex program */
|
||||||
|
|
||||||
/** Currently enabled and valid vertex program (including internal
|
/** Currently enabled and valid vertex program (including internal
|
||||||
* programs, user-defined vertex programs and GLSL vertex shaders).
|
* programs, user-defined vertex programs and GLSL vertex shaders).
|
||||||
* This is the program we must use when rendering.
|
* This is the program we must use when rendering.
|
||||||
*/
|
*/
|
||||||
struct gl_vertex_program *_Current;
|
struct gl_program *_Current;
|
||||||
|
|
||||||
GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
|
GLfloat Parameters[MAX_PROGRAM_ENV_PARAMS][4]; /**< Env params */
|
||||||
|
|
||||||
|
|
@ -2080,7 +2077,7 @@ struct gl_vertex_program_state
|
||||||
GLboolean _MaintainTnlProgram;
|
GLboolean _MaintainTnlProgram;
|
||||||
|
|
||||||
/** Program to emulate fixed-function T&L (see above) */
|
/** Program to emulate fixed-function T&L (see above) */
|
||||||
struct gl_vertex_program *_TnlProgram;
|
struct gl_program *_TnlProgram;
|
||||||
|
|
||||||
/** Cache of fixed-function programs */
|
/** Cache of fixed-function programs */
|
||||||
struct gl_program_cache *Cache;
|
struct gl_program_cache *Cache;
|
||||||
|
|
@ -2775,7 +2772,7 @@ struct gl_shader_program
|
||||||
/** Vertex shader state */
|
/** Vertex shader state */
|
||||||
struct {
|
struct {
|
||||||
/**
|
/**
|
||||||
* True if gl_ClipDistance is written to. Copied into gl_vertex_program
|
* True if gl_ClipDistance is written to. Copied into gl_program
|
||||||
* by _mesa_copy_linked_program_data().
|
* by _mesa_copy_linked_program_data().
|
||||||
*/
|
*/
|
||||||
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
|
GLuint ClipDistanceArraySize; /**< Size of the gl_ClipDistance array, or
|
||||||
|
|
@ -3095,7 +3092,7 @@ struct gl_shared_state
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */
|
struct _mesa_HashTable *Programs; /**< All vertex/fragment programs */
|
||||||
struct gl_vertex_program *DefaultVertexProgram;
|
struct gl_program *DefaultVertexProgram;
|
||||||
struct gl_fragment_program *DefaultFragmentProgram;
|
struct gl_fragment_program *DefaultFragmentProgram;
|
||||||
/*@}*/
|
/*@}*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
|
||||||
shared->Programs = _mesa_NewHashTable();
|
shared->Programs = _mesa_NewHashTable();
|
||||||
|
|
||||||
shared->DefaultVertexProgram =
|
shared->DefaultVertexProgram =
|
||||||
gl_vertex_program(ctx->Driver.NewProgram(ctx,
|
ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0);
|
||||||
GL_VERTEX_PROGRAM_ARB, 0));
|
|
||||||
shared->DefaultFragmentProgram =
|
shared->DefaultFragmentProgram =
|
||||||
gl_fragment_program(ctx->Driver.NewProgram(ctx,
|
gl_fragment_program(ctx->Driver.NewProgram(ctx,
|
||||||
GL_FRAGMENT_PROGRAM_ARB, 0));
|
GL_FRAGMENT_PROGRAM_ARB, 0));
|
||||||
|
|
@ -332,7 +331,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared)
|
||||||
_mesa_HashDeleteAll(shared->Programs, delete_program_cb, ctx);
|
_mesa_HashDeleteAll(shared->Programs, delete_program_cb, ctx);
|
||||||
_mesa_DeleteHashTable(shared->Programs);
|
_mesa_DeleteHashTable(shared->Programs);
|
||||||
|
|
||||||
_mesa_reference_vertprog(ctx, &shared->DefaultVertexProgram, NULL);
|
_mesa_reference_program(ctx, &shared->DefaultVertexProgram, NULL);
|
||||||
_mesa_reference_fragprog(ctx, &shared->DefaultFragmentProgram, NULL);
|
_mesa_reference_fragprog(ctx, &shared->DefaultFragmentProgram, NULL);
|
||||||
|
|
||||||
_mesa_HashDeleteAll(shared->ATIShaders, delete_fragshader_cb, ctx);
|
_mesa_HashDeleteAll(shared->ATIShaders, delete_fragshader_cb, ctx);
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ update_program_enables(struct gl_context *ctx)
|
||||||
* GLSL shaders not relevant here.
|
* GLSL shaders not relevant here.
|
||||||
*/
|
*/
|
||||||
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
|
ctx->VertexProgram._Enabled = ctx->VertexProgram.Enabled
|
||||||
&& ctx->VertexProgram.Current->Base.Instructions;
|
&& ctx->VertexProgram.Current->Instructions;
|
||||||
ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
|
ctx->FragmentProgram._Enabled = ctx->FragmentProgram.Enabled
|
||||||
&& ctx->FragmentProgram.Current->Base.Instructions;
|
&& ctx->FragmentProgram.Current->Base.Instructions;
|
||||||
ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
|
ctx->ATIFragmentShader._Enabled = ctx->ATIFragmentShader.Enabled
|
||||||
|
|
@ -107,7 +107,7 @@ update_program(struct gl_context *ctx)
|
||||||
ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
|
ctx->_Shader->CurrentProgram[MESA_SHADER_FRAGMENT];
|
||||||
const struct gl_shader_program *csProg =
|
const struct gl_shader_program *csProg =
|
||||||
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
|
ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
|
||||||
const struct gl_vertex_program *prevVP = ctx->VertexProgram._Current;
|
const struct gl_program *prevVP = ctx->VertexProgram._Current;
|
||||||
const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
|
const struct gl_fragment_program *prevFP = ctx->FragmentProgram._Current;
|
||||||
const struct gl_program *prevGP = ctx->GeometryProgram._Current;
|
const struct gl_program *prevGP = ctx->GeometryProgram._Current;
|
||||||
const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
|
const struct gl_program *prevTCP = ctx->TessCtrlProgram._Current;
|
||||||
|
|
@ -222,24 +222,24 @@ update_program(struct gl_context *ctx)
|
||||||
if (vsProg && vsProg->LinkStatus
|
if (vsProg && vsProg->LinkStatus
|
||||||
&& vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
|
&& vsProg->_LinkedShaders[MESA_SHADER_VERTEX]) {
|
||||||
/* Use GLSL vertex shader */
|
/* Use GLSL vertex shader */
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
|
_mesa_reference_program(ctx, &ctx->VertexProgram._Current,
|
||||||
gl_vertex_program(vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program));
|
vsProg->_LinkedShaders[MESA_SHADER_VERTEX]->Program);
|
||||||
}
|
}
|
||||||
else if (ctx->VertexProgram._Enabled) {
|
else if (ctx->VertexProgram._Enabled) {
|
||||||
/* Use user-defined vertex program */
|
/* Use user-defined vertex program */
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
|
_mesa_reference_program(ctx, &ctx->VertexProgram._Current,
|
||||||
ctx->VertexProgram.Current);
|
ctx->VertexProgram.Current);
|
||||||
}
|
}
|
||||||
else if (ctx->VertexProgram._MaintainTnlProgram) {
|
else if (ctx->VertexProgram._MaintainTnlProgram) {
|
||||||
/* Use vertex program generated from fixed-function state */
|
/* Use vertex program generated from fixed-function state */
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current,
|
_mesa_reference_program(ctx, &ctx->VertexProgram._Current,
|
||||||
_mesa_get_fixed_func_vertex_program(ctx));
|
_mesa_get_fixed_func_vertex_program(ctx));
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram,
|
_mesa_reference_program(ctx, &ctx->VertexProgram._TnlProgram,
|
||||||
ctx->VertexProgram._Current);
|
ctx->VertexProgram._Current);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* no vertex program */
|
/* no vertex program */
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram._Current, NULL);
|
_mesa_reference_program(ctx, &ctx->VertexProgram._Current, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csProg && csProg->LinkStatus
|
if (csProg && csProg->LinkStatus
|
||||||
|
|
@ -290,7 +290,7 @@ update_program(struct gl_context *ctx)
|
||||||
new_state |= _NEW_PROGRAM;
|
new_state |= _NEW_PROGRAM;
|
||||||
if (ctx->Driver.BindProgram) {
|
if (ctx->Driver.BindProgram) {
|
||||||
ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
|
ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
|
||||||
(struct gl_program *) ctx->VertexProgram._Current);
|
ctx->VertexProgram._Current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -328,7 +328,7 @@ update_program_constants(struct gl_context *ctx)
|
||||||
|
|
||||||
if (ctx->VertexProgram._Current) {
|
if (ctx->VertexProgram._Current) {
|
||||||
const struct gl_program_parameter_list *params =
|
const struct gl_program_parameter_list *params =
|
||||||
ctx->VertexProgram._Current->Base.Parameters;
|
ctx->VertexProgram._Current->Parameters;
|
||||||
if (params && params->StateFlags & ctx->NewState) {
|
if (params && params->StateFlags & ctx->NewState) {
|
||||||
new_state |= _NEW_PROGRAM_CONSTANTS;
|
new_state |= _NEW_PROGRAM_CONSTANTS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ _mesa_need_secondary_color(const struct gl_context *ctx)
|
||||||
|
|
||||||
if (ctx->VertexProgram._Current &&
|
if (ctx->VertexProgram._Current &&
|
||||||
(ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) &&
|
(ctx->VertexProgram._Current != ctx->VertexProgram._TnlProgram) &&
|
||||||
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_COLOR1))
|
(ctx->VertexProgram._Current->InputsRead & VERT_BIT_COLOR1))
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
|
||||||
if (ctx->FragmentProgram._Current &&
|
if (ctx->FragmentProgram._Current &&
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target,
|
||||||
void
|
void
|
||||||
_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
|
_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
|
||||||
const GLvoid *str, GLsizei len,
|
const GLvoid *str, GLsizei len,
|
||||||
struct gl_vertex_program *program)
|
struct gl_program *program)
|
||||||
{
|
{
|
||||||
struct gl_program prog;
|
struct gl_program prog;
|
||||||
struct asm_parser_state state;
|
struct asm_parser_state state;
|
||||||
|
|
@ -180,37 +180,37 @@ _mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
|
||||||
if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
|
if ((ctx->_Shader->Flags & GLSL_NO_OPT) == 0)
|
||||||
_mesa_optimize_program(ctx, &prog);
|
_mesa_optimize_program(ctx, &prog);
|
||||||
|
|
||||||
free(program->Base.String);
|
free(program->String);
|
||||||
|
|
||||||
/* Copy the relevant contents of the arb_program struct into the
|
/* Copy the relevant contents of the arb_program struct into the
|
||||||
* vertex_program struct.
|
* vertex_program struct.
|
||||||
*/
|
*/
|
||||||
program->Base.String = prog.String;
|
program->String = prog.String;
|
||||||
program->Base.NumInstructions = prog.NumInstructions;
|
program->NumInstructions = prog.NumInstructions;
|
||||||
program->Base.NumTemporaries = prog.NumTemporaries;
|
program->NumTemporaries = prog.NumTemporaries;
|
||||||
program->Base.NumParameters = prog.NumParameters;
|
program->NumParameters = prog.NumParameters;
|
||||||
program->Base.NumAttributes = prog.NumAttributes;
|
program->NumAttributes = prog.NumAttributes;
|
||||||
program->Base.NumAddressRegs = prog.NumAddressRegs;
|
program->NumAddressRegs = prog.NumAddressRegs;
|
||||||
program->Base.NumNativeInstructions = prog.NumNativeInstructions;
|
program->NumNativeInstructions = prog.NumNativeInstructions;
|
||||||
program->Base.NumNativeTemporaries = prog.NumNativeTemporaries;
|
program->NumNativeTemporaries = prog.NumNativeTemporaries;
|
||||||
program->Base.NumNativeParameters = prog.NumNativeParameters;
|
program->NumNativeParameters = prog.NumNativeParameters;
|
||||||
program->Base.NumNativeAttributes = prog.NumNativeAttributes;
|
program->NumNativeAttributes = prog.NumNativeAttributes;
|
||||||
program->Base.NumNativeAddressRegs = prog.NumNativeAddressRegs;
|
program->NumNativeAddressRegs = prog.NumNativeAddressRegs;
|
||||||
program->Base.InputsRead = prog.InputsRead;
|
program->InputsRead = prog.InputsRead;
|
||||||
program->Base.OutputsWritten = prog.OutputsWritten;
|
program->OutputsWritten = prog.OutputsWritten;
|
||||||
program->Base.IndirectRegisterFiles = prog.IndirectRegisterFiles;
|
program->IndirectRegisterFiles = prog.IndirectRegisterFiles;
|
||||||
program->IsPositionInvariant = (state.option.PositionInvariant)
|
program->IsPositionInvariant = (state.option.PositionInvariant)
|
||||||
? GL_TRUE : GL_FALSE;
|
? GL_TRUE : GL_FALSE;
|
||||||
|
|
||||||
free(program->Base.Instructions);
|
free(program->Instructions);
|
||||||
program->Base.Instructions = prog.Instructions;
|
program->Instructions = prog.Instructions;
|
||||||
|
|
||||||
if (program->Base.Parameters)
|
if (program->Parameters)
|
||||||
_mesa_free_parameter_list(program->Base.Parameters);
|
_mesa_free_parameter_list(program->Parameters);
|
||||||
program->Base.Parameters = prog.Parameters;
|
program->Parameters = prog.Parameters;
|
||||||
|
|
||||||
#if DEBUG_VP
|
#if DEBUG_VP
|
||||||
printf("____________Vertex program %u __________\n", program->Base.Id);
|
printf("____________Vertex program %u __________\n", program->Id);
|
||||||
_mesa_print_program(&program->Base);
|
_mesa_print_program(program);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ struct gl_vertex_program;
|
||||||
extern void
|
extern void
|
||||||
_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
|
_mesa_parse_arb_vertex_program(struct gl_context *ctx, GLenum target,
|
||||||
const GLvoid *str, GLsizei len,
|
const GLvoid *str, GLsizei len,
|
||||||
struct gl_vertex_program *program);
|
struct gl_program *program);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target,
|
_mesa_parse_arb_fragment_program(struct gl_context *ctx, GLenum target,
|
||||||
|
|
|
||||||
|
|
@ -399,14 +399,14 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[],
|
||||||
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
|
COPY_4V(value, ctx->VertexProgram.Parameters[idx]);
|
||||||
return;
|
return;
|
||||||
case STATE_LOCAL:
|
case STATE_LOCAL:
|
||||||
if (!ctx->VertexProgram.Current->Base.LocalParams) {
|
if (!ctx->VertexProgram.Current->LocalParams) {
|
||||||
ctx->VertexProgram.Current->Base.LocalParams =
|
ctx->VertexProgram.Current->LocalParams =
|
||||||
calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
|
calloc(MAX_PROGRAM_LOCAL_PARAMS, sizeof(float[4]));
|
||||||
if (!ctx->VertexProgram.Current->Base.LocalParams)
|
if (!ctx->VertexProgram.Current->LocalParams)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
COPY_4V(value, ctx->VertexProgram.Current->Base.LocalParams[idx]);
|
COPY_4V(value, ctx->VertexProgram.Current->LocalParams[idx]);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
|
_mesa_problem(ctx, "Bad state switch in _mesa_fetch_state()");
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,8 @@ _mesa_init_program(struct gl_context *ctx)
|
||||||
ctx->VertexProgram.PointSizeEnabled =
|
ctx->VertexProgram.PointSizeEnabled =
|
||||||
(ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
|
(ctx->API == API_OPENGLES2) ? GL_TRUE : GL_FALSE;
|
||||||
ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
|
ctx->VertexProgram.TwoSideEnabled = GL_FALSE;
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
|
_mesa_reference_program(ctx, &ctx->VertexProgram.Current,
|
||||||
ctx->Shared->DefaultVertexProgram);
|
ctx->Shared->DefaultVertexProgram);
|
||||||
assert(ctx->VertexProgram.Current);
|
assert(ctx->VertexProgram.Current);
|
||||||
ctx->VertexProgram.Cache = _mesa_new_program_cache();
|
ctx->VertexProgram.Cache = _mesa_new_program_cache();
|
||||||
|
|
||||||
|
|
@ -112,7 +112,7 @@ _mesa_init_program(struct gl_context *ctx)
|
||||||
void
|
void
|
||||||
_mesa_free_program_data(struct gl_context *ctx)
|
_mesa_free_program_data(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, NULL);
|
_mesa_reference_program(ctx, &ctx->VertexProgram.Current, NULL);
|
||||||
_mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
|
_mesa_delete_program_cache(ctx, ctx->VertexProgram.Cache);
|
||||||
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
|
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, NULL);
|
||||||
_mesa_delete_shader_cache(ctx, ctx->FragmentProgram.Cache);
|
_mesa_delete_shader_cache(ctx, ctx->FragmentProgram.Cache);
|
||||||
|
|
@ -137,8 +137,8 @@ _mesa_free_program_data(struct gl_context *ctx)
|
||||||
void
|
void
|
||||||
_mesa_update_default_objects_program(struct gl_context *ctx)
|
_mesa_update_default_objects_program(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
_mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current,
|
_mesa_reference_program(ctx, &ctx->VertexProgram.Current,
|
||||||
ctx->Shared->DefaultVertexProgram);
|
ctx->Shared->DefaultVertexProgram);
|
||||||
assert(ctx->VertexProgram.Current);
|
assert(ctx->VertexProgram.Current);
|
||||||
|
|
||||||
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
|
_mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current,
|
||||||
|
|
@ -215,14 +215,11 @@ struct gl_program *
|
||||||
_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
|
_mesa_new_program(struct gl_context *ctx, GLenum target, GLuint id)
|
||||||
{
|
{
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case GL_VERTEX_PROGRAM_ARB: { /* == GL_VERTEX_PROGRAM_NV */
|
|
||||||
struct gl_vertex_program *prog = CALLOC_STRUCT(gl_vertex_program);
|
|
||||||
return _mesa_init_gl_program(&prog->Base, target, id);
|
|
||||||
}
|
|
||||||
case GL_FRAGMENT_PROGRAM_ARB: {
|
case GL_FRAGMENT_PROGRAM_ARB: {
|
||||||
struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
|
struct gl_fragment_program *prog = CALLOC_STRUCT(gl_fragment_program);
|
||||||
return _mesa_init_gl_program(&prog->Base, target, id);
|
return _mesa_init_gl_program(&prog->Base, target, id);
|
||||||
}
|
}
|
||||||
|
case GL_VERTEX_PROGRAM_ARB: /* == GL_VERTEX_PROGRAM_NV */
|
||||||
case GL_GEOMETRY_PROGRAM_NV:
|
case GL_GEOMETRY_PROGRAM_NV:
|
||||||
case GL_TESS_CONTROL_PROGRAM_NV:
|
case GL_TESS_CONTROL_PROGRAM_NV:
|
||||||
case GL_TESS_EVALUATION_PROGRAM_NV: {
|
case GL_TESS_EVALUATION_PROGRAM_NV: {
|
||||||
|
|
|
||||||
|
|
@ -89,15 +89,6 @@ _mesa_reference_program(struct gl_context *ctx,
|
||||||
_mesa_reference_program_(ctx, ptr, prog);
|
_mesa_reference_program_(ctx, ptr, prog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
_mesa_reference_vertprog(struct gl_context *ctx,
|
|
||||||
struct gl_vertex_program **ptr,
|
|
||||||
struct gl_vertex_program *prog)
|
|
||||||
{
|
|
||||||
_mesa_reference_program(ctx, (struct gl_program **) ptr,
|
|
||||||
(struct gl_program *) prog);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
_mesa_reference_fragprog(struct gl_context *ctx,
|
_mesa_reference_fragprog(struct gl_context *ctx,
|
||||||
struct gl_fragment_program **ptr,
|
struct gl_fragment_program **ptr,
|
||||||
|
|
@ -184,10 +175,6 @@ _mesa_shader_stage_to_program(unsigned stage)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Cast wrappers from gl_program to derived program types.
|
|
||||||
* (e.g. gl_vertex_program)
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline struct gl_fragment_program *
|
static inline struct gl_fragment_program *
|
||||||
gl_fragment_program(struct gl_program *prog)
|
gl_fragment_program(struct gl_program *prog)
|
||||||
{
|
{
|
||||||
|
|
@ -200,19 +187,6 @@ gl_fragment_program_const(const struct gl_program *prog)
|
||||||
return (const struct gl_fragment_program *) prog;
|
return (const struct gl_fragment_program *) prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline struct gl_vertex_program *
|
|
||||||
gl_vertex_program(struct gl_program *prog)
|
|
||||||
{
|
|
||||||
return (struct gl_vertex_program *) prog;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline const struct gl_vertex_program *
|
|
||||||
gl_vertex_program_const(const struct gl_program *prog)
|
|
||||||
{
|
|
||||||
return (const struct gl_vertex_program *) prog;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct gl_compute_program *
|
static inline struct gl_compute_program *
|
||||||
gl_compute_program(struct gl_program *prog)
|
gl_compute_program(struct gl_program *prog)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -46,10 +46,10 @@
|
||||||
* May be used to implement the position_invariant option.
|
* May be used to implement the position_invariant option.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
|
_mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_program *vprog)
|
||||||
{
|
{
|
||||||
struct prog_instruction *newInst;
|
struct prog_instruction *newInst;
|
||||||
const GLuint origLen = vprog->Base.NumInstructions;
|
const GLuint origLen = vprog->NumInstructions;
|
||||||
const GLuint newLen = origLen + 4;
|
const GLuint newLen = origLen + 4;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
|
|
@ -66,8 +66,7 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro
|
||||||
GLint mvpRef[4];
|
GLint mvpRef[4];
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
|
mvpRef[i] = _mesa_add_state_reference(vprog->Parameters, mvpState[i]);
|
||||||
mvpState[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alloc storage for new instructions */
|
/* Alloc storage for new instructions */
|
||||||
|
|
@ -100,24 +99,24 @@ _mesa_insert_mvp_dp4_code(struct gl_context *ctx, struct gl_vertex_program *vpro
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Append original instructions after new instructions */
|
/* Append original instructions after new instructions */
|
||||||
_mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
|
_mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
|
||||||
|
|
||||||
/* free old instructions */
|
/* free old instructions */
|
||||||
_mesa_free_instructions(vprog->Base.Instructions, origLen);
|
_mesa_free_instructions(vprog->Instructions, origLen);
|
||||||
|
|
||||||
/* install new instructions */
|
/* install new instructions */
|
||||||
vprog->Base.Instructions = newInst;
|
vprog->Instructions = newInst;
|
||||||
vprog->Base.NumInstructions = newLen;
|
vprog->NumInstructions = newLen;
|
||||||
vprog->Base.InputsRead |= VERT_BIT_POS;
|
vprog->InputsRead |= VERT_BIT_POS;
|
||||||
vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
|
vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
|
_mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_program *vprog)
|
||||||
{
|
{
|
||||||
struct prog_instruction *newInst;
|
struct prog_instruction *newInst;
|
||||||
const GLuint origLen = vprog->Base.NumInstructions;
|
const GLuint origLen = vprog->NumInstructions;
|
||||||
const GLuint newLen = origLen + 4;
|
const GLuint newLen = origLen + 4;
|
||||||
GLuint hposTemp;
|
GLuint hposTemp;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
@ -135,8 +134,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
|
||||||
GLint mvpRef[4];
|
GLint mvpRef[4];
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
for (i = 0; i < 4; i++) {
|
||||||
mvpRef[i] = _mesa_add_state_reference(vprog->Base.Parameters,
|
mvpRef[i] = _mesa_add_state_reference(vprog->Parameters, mvpState[i]);
|
||||||
mvpState[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Alloc storage for new instructions */
|
/* Alloc storage for new instructions */
|
||||||
|
|
@ -148,7 +146,7 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TEMP hposTemp; */
|
/* TEMP hposTemp; */
|
||||||
hposTemp = vprog->Base.NumTemporaries++;
|
hposTemp = vprog->NumTemporaries++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generated instructions:
|
* Generated instructions:
|
||||||
|
|
@ -202,21 +200,21 @@ _mesa_insert_mvp_mad_code(struct gl_context *ctx, struct gl_vertex_program *vpro
|
||||||
|
|
||||||
|
|
||||||
/* Append original instructions after new instructions */
|
/* Append original instructions after new instructions */
|
||||||
_mesa_copy_instructions (newInst + 4, vprog->Base.Instructions, origLen);
|
_mesa_copy_instructions (newInst + 4, vprog->Instructions, origLen);
|
||||||
|
|
||||||
/* free old instructions */
|
/* free old instructions */
|
||||||
_mesa_free_instructions(vprog->Base.Instructions, origLen);
|
_mesa_free_instructions(vprog->Instructions, origLen);
|
||||||
|
|
||||||
/* install new instructions */
|
/* install new instructions */
|
||||||
vprog->Base.Instructions = newInst;
|
vprog->Instructions = newInst;
|
||||||
vprog->Base.NumInstructions = newLen;
|
vprog->NumInstructions = newLen;
|
||||||
vprog->Base.InputsRead |= VERT_BIT_POS;
|
vprog->InputsRead |= VERT_BIT_POS;
|
||||||
vprog->Base.OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
|
vprog->OutputsWritten |= BITFIELD64_BIT(VARYING_SLOT_POS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog)
|
_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog)
|
||||||
{
|
{
|
||||||
if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS)
|
if (ctx->Const.ShaderCompilerOptions[MESA_SHADER_VERTEX].OptimizeForAOS)
|
||||||
_mesa_insert_mvp_dp4_code( ctx, vprog );
|
_mesa_insert_mvp_dp4_code( ctx, vprog );
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ extern "C" {
|
||||||
|
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_vertex_program *vprog);
|
_mesa_insert_mvp_code(struct gl_context *ctx, struct gl_program *vprog);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_mesa_append_fog_code(struct gl_context *ctx,
|
_mesa_append_fog_code(struct gl_context *ctx,
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ static void check_program_state( struct st_context *st )
|
||||||
struct st_geometry_program *old_gp = st->gp;
|
struct st_geometry_program *old_gp = st->gp;
|
||||||
struct st_fragment_program *old_fp = st->fp;
|
struct st_fragment_program *old_fp = st->fp;
|
||||||
|
|
||||||
struct gl_vertex_program *new_vp = ctx->VertexProgram._Current;
|
struct gl_program *new_vp = ctx->VertexProgram._Current;
|
||||||
struct gl_program *new_tcp = ctx->TessCtrlProgram._Current;
|
struct gl_program *new_tcp = ctx->TessCtrlProgram._Current;
|
||||||
struct gl_program *new_tep = ctx->TessEvalProgram._Current;
|
struct gl_program *new_tep = ctx->TessEvalProgram._Current;
|
||||||
struct gl_program *new_gp = ctx->GeometryProgram._Current;
|
struct gl_program *new_gp = ctx->GeometryProgram._Current;
|
||||||
|
|
@ -122,7 +122,7 @@ static void check_attrib_edgeflag(struct st_context *st)
|
||||||
{
|
{
|
||||||
const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
|
const struct gl_client_array **arrays = st->ctx->Array._DrawArrays;
|
||||||
GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
|
GLboolean vertdata_edgeflags, edgeflag_culls_prims, edgeflags_enabled;
|
||||||
struct gl_vertex_program *vp = st->ctx->VertexProgram._Current;
|
struct gl_program *vp = st->ctx->VertexProgram._Current;
|
||||||
|
|
||||||
if (!arrays)
|
if (!arrays)
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ void st_upload_constants( struct st_context *st,
|
||||||
static void update_vs_constants(struct st_context *st )
|
static void update_vs_constants(struct st_context *st )
|
||||||
{
|
{
|
||||||
struct st_vertex_program *vp = st->vp;
|
struct st_vertex_program *vp = st->vp;
|
||||||
struct gl_program_parameter_list *params = vp->Base.Base.Parameters;
|
struct gl_program_parameter_list *params = vp->Base.Parameters;
|
||||||
|
|
||||||
st_upload_constants( st, params, MESA_SHADER_VERTEX );
|
st_upload_constants( st, params, MESA_SHADER_VERTEX );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ static void update_raster_state( struct st_context *st )
|
||||||
{
|
{
|
||||||
struct gl_context *ctx = st->ctx;
|
struct gl_context *ctx = st->ctx;
|
||||||
struct pipe_rasterizer_state *raster = &st->state.rasterizer;
|
struct pipe_rasterizer_state *raster = &st->state.rasterizer;
|
||||||
const struct gl_vertex_program *vertProg = ctx->VertexProgram._Current;
|
const struct gl_program *vertProg = ctx->VertexProgram._Current;
|
||||||
const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current;
|
const struct gl_fragment_program *fragProg = ctx->FragmentProgram._Current;
|
||||||
|
|
||||||
memset(raster, 0, sizeof(*raster));
|
memset(raster, 0, sizeof(*raster));
|
||||||
|
|
@ -194,8 +194,8 @@ static void update_raster_state( struct st_context *st )
|
||||||
/* ST_NEW_VERTEX_PROGRAM
|
/* ST_NEW_VERTEX_PROGRAM
|
||||||
*/
|
*/
|
||||||
if (vertProg) {
|
if (vertProg) {
|
||||||
if (vertProg->Base.Id == 0) {
|
if (vertProg->Id == 0) {
|
||||||
if (vertProg->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
|
if (vertProg->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ)) {
|
||||||
/* generated program which emits point size */
|
/* generated program which emits point size */
|
||||||
raster->point_size_per_vertex = TRUE;
|
raster->point_size_per_vertex = TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -213,7 +213,7 @@ static void update_raster_state( struct st_context *st )
|
||||||
else if (ctx->TessEvalProgram._Current)
|
else if (ctx->TessEvalProgram._Current)
|
||||||
last = ctx->TessEvalProgram._Current;
|
last = ctx->TessEvalProgram._Current;
|
||||||
else if (ctx->VertexProgram._Current)
|
else if (ctx->VertexProgram._Current)
|
||||||
last = &ctx->VertexProgram._Current->Base;
|
last = ctx->VertexProgram._Current;
|
||||||
if (last)
|
if (last)
|
||||||
raster->point_size_per_vertex =
|
raster->point_size_per_vertex =
|
||||||
!!(last->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ));
|
!!(last->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_PSIZ));
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,7 @@ update_samplers(struct st_context *st)
|
||||||
|
|
||||||
update_shader_samplers(st,
|
update_shader_samplers(st,
|
||||||
PIPE_SHADER_VERTEX,
|
PIPE_SHADER_VERTEX,
|
||||||
&ctx->VertexProgram._Current->Base,
|
ctx->VertexProgram._Current,
|
||||||
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
|
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
|
||||||
st->state.samplers[PIPE_SHADER_VERTEX],
|
st->state.samplers[PIPE_SHADER_VERTEX],
|
||||||
&st->state.num_samplers[PIPE_SHADER_VERTEX]);
|
&st->state.num_samplers[PIPE_SHADER_VERTEX]);
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ update_vp( struct st_context *st )
|
||||||
*/
|
*/
|
||||||
assert(st->ctx->VertexProgram._Current);
|
assert(st->ctx->VertexProgram._Current);
|
||||||
stvp = st_vertex_program(st->ctx->VertexProgram._Current);
|
stvp = st_vertex_program(st->ctx->VertexProgram._Current);
|
||||||
assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB);
|
assert(stvp->Base.Target == GL_VERTEX_PROGRAM_ARB);
|
||||||
|
|
||||||
memset(&key, 0, sizeof key);
|
memset(&key, 0, sizeof key);
|
||||||
key.st = st->has_shareable_shaders ? NULL : st;
|
key.st = st->has_shareable_shaders ? NULL : st;
|
||||||
|
|
@ -190,7 +190,7 @@ update_vp( struct st_context *st )
|
||||||
|
|
||||||
key.clamp_color = st->clamp_vert_color_in_shader &&
|
key.clamp_color = st->clamp_vert_color_in_shader &&
|
||||||
st->ctx->Light._ClampVertexColor &&
|
st->ctx->Light._ClampVertexColor &&
|
||||||
(stvp->Base.Base.OutputsWritten &
|
(stvp->Base.OutputsWritten &
|
||||||
(VARYING_SLOT_COL0 |
|
(VARYING_SLOT_COL0 |
|
||||||
VARYING_SLOT_COL1 |
|
VARYING_SLOT_COL1 |
|
||||||
VARYING_SLOT_BFC0 |
|
VARYING_SLOT_BFC0 |
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ update_vertex_textures(struct st_context *st)
|
||||||
if (ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits > 0) {
|
if (ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits > 0) {
|
||||||
update_textures(st,
|
update_textures(st,
|
||||||
MESA_SHADER_VERTEX,
|
MESA_SHADER_VERTEX,
|
||||||
&ctx->VertexProgram._Current->Base,
|
ctx->VertexProgram._Current,
|
||||||
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
|
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits,
|
||||||
st->state.sampler_views[PIPE_SHADER_VERTEX],
|
st->state.sampler_views[PIPE_SHADER_VERTEX],
|
||||||
&st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
|
&st->state.num_sampler_views[PIPE_SHADER_VERTEX]);
|
||||||
|
|
|
||||||
|
|
@ -292,7 +292,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
|
||||||
vbo_set_draw_func(ctx, st_feedback_draw_vbo);
|
vbo_set_draw_func(ctx, st_feedback_draw_vbo);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
struct gl_vertex_program *vp = st->ctx->VertexProgram._Current;
|
struct gl_program *vp = st->ctx->VertexProgram._Current;
|
||||||
|
|
||||||
if (!st->feedback_stage)
|
if (!st->feedback_stage)
|
||||||
st->feedback_stage = draw_glfeedback_stage(ctx, draw);
|
st->feedback_stage = draw_glfeedback_stage(ctx, draw);
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ st_new_program(struct gl_context *ctx, GLenum target, GLuint id)
|
||||||
switch (target) {
|
switch (target) {
|
||||||
case GL_VERTEX_PROGRAM_ARB: {
|
case GL_VERTEX_PROGRAM_ARB: {
|
||||||
struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program);
|
struct st_vertex_program *prog = ST_CALLOC_STRUCT(st_vertex_program);
|
||||||
return _mesa_init_gl_program(&prog->Base.Base, target, id);
|
return _mesa_init_gl_program(&prog->Base, target, id);
|
||||||
}
|
}
|
||||||
case GL_FRAGMENT_PROGRAM_ARB: {
|
case GL_FRAGMENT_PROGRAM_ARB: {
|
||||||
struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
|
struct st_fragment_program *prog = ST_CALLOC_STRUCT(st_fragment_program);
|
||||||
|
|
|
||||||
|
|
@ -98,8 +98,8 @@ st_print_current(void)
|
||||||
|
|
||||||
if (st->vp->variants)
|
if (st->vp->variants)
|
||||||
tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
|
tgsi_dump( st->vp->variants[0].tgsi.tokens, 0 );
|
||||||
if (st->vp->Base.Base.Parameters)
|
if (st->vp->Base.Parameters)
|
||||||
_mesa_print_parameter_list(st->vp->Base.Base.Parameters);
|
_mesa_print_parameter_list(st->vp->Base.Parameters);
|
||||||
|
|
||||||
tgsi_dump(st->fp->tgsi.tokens, 0);
|
tgsi_dump(st->fp->tgsi.tokens, 0);
|
||||||
if (st->fp->Base.Base.Parameters)
|
if (st->fp->Base.Base.Parameters)
|
||||||
|
|
|
||||||
|
|
@ -250,11 +250,11 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
* and TGSI generic input indexes, plus input attrib semantic info.
|
* and TGSI generic input indexes, plus input attrib semantic info.
|
||||||
*/
|
*/
|
||||||
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
|
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
|
||||||
if ((stvp->Base.Base.InputsRead & BITFIELD64_BIT(attr)) != 0) {
|
if ((stvp->Base.InputsRead & BITFIELD64_BIT(attr)) != 0) {
|
||||||
input_to_index[attr] = stvp->num_inputs;
|
input_to_index[attr] = stvp->num_inputs;
|
||||||
stvp->index_to_input[stvp->num_inputs] = attr;
|
stvp->index_to_input[stvp->num_inputs] = attr;
|
||||||
stvp->num_inputs++;
|
stvp->num_inputs++;
|
||||||
if ((stvp->Base.Base.DoubleInputsRead & BITFIELD64_BIT(attr)) != 0) {
|
if ((stvp->Base.DoubleInputsRead & BITFIELD64_BIT(attr)) != 0) {
|
||||||
/* add placeholder for second part of a double attribute */
|
/* add placeholder for second part of a double attribute */
|
||||||
stvp->index_to_input[stvp->num_inputs] = ST_DOUBLE_ATTRIB_PLACEHOLDER;
|
stvp->index_to_input[stvp->num_inputs] = ST_DOUBLE_ATTRIB_PLACEHOLDER;
|
||||||
stvp->num_inputs++;
|
stvp->num_inputs++;
|
||||||
|
|
@ -268,7 +268,7 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
/* Compute mapping of vertex program outputs to slots.
|
/* Compute mapping of vertex program outputs to slots.
|
||||||
*/
|
*/
|
||||||
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
|
for (attr = 0; attr < VARYING_SLOT_MAX; attr++) {
|
||||||
if ((stvp->Base.Base.OutputsWritten & BITFIELD64_BIT(attr)) == 0) {
|
if ((stvp->Base.OutputsWritten & BITFIELD64_BIT(attr)) == 0) {
|
||||||
stvp->result_to_output[attr] = ~0;
|
stvp->result_to_output[attr] = ~0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -367,7 +367,7 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
|
|
||||||
/* ARB_vp: */
|
/* ARB_vp: */
|
||||||
if (!stvp->glsl_to_tgsi && !stvp->shader_program) {
|
if (!stvp->glsl_to_tgsi && !stvp->shader_program) {
|
||||||
_mesa_remove_output_reads(&stvp->Base.Base, PROGRAM_OUTPUT);
|
_mesa_remove_output_reads(&stvp->Base, PROGRAM_OUTPUT);
|
||||||
|
|
||||||
/* This determines which states will be updated when the assembly
|
/* This determines which states will be updated when the assembly
|
||||||
* shader is bound.
|
* shader is bound.
|
||||||
|
|
@ -376,15 +376,14 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
ST_NEW_RASTERIZER |
|
ST_NEW_RASTERIZER |
|
||||||
ST_NEW_VERTEX_ARRAYS;
|
ST_NEW_VERTEX_ARRAYS;
|
||||||
|
|
||||||
if (stvp->Base.Base.Parameters->NumParameters)
|
if (stvp->Base.Parameters->NumParameters)
|
||||||
stvp->affected_states |= ST_NEW_VS_CONSTANTS;
|
stvp->affected_states |= ST_NEW_VS_CONSTANTS;
|
||||||
|
|
||||||
/* No samplers are allowed in ARB_vp. */
|
/* No samplers are allowed in ARB_vp. */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stvp->shader_program) {
|
if (stvp->shader_program) {
|
||||||
nir_shader *nir = st_glsl_to_nir(st, &stvp->Base.Base,
|
nir_shader *nir = st_glsl_to_nir(st, &stvp->Base, stvp->shader_program,
|
||||||
stvp->shader_program,
|
|
||||||
MESA_SHADER_VERTEX);
|
MESA_SHADER_VERTEX);
|
||||||
|
|
||||||
stvp->tgsi.type = PIPE_SHADER_IR_NIR;
|
stvp->tgsi.type = PIPE_SHADER_IR_NIR;
|
||||||
|
|
@ -400,16 +399,16 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
if (ureg == NULL)
|
if (ureg == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (stvp->Base.Base.ClipDistanceArraySize)
|
if (stvp->Base.ClipDistanceArraySize)
|
||||||
ureg_property(ureg, TGSI_PROPERTY_NUM_CLIPDIST_ENABLED,
|
ureg_property(ureg, TGSI_PROPERTY_NUM_CLIPDIST_ENABLED,
|
||||||
stvp->Base.Base.ClipDistanceArraySize);
|
stvp->Base.ClipDistanceArraySize);
|
||||||
if (stvp->Base.Base.CullDistanceArraySize)
|
if (stvp->Base.CullDistanceArraySize)
|
||||||
ureg_property(ureg, TGSI_PROPERTY_NUM_CULLDIST_ENABLED,
|
ureg_property(ureg, TGSI_PROPERTY_NUM_CULLDIST_ENABLED,
|
||||||
stvp->Base.Base.CullDistanceArraySize);
|
stvp->Base.CullDistanceArraySize);
|
||||||
|
|
||||||
if (ST_DEBUG & DEBUG_MESA) {
|
if (ST_DEBUG & DEBUG_MESA) {
|
||||||
_mesa_print_program(&stvp->Base.Base);
|
_mesa_print_program(&stvp->Base);
|
||||||
_mesa_print_program_parameters(st->ctx, &stvp->Base.Base);
|
_mesa_print_program_parameters(st->ctx, &stvp->Base);
|
||||||
debug_printf("\n");
|
debug_printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -418,7 +417,7 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
PIPE_SHADER_VERTEX,
|
PIPE_SHADER_VERTEX,
|
||||||
ureg,
|
ureg,
|
||||||
stvp->glsl_to_tgsi,
|
stvp->glsl_to_tgsi,
|
||||||
&stvp->Base.Base,
|
&stvp->Base,
|
||||||
/* inputs */
|
/* inputs */
|
||||||
stvp->num_inputs,
|
stvp->num_inputs,
|
||||||
input_to_index,
|
input_to_index,
|
||||||
|
|
@ -444,7 +443,7 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
error = st_translate_mesa_program(st->ctx,
|
error = st_translate_mesa_program(st->ctx,
|
||||||
PIPE_SHADER_VERTEX,
|
PIPE_SHADER_VERTEX,
|
||||||
ureg,
|
ureg,
|
||||||
&stvp->Base.Base,
|
&stvp->Base,
|
||||||
/* inputs */
|
/* inputs */
|
||||||
stvp->num_inputs,
|
stvp->num_inputs,
|
||||||
input_to_index,
|
input_to_index,
|
||||||
|
|
@ -459,7 +458,7 @@ st_translate_vertex_program(struct st_context *st,
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
debug_printf("%s: failed to translate Mesa program:\n", __func__);
|
debug_printf("%s: failed to translate Mesa program:\n", __func__);
|
||||||
_mesa_print_program(&stvp->Base.Base);
|
_mesa_print_program(&stvp->Base);
|
||||||
debug_assert(0);
|
debug_assert(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -489,7 +488,7 @@ st_create_vp_variant(struct st_context *st,
|
||||||
if (key->passthrough_edgeflags)
|
if (key->passthrough_edgeflags)
|
||||||
NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_passthrough_edgeflags);
|
NIR_PASS_V(vpv->tgsi.ir.nir, nir_lower_passthrough_edgeflags);
|
||||||
|
|
||||||
st_finalize_nir(st, &stvp->Base.Base, vpv->tgsi.ir.nir);
|
st_finalize_nir(st, &stvp->Base, vpv->tgsi.ir.nir);
|
||||||
|
|
||||||
vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
|
vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->tgsi);
|
||||||
/* driver takes ownership of IR: */
|
/* driver takes ownership of IR: */
|
||||||
|
|
@ -1913,7 +1912,7 @@ st_print_current_vertex_program(void)
|
||||||
(struct st_vertex_program *) ctx->VertexProgram._Current;
|
(struct st_vertex_program *) ctx->VertexProgram._Current;
|
||||||
struct st_vp_variant *stv;
|
struct st_vp_variant *stv;
|
||||||
|
|
||||||
debug_printf("Vertex program %u\n", stvp->Base.Base.Id);
|
debug_printf("Vertex program %u\n", stvp->Base.Id);
|
||||||
|
|
||||||
for (stv = stvp->variants; stv; stv = stv->next) {
|
for (stv = stvp->variants; stv; stv = stv->next) {
|
||||||
debug_printf("variant %p\n", stv);
|
debug_printf("variant %p\n", stv);
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ struct st_vp_variant
|
||||||
*/
|
*/
|
||||||
struct st_vertex_program
|
struct st_vertex_program
|
||||||
{
|
{
|
||||||
struct gl_vertex_program Base; /**< The Mesa vertex program */
|
struct gl_program Base; /**< The Mesa vertex program */
|
||||||
struct pipe_shader_state tgsi;
|
struct pipe_shader_state tgsi;
|
||||||
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
|
struct glsl_to_tgsi_visitor* glsl_to_tgsi;
|
||||||
uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
|
uint64_t affected_states; /**< ST_NEW_* flags to mark dirty when binding */
|
||||||
|
|
@ -309,7 +309,7 @@ st_fragment_program( struct gl_fragment_program *fp )
|
||||||
|
|
||||||
|
|
||||||
static inline struct st_vertex_program *
|
static inline struct st_vertex_program *
|
||||||
st_vertex_program( struct gl_vertex_program *vp )
|
st_vertex_program( struct gl_program *vp )
|
||||||
{
|
{
|
||||||
return (struct st_vertex_program *)vp;
|
return (struct st_vertex_program *)vp;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ void
|
||||||
_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
|
_tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
|
||||||
{
|
{
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
const struct gl_vertex_program *vp = ctx->VertexProgram._Current;
|
const struct gl_program *vp = ctx->VertexProgram._Current;
|
||||||
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
|
const struct gl_fragment_program *fp = ctx->FragmentProgram._Current;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ _tnl_InvalidateState( struct gl_context *ctx, GLuint new_state )
|
||||||
if (vp) {
|
if (vp) {
|
||||||
GLuint i;
|
GLuint i;
|
||||||
for (i = 0; i < MAX_VARYING; i++) {
|
for (i = 0; i < MAX_VARYING; i++) {
|
||||||
if (vp->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
|
if (vp->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
|
||||||
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i));
|
tnl->render_inputs_bitset |= BITFIELD64_BIT(_TNL_ATTRIB_GENERIC(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
|
||||||
machine->FetchTexelLod = vp_fetch_texel;
|
machine->FetchTexelLod = vp_fetch_texel;
|
||||||
machine->FetchTexelDeriv = NULL; /* not used by vertex programs */
|
machine->FetchTexelDeriv = NULL; /* not used by vertex programs */
|
||||||
|
|
||||||
machine->Samplers = ctx->VertexProgram._Current->Base.SamplerUnits;
|
machine->Samplers = ctx->VertexProgram._Current->SamplerUnits;
|
||||||
|
|
||||||
machine->SystemValues[SYSTEM_VALUE_INSTANCE_ID][0] = (GLfloat) instID;
|
machine->SystemValues[SYSTEM_VALUE_INSTANCE_ID][0] = (GLfloat) instID;
|
||||||
}
|
}
|
||||||
|
|
@ -247,12 +247,12 @@ init_machine(struct gl_context *ctx, struct gl_program_machine *machine,
|
||||||
* Map the texture images which the vertex program will access (if any).
|
* Map the texture images which the vertex program will access (if any).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
|
map_textures(struct gl_context *ctx, const struct gl_program *vp)
|
||||||
{
|
{
|
||||||
GLuint u;
|
GLuint u;
|
||||||
|
|
||||||
for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
|
for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
|
||||||
if (vp->Base.TexturesUsed[u]) {
|
if (vp->TexturesUsed[u]) {
|
||||||
/* Note: _Current *should* correspond to the target indicated
|
/* Note: _Current *should* correspond to the target indicated
|
||||||
* in TexturesUsed[u].
|
* in TexturesUsed[u].
|
||||||
*/
|
*/
|
||||||
|
|
@ -266,12 +266,12 @@ map_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
|
||||||
* Unmap the texture images which were used by the vertex program (if any).
|
* Unmap the texture images which were used by the vertex program (if any).
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
unmap_textures(struct gl_context *ctx, const struct gl_vertex_program *vp)
|
unmap_textures(struct gl_context *ctx, const struct gl_program *vp)
|
||||||
{
|
{
|
||||||
GLuint u;
|
GLuint u;
|
||||||
|
|
||||||
for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
|
for (u = 0; u < ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits; u++) {
|
||||||
if (vp->Base.TexturesUsed[u]) {
|
if (vp->TexturesUsed[u]) {
|
||||||
/* Note: _Current *should* correspond to the target indicated
|
/* Note: _Current *should* correspond to the target indicated
|
||||||
* in TexturesUsed[u].
|
* in TexturesUsed[u].
|
||||||
*/
|
*/
|
||||||
|
|
@ -290,7 +290,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
|
||||||
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
TNLcontext *tnl = TNL_CONTEXT(ctx);
|
||||||
struct vp_stage_data *store = VP_STAGE_DATA(stage);
|
struct vp_stage_data *store = VP_STAGE_DATA(stage);
|
||||||
struct vertex_buffer *VB = &tnl->vb;
|
struct vertex_buffer *VB = &tnl->vb;
|
||||||
struct gl_vertex_program *program = ctx->VertexProgram._Current;
|
struct gl_program *program = ctx->VertexProgram._Current;
|
||||||
struct gl_program_machine *machine = &store->machine;
|
struct gl_program_machine *machine = &store->machine;
|
||||||
GLuint outputs[VARYING_SLOT_MAX], numOutputs;
|
GLuint outputs[VARYING_SLOT_MAX], numOutputs;
|
||||||
GLuint i, j;
|
GLuint i, j;
|
||||||
|
|
@ -299,12 +299,12 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
|
|
||||||
/* ARB program or vertex shader */
|
/* ARB program or vertex shader */
|
||||||
_mesa_load_state_parameters(ctx, program->Base.Parameters);
|
_mesa_load_state_parameters(ctx, program->Parameters);
|
||||||
|
|
||||||
/* make list of outputs to save some time below */
|
/* make list of outputs to save some time below */
|
||||||
numOutputs = 0;
|
numOutputs = 0;
|
||||||
for (i = 0; i < VARYING_SLOT_MAX; i++) {
|
for (i = 0; i < VARYING_SLOT_MAX; i++) {
|
||||||
if (program->Base.OutputsWritten & BITFIELD64_BIT(i)) {
|
if (program->OutputsWritten & BITFIELD64_BIT(i)) {
|
||||||
outputs[numOutputs++] = i;
|
outputs[numOutputs++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -347,7 +347,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
|
||||||
|
|
||||||
/* the vertex array case */
|
/* the vertex array case */
|
||||||
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
|
for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) {
|
||||||
if (program->Base.InputsRead & BITFIELD64_BIT(attr)) {
|
if (program->InputsRead & BITFIELD64_BIT(attr)) {
|
||||||
const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data;
|
const GLubyte *ptr = (const GLubyte*) VB->AttribPtr[attr]->data;
|
||||||
const GLuint size = VB->AttribPtr[attr]->size;
|
const GLuint size = VB->AttribPtr[attr]->size;
|
||||||
const GLuint stride = VB->AttribPtr[attr]->stride;
|
const GLuint stride = VB->AttribPtr[attr]->stride;
|
||||||
|
|
@ -363,7 +363,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* execute the program */
|
/* execute the program */
|
||||||
_mesa_execute_program(ctx, &program->Base, machine);
|
_mesa_execute_program(ctx, program, machine);
|
||||||
|
|
||||||
/* copy the output registers into the VB->attribs arrays */
|
/* copy the output registers into the VB->attribs arrays */
|
||||||
for (j = 0; j < numOutputs; j++) {
|
for (j = 0; j < numOutputs; j++) {
|
||||||
|
|
@ -378,7 +378,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FOGC is a special case. Fragment shader expects (f,0,0,1) */
|
/* FOGC is a special case. Fragment shader expects (f,0,0,1) */
|
||||||
if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_FOGC)) {
|
if (program->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_FOGC)) {
|
||||||
store->results[VARYING_SLOT_FOGC].data[i][1] = 0.0;
|
store->results[VARYING_SLOT_FOGC].data[i][1] = 0.0;
|
||||||
store->results[VARYING_SLOT_FOGC].data[i][2] = 0.0;
|
store->results[VARYING_SLOT_FOGC].data[i][2] = 0.0;
|
||||||
store->results[VARYING_SLOT_FOGC].data[i][3] = 1.0;
|
store->results[VARYING_SLOT_FOGC].data[i][3] = 1.0;
|
||||||
|
|
@ -443,7 +443,7 @@ run_vp( struct gl_context *ctx, struct tnl_pipeline_stage *stage )
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ctx->Const.MaxVarying; i++) {
|
for (i = 0; i < ctx->Const.MaxVarying; i++) {
|
||||||
if (program->Base.OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
|
if (program->OutputsWritten & BITFIELD64_BIT(VARYING_SLOT_VAR0 + i)) {
|
||||||
/* Note: varying results get put into the generic attributes */
|
/* Note: varying results get put into the generic attributes */
|
||||||
VB->AttribPtr[VERT_ATTRIB_GENERIC0+i]
|
VB->AttribPtr[VERT_ATTRIB_GENERIC0+i]
|
||||||
= &store->results[VARYING_SLOT_VAR0 + i];
|
= &store->results[VARYING_SLOT_VAR0 + i];
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
*/
|
*/
|
||||||
void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
|
void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
const struct gl_vertex_program *prev = ctx->VertexProgram._Current;
|
const struct gl_program *prev = ctx->VertexProgram._Current;
|
||||||
|
|
||||||
if (!ctx->VertexProgram._Current ||
|
if (!ctx->VertexProgram._Current ||
|
||||||
ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
|
ctx->VertexProgram._Current == ctx->VertexProgram._TnlProgram) {
|
||||||
|
|
@ -54,6 +54,6 @@ void _tnl_UpdateFixedFunctionProgram( struct gl_context *ctx )
|
||||||
*/
|
*/
|
||||||
if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) {
|
if (ctx->VertexProgram._Current != prev && ctx->Driver.BindProgram) {
|
||||||
ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
|
ctx->Driver.BindProgram(ctx, GL_VERTEX_PROGRAM_ARB,
|
||||||
(struct gl_program *) ctx->VertexProgram._Current);
|
ctx->VertexProgram._Current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,8 +211,8 @@ vbo_exec_bind_arrays( struct gl_context *ctx )
|
||||||
* glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
|
* glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
|
||||||
* The original state gets essentially restored below.
|
* The original state gets essentially restored below.
|
||||||
*/
|
*/
|
||||||
if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 &&
|
if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 &&
|
||||||
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
|
(ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) {
|
||||||
swap_pos = true;
|
swap_pos = true;
|
||||||
exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0];
|
exec->vtx.inputs[VERT_ATTRIB_GENERIC0] = exec->vtx.inputs[0];
|
||||||
exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0];
|
exec->vtx.attrsz[VERT_ATTRIB_GENERIC0] = exec->vtx.attrsz[0];
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,8 @@ static void vbo_bind_vertex_list(struct gl_context *ctx,
|
||||||
* In that case we effectively need to route the data from
|
* In that case we effectively need to route the data from
|
||||||
* glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
|
* glVertexAttrib(0, val) calls to feed into the GENERIC0 input.
|
||||||
*/
|
*/
|
||||||
if ((ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_POS) == 0 &&
|
if ((ctx->VertexProgram._Current->InputsRead & VERT_BIT_POS) == 0 &&
|
||||||
(ctx->VertexProgram._Current->Base.InputsRead & VERT_BIT_GENERIC0)) {
|
(ctx->VertexProgram._Current->InputsRead & VERT_BIT_GENERIC0)) {
|
||||||
save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0];
|
save->inputs[VERT_ATTRIB_GENERIC0] = save->inputs[0];
|
||||||
node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0];
|
node_attrsz[VERT_ATTRIB_GENERIC0] = node_attrsz[0];
|
||||||
node_attrtype[VERT_ATTRIB_GENERIC0] = node_attrtype[0];
|
node_attrtype[VERT_ATTRIB_GENERIC0] = node_attrtype[0];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue