struct pipe_surface *dst,
const union pipe_color_union *color,
unsigned dstx, unsigned dsty,
- unsigned width, unsigned height)
+ unsigned width, unsigned height,
+ bool render_condition_enabled)
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
nvc0_resource_fence(res, NOUVEAU_BO_WR);
}
- IMMED_NVC0(push, NVC0_3D(COND_MODE), NVC0_3D_COND_MODE_ALWAYS);
+ if (!render_condition_enabled)
+ IMMED_NVC0(push, NVC0_3D(COND_MODE), NVC0_3D_COND_MODE_ALWAYS);
BEGIN_NIC0(push, NVC0_3D(CLEAR_BUFFERS), sf->depth);
for (z = 0; z < sf->depth; ++z) {
(z << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT));
}
- IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode);
+ if (!render_condition_enabled)
+ IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode);
nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER;
}
double depth,
unsigned stencil,
unsigned dstx, unsigned dsty,
- unsigned width, unsigned height)
+ unsigned width, unsigned height,
+ bool render_condition_enabled)
{
struct nvc0_context *nvc0 = nvc0_context(pipe);
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
PUSH_DATA (push, dst->u.tex.first_layer);
IMMED_NVC0(push, NVC0_3D(MULTISAMPLE_MODE), mt->ms_mode);
- IMMED_NVC0(push, NVC0_3D(COND_MODE), NVC0_3D_COND_MODE_ALWAYS);
+ if (!render_condition_enabled)
+ IMMED_NVC0(push, NVC0_3D(COND_MODE), NVC0_3D_COND_MODE_ALWAYS);
BEGIN_NIC0(push, NVC0_3D(CLEAR_BUFFERS), sf->depth);
for (z = 0; z < sf->depth; ++z) {
(z << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT));
}
- IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode);
+ if (!render_condition_enabled)
+ IMMED_NVC0(push, NVC0_3D(COND_MODE), nvc0->cond_condmode);
nvc0->dirty_3d |= NVC0_NEW_3D_FRAMEBUFFER;
}
uint32_t mode = 0;
/* don't need NEW_BLEND, COLOR_MASK doesn't affect CLEAR_BUFFERS */
- if (!nvc0_state_validate(nvc0, NVC0_NEW_3D_FRAMEBUFFER))
+ if (!nvc0_state_validate_3d(nvc0, NVC0_NEW_3D_FRAMEBUFFER))
return;
if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
enum pipe_texture_target target;
struct {
struct pipe_framebuffer_state fb;
+ struct nvc0_window_rect_stateobj window_rect;
struct nvc0_rasterizer_stateobj *rast;
struct nvc0_program *vp;
struct nvc0_program *tcp;
};
static const uint32_t code_gm107[] =
{
- 0xfc0007e0, 0x001f8000, /* sched 0x7e0 0x7e0 0x7e0 */
- 0x0807ff04, 0xefd8ff80, /* ld b64 $r4 a[0x80] 0x0 */
- 0x0907ff00, 0xefd97f80, /* ld b96 $r0 a[0x90] 0x0 */
- 0x0707ff04, 0xeff0ff80, /* st b64 a[0x70] $r4 0x0 */
- 0xfc0007e0, 0x00000000, /* sched 0x7e0 0x7e0 0x0 */
- 0x0807ff00, 0xeff17f80, /* st b96 a[0x80] $r0 0x0 */
+ 0xe4200701, 0x001d0400, /* sched (st 0x1 wr 0x0) (st 0x1 wr 0x1) (st 0x1 wr 0x2) */
+ 0x0807ff00, 0xefd87f80, /* ld b32 $r0 a[0x80] 0x0 */
+ 0x0847ff01, 0xefd87f80, /* ld b32 $r1 a[0x84] 0x0 */
+ 0x0907ff02, 0xefd87f80, /* ld b32 $r2 a[0x90] 0x0 */
+ 0xf0200761, 0x003f8400, /* sched (st 0x1 wr 0x3) (st 0x1 wr 0x4) (st 0x1 wt 0x1) */
+ 0x0947ff03, 0xefd87f80, /* ld b32 $r3 a[0x94] 0x0 */
+ 0x0987ff04, 0xefd87f80, /* ld b32 $r4 a[0x98] 0x0 */
+ 0x0707ff00, 0xeff07f80, /* st b32 a[0x70] $r0 0x0 */
+ 0xfc2017e1, 0x011f8404, /* sched (st 0x1 wt 0x2) (st 0x1 wt 0x4) (st 0x1 wt 0x8) */
+ 0x0747ff01, 0xeff07f80, /* st b32 a[0x74] $r1 0x0 */
+ 0x0807ff02, 0xeff07f80, /* st b32 a[0x80] $r2 0x0 */
+ 0x0847ff03, 0xeff07f80, /* st b32 a[0x84] $r3 0x0 */
+ 0xfde087e1, 0x001f8000, /* sched (st 0x1 wt 0x10) (st 0xf) (st 0x0) */
+ 0x0887ff04, 0xeff07f80, /* st b32 a[0x88] $r4 0x0 */
0x0007000f, 0xe3000000, /* exit */
};
templ.format = format;
templ.u.tex.first_layer = templ.u.tex.last_layer = layer;
templ.u.tex.first_level = templ.u.tex.last_level = level;
- templ.swizzle_r = PIPE_SWIZZLE_RED;
- templ.swizzle_g = PIPE_SWIZZLE_GREEN;
- templ.swizzle_b = PIPE_SWIZZLE_BLUE;
- templ.swizzle_a = PIPE_SWIZZLE_ALPHA;
+ templ.swizzle_r = PIPE_SWIZZLE_X;
+ templ.swizzle_g = PIPE_SWIZZLE_Y;
+ templ.swizzle_b = PIPE_SWIZZLE_Z;
+ templ.swizzle_a = PIPE_SWIZZLE_W;
if (layer == -1) {
templ.u.tex.first_layer = 0;
}
static void
-nvc0_blitctx_pre_blit(struct nvc0_blitctx *ctx)
+nvc0_blitctx_pre_blit(struct nvc0_blitctx *ctx,
+ const struct pipe_blit_info *info)
{
struct nvc0_context *nvc0 = ctx->nvc0;
struct nvc0_blitter *blitter = nvc0->screen->blitter;
ctx->saved.fb.width = nvc0->framebuffer.width;
ctx->saved.fb.height = nvc0->framebuffer.height;
+ ctx->saved.fb.samples = nvc0->framebuffer.samples;
+ ctx->saved.fb.layers = nvc0->framebuffer.layers;
ctx->saved.fb.nr_cbufs = nvc0->framebuffer.nr_cbufs;
ctx->saved.fb.cbufs[0] = nvc0->framebuffer.cbufs[0];
ctx->saved.fb.zsbuf = nvc0->framebuffer.zsbuf;
ctx->saved.fp = nvc0->fragprog;
ctx->saved.min_samples = nvc0->min_samples;
+ ctx->saved.window_rect = nvc0->window_rect;
nvc0->rast = &ctx->rast;
nvc0->gmtyprog = NULL;
nvc0->fragprog = ctx->fp;
+ nvc0->window_rect.rects =
+ MIN2(info->num_window_rectangles, NVC0_MAX_WINDOW_RECTANGLES);
+ nvc0->window_rect.inclusive = info->window_rectangle_include;
+ if (nvc0->window_rect.rects)
+ memcpy(nvc0->window_rect.rect, info->window_rectangles,
+ sizeof(struct pipe_scissor_state) * nvc0->window_rect.rects);
+
for (s = 0; s <= 4; ++s) {
ctx->saved.num_textures[s] = nvc0->num_textures[s];
ctx->saved.num_samplers[s] = nvc0->num_samplers[s];
nvc0->dirty_3d = NVC0_NEW_3D_FRAMEBUFFER | NVC0_NEW_3D_MIN_SAMPLES |
NVC0_NEW_3D_VERTPROG | NVC0_NEW_3D_FRAGPROG |
NVC0_NEW_3D_TCTLPROG | NVC0_NEW_3D_TEVLPROG | NVC0_NEW_3D_GMTYPROG |
- NVC0_NEW_3D_TEXTURES | NVC0_NEW_3D_SAMPLERS;
+ NVC0_NEW_3D_TEXTURES | NVC0_NEW_3D_SAMPLERS | NVC0_NEW_3D_WINDOW_RECTS;
}
static void
nvc0->framebuffer.width = blit->saved.fb.width;
nvc0->framebuffer.height = blit->saved.fb.height;
+ nvc0->framebuffer.samples = blit->saved.fb.samples;
+ nvc0->framebuffer.layers = blit->saved.fb.layers;
nvc0->framebuffer.nr_cbufs = blit->saved.fb.nr_cbufs;
nvc0->framebuffer.cbufs[0] = blit->saved.fb.cbufs[0];
nvc0->framebuffer.zsbuf = blit->saved.fb.zsbuf;
nvc0->fragprog = blit->saved.fp;
nvc0->min_samples = blit->saved.min_samples;
+ nvc0->window_rect = blit->saved.window_rect;
pipe_sampler_view_reference(&nvc0->textures[4][0], NULL);
pipe_sampler_view_reference(&nvc0->textures[4][1], NULL);
nvc0->dirty_3d = blit->saved.dirty_3d |
(NVC0_NEW_3D_FRAMEBUFFER | NVC0_NEW_3D_SCISSOR | NVC0_NEW_3D_SAMPLE_MASK |
NVC0_NEW_3D_RASTERIZER | NVC0_NEW_3D_ZSA | NVC0_NEW_3D_BLEND |
- NVC0_NEW_3D_VIEWPORT |
+ NVC0_NEW_3D_VIEWPORT | NVC0_NEW_3D_WINDOW_RECTS |
NVC0_NEW_3D_TEXTURES | NVC0_NEW_3D_SAMPLERS |
NVC0_NEW_3D_VERTPROG | NVC0_NEW_3D_FRAGPROG |
NVC0_NEW_3D_TCTLPROG | NVC0_NEW_3D_TEVLPROG | NVC0_NEW_3D_GMTYPROG |
blit->render_condition_enable = info->render_condition_enable;
nvc0_blit_select_fp(blit, info);
- nvc0_blitctx_pre_blit(blit);
+ nvc0_blitctx_pre_blit(blit, info);
nvc0_blit_set_dst(blit, dst, info->dst.level, -1, info->dst.format);
nvc0_blit_set_src(blit, src, info->src.level, -1, info->src.format,
nvc0_blitctx_prepare_state(blit);
- nvc0_state_validate(nvc0, ~0);
+ nvc0_state_validate_3d(nvc0, ~0);
x_range = (float)info->src.box.width / (float)info->dst.box.width;
y_range = (float)info->src.box.height / (float)info->dst.box.height;
x0 = (float)info->src.box.x - x_range * (float)info->dst.box.x;
y0 = (float)info->src.box.y - y_range * (float)info->dst.box.y;
- x1 = x0 + 16384.0f * x_range;
- y1 = y0 + 16384.0f * y_range;
+ x1 = x0 + 32768.0f * x_range;
+ y1 = y0 + 32768.0f * y_range;
x0 *= (float)(1 << nv50_miptree(src)->ms_x);
x1 *= (float)(1 << nv50_miptree(src)->ms_x);
NVC0_3D_VERTEX_ATTRIB_FORMAT_SIZE_32 |
NVC0_3D_VERTEX_ATTRIB_FORMAT_CONST);
}
+ for (i = 1; i < n; ++i)
+ IMMED_NVC0(push, NVC0_3D(VERTEX_ARRAY_FETCH(i)), 0);
if (nvc0->state.instance_elts) {
nvc0->state.instance_elts = 0;
BEGIN_NVC0(push, NVC0_3D(MACRO_VERTEX_ARRAY_PER_INSTANCE), 2);
}
nvc0->state.num_vtxelts = 2;
+ if (nvc0->state.prim_restart) {
+ IMMED_NVC0(push, NVC0_3D(PRIM_RESTART_ENABLE), 0);
+ nvc0->state.prim_restart = 0;
+ }
+
+ if (nvc0->state.index_bias) {
+ IMMED_NVC0(push, NVC0_3D(VB_ELEMENT_BASE), 0);
+ IMMED_NVC0(push, NVC0_3D(VERTEX_ID_BASE), 0);
+ nvc0->state.index_bias = 0;
+ }
+
for (i = 0; i < info->dst.box.depth; ++i, z += dz) {
if (info->dst.box.z + i) {
BEGIN_NVC0(push, NVC0_3D(LAYER), 1);
*(vbuf++) = fui(y0);
*(vbuf++) = fui(z);
- *(vbuf++) = fui(16384 << nv50_miptree(dst)->ms_x);
+ *(vbuf++) = fui(32768 << nv50_miptree(dst)->ms_x);
*(vbuf++) = fui(0.0f);
*(vbuf++) = fui(x1);
*(vbuf++) = fui(y0);
*(vbuf++) = fui(z);
*(vbuf++) = fui(0.0f);
- *(vbuf++) = fui(16384 << nv50_miptree(dst)->ms_y);
+ *(vbuf++) = fui(32768 << nv50_miptree(dst)->ms_y);
*(vbuf++) = fui(x0);
*(vbuf++) = fui(y1);
*(vbuf++) = fui(z);
info->src.box.height != -info->dst.box.height))
eng3d = true;
+ if (info->num_window_rectangles > 0 || info->window_rectangle_include)
+ eng3d = true;
+
if (nvc0->screen->num_occlusion_queries_active)
IMMED_NVC0(push, NVC0_3D(SAMPLECNT_ENABLE), 0);
}
}
+ pipe_mutex_destroy(blitter->mutex);
FREE(blitter);
}