NineUnknown_ConvertRefToBind(NineUnknown(This->state.rt[i]));
}
+ /* Initialize a dummy VBO to be used when a a vertex declaration does not
+ * specify all the inputs needed by vertex shader, on win default behavior
+ * is to pass 0,0,0,0 to the shader */
+ {
+ struct pipe_transfer *transfer;
+ struct pipe_resource tmpl;
+ struct pipe_box box;
+ unsigned char *data;
+
+ tmpl.target = PIPE_BUFFER;
+ tmpl.format = PIPE_FORMAT_R8_UNORM;
+ tmpl.width0 = 16; /* 4 floats */
+ tmpl.height0 = 1;
+ tmpl.depth0 = 1;
+ tmpl.array_size = 1;
+ tmpl.last_level = 0;
+ tmpl.nr_samples = 0;
+ tmpl.usage = PIPE_USAGE_DEFAULT;
+ tmpl.bind = PIPE_BIND_VERTEX_BUFFER | PIPE_BIND_TRANSFER_WRITE;
+ tmpl.flags = 0;
+ This->dummy_vbo = pScreen->resource_create(pScreen, &tmpl);
+
+ if (!This->dummy_vbo)
+ return D3DERR_OUTOFVIDEOMEMORY;
+
+ u_box_1d(0, 16, &box);
+ data = This->pipe->transfer_map(This->pipe, This->dummy_vbo, 0,
+ PIPE_TRANSFER_WRITE |
+ PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE,
+ &box, &transfer);
+ assert(data);
+ assert(transfer);
+ memset(data, 0, 16);
+ This->pipe->transfer_unmap(This->pipe, transfer);
+ }
+
This->cursor.software = FALSE;
This->cursor.hotspot.x = -1;
This->cursor.hotspot.y = -1;
return E_OUTOFMEMORY;
if (strstr(pScreen->get_name(pScreen), "AMD") ||
- strstr(pScreen->get_name(pScreen), "ATI"))
+ strstr(pScreen->get_name(pScreen), "ATI")) {
This->prefer_user_constbuf = TRUE;
+ This->driver_bugs.buggy_barycentrics = TRUE;
+ }
tmpl.target = PIPE_BUFFER;
tmpl.format = PIPE_FORMAT_R8_UNORM;
return E_OUTOFMEMORY;
}
+ /* allocate dummy texture/sampler for when there are missing ones bound */
+ {
+ struct pipe_resource tmplt;
+ struct pipe_sampler_view templ;
+
+ tmplt.target = PIPE_TEXTURE_2D;
+ tmplt.width0 = 1;
+ tmplt.height0 = 1;
+ tmplt.depth0 = 1;
+ tmplt.last_level = 0;
+ tmplt.array_size = 1;
+ tmplt.usage = PIPE_USAGE_DEFAULT;
+ tmplt.flags = 0;
+ tmplt.format = PIPE_FORMAT_B8G8R8A8_UNORM;
+ tmplt.bind = PIPE_BIND_SAMPLER_VIEW;
+ tmplt.nr_samples = 0;
+
+ This->dummy_texture = This->screen->resource_create(This->screen, &tmplt);
+ if (!This->dummy_texture)
+ return D3DERR_DRIVERINTERNALERROR;
+
+ templ.format = PIPE_FORMAT_B8G8R8A8_UNORM;
+ templ.u.tex.first_layer = 0;
+ templ.u.tex.last_layer = 0;
+ templ.u.tex.first_level = 0;
+ templ.u.tex.last_level = 0;
+ templ.swizzle_r = PIPE_SWIZZLE_ZERO;
+ templ.swizzle_g = PIPE_SWIZZLE_ZERO;
+ templ.swizzle_b = PIPE_SWIZZLE_ZERO;
+ templ.swizzle_a = PIPE_SWIZZLE_ONE;
+ templ.target = This->dummy_texture->target;
+
+ This->dummy_sampler = This->pipe->create_sampler_view(This->pipe, This->dummy_texture, &templ);
+ if (!This->dummy_sampler)
+ return D3DERR_DRIVERINTERNALERROR;
+ }
+
/* Allocate upload helper for drivers that suck (from st pov ;). */
{
unsigned bind = 0;
nine_bind(&This->record, NULL);
+ pipe_sampler_view_reference(&This->dummy_sampler, NULL);
+ pipe_resource_reference(&This->dummy_texture, NULL);
pipe_resource_reference(&This->constbuf_vs, NULL);
pipe_resource_reference(&This->constbuf_ps, NULL);
+ pipe_resource_reference(&This->dummy_vbo, NULL);
FREE(This->state.vs_const_f);
FREE(This->state.ps_const_f);
FREE(This->state.vs_lconstf_temp);
(pSourceRect->left <= pSourceRect->right &&
pSourceRect->top <= pSourceRect->bottom), D3DERR_INVALIDCALL);
+ memset(&blit, 0, sizeof(blit));
blit.dst.resource = dst_res;
blit.dst.level = dst->level;
blit.dst.box.z = dst->layer;
rt_mask |= 1 << i;
}
+ /* fast path, clears everything at once */
if (!Count &&
(!(bufs & PIPE_CLEAR_COLOR) || (rt_mask == This->state.rt_mask)) &&
- rect.x1 == 0 && rect.x2 >= This->state.fb.width &&
- rect.y1 == 0 && rect.y2 >= This->state.fb.height) {
- /* fast path, clears everything at once */
- DBG("fast path\n");
+ rect.x1 == 0 && rect.y1 == 0 &&
+ /* Case we clear only render target. Check clear region vs rt. */
+ ((!(bufs & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) &&
+ rect.x2 >= This->state.fb.width &&
+ rect.y2 >= This->state.fb.height) ||
+ /* Case we clear depth buffer (and eventually rt too).
+ * depth buffer size is always >= rt size. Compare to clear region */
+ ((bufs & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) &&
+ This->state.fb.zsbuf != NULL &&
+ rect.x2 >= zsbuf_surf->desc.Width &&
+ rect.y2 >= zsbuf_surf->desc.Height))) {
+ DBG("Clear fast path\n");
pipe->clear(pipe, bufs, &rgba, Z, Stencil);
return D3D_OK;
}
desc = util_format_description(dst->format);
user_assert(desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS, D3DERR_INVALIDCALL);
+ memset(&blit, 0, sizeof(blit));
blit.src.resource = src;
blit.src.level = 0;
blit.src.format = src->format;
Stage == D3DDMAPSAMPLER ||
(Stage >= D3DVERTEXTEXTURESAMPLER0 &&
Stage <= D3DVERTEXTEXTURESAMPLER3), D3DERR_INVALIDCALL);
- user_assert(!tex || tex->base.pool != D3DPOOL_SCRATCH, D3DERR_INVALIDCALL);
-
- if (unlikely(tex && tex->base.pool == D3DPOOL_SYSTEMMEM)) {
- /* TODO: Currently not implemented. Better return error
- * with message telling what's wrong */
- ERR("This=%p D3DPOOL_SYSTEMMEM not implemented for SetTexture\n", This);
- user_assert(tex->base.pool != D3DPOOL_SYSTEMMEM, D3DERR_INVALIDCALL);
- }
+ user_assert(!tex || (tex->base.pool != D3DPOOL_SCRATCH &&
+ tex->base.pool != D3DPOOL_SYSTEMMEM), D3DERR_INVALIDCALL);
if (Stage >= D3DDMAPSAMPLER)
Stage = Stage - D3DDMAPSAMPLER + NINE_MAX_SAMPLERS_PS;