prog = standalone_compile_shader(&options, 1, argv);
prog->_LinkedShaders[MESA_SHADER_FRAGMENT]->Program->info.stage = MESA_SHADER_FRAGMENT;
-#if 0
-
- for (unsigned i = 0; i < MESA_SHADER_STAGES; ++i) {
- if (prog->_LinkedShaders[i] == NULL)
- continue;
-
- c_do_mat_op_to_vec(prog->_LinkedShaders[i]->ir);
- }
-
-#endif
-
midgard_program program;
nir = glsl_to_nir(prog, MESA_SHADER_FRAGMENT, &midgard_nir_options);
midgard_compile_shader_nir(nir, &program, true);
int size = program.compiled.size;
dst = program.compiled.data;
- /* Inject an external shader */
-#if 0
- char buf[4096];
-
- if (type != JOB_TYPE_VERTEX) {
- FILE *fp = fopen("/home/alyssa/panfrost/midgard/good.bin", "rb");
- fread(buf, 1, 2816, fp);
- fclose(fp);
- dst = buf;
- size = 2816;
- }
-
-#endif
-
/* Upload the shader. The lookahead tag is ORed on as a tagged pointer.
* I bet someone just thought that would be a cute pun. At least,
* that's how I'd do it. */
int size = program.compiled.size;
uint8_t *dst = program.compiled.data;
-#if 0
- midgard_program program = {
- .work_register_count = 3,
- .first_tag = 9,
- //.blend_patch_offset = 16
- .blend_patch_offset = -1,
- };
-
- char dst[4096];
-
- FILE *fp = fopen("/home/alyssa/panfrost/midgard/blend.bin", "rb");
- fread(dst, 1, 2816, fp);
- fclose(fp);
- int size = 2816;
-#endif
-
/* Hot patch in constant color */
if (program.blend_patch_offset >= 0) {
/* Force a clear XXX wrong? */
if (ctx->last_clear.color)
panfrost_clear(&ctx->base, ctx->last_clear.buffers, ctx->last_clear.color, ctx->last_clear.depth, ctx->last_clear.stencil);
-
-#if 0
- /* Don't consider the buffer dirty */
- ctx->dirty &= ~PAN_DIRTY_CLEAR;
-#endif
}
static void *
return sz;
}
-
-#if 0
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-#define TW 1920
-#define TH 1080
-void
-main()
-{
- panfrost_generate_space_filler_indices();
-
- uint8_t in[TW * TH * 4];
-
- for (int i = 0; i < TW * TH * 4; ++i) in[i] = i;
-
- uint8_t *out = malloc(TW * TH * 4 * 2);
-
- for (int i = 0; i < 60; ++i) {
- //swizzle_bpp4_align16(TW, TH, TW*4, TW>>4, (uint32_t *) in, (uint32_t *) out);
- //panfrost_texture_swizzle_bpp4(TW, TH, TW*4, (uint32_t *) in, (uint32_t *) out);
- //panfrost_texture_swizzle(TW, TH, 4, TW*4, (uint32_t *) in, (uint32_t *) out);
-
- int block_pitch = ALIGN(TW, 16) >> 4;
- swizzle_bpp1_align16(TW, TH, TW, (block_pitch * 256 >> 4), in, (uint8_t *) out);
- }
-
-#if 0
- uint8_t *reference = malloc(TW * TH * 4 * 2);
- panfrost_texture_swizzle(TW, TH, 1, TW, (uint8_t *) in, (uint8_t *) reference);
-
- if (memcmp(reference, out, TW * TH * 4)) printf("XXX\n");
-
-#endif
- printf("ref %X\n", out[0]);
-}
-#endif