nvc0: only force early fragment tests if requested by shader
This commit is contained in:
@@ -84,7 +84,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
#define NVC0_3D_LINE_WIDTH_SEPARATE 0x0000020c
|
||||
|
||||
#define NVC0_3D_EARLY_FRAGMENT_TESTS 0x00000210
|
||||
#define NVC0_3D_FORCE_EARLY_FRAGMENT_TESTS 0x00000210
|
||||
|
||||
#define NVC0_3D_MEM_BARRIER 0x0000021c
|
||||
#define NVC0_3D_MEM_BARRIER_UNK0 0x00000001
|
||||
|
||||
@@ -78,7 +78,7 @@ struct nvc0_context {
|
||||
struct {
|
||||
boolean flushed;
|
||||
boolean rasterizer_discard;
|
||||
boolean early_z;
|
||||
boolean early_z_forced;
|
||||
boolean prim_restart;
|
||||
uint32_t instance_elts; /* bitmask of per-instance elements */
|
||||
uint32_t instance_base;
|
||||
|
||||
@@ -479,10 +479,6 @@ nvc0_fp_gen_header(struct nvc0_program *fp, struct nv50_ir_prog_info *info)
|
||||
}
|
||||
|
||||
fp->fp.early_z = info->prop.fp.earlyFragTests;
|
||||
if (fp->fp.early_z == FALSE && fp->code_size >= 0x400)
|
||||
fp->fp.early_z = !(info->prop.fp.writesDepth ||
|
||||
info->prop.fp.usesDiscard ||
|
||||
(info->io.globalAccess & 2));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -110,6 +110,11 @@ nvc0_fragprog_validate(struct nvc0_context *nvc0)
|
||||
return;
|
||||
nvc0_program_update_context_state(nvc0, fp, 4);
|
||||
|
||||
if (fp->fp.early_z != nvc0->state.early_z_forced) {
|
||||
nvc0->state.early_z_forced = fp->fp.early_z;
|
||||
IMMED_NVC0(push, NVC0_3D(FORCE_EARLY_FRAGMENT_TESTS), fp->fp.early_z);
|
||||
}
|
||||
|
||||
BEGIN_NVC0(push, NVC0_3D(SP_SELECT(5)), 2);
|
||||
PUSH_DATA (push, 0x51);
|
||||
PUSH_DATA (push, fp->code_base);
|
||||
|
||||
@@ -442,16 +442,8 @@ static void
|
||||
nvc0_validate_derived_1(struct nvc0_context *nvc0)
|
||||
{
|
||||
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
|
||||
boolean early_z;
|
||||
boolean rasterizer_discard;
|
||||
|
||||
early_z = nvc0->fragprog->fp.early_z && !nvc0->zsa->pipe.alpha.enabled;
|
||||
|
||||
if (early_z != nvc0->state.early_z) {
|
||||
nvc0->state.early_z = early_z;
|
||||
IMMED_NVC0(push, NVC0_3D(EARLY_FRAGMENT_TESTS), early_z);
|
||||
}
|
||||
|
||||
rasterizer_discard = (!nvc0->fragprog || !nvc0->fragprog->hdr[18]) &&
|
||||
!nvc0->zsa->pipe.depth.enabled && !nvc0->zsa->pipe.stencil[0].enabled;
|
||||
rasterizer_discard = rasterizer_discard ||
|
||||
|
||||
Reference in New Issue
Block a user