if (inst->Opcode == OPCODE_TEX ||
inst->Opcode == OPCODE_TXB ||
inst->Opcode == OPCODE_TXP) {
+ /*
printf("====== remap sampler from %d to %d\n",
inst->Sampler, map[ inst->Sampler ]);
+ */
inst->Sampler = map[ inst->Sampler ];
}
}
*/
usedAttributes = 0x0;
for (i = 0; i < shProg->Attributes->NumParameters; i++) {
- GLint attr = shProg->Attributes->Parameters[i].StateIndexes[1];
+ GLint attr = shProg->Attributes->Parameters[i].StateIndexes[0];
usedAttributes |= attr;
}
GLint attr;
if (index >= 0) {
/* found, user must have specified a binding */
- attr = shProg->Attributes->Parameters[index].StateIndexes[1];
+ attr = shProg->Attributes->Parameters[index].StateIndexes[0];
}
else {
- /* not found, choose our own attribute number */
- for (attr = 0; attr < MAX_VERTEX_ATTRIBS; attr++) {
+ /* Not found, choose our own attribute number.
+ * Start at 1 since generic attribute 0 always aliases
+ * glVertex/position.
+ */
+ for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) {
if (((1 << attr) & usedAttributes) == 0)
break;
}
_slang_resolve_samplers(shProg, &shProg->VertexProgram->Base);
_slang_resolve_samplers(shProg, &shProg->FragmentProgram->Base);
- _slang_resolve_attributes(shProg, &shProg->VertexProgram->Base);
+ if (!_slang_resolve_attributes(shProg, &shProg->VertexProgram->Base)) {
+ /*goto cleanup;*/
+ }
_slang_update_inputs_outputs(&shProg->VertexProgram->Base);
_slang_update_inputs_outputs(&shProg->FragmentProgram->Base);