summaryrefslogtreecommitdiff
path: root/src/mesa/shader/slang/slang_assemble_conditional.c
diff options
context:
space:
mode:
authorMichal Krol <mjkrol@gmail.org>2006-02-13 11:38:37 +0000
committerMichal Krol <mjkrol@gmail.org>2006-02-13 11:38:37 +0000
commit02eb9acc5e4307db09662592951ef44319a0cda5 (patch)
tree585a539ed6d6775801dcc9e685759521680da9f9 /src/mesa/shader/slang/slang_assemble_conditional.c
parent44e9ccc708bb0a92dfeaf038ded60295dfe2d3ae (diff)
Get it running for ARB_vertex_shader.
Add experimental print functions to builtin library. Some functionality missing: - automatic arrays; - general constructors; - local variable initialization; - texture sampling and noise; - semantic error checking; - function prototypes.
Diffstat (limited to 'src/mesa/shader/slang/slang_assemble_conditional.c')
-rw-r--r--src/mesa/shader/slang/slang_assemble_conditional.c73
1 files changed, 37 insertions, 36 deletions
diff --git a/src/mesa/shader/slang/slang_assemble_conditional.c b/src/mesa/shader/slang/slang_assemble_conditional.c
index 498938bdd5..74324cfe6c 100644
--- a/src/mesa/shader/slang/slang_assemble_conditional.c
+++ b/src/mesa/shader/slang/slang_assemble_conditional.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 6.3
+ * Version: 6.5
*
- * Copyright (C) 2005 Brian Paul All Rights Reserved.
+ * Copyright (C) 2005-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -32,12 +32,13 @@
#include "slang_utility.h"
#include "slang_assemble_conditional.h"
#include "slang_assemble.h"
+#include "slang_execute.h"
/* _slang_assemble_logicaland() */
int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
+ slang_assembly_local_info *info, slang_machine *mach, slang_atom_pool *atoms)
{
/*
and:
@@ -54,7 +55,7 @@ int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
slang_assembly_stack_info stk;
/* evaluate left expression */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[0], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -64,7 +65,7 @@ int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
return 0;
/* evaluate right expression */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[1], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -75,7 +76,7 @@ int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
/* push 0 on stack */
file->code[zero_jump].param[0] = file->count;
- if (!slang_assembly_file_push (file, slang_asm_bool_push))
+ if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, (GLfloat) 0))
return 0;
/* the end of the expression */
@@ -88,7 +89,7 @@ int _slang_assemble_logicaland (slang_assembly_file *file, slang_operation *op,
int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
+ slang_assembly_local_info *info, slang_machine *mach, slang_atom_pool *atoms)
{
/*
or:
@@ -105,7 +106,7 @@ int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
slang_assembly_stack_info stk;
/* evaluate left expression */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[0], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -115,7 +116,7 @@ int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
return 0;
/* push 1 on stack */
- if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, 1.0f))
+ if (!slang_assembly_file_push_literal (file, slang_asm_bool_push, (GLfloat) 1))
return 0;
/* jump to the end of the expression */
@@ -125,7 +126,7 @@ int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
/* evaluate right expression */
file->code[right_jump].param[0] = file->count;
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[1], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -139,7 +140,7 @@ int _slang_assemble_logicalor (slang_assembly_file *file, slang_operation *op,
int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
+ slang_assembly_local_info *info, slang_machine *mach, slang_atom_pool *atoms)
{
/*
select:
@@ -156,7 +157,7 @@ int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
slang_assembly_stack_info stk;
/* execute condition expression */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[0], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -166,7 +167,7 @@ int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
return 0;
/* execute true expression */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[1], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -179,7 +180,7 @@ int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
file->code[cond_jump].param[0] = file->count;
/* execute false expression */
- if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[2], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -193,7 +194,7 @@ int _slang_assemble_select (slang_assembly_file *file, slang_operation *op,
int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
+ slang_assembly_local_info *info, slang_machine *mach, slang_atom_pool *atoms)
{
/*
for:
@@ -217,10 +218,10 @@ int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
slang_assembly_stack_info stk;
/* execute initialization statement */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[0], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children, 0, space))
+ if (!_slang_cleanup_stack (file, &op->children[0], 0, space, mach, atoms))
return 0;
/* skip the "go to the end of the loop" and loop-increment statements */
@@ -238,17 +239,17 @@ int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
cont_label = file->count;
/* execute loop-increment statement */
- if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[2], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
+ if (!_slang_cleanup_stack (file, &op->children[2], 0, space, mach, atoms))
return 0;
/* resolve the condition point */
file->code[start_jump].param[0] = file->count;
/* execute condition statement */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[1], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: inspect stk */
@@ -260,10 +261,10 @@ int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
/* execute loop body */
loop_flow.loop_start = cont_label;
loop_flow.loop_end = break_label;
- if (!_slang_assemble_operation (file, op->children + 3, 0, &loop_flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[3], 0, &loop_flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 3, 0, space))
+ if (!_slang_cleanup_stack (file, &op->children[3], 0, space, mach, atoms))
return 0;
/* go to the beginning of the loop */
@@ -281,7 +282,7 @@ int _slang_assemble_for (slang_assembly_file *file, slang_operation *op,
int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
+ slang_assembly_local_info *info, slang_machine *mach, slang_atom_pool *atoms)
{
/*
do:
@@ -327,17 +328,17 @@ int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
/* execute loop body */
loop_flow.loop_start = cont_label;
loop_flow.loop_end = break_label;
- if (!_slang_assemble_operation (file, op->children, 0, &loop_flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[0], 0, &loop_flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children, 0, space))
+ if (!_slang_cleanup_stack (file, &op->children[0], 0, space, mach, atoms))
return 0;
/* resolve condition point */
file->code[cont_jump].param[0] = file->count;
/* execute condition statement */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[1], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
@@ -361,7 +362,7 @@ int _slang_assemble_do (slang_assembly_file *file, slang_operation *op,
int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
+ slang_assembly_local_info *info, slang_machine *mach, slang_atom_pool *atoms)
{
/*
while:
@@ -396,7 +397,7 @@ int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
file->code[skip_jump].param[0] = file->count;
/* execute condition statement */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[0], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
@@ -408,10 +409,10 @@ int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
/* execute loop body */
loop_flow.loop_start = file->code[skip_jump].param[0];
loop_flow.loop_end = break_label;
- if (!_slang_assemble_operation (file, op->children + 1, 0, &loop_flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[1], 0, &loop_flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
+ if (!_slang_cleanup_stack (file, &op->children[1], 0, space, mach, atoms))
return 0;
/* jump to the beginning of the loop */
@@ -429,7 +430,7 @@ int _slang_assemble_while (slang_assembly_file *file, slang_operation *op,
int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
slang_assembly_flow_control *flow, slang_assembly_name_space *space,
- slang_assembly_local_info *info)
+ slang_assembly_local_info *info, slang_machine *mach, slang_atom_pool *atoms)
{
/*
if:
@@ -446,7 +447,7 @@ int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
slang_assembly_stack_info stk;
/* execute condition statement */
- if (!_slang_assemble_operation (file, op->children, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[0], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
@@ -456,10 +457,10 @@ int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
return 0;
/* execute true-statement */
- if (!_slang_assemble_operation (file, op->children + 1, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[1], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 1, 0, space))
+ if (!_slang_cleanup_stack (file, &op->children[1], 0, space, mach, atoms))
return 0;
/* skip if-false statement */
@@ -471,10 +472,10 @@ int _slang_assemble_if (slang_assembly_file *file, slang_operation *op,
file->code[cond_jump].param[0] = file->count;
/* execute false-statement */
- if (!_slang_assemble_operation (file, op->children + 2, 0, flow, space, info, &stk))
+ if (!_slang_assemble_operation (file, &op->children[2], 0, flow, space, info, &stk, mach, atoms))
return 0;
/* TODO: pass-in stk to cleanup */
- if (!_slang_cleanup_stack (file, op->children + 2, 0, space))
+ if (!_slang_cleanup_stack (file, &op->children[2], 0, space, mach, atoms))
return 0;
/* resolve end of if-false statement */