Mesa (master): nvc0: enable early fragment tests where possible

Christoph Bumiller chrisbmr at kemper.freedesktop.org
Sat Jan 15 11:19:45 UTC 2011


Module: Mesa
Branch: master
Commit: b50d02e2e0729de101fd0acddeac21cca038786e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b50d02e2e0729de101fd0acddeac21cca038786e

Author: Christoph Bumiller <e0425955 at student.tuwien.ac.at>
Date:   Thu Jan 13 21:03:18 2011 +0100

nvc0: enable early fragment tests where possible

---

 src/gallium/drivers/nvc0/nvc0_program.c      |    7 +++++++
 src/gallium/drivers/nvc0/nvc0_program.h      |    6 +++++-
 src/gallium/drivers/nvc0/nvc0_shader_state.c |    2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/nvc0/nvc0_program.c b/src/gallium/drivers/nvc0/nvc0_program.c
index 3e7fc4d..57a0874 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nvc0/nvc0_program.c
@@ -598,6 +598,13 @@ nvc0_prog_scan(struct nvc0_translation_info *ti)
    case PIPE_SHADER_FRAGMENT:
       ti->input_file = NV_FILE_MEM_V;
       ti->output_file = NV_FILE_GPR;
+
+      if (ti->scan.writes_z)
+         prog->flags[0] = 0x11; /* ? */
+      else
+      if (!ti->global_stores)
+         prog->fp.early_z = 1;
+
       ret = nvc0_fp_gen_header(prog, ti);
       break;
    default:
diff --git a/src/gallium/drivers/nvc0/nvc0_program.h b/src/gallium/drivers/nvc0/nvc0_program.h
index 1271303..2e84cae 100644
--- a/src/gallium/drivers/nvc0/nvc0_program.h
+++ b/src/gallium/drivers/nvc0/nvc0_program.h
@@ -23,12 +23,15 @@ struct nvc0_program {
 
    uint32_t hdr[20];
 
-   uint32_t flags[2]; /* FP_ZORDER */
+   uint32_t flags[2];
 
    struct {
       uint8_t edgeflag;
       uint8_t num_ucps;
    } vp;
+   struct {
+      uint8_t early_z;
+   } fp;
 
    void *relocs;
    unsigned num_relocs;
@@ -66,6 +69,7 @@ struct nvc0_translation_info {
    boolean indirect_inputs;
    boolean indirect_outputs;
    boolean require_stores;
+   boolean global_stores;
    uint32_t *immd32;
    ubyte *immd32_ty;
    unsigned immd32_nr;
diff --git a/src/gallium/drivers/nvc0/nvc0_shader_state.c b/src/gallium/drivers/nvc0/nvc0_shader_state.c
index a6595c5..981b548 100644
--- a/src/gallium/drivers/nvc0/nvc0_shader_state.c
+++ b/src/gallium/drivers/nvc0/nvc0_shader_state.c
@@ -100,7 +100,7 @@ nvc0_fragprog_validate(struct nvc0_context *nvc0)
          return;
 
    BEGIN_RING(chan, RING_3D(EARLY_FRAGMENT_TESTS), 1);
-   OUT_RING  (chan, 0);
+   OUT_RING  (chan, fp->fp.early_z);
    BEGIN_RING(chan, RING_3D(SP_SELECT(5)), 2);
    OUT_RING  (chan, 0x51);
    OUT_RING  (chan, fp->code_base);




More information about the mesa-commit mailing list