/**************************************************************************
- *
+ *
* Copyright 2009-2010 VMware, Inc.
* 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"), to deal in the Software without restriction, including
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
- *
+ *
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
- *
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
+ *
**************************************************************************/
}
-struct ureg_src
+struct ureg_src
ureg_DECL_vs_input( struct ureg_program *ureg,
unsigned index )
{
}
-struct ureg_dst
+struct ureg_dst
ureg_DECL_output(struct ureg_program *ureg,
enum tgsi_semantic name,
unsigned index)
for (i = 0; i < ureg->nr_samplers; i++)
if (ureg->sampler[i].Index == (int)nr)
return ureg->sampler[i];
-
+
if (i < PIPE_MAX_SAMPLERS) {
ureg->sampler[i] = ureg_src_register( TGSI_FILE_SAMPLER, nr );
ureg->nr_samplers++;
assert(src.File != TGSI_FILE_NULL);
assert(src.File < TGSI_FILE_COUNT);
-
+
out[n].value = 0;
out[n].src.File = src.File;
out[n].src.SwizzleX = src.SwizzleX;
}
-void
+void
ureg_emit_dst( struct ureg_program *ureg,
struct ureg_dst dst )
{
out[n].dst.Indirect = dst.Indirect;
out[n].dst.Index = dst.Index;
n++;
-
+
if (dst.Indirect) {
out[n].value = 0;
out[n].ind.File = dst.IndirectFile;
struct ureg_emit_insn_result result;
validate( opcode, num_dst, num_src );
-
+
out = get_tokens( ureg, DOMAIN_INSN, count );
out[0].insn = tgsi_default_instruction();
out[0].insn.Opcode = opcode;
out[0].value = 0;
out[0].insn_texture_offset = *offset;
-
}
void
}
for (i = 0; i < ureg->nr_samplers; i++) {
- emit_decl_range( ureg,
+ emit_decl_range( ureg,
TGSI_FILE_SAMPLER,
ureg->sampler[i].Index, 1 );
}
static void copy_instructions( struct ureg_program *ureg )
{
unsigned nr_tokens = ureg->domain[DOMAIN_INSN].count;
- union tgsi_any_token *out = get_tokens( ureg,
- DOMAIN_DECL,
+ union tgsi_any_token *out = get_tokens( ureg,
+ DOMAIN_DECL,
nr_tokens );
- memcpy(out,
- ureg->domain[DOMAIN_INSN].tokens,
+ memcpy(out,
+ ureg->domain[DOMAIN_INSN].tokens,
nr_tokens * sizeof out[0] );
}
emit_decls( ureg );
copy_instructions( ureg );
fixup_header_size( ureg );
-
+
if (ureg->domain[0].tokens == error_tokens ||
ureg->domain[1].tokens == error_tokens) {
debug_printf("%s: error in generated shader\n", __FUNCTION__);
tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token;
if (0) {
- debug_printf("%s: emitted shader %d tokens:\n", __FUNCTION__,
+ debug_printf("%s: emitted shader %d tokens:\n", __FUNCTION__,
ureg->domain[DOMAIN_DECL].count);
tgsi_dump( tokens, 0 );
}
}
#endif
-
+
return tokens;
}
tokens = &ureg->domain[DOMAIN_DECL].tokens[0].token;
- if (nr_tokens)
+ if (nr_tokens)
*nr_tokens = ureg->domain[DOMAIN_DECL].count;
ureg->domain[DOMAIN_DECL].tokens = 0;
unsigned i;
for (i = 0; i < ARRAY_SIZE(ureg->domain); i++) {
- if (ureg->domain[i].tokens &&
+ if (ureg->domain[i].tokens &&
ureg->domain[i].tokens != error_tokens)
FREE(ureg->domain[i].tokens);
}