#include "arbprogparse.h"
#include "light.h"
#include "program.h"
+#include "programopt.h"
#include "math/m_matrix.h"
#include "t_context.h"
#include "t_pipeline.h"
GLfloat *result = m->File[0][op.alu.dst];
const GLfloat *arg0 = m->File[op.alu.file0][op.alu.idx0];
- result[0] = (GLfloat)ApproxExp2(arg0[0]);
+ result[0] = ApproxExp2(arg0[0]);
PUFF(result);
}
_mesa_printf("TMP%d", reg - REG_TMP0);
else if (reg >= REG_IN0 && reg <= REG_IN31)
_mesa_printf("IN%d", reg - REG_IN0);
- else if (reg >= REG_OUT0 && reg <= REG_OUT14)
+ else if (reg >= REG_OUT0 && reg <= REG_OUT23)
_mesa_printf("OUT%d", reg - REG_OUT0);
else if (reg == REG_ADDR)
_mesa_printf("ADDR");
static void (* const opcode_func[MAX_OPCODE+3])(struct arb_vp_machine *, union instruction) =
{
+ do_NOP,
do_ABS,
do_ADD,
do_NOP,/*ARA*/
return reg;
case PROGRAM_STATE_VAR:
+ case PROGRAM_CONSTANT:
reg = cvp_make_reg(FILE_STATE_PARAM, index);
if (rel)
return cvp_emit_rel(cp, reg, tmpreg);
struct tnl_compiled_program *p = CALLOC_STRUCT(tnl_compiled_program);
GLuint i;
+#if 1
+ if (!program->IsNVProgram && program->IsPositionInvariant) {
+ printf("Adding MVP code\n");
+ if (!program->Base.Parameters)
+ program->Base.Parameters = _mesa_new_parameter_list();
+ _mesa_insert_mvp_code(NULL, program);
+ program->IsPositionInvariant = 0;
+ }
+#endif
+
if (program->TnlData)
free_tnl_data( program );
/* Test userclip planes. This contributes to VB->ClipMask.
*/
+ /** XXX NEW_SLANG _Enabled ??? */
if (ctx->Transform.ClipPlanesEnabled && (!ctx->VertexProgram._Enabled ||
ctx->VertexProgram.Current->IsPositionInvariant)) {
userclip( ctx,
static GLboolean
run_arb_vertex_program(GLcontext *ctx, struct tnl_pipeline_stage *stage)
{
- const struct gl_vertex_program *program;
+ const struct gl_vertex_program *program = ctx->VertexProgram._Current;
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct arb_vp_machine *m = ARB_VP_MACHINE(stage);
struct tnl_compiled_program *p;
GLuint i, j;
GLbitfield outputs;
- if (ctx->ShaderObjects._VertexShaderPresent)
- return GL_TRUE;
-
- program = ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : NULL;
- if (!program && ctx->_MaintainTnlProgram) {
- program = ctx->_TnlProgram;
- }
- if (!program || program->IsNVProgram)
+ if (!program)
return GL_TRUE;
if (program->Base.Parameters) {
/* If the program is position invariant, multiply the input position
* by the MVP matrix and store in the vertex position result register.
*/
+#if 0
if (program->IsPositionInvariant) {
TRANSFORM_POINT( m->File[0][REG_OUT0+0],
ctx->_ModelProjectMatrix.m,
m->File[0][REG_IN0+0]);
}
-
+#endif
for (j = 0; j < m->nr_outputs; j++) {
GLuint idx = REG_OUT0 + m->output[j].idx;
m->output[j].data[0] = m->File[0][idx][0];
}
}
+ for (i = 0; i < ctx->Const.MaxVarying; i++) {
+ if (outputs & (1 << (VERT_RESULT_VAR0 + i))) {
+ /* Note: varying results get put into the generic attributes */
+ VB->AttribPtr[VERT_ATTRIB_GENERIC0+i]
+ = &m->attribs[VERT_RESULT_VAR0 + i];
+ }
+ }
+
#if 0
for (i = 0; i < VB->Count; i++) {
printf("Out %d: %f %f %f %f %f %f %f %f\n", i,
validate_vertex_program( GLcontext *ctx, struct tnl_pipeline_stage *stage )
{
struct arb_vp_machine *m = ARB_VP_MACHINE(stage);
- struct gl_vertex_program *program;
-
- if (ctx->ShaderObjects._VertexShaderPresent)
- return;
-
- program = (ctx->VertexProgram._Enabled ? ctx->VertexProgram.Current : 0);
- if (!program && ctx->_MaintainTnlProgram) {
- program = ctx->_TnlProgram;
- }
+ struct gl_vertex_program *program = ctx->VertexProgram._Current;
if (program) {
if (!program->TnlData)
_mesa_vector4f_alloc( &m->ndcCoords, 0, size, 32 );
m->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 );
- if (ctx->_MaintainTnlProgram)
+ if (ctx->VertexProgram._MaintainTnlProgram)
_mesa_allow_light_in_model( ctx, GL_FALSE );
m->fpucntl_rnd_neg = RND_NEG_FPU; /* const value */
void
_tnl_program_string(GLcontext *ctx, GLenum target, struct gl_program *program)
{
- if (target == GL_VERTEX_PROGRAM_ARB) {
+ if (program->Target == GL_VERTEX_PROGRAM_ARB) {
/* free any existing tnl data hanging off the program */
struct gl_vertex_program *vprog = (struct gl_vertex_program *) program;
if (vprog->TnlData) {
typedef struct
{
- GLvector4f outputs[VERT_RESULT_MAX];
- GLvector4f varyings[MAX_VARYING_VECTORS];
- GLvector4f ndc_coords;
- GLubyte *clipmask;
- GLubyte ormask;
- GLubyte andmask;
+ GLvector4f outputs[VERT_RESULT_MAX];
+ GLvector4f varyings[MAX_VARYING_VECTORS];
+ GLvector4f ndc_coords;
+ GLubyte *clipmask;
+ GLubyte ormask;
+ GLubyte andmask;
} arbvs_stage_data;
#define ARBVS_STAGE_DATA(stage) ((arbvs_stage_data *) stage->privatePtr)
-static GLboolean construct_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stage *stage)
+static GLboolean
+construct_arb_vertex_shader(GLcontext * ctx, struct tnl_pipeline_stage *stage)
{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *vb = &tnl->vb;
- arbvs_stage_data *store;
- GLuint size = vb->Size;
- GLuint i;
-
- stage->privatePtr = _mesa_malloc (sizeof (arbvs_stage_data));
- store = ARBVS_STAGE_DATA(stage);
- if (store == NULL)
- return GL_FALSE;
-
- for (i = 0; i < VERT_RESULT_MAX; i++)
- {
- _mesa_vector4f_alloc (&store->outputs[i], 0, size, 32);
- store->outputs[i].size = 4;
- }
- for (i = 0; i < MAX_VARYING_VECTORS; i++)
- {
- _mesa_vector4f_alloc (&store->varyings[i], 0, size, 32);
- store->varyings[i].size = 4;
- }
- _mesa_vector4f_alloc (&store->ndc_coords, 0, size, 32);
- store->clipmask = (GLubyte *) ALIGN_MALLOC (size, 32);
-
- return GL_TRUE;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *vb = &tnl->vb;
+ arbvs_stage_data *store;
+ GLuint size = vb->Size;
+ GLuint i;
+
+ stage->privatePtr = _mesa_malloc(sizeof(arbvs_stage_data));
+ store = ARBVS_STAGE_DATA(stage);
+ if (store == NULL)
+ return GL_FALSE;
+
+ for (i = 0; i < VERT_RESULT_MAX; i++) {
+ _mesa_vector4f_alloc(&store->outputs[i], 0, size, 32);
+ store->outputs[i].size = 4;
+ }
+ for (i = 0; i < MAX_VARYING_VECTORS; i++) {
+ _mesa_vector4f_alloc(&store->varyings[i], 0, size, 32);
+ store->varyings[i].size = 4;
+ }
+ _mesa_vector4f_alloc(&store->ndc_coords, 0, size, 32);
+ store->clipmask = (GLubyte *) ALIGN_MALLOC(size, 32);
+
+ return GL_TRUE;
}
-static void destruct_arb_vertex_shader (struct tnl_pipeline_stage *stage)
+static void
+destruct_arb_vertex_shader(struct tnl_pipeline_stage *stage)
{
- arbvs_stage_data *store = ARBVS_STAGE_DATA(stage);
-
- if (store != NULL)
- {
- GLuint i;
-
- for (i = 0; i < VERT_RESULT_MAX; i++)
- _mesa_vector4f_free (&store->outputs[i]);
- for (i = 0; i < MAX_VARYING_VECTORS; i++)
- _mesa_vector4f_free (&store->varyings[i]);
- _mesa_vector4f_free (&store->ndc_coords);
- ALIGN_FREE (store->clipmask);
-
- _mesa_free (store);
- stage->privatePtr = NULL;
- }
+ arbvs_stage_data *store = ARBVS_STAGE_DATA(stage);
+
+ if (store != NULL) {
+ GLuint i;
+
+ for (i = 0; i < VERT_RESULT_MAX; i++)
+ _mesa_vector4f_free(&store->outputs[i]);
+ for (i = 0; i < MAX_VARYING_VECTORS; i++)
+ _mesa_vector4f_free(&store->varyings[i]);
+ _mesa_vector4f_free(&store->ndc_coords);
+ ALIGN_FREE(store->clipmask);
+
+ _mesa_free(store);
+ stage->privatePtr = NULL;
+ }
}
-static void validate_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stage *stage)
+static void
+validate_arb_vertex_shader(GLcontext * ctx, struct tnl_pipeline_stage *stage)
{
}
-static GLvoid fetch_input_float (struct gl2_program_intf **pro, GLuint index, GLuint attr, GLuint i,
- struct vertex_buffer *vb)
+static GLvoid
+fetch_input_float(struct gl2_program_intf **pro, GLuint index, GLuint attr,
+ GLuint i, struct vertex_buffer *vb)
{
- const GLubyte *ptr = (const GLubyte *) vb->AttribPtr[attr]->data;
- const GLuint stride = vb->AttribPtr[attr]->stride;
+ const GLubyte *ptr = (const GLubyte *) vb->AttribPtr[attr]->data;
+ const GLuint stride = vb->AttribPtr[attr]->stride;
GLfloat *data = (GLfloat *) (ptr + stride * i);
- (**pro).UpdateFixedAttrib (pro, index, data, 0, sizeof (GLfloat), GL_TRUE);
+ (**pro).UpdateFixedAttrib(pro, index, data, 0, sizeof(GLfloat), GL_TRUE);
}
-static GLvoid fetch_input_vec3 (struct gl2_program_intf **pro, GLuint index, GLuint attr, GLuint i,
- struct vertex_buffer *vb)
+static GLvoid
+fetch_input_vec3(struct gl2_program_intf **pro, GLuint index, GLuint attr,
+ GLuint i, struct vertex_buffer *vb)
{
- const GLubyte *ptr = (const GLubyte *) vb->AttribPtr[attr]->data;
- const GLuint stride = vb->AttribPtr[attr]->stride;
+ const GLubyte *ptr = (const GLubyte *) vb->AttribPtr[attr]->data;
+ const GLuint stride = vb->AttribPtr[attr]->stride;
GLfloat *data = (GLfloat *) (ptr + stride * i);
- (**pro).UpdateFixedAttrib (pro, index, data, 0, 3 * sizeof (GLfloat), GL_TRUE);
+ (**pro).UpdateFixedAttrib(pro, index, data, 0, 3 * sizeof(GLfloat),
+ GL_TRUE);
}
-static void fetch_input_vec4 (struct gl2_program_intf **pro, GLuint index, GLuint attr, GLuint i,
- struct vertex_buffer *vb)
+static void
+fetch_input_vec4(struct gl2_program_intf **pro, GLuint index, GLuint attr,
+ GLuint i, struct vertex_buffer *vb)
{
- const GLubyte *ptr = (const GLubyte *) vb->AttribPtr[attr]->data;
- const GLuint size = vb->AttribPtr[attr]->size;
- const GLuint stride = vb->AttribPtr[attr]->stride;
- const GLfloat *data = (const GLfloat *) (ptr + stride * i);
- GLfloat vec[4];
-
- switch (size)
- {
- case 2:
- vec[0] = data[0];
- vec[1] = data[1];
- vec[2] = 0.0f;
- vec[3] = 1.0f;
- break;
- case 3:
- vec[0] = data[0];
- vec[1] = data[1];
- vec[2] = data[2];
- vec[3] = 1.0f;
- break;
- case 4:
- vec[0] = data[0];
- vec[1] = data[1];
- vec[2] = data[2];
- vec[3] = data[3];
- break;
- }
- (**pro).UpdateFixedAttrib (pro, index, vec, 0, 4 * sizeof (GLfloat), GL_TRUE);
+ const GLubyte *ptr = (const GLubyte *) vb->AttribPtr[attr]->data;
+ const GLuint size = vb->AttribPtr[attr]->size;
+ const GLuint stride = vb->AttribPtr[attr]->stride;
+ const GLfloat *data = (const GLfloat *) (ptr + stride * i);
+ GLfloat vec[4];
+
+ switch (size) {
+ case 2:
+ vec[0] = data[0];
+ vec[1] = data[1];
+ vec[2] = 0.0f;
+ vec[3] = 1.0f;
+ break;
+ case 3:
+ vec[0] = data[0];
+ vec[1] = data[1];
+ vec[2] = data[2];
+ vec[3] = 1.0f;
+ break;
+ case 4:
+ vec[0] = data[0];
+ vec[1] = data[1];
+ vec[2] = data[2];
+ vec[3] = data[3];
+ break;
+ }
+ (**pro).UpdateFixedAttrib(pro, index, vec, 0, 4 * sizeof(GLfloat),
+ GL_TRUE);
}
static GLvoid
-fetch_gen_attrib (struct gl2_program_intf **pro, GLuint index, GLuint i, struct vertex_buffer *vb)
+fetch_gen_attrib(struct gl2_program_intf **pro, GLuint index, GLuint i,
+ struct vertex_buffer *vb)
{
const GLuint attr = _TNL_ATTRIB_GENERIC0 + index;
const GLubyte *ptr = (const GLubyte *) (vb->AttribPtr[attr]->data);
const GLuint stride = vb->AttribPtr[attr]->stride;
const GLfloat *data = (const GLfloat *) (ptr + stride * i);
- (**pro).WriteAttrib (pro, index, data);
+ (**pro).WriteAttrib(pro, index, data);
}
-static GLvoid fetch_output_float (struct gl2_program_intf **pro, GLuint index, GLuint attr, GLuint i,
- arbvs_stage_data *store)
+static GLvoid
+fetch_output_float(struct gl2_program_intf **pro, GLuint index, GLuint attr,
+ GLuint i, arbvs_stage_data * store)
{
- (**pro).UpdateFixedAttrib (pro, index, &store->outputs[attr].data[i], 0, sizeof (GLfloat),
- GL_FALSE);
+ (**pro).UpdateFixedAttrib(pro, index, &store->outputs[attr].data[i], 0,
+ sizeof(GLfloat), GL_FALSE);
}
-static void fetch_output_vec4 (struct gl2_program_intf **pro, GLuint index, GLuint attr, GLuint i,
- GLuint offset, arbvs_stage_data *store)
+static void
+fetch_output_vec4(struct gl2_program_intf **pro, GLuint index, GLuint attr,
+ GLuint i, GLuint offset, arbvs_stage_data * store)
{
- (**pro).UpdateFixedAttrib (pro, index, &store->outputs[attr].data[i], offset,
- 4 * sizeof (GLfloat), GL_FALSE);
+ (**pro).UpdateFixedAttrib(pro, index, &store->outputs[attr].data[i],
+ offset, 4 * sizeof(GLfloat), GL_FALSE);
}
-static GLboolean run_arb_vertex_shader (GLcontext *ctx, struct tnl_pipeline_stage *stage)
+static GLboolean
+run_arb_vertex_shader(GLcontext * ctx, struct tnl_pipeline_stage *stage)
{
- TNLcontext *tnl = TNL_CONTEXT(ctx);
- struct vertex_buffer *vb = &tnl->vb;
- arbvs_stage_data *store = ARBVS_STAGE_DATA(stage);
- struct gl2_program_intf **pro;
- GLsizei i, j;
-
- if (!ctx->ShaderObjects._VertexShaderPresent)
- return GL_TRUE;
-
- pro = ctx->ShaderObjects.CurrentProgram;
- (**pro).UpdateFixedUniforms (pro);
-
- for (i = 0; i < vb->Count; i++)
- {
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_VERTEX, _TNL_ATTRIB_POS, i, vb);
- fetch_input_vec3 (pro, SLANG_VERTEX_FIXED_NORMAL, _TNL_ATTRIB_NORMAL, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_COLOR, _TNL_ATTRIB_COLOR0, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_SECONDARYCOLOR, _TNL_ATTRIB_COLOR1, i, vb);
- fetch_input_float (pro, SLANG_VERTEX_FIXED_FOGCOORD, _TNL_ATTRIB_FOG, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD0, _TNL_ATTRIB_TEX0, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD1, _TNL_ATTRIB_TEX1, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD2, _TNL_ATTRIB_TEX2, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD3, _TNL_ATTRIB_TEX3, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD4, _TNL_ATTRIB_TEX4, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD5, _TNL_ATTRIB_TEX5, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD6, _TNL_ATTRIB_TEX6, i, vb);
- fetch_input_vec4 (pro, SLANG_VERTEX_FIXED_MULTITEXCOORD7, _TNL_ATTRIB_TEX7, i, vb);
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+ struct vertex_buffer *vb = &tnl->vb;
+ arbvs_stage_data *store = ARBVS_STAGE_DATA(stage);
+ struct gl2_program_intf **pro;
+ GLsizei i, j;
+
+#if 00
+ if (!ctx->ShaderObjects._VertexShaderPresent)
+ return GL_TRUE;
+#else
+ return GL_TRUE;
+#endif
+
+ pro = ctx->ShaderObjects.CurrentProgram;
+ (**pro).UpdateFixedUniforms(pro);
+
+ for (i = 0; i < vb->Count; i++) {
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_VERTEX, _TNL_ATTRIB_POS, i,
+ vb);
+ fetch_input_vec3(pro, SLANG_VERTEX_FIXED_NORMAL, _TNL_ATTRIB_NORMAL, i,
+ vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_COLOR, _TNL_ATTRIB_COLOR0, i,
+ vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_SECONDARYCOLOR,
+ _TNL_ATTRIB_COLOR1, i, vb);
+ fetch_input_float(pro, SLANG_VERTEX_FIXED_FOGCOORD, _TNL_ATTRIB_FOG, i,
+ vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD0,
+ _TNL_ATTRIB_TEX0, i, vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD1,
+ _TNL_ATTRIB_TEX1, i, vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD2,
+ _TNL_ATTRIB_TEX2, i, vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD3,
+ _TNL_ATTRIB_TEX3, i, vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD4,
+ _TNL_ATTRIB_TEX4, i, vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD5,
+ _TNL_ATTRIB_TEX5, i, vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD6,
+ _TNL_ATTRIB_TEX6, i, vb);
+ fetch_input_vec4(pro, SLANG_VERTEX_FIXED_MULTITEXCOORD7,
+ _TNL_ATTRIB_TEX7, i, vb);
for (j = 0; j < MAX_VERTEX_ATTRIBS; j++)
- fetch_gen_attrib (pro, j, i, vb);
-
- _slang_exec_vertex_shader (pro);
-
- fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_POSITION, VERT_RESULT_HPOS, i, 0, store);
- fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_FRONTCOLOR, VERT_RESULT_COL0, i, 0, store);
- fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_FRONTSECONDARYCOLOR, VERT_RESULT_COL1, i, 0, store);
- fetch_output_float (pro, SLANG_VERTEX_FIXED_FOGFRAGCOORD, VERT_RESULT_FOGC, i, store);
- for (j = 0; j < 8; j++)
- fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_TEXCOORD, VERT_RESULT_TEX0 + j, i, j, store);
- fetch_output_float (pro, SLANG_VERTEX_FIXED_POINTSIZE, VERT_RESULT_PSIZ, i, store);
- fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_BACKCOLOR, VERT_RESULT_BFC0, i, 0, store);
- fetch_output_vec4 (pro, SLANG_VERTEX_FIXED_BACKSECONDARYCOLOR, VERT_RESULT_BFC1, i, 0, store);
- /* XXX: fetch output SLANG_VERTEX_FIXED_CLIPVERTEX */
-
- for (j = 0; j < MAX_VARYING_VECTORS; j++)
- {
- GLuint k;
-
- for (k = 0; k < VARYINGS_PER_VECTOR; k++)
- {
- (**pro).UpdateVarying (pro, j * VARYINGS_PER_VECTOR + k,
- &store->varyings[j].data[i][k], GL_TRUE);
- }
- }
- }
-
- vb->ClipPtr = &store->outputs[VERT_RESULT_HPOS];
- vb->ClipPtr->count = vb->Count;
-
- vb->ColorPtr[0] = &store->outputs[VERT_RESULT_COL0];
- vb->AttribPtr[VERT_ATTRIB_COLOR0] = vb->ColorPtr[0];
- vb->ColorPtr[1] = &store->outputs[VERT_RESULT_BFC0];
-
- vb->SecondaryColorPtr[0] =
- vb->AttribPtr[VERT_ATTRIB_COLOR1] = &store->outputs[VERT_RESULT_COL1];
-
- vb->SecondaryColorPtr[1] = &store->outputs[VERT_RESULT_BFC1];
-
- for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
- vb->TexCoordPtr[i] =
- vb->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->outputs[VERT_RESULT_TEX0 + i];
- }
-
- vb->FogCoordPtr =
- vb->AttribPtr[VERT_ATTRIB_FOG] = &store->outputs[VERT_RESULT_FOGC];
-
- vb->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->outputs[VERT_RESULT_PSIZ];
-
- for (i = 0; i < MAX_VARYING_VECTORS; i++) {
- vb->VaryingPtr[i] = &store->varyings[i];
- vb->AttribPtr[_TNL_ATTRIB_GENERIC0 + i] = vb->VaryingPtr[i];
- }
-
- store->ormask = 0;
- store->andmask = CLIP_FRUSTUM_BITS;
-
- if (tnl->NeedNdcCoords)
- {
- vb->NdcPtr = _mesa_clip_tab[vb->ClipPtr->size] (vb->ClipPtr, &store->ndc_coords,
- store->clipmask, &store->ormask, &store->andmask);
- }
- else
- {
- vb->NdcPtr = NULL;
- _mesa_clip_np_tab[vb->ClipPtr->size] (vb->ClipPtr, NULL, store->clipmask, &store->ormask,
- &store->andmask);
- }
-
- if (store->andmask)
- return GL_FALSE;
-
- vb->ClipAndMask = store->andmask;
- vb->ClipOrMask = store->ormask;
- vb->ClipMask = store->clipmask;
-
- return GL_TRUE;
+ fetch_gen_attrib(pro, j, i, vb);
+
+ _slang_exec_vertex_shader(pro);
+
+ fetch_output_vec4(pro, SLANG_VERTEX_FIXED_POSITION, VERT_RESULT_HPOS, i,
+ 0, store);
+ fetch_output_vec4(pro, SLANG_VERTEX_FIXED_FRONTCOLOR, VERT_RESULT_COL0,
+ i, 0, store);
+ fetch_output_vec4(pro, SLANG_VERTEX_FIXED_FRONTSECONDARYCOLOR,
+ VERT_RESULT_COL1, i, 0, store);
+ fetch_output_float(pro, SLANG_VERTEX_FIXED_FOGFRAGCOORD,
+ VERT_RESULT_FOGC, i, store);
+ for (j = 0; j < 8; j++)
+ fetch_output_vec4(pro, SLANG_VERTEX_FIXED_TEXCOORD,
+ VERT_RESULT_TEX0 + j, i, j, store);
+ fetch_output_float(pro, SLANG_VERTEX_FIXED_POINTSIZE, VERT_RESULT_PSIZ,
+ i, store);
+ fetch_output_vec4(pro, SLANG_VERTEX_FIXED_BACKCOLOR, VERT_RESULT_BFC0,
+ i, 0, store);
+ fetch_output_vec4(pro, SLANG_VERTEX_FIXED_BACKSECONDARYCOLOR,
+ VERT_RESULT_BFC1, i, 0, store);
+ /* XXX: fetch output SLANG_VERTEX_FIXED_CLIPVERTEX */
+
+ for (j = 0; j < MAX_VARYING_VECTORS; j++) {
+ GLuint k;
+
+ for (k = 0; k < VARYINGS_PER_VECTOR; k++) {
+ (**pro).UpdateVarying(pro, j * VARYINGS_PER_VECTOR + k,
+ &store->varyings[j].data[i][k], GL_TRUE);
+ }
+ }
+ }
+
+ vb->ClipPtr = &store->outputs[VERT_RESULT_HPOS];
+ vb->ClipPtr->count = vb->Count;
+
+ vb->ColorPtr[0] = &store->outputs[VERT_RESULT_COL0];
+ vb->AttribPtr[VERT_ATTRIB_COLOR0] = vb->ColorPtr[0];
+ vb->ColorPtr[1] = &store->outputs[VERT_RESULT_BFC0];
+
+ vb->SecondaryColorPtr[0] =
+ vb->AttribPtr[VERT_ATTRIB_COLOR1] = &store->outputs[VERT_RESULT_COL1];
+
+ vb->SecondaryColorPtr[1] = &store->outputs[VERT_RESULT_BFC1];
+
+ for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+ vb->TexCoordPtr[i] =
+ vb->AttribPtr[VERT_ATTRIB_TEX0 + i] =
+ &store->outputs[VERT_RESULT_TEX0 + i];
+ }
+
+ vb->FogCoordPtr =
+ vb->AttribPtr[VERT_ATTRIB_FOG] = &store->outputs[VERT_RESULT_FOGC];
+
+ vb->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->outputs[VERT_RESULT_PSIZ];
+
+ for (i = 0; i < MAX_VARYING_VECTORS; i++) {
+ vb->VaryingPtr[i] = &store->varyings[i];
+ vb->AttribPtr[_TNL_ATTRIB_GENERIC0 + i] = vb->VaryingPtr[i];
+ }
+
+ store->ormask = 0;
+ store->andmask = CLIP_FRUSTUM_BITS;
+
+ if (tnl->NeedNdcCoords) {
+ vb->NdcPtr =
+ _mesa_clip_tab[vb->ClipPtr->size] (vb->ClipPtr, &store->ndc_coords,
+ store->clipmask, &store->ormask,
+ &store->andmask);
+ }
+ else {
+ vb->NdcPtr = NULL;
+ _mesa_clip_np_tab[vb->ClipPtr->size] (vb->ClipPtr, NULL,
+ store->clipmask, &store->ormask,
+ &store->andmask);
+ }
+
+ if (store->andmask)
+ return GL_FALSE;
+
+ vb->ClipAndMask = store->andmask;
+ vb->ClipOrMask = store->ormask;
+ vb->ClipMask = store->clipmask;
+
+ return GL_TRUE;
}
const struct tnl_pipeline_stage _tnl_arb_vertex_shader_stage = {
- "ARB_vertex_shader",
- NULL,
- construct_arb_vertex_shader,
- destruct_arb_vertex_shader,
- validate_arb_vertex_shader,
- run_arb_vertex_shader
+ "ARB_vertex_shader",
+ NULL,
+ construct_arb_vertex_shader,
+ destruct_arb_vertex_shader,
+ validate_arb_vertex_shader,
+ run_arb_vertex_shader
};
#endif /* FEATURE_ARB_vertex_shader */
-