#include "util/u_memory.h"
#include "util/u_inlines.h"
#include "util/u_sampler.h"
-#include "util/u_format.h"
+#include "util/format/u_format.h"
#include "tgsi/tgsi_text.h"
#include "pipe-loader/pipe_loader.h"
uint64_t __v[4]; \
int __i, __n; \
\
- __n = ctx->screen->get_compute_param(ctx->screen, c, __v); \
+ __n = ctx->screen->get_compute_param(ctx->screen, \
+ PIPE_SHADER_IR_TGSI, \
+ c, __v); \
printf("%s: {", #c); \
\
for (__i = 0; __i < __n / sizeof(*__v); ++__i) \
char *psrc = preprocess_prog(ctx, src, defs);
int ret;
- ret = tgsi_text_translate(psrc, prog, Elements(prog));
+ ret = tgsi_text_translate(psrc, prog, ARRAY_SIZE(prog));
assert(ret);
free(psrc);
util_format_get_nblocksy(tex->format, tex->height0));
struct pipe_transfer *xfer;
char *map;
- int x, y, i;
+ int x = 0, y, i;
int err = 0;
if (!check)
float v[] = { 1.0, -.75, .50, -.25 };
int i = 0;
- util_format_write_4f(surface_fmts[i], v, 0, p, 0, 0, 0, 1, 1);
+ util_format_pack_rgba(surface_fmts[i], p, v, 1);
}
static void test_surface_ld_init0i(void *p, int s, int x, int y)
int v[] = { 0xffffffff, 0xffff, 0xff, 0xf };
int i = 0;
- util_format_write_4i(surface_fmts[i], v, 0, p, 0, 0, 0, 1, 1);
+ util_format_pack_rgba(surface_fmts[i], p, v, 1);
}
static void test_surface_ld_expectf(void *p, int s, int x, int y)
int i = 0;
test_surface_ld_init0f(v, s, x / 4, y);
- util_format_read_4f(surface_fmts[i], w, 0, v, 0, 0, 0, 1, 1);
+ util_format_unpack_rgba(surface_fmts[i], w, v, 1);
*(float *)p = w[x % 4];
}
int i = 0;
test_surface_ld_init0i(v, s, x / 4, y);
- util_format_read_4i(surface_fmts[i], w, 0, v, 0, 0, 0, 1, 1);
+ util_format_unpack_rgba(surface_fmts[i], w, v, 1);
*(uint32_t *)p = w[x % 4];
}
init_prog(ctx, 0, 0, 0, src, NULL);
- for (i = 0; i < Elements(surface_fmts); i++) {
+ for (i = 0; i < ARRAY_SIZE(surface_fmts); i++) {
bool is_int = util_format_is_pure_integer(surface_fmts[i]);
printf(" - %s\n", util_format_name(surface_fmts[i]));
if (!ctx->screen->is_format_supported(ctx->screen,
- surface_fmts[i], PIPE_TEXTURE_2D, 1,
+ surface_fmts[i], PIPE_TEXTURE_2D, 1, 1,
PIPE_BIND_COMPUTE_RESOURCE)) {
printf("(unsupported)\n");
continue;
for (j = 0; j < 4; j++)
test_surface_st_init0f(&vf[j], s, 4 * x + j, y);
- util_format_write_4f(surface_fmts[i], vf, 0, p, 0, 0, 0, 1, 1);
+ util_format_pack_rgba(surface_fmts[i], p, vf, 1);
}
static void test_surface_st_expects(void *p, int s, int x, int y)
for (j = 0; j < 4; j++)
test_surface_st_init0i(&v[j], s, 4 * x + j, y);
- util_format_write_4i(surface_fmts[i], v, 0, p, 0, 0, 0, 1, 1);
+ util_format_pack_rgba(surface_fmts[i], p, v, 1);
}
static void test_surface_st_expectu(void *p, int s, int x, int y)
for (j = 0; j < 4; j++)
test_surface_st_init0i(&v[j], s, 4 * x + j, y);
- util_format_write_4ui(surface_fmts[i], v, 0, p, 0, 0, 0, 1, 1);
+ util_format_pack_rgba(surface_fmts[i], p, v, 1);
}
static bool test_surface_st_check(void *x, void *y, int sz)
init_prog(ctx, 0, 0, 0, src, NULL);
- for (i = 0; i < Elements(surface_fmts); i++) {
+ for (i = 0; i < ARRAY_SIZE(surface_fmts); i++) {
bool is_signed = (util_format_description(surface_fmts[i])
->channel[0].type == UTIL_FORMAT_TYPE_SIGNED);
bool is_int = util_format_is_pure_integer(surface_fmts[i]);
printf(" - %s\n", util_format_name(surface_fmts[i]));
if (!ctx->screen->is_format_supported(ctx->screen,
- surface_fmts[i], PIPE_TEXTURE_2D, 1,
+ surface_fmts[i], PIPE_TEXTURE_2D, 1, 1,
PIPE_BIND_COMPUTE_RESOURCE)) {
printf("(unsupported)\n");
continue;