85
88
ty = slang_asm_none;
88
/* Calculate the distance from top of the stack to the destination address. As the
89
* copy operation progresses, components of the source are being successively popped
90
* off the stack by the amount of *index increase step.
91
/* Calculate the distance from top of the stack to the destination
92
* address. As the copy operation progresses, components of the
93
* source are being successively popped off the stack by the amount
94
* of *index increase step.
92
96
dst_addr_loc = size - *index;
94
if (!slang_assembly_file_push_label2 (A->file, ty, dst_addr_loc, dst_offset))
98
if (!slang_assembly_file_push_label2
99
(A->file, ty, dst_addr_loc, dst_offset))
96
*index += _slang_sizeof_type (type);
101
*index += _slang_sizeof_type(type);
102
assign_aggregate (slang_assemble_ctx *A, const slang_storage_aggregate *agg, GLuint *index,
108
assign_aggregate(slang_assemble_ctx * A, const slang_storage_aggregate * agg,
109
GLuint * index, GLuint size)
111
117
for (j = 0; j < arr->length; j++) {
112
118
if (arr->type == slang_stor_aggregate) {
113
if (!assign_aggregate (A, arr->aggregate, index, size))
119
if (!assign_aggregate(A, arr->aggregate, index, size))
117
/* When the destination is swizzled, we are forced to do float_copy, even if
118
* vec4 extension is enabled with vec4_copy operation.
123
/* When the destination is swizzled, we are forced to do
124
* float_copy, even if vec4 extension is enabled with
125
* vec4_copy operation.
120
127
if (A->swz.num_components != 0 && arr->type == slang_stor_vec4) {
121
if (!assign_basic (A, slang_stor_float, index, size))
123
if (!assign_basic (A, slang_stor_float, index, size))
125
if (!assign_basic (A, slang_stor_float, index, size))
127
if (!assign_basic (A, slang_stor_float, index, size))
128
if (!assign_basic(A, slang_stor_float, index, size))
130
if (!assign_basic(A, slang_stor_float, index, size))
132
if (!assign_basic(A, slang_stor_float, index, size))
134
if (!assign_basic(A, slang_stor_float, index, size))
131
if (!assign_basic (A, arr->type, index, size))
138
if (!assign_basic(A, arr->type, index, size))
141
GLboolean _slang_assemble_assignment (slang_assemble_ctx *A, slang_operation *op)
150
_slang_assemble_assignment(slang_assemble_ctx * A, const slang_operation * op)
143
slang_assembly_typeinfo ti;
144
GLboolean result = GL_FALSE;
145
slang_storage_aggregate agg;
148
if (!slang_assembly_typeinfo_construct (&ti))
150
if (!_slang_typeof_operation (A, op, &ti))
153
if (!slang_storage_aggregate_construct (&agg))
155
if (!_slang_aggregate_variable (&agg, &ti.spec, 0, A->space.funcs, A->space.structs,
156
A->space.vars, A->mach, A->file, A->atoms))
160
size = _slang_sizeof_aggregate (&agg);
161
result = assign_aggregate (A, &agg, &index, size);
164
slang_storage_aggregate_destruct (&agg);
166
slang_assembly_typeinfo_destruct (&ti);
152
slang_assembly_typeinfo ti;
153
GLboolean result = GL_FALSE;
154
slang_storage_aggregate agg;
157
if (!slang_assembly_typeinfo_construct(&ti))
159
if (!_slang_typeof_operation(A, op, &ti))
162
if (!slang_storage_aggregate_construct(&agg))
164
if (!_slang_aggregate_variable(&agg, &ti.spec, 0, A->space.funcs,
165
A->space.structs, A->space.vars,
166
A->mach, A->file, A->atoms))
170
size = _slang_sizeof_aggregate(&agg);
171
result = assign_aggregate(A, &agg, &index, size);
174
slang_storage_aggregate_destruct(&agg);
176
slang_assembly_typeinfo_destruct(&ti);
171
* _slang_assemble_assign()
173
* Performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=) assignment on the operation's
182
* Performs unary (pre ++ and --) or binary (=, +=, -=, *=, /=)
183
* assignment on the operation's children.
177
GLboolean _slang_assemble_assign (slang_assemble_ctx *A, slang_operation *op, const char *oper,
186
_slang_assemble_assign(slang_assemble_ctx * A, slang_operation * op,
187
const char *oper, slang_ref_type ref)
182
if (ref == slang_ref_forbid)
184
if (!slang_assembly_file_push_label2 (A->file, slang_asm_local_addr, A->local.addr_tmp, 4))
188
if (slang_string_compare ("=", oper) == 0)
190
if (!_slang_assemble_operation (A, &op->children[0], slang_ref_force))
193
if (!_slang_assemble_operation (A, &op->children[1], slang_ref_forbid))
196
if (!_slang_assemble_assignment (A, op->children))
201
if (!_slang_assemble_function_call_name (A, oper, op->children, op->num_children, GL_TRUE))
205
if (ref == slang_ref_forbid)
207
if (!slang_assembly_file_push (A->file, slang_asm_addr_copy))
209
if (!slang_assembly_file_push_label (A->file, slang_asm_local_free, 4))
211
if (!_slang_dereference (A, op->children))
191
if (ref == slang_ref_forbid) {
192
if (!slang_assembly_file_push_label2
193
(A->file, slang_asm_local_addr, A->local.addr_tmp, 4))
197
if (slang_string_compare("=", oper) == 0) {
198
if (!_slang_assemble_operation(A, &op->children[0], slang_ref_force))
201
if (!_slang_assemble_operation(A, &op->children[1], slang_ref_forbid))
204
if (!_slang_assemble_assignment(A, op->children))
208
if (!_slang_assemble_function_call_name
209
(A, oper, op->children, op->num_children, GL_TRUE))
213
if (ref == slang_ref_forbid) {
214
if (!slang_assembly_file_push(A->file, slang_asm_addr_copy))
216
if (!slang_assembly_file_push_label(A->file, slang_asm_local_free, 4))
218
if (!_slang_dereference(A, op->children))