struct pipe_framebuffer_state *fb = &ctx->pipe_framebuffer;
enum pipe_format fmt = PIPE_FORMAT_R8G8B8A8_UNORM;
- if (fb->nr_cbufs > rti)
+ if ((fb->nr_cbufs > rti) && fb->cbufs[rti])
fmt = fb->cbufs[rti]->format;
/* Grab the blend state */
struct midgard_blend_rt rts[4];
- /* TODO: MRT */
-
- for (unsigned i = 0; i < 1; ++i) {
+ for (unsigned i = 0; i < ctx->pipe_framebuffer.nr_cbufs; ++i) {
bool is_srgb =
(ctx->pipe_framebuffer.nr_cbufs > i) &&
+ (ctx->pipe_framebuffer.cbufs[i]) &&
util_format_is_srgb(ctx->pipe_framebuffer.cbufs[i]->format);
rts[i].flags = blend_count;
struct panfrost_job *batch,
struct pipe_surface *surf)
{
+ if (!surf)
+ return;
+
unsigned level = surf->u.tex.level;
struct panfrost_resource *rsrc = pan_resource(surf->texture);
for (int cb = 0; cb < ctx->pipe_framebuffer.nr_cbufs; ++cb) {
struct pipe_surface *surf = ctx->pipe_framebuffer.cbufs[cb];
+
+ if (!surf)
+ continue;
+
unsigned bpp = util_format_get_blocksize(surf->format);
panfrost_mfbd_set_cbuf(&rts[cb], surf);
bool is_bound = false;
for (unsigned c = 0; c < fb->nr_cbufs; ++c) {
- is_bound |= fb->cbufs[c]->texture == resource;
+ /* If cbufs is NULL, we're definitely not bound here */
+
+ if (fb->cbufs[c])
+ is_bound |= fb->cbufs[c]->texture == resource;
}
if (is_bound && (usage & PIPE_TRANSFER_READ)) {