All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] st/mesa: treat resource-less xfb buffers as if they weren't there
@ 2015-02-14  6:46 Ilia Mirkin
       [not found] ` <1423896362-6808-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Ilia Mirkin @ 2015-02-14  6:46 UTC (permalink / raw)
  To: mesa-dev, nouveau

If a transform feedback buffer's size is 0, st_bufferobj_data doesn't
end up creating a buffer for it. There's no point in trying to write to
such a buffer, so just pretend as if it's not really there.

This fixes arb_gpu_shader5-xfb-streams-without-invocations on nvc0.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
---
 src/mesa/state_tracker/st_cb_xformfb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_cb_xformfb.c b/src/mesa/state_tracker/st_cb_xformfb.c
index 8f75eda..a2bd86a 100644
--- a/src/mesa/state_tracker/st_cb_xformfb.c
+++ b/src/mesa/state_tracker/st_cb_xformfb.c
@@ -122,7 +122,7 @@ st_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
    for (i = 0; i < max_num_targets; i++) {
       struct st_buffer_object *bo = st_buffer_object(sobj->base.Buffers[i]);
 
-      if (bo) {
+      if (bo && bo->buffer) {
          /* Check whether we need to recreate the target. */
          if (!sobj->targets[i] ||
              sobj->targets[i] == sobj->draw_count ||
-- 
2.0.5

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] nvc0: allow holes in xfb target lists
       [not found] ` <1423896362-6808-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
@ 2015-02-14  6:46   ` Ilia Mirkin
  2015-02-14 19:33   ` [Mesa-dev] [PATCH 1/2] st/mesa: treat resource-less xfb buffers as if they weren't there Marek Olšák
  1 sibling, 0 replies; 3+ messages in thread
From: Ilia Mirkin @ 2015-02-14  6:46 UTC (permalink / raw)
  To: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Tested with a modified xfb-streams test which outputs to streams 0, 2,
and 3.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
---
 src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c | 9 ++++++++-
 src/gallium/drivers/nouveau/nvc0/nvc0_state.c        | 8 +++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
index 1000d82..516b33b 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_shader_state.c
@@ -252,7 +252,12 @@ nvc0_tfb_validate(struct nvc0_context *nvc0)
 
    for (b = 0; b < nvc0->num_tfbbufs; ++b) {
       struct nvc0_so_target *targ = nvc0_so_target(nvc0->tfbbuf[b]);
-      struct nv04_resource *buf = nv04_resource(targ->pipe.buffer);
+      struct nv04_resource *buf;
+
+      if (!targ) {
+         IMMED_NVC0(push, NVC0_3D(TFB_BUFFER_ENABLE(b)), 0);
+         continue;
+      }
 
       if (tfb)
          targ->stride = tfb->stride[b];
@@ -260,6 +265,8 @@ nvc0_tfb_validate(struct nvc0_context *nvc0)
       if (!(nvc0->tfbbuf_dirty & (1 << b)))
          continue;
 
+      buf = nv04_resource(targ->pipe.buffer);
+
       if (!targ->clean)
          nvc0_query_fifo_wait(push, targ->pq);
       BEGIN_NVC0(push, NVC0_3D(TFB_BUFFER_ENABLE(b)), 5);
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
index b6666ca..dca06f4 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_state.c
@@ -1089,9 +1089,11 @@ nvc0_set_transform_feedback_targets(struct pipe_context *pipe,
       pipe_so_target_reference(&nvc0->tfbbuf[i], targets[i]);
    }
    for (; i < nvc0->num_tfbbufs; ++i) {
-      nvc0->tfbbuf_dirty |= 1 << i;
-      nvc0_so_target_save_offset(pipe, nvc0->tfbbuf[i], i, &serialize);
-      pipe_so_target_reference(&nvc0->tfbbuf[i], NULL);
+      if (nvc0->tfbbuf[i]) {
+         nvc0->tfbbuf_dirty |= 1 << i;
+         nvc0_so_target_save_offset(pipe, nvc0->tfbbuf[i], i, &serialize);
+         pipe_so_target_reference(&nvc0->tfbbuf[i], NULL);
+      }
    }
    nvc0->num_tfbbufs = num_targets;
 
-- 
2.0.5

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Mesa-dev] [PATCH 1/2] st/mesa: treat resource-less xfb buffers as if they weren't there
       [not found] ` <1423896362-6808-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
  2015-02-14  6:46   ` [PATCH 2/2] nvc0: allow holes in xfb target lists Ilia Mirkin
@ 2015-02-14 19:33   ` Marek Olšák
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Olšák @ 2015-02-14 19:33 UTC (permalink / raw)
  To: Ilia Mirkin; +Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, nouveau

Reviewed-by: Marek Olšák <marek.olsak@amd.com>

Marek

On Sat, Feb 14, 2015 at 7:46 AM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> If a transform feedback buffer's size is 0, st_bufferobj_data doesn't
> end up creating a buffer for it. There's no point in trying to write to
> such a buffer, so just pretend as if it's not really there.
>
> This fixes arb_gpu_shader5-xfb-streams-without-invocations on nvc0.
>
> Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
> ---
>  src/mesa/state_tracker/st_cb_xformfb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_cb_xformfb.c b/src/mesa/state_tracker/st_cb_xformfb.c
> index 8f75eda..a2bd86a 100644
> --- a/src/mesa/state_tracker/st_cb_xformfb.c
> +++ b/src/mesa/state_tracker/st_cb_xformfb.c
> @@ -122,7 +122,7 @@ st_begin_transform_feedback(struct gl_context *ctx, GLenum mode,
>     for (i = 0; i < max_num_targets; i++) {
>        struct st_buffer_object *bo = st_buffer_object(sobj->base.Buffers[i]);
>
> -      if (bo) {
> +      if (bo && bo->buffer) {
>           /* Check whether we need to recreate the target. */
>           if (!sobj->targets[i] ||
>               sobj->targets[i] == sobj->draw_count ||
> --
> 2.0.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-14 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-14  6:46 [PATCH 1/2] st/mesa: treat resource-less xfb buffers as if they weren't there Ilia Mirkin
     [not found] ` <1423896362-6808-1-git-send-email-imirkin-FrUbXkNCsVf2fBVCVOL8/A@public.gmane.org>
2015-02-14  6:46   ` [PATCH 2/2] nvc0: allow holes in xfb target lists Ilia Mirkin
2015-02-14 19:33   ` [Mesa-dev] [PATCH 1/2] st/mesa: treat resource-less xfb buffers as if they weren't there Marek Olšák

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.