if (str_match_nocase_whole(&cur, "ATOMIC")) {
decl.Declaration.Atomic = 1;
ctx->cur = cur;
+ } else if (str_match_nocase_whole(&cur, "SHARED")) {
+ decl.Declaration.Shared = 1;
+ ctx->cur = cur;
}
} else {
if (str_match_nocase_whole(&cur, "LOCAL")) {
unsigned nr_instructions;
struct ureg_tokens domain[2];
+
+ bool use_shared_memory;
};
static union tgsi_any_token error_tokens[32];
return reg;
}
+/* Allocate a shared memory area.
+ */
+struct ureg_src ureg_DECL_shared_memory(struct ureg_program *ureg)
+{
+ struct ureg_src reg = ureg_src_register(TGSI_FILE_MEMORY, 0);
+
+ ureg->use_shared_memory = true;
+ return reg;
+}
+
static int
match_or_expand_immediate64( const unsigned *v,
int type,
out[1].decl_range.Last = index;
}
+static void
+emit_decl_shared_memory(struct ureg_program *ureg)
+{
+ union tgsi_any_token *out = get_tokens(ureg, DOMAIN_DECL, 2);
+
+ out[0].value = 0;
+ out[0].decl.Type = TGSI_TOKEN_TYPE_DECLARATION;
+ out[0].decl.NrTokens = 2;
+ out[0].decl.File = TGSI_FILE_MEMORY;
+ out[0].decl.UsageMask = TGSI_WRITEMASK_XYZW;
+ out[0].decl.Shared = true;
+
+ out[1].value = 0;
+ out[1].decl_range.First = 0;
+ out[1].decl_range.Last = 0;
+}
+
static void
emit_immediate( struct ureg_program *ureg,
const unsigned *v,
emit_decl_buffer(ureg, ureg->buffer[i].index, ureg->buffer[i].atomic);
}
+ if (ureg->use_shared_memory)
+ emit_decl_shared_memory(ureg);
+
if (ureg->const_decls.nr_constant_ranges) {
for (i = 0; i < ureg->const_decls.nr_constant_ranges; i++) {
emit_decl_range(ureg,
struct ureg_src
ureg_DECL_buffer(struct ureg_program *ureg, unsigned nr, bool atomic);
+struct ureg_src
+ureg_DECL_shared_memory(struct ureg_program *ureg);
+
static inline struct ureg_src
ureg_imm4f( struct ureg_program *ureg,
float a, float b,
TGSI_FILE_IMAGE =10,
TGSI_FILE_SAMPLER_VIEW =11,
TGSI_FILE_BUFFER =12,
+ TGSI_FILE_MEMORY =13,
TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */
};
unsigned Local : 1; /**< optimize as subroutine local variable? */
unsigned Array : 1; /**< extra array info? */
unsigned Atomic : 1; /**< atomic only? for TGSI_FILE_BUFFER */
- unsigned Padding : 5;
+ unsigned Shared : 1; /**< shared storage for TGSI_FILE_MEMORY */
+ unsigned Padding : 4;
};
struct tgsi_declaration_range