summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/panfrost/pan_blend_cso.c2
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c5
-rw-r--r--src/gallium/drivers/panfrost/pan_fragment.c3
-rw-r--r--src/gallium/drivers/panfrost/pan_mfbd.c4
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c5
5 files changed, 14 insertions, 5 deletions
diff --git a/src/gallium/drivers/panfrost/pan_blend_cso.c b/src/gallium/drivers/panfrost/pan_blend_cso.c
index 5055d2d854e..a96e7b02cd4 100644
--- a/src/gallium/drivers/panfrost/pan_blend_cso.c
+++ b/src/gallium/drivers/panfrost/pan_blend_cso.c
@@ -212,7 +212,7 @@ panfrost_get_blend_for_context(struct panfrost_context *ctx, unsigned rti)
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 */
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index d01503e43a9..06943c22b44 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1213,11 +1213,10 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
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;
diff --git a/src/gallium/drivers/panfrost/pan_fragment.c b/src/gallium/drivers/panfrost/pan_fragment.c
index 7ffb9db0a05..023569ef204 100644
--- a/src/gallium/drivers/panfrost/pan_fragment.c
+++ b/src/gallium/drivers/panfrost/pan_fragment.c
@@ -35,6 +35,9 @@ panfrost_initialize_surface(
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);
diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c
index e3595af4cf1..c9f3dc315a0 100644
--- a/src/gallium/drivers/panfrost/pan_mfbd.c
+++ b/src/gallium/drivers/panfrost/pan_mfbd.c
@@ -403,6 +403,10 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool has_draws)
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);
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index d3cbfe70c77..3f8d50cad73 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -507,7 +507,10 @@ panfrost_transfer_map(struct pipe_context *pctx,
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)) {