* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const struct prog_dst_register *dst, const struct asm_src_register *src0,
const struct asm_src_register *src1, const struct asm_src_register *src2);
-static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op,
+static struct asm_instruction *asm_instruction_ctor(enum prog_opcode op,
const struct prog_dst_register *dst, const struct asm_src_register *src0,
const struct asm_src_register *src1, const struct asm_src_register *src2);
gl_state_index state[STATE_LENGTH];
int negate;
struct asm_vector vector;
- gl_inst_opcode opcode;
+ enum prog_opcode opcode;
struct {
unsigned swz;
struct asm_instruction *
-asm_instruction_ctor(gl_inst_opcode op,
+asm_instruction_ctor(enum prog_opcode op,
const struct prog_dst_register *dst,
const struct asm_src_register *src0,
const struct asm_src_register *src1,
inst->Base.Opcode = base->Opcode;
inst->Base.CondUpdate = base->CondUpdate;
inst->Base.CondDst = base->CondDst;
- inst->Base.SaturateMode = base->SaturateMode;
+ inst->Base.Saturate = base->Saturate;
inst->Base.Precision = base->Precision;
asm_instruction_set_operands(inst, dst, src0, src1, src2);
{
const GLint maxIndex = 1 << INST_INDEX_BITS;
const GLint minIndex = 0;
- ASSERT(index >= minIndex);
+ assert(index >= minIndex);
(void) minIndex;
- ASSERT(index <= maxIndex);
+ assert(index <= maxIndex);
(void) maxIndex;
- ASSERT(file == PROGRAM_TEMPORARY ||
+ assert(file == PROGRAM_TEMPORARY ||
file == PROGRAM_ADDRESS ||
file == PROGRAM_OUTPUT);
memset(r, 0, sizeof(*r));
{
const GLint maxIndex = (1 << INST_INDEX_BITS) - 1;
const GLint minIndex = -(1 << INST_INDEX_BITS);
- ASSERT(file < PROGRAM_FILE_MAX);
- ASSERT(index >= minIndex);
+ assert(file < PROGRAM_FILE_MAX);
+ assert(index >= minIndex);
(void) minIndex;
- ASSERT(index <= maxIndex);
+ assert(index <= maxIndex);
(void) maxIndex;
memset(r, 0, sizeof(*r));
r->Base.File = file;
state->st = _mesa_symbol_table_ctor();
state->limits = (target == GL_VERTEX_PROGRAM_ARB)
- ? & ctx->Const.VertexProgram
- : & ctx->Const.FragmentProgram;
+ ? & ctx->Const.Program[MESA_SHADER_VERTEX]
+ : & ctx->Const.Program[MESA_SHADER_FRAGMENT];
- state->MaxTextureImageUnits = ctx->Const.FragmentProgram.MaxTextureImageUnits;
+ state->MaxTextureImageUnits = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits;
state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits;
state->MaxTextureUnits = ctx->Const.MaxTextureUnits;
state->MaxClipPlanes = ctx->Const.MaxClipPlanes;
*/
state->prog->Instructions =
_mesa_alloc_instructions(state->prog->NumInstructions + 1);
+
+ if (state->prog->Instructions == NULL) {
+ goto error;
+ }
+
inst = state->inst_head;
for (i = 0; i < state->prog->NumInstructions; i++) {
struct asm_instruction *const temp = inst->next;