This->base.info.last_level = 0;
This->base.info.array_size = 1;
This->base.info.nr_samples = multisample_type;
+ This->base.info.nr_storage_samples = multisample_type;
This->base.info.usage = PIPE_USAGE_DEFAULT;
This->base.info.bind = PIPE_BIND_SAMPLER_VIEW; /* StretchRect */
if (pDesc->Usage & D3DUSAGE_RENDERTARGET) {
This->base.info.bind |= PIPE_BIND_RENDER_TARGET;
} else if (pDesc->Usage & D3DUSAGE_DEPTHSTENCIL) {
+ if (!depth_stencil_format(pDesc->Format))
+ return D3DERR_INVALIDCALL;
This->base.info.bind = d3d9_get_pipe_depth_format_bindings(pDesc->Format);
if (TextureType)
This->base.info.bind |= PIPE_BIND_SAMPLER_VIEW;
{
DBG("This=%p\n", This);
- if (This->transfer)
- NineSurface9_UnlockRect(This);
+ if (This->transfer) {
+ struct pipe_context *pipe = nine_context_get_pipe_multithread(This->base.base.device);
+ pipe->transfer_unmap(pipe, This->transfer);
+ This->transfer = NULL;
+ }
+ /* Note: Following condition cannot happen currently, since we
+ * refcount the surface in the functions increasing
+ * pending_uploads_counter. */
if (p_atomic_read(&This->pending_uploads_counter))
nine_csmt_process(This->base.base.device);
srgb_format = util_format_srgb(resource->format);
if (srgb_format == PIPE_FORMAT_NONE ||
!screen->is_format_supported(screen, srgb_format,
- resource->target, 0, resource->bind))
+ resource->target, 0, 0, resource->bind))
srgb_format = resource->format;
memset(&templ, 0, sizeof(templ));
return D3D_OK;
}
+/* Currently nine_context uses the NineSurface9
+ * fields when it is render target. Any modification requires
+ * pending commands with the surface to be executed. If the bind
+ * count is 0, there is no pending commands. */
+#define PROCESS_IF_BOUND(surf) \
+ if (surf->base.base.bind) \
+ nine_csmt_process(surf->base.base.device);
+
+void
+NineSurface9_SetResource( struct NineSurface9 *This,
+ struct pipe_resource *resource, unsigned level )
+{
+ /* No need to call PROCESS_IF_BOUND, because SetResource is used only
+ * for MANAGED textures, and they are not render targets. */
+ assert(This->base.pool == D3DPOOL_MANAGED);
+ This->level = level;
+ pipe_resource_reference(&This->base.resource, resource);
+}
+
+void
+NineSurface9_SetMultiSampleType( struct NineSurface9 *This,
+ D3DMULTISAMPLE_TYPE mst )
+{
+ PROCESS_IF_BOUND(This);
+ This->desc.MultiSampleType = mst;
+}
+
void
NineSurface9_SetResourceResize( struct NineSurface9 *This,
struct pipe_resource *resource )
assert(This->desc.Pool == D3DPOOL_DEFAULT);
assert(!This->texture);
+ PROCESS_IF_BOUND(This);
pipe_resource_reference(&This->base.resource, resource);
This->desc.Width = This->base.info.width0 = resource->width0;
This->desc.Height = This->base.info.height0 = resource->height0;
This->base.info.nr_samples = resource->nr_samples;
+ This->base.info.nr_storage_samples = resource->nr_storage_samples;
This->stride = nine_format_get_stride(This->base.info.format,
This->desc.Width);