nvc0: enable early fragment tests where possible
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Thu, 13 Jan 2011 20:03:18 +0000 (21:03 +0100)
committerChristoph Bumiller <e0425955@student.tuwien.ac.at>
Sat, 15 Jan 2011 11:17:57 +0000 (12:17 +0100)
src/gallium/drivers/nvc0/nvc0_program.c
src/gallium/drivers/nvc0/nvc0_program.h
src/gallium/drivers/nvc0/nvc0_shader_state.c

index 3e7fc4d350e4e2bdde36464e124afb2e343159d9..57a0874e679c003d3fcd1b136acdfb6ed0ee49c9 100644 (file)
@@ -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:
index 1271303144ed533a5d0fc8bcb41dfa8c8053cdfe..2e84caecc9eead8de24edb40f8ec3725c1473c56 100644 (file)
@@ -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;
index a6595c5610615a5b01f9499c10197a14aa694193..981b5488d088be36110265a5990c9d0403fb3859 100644 (file)
@@ -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);