if (!bufs)
return E_OUTOFMEMORY;
This->buffers = bufs;
- if (has_present_buffers) {
- This->present_buffers = REALLOC(This->present_buffers,
- This->present_buffers == NULL ? 0 : oldBufferCount * sizeof(struct pipe_resource *),
- newBufferCount * sizeof(struct pipe_resource *));
- memset(This->present_buffers, 0, newBufferCount * sizeof(struct pipe_resource *));
- }
This->present_handles = REALLOC(This->present_handles,
oldBufferCount * sizeof(D3DWindowBuffer *),
newBufferCount * sizeof(D3DWindowBuffer *));
}
}
+ if (has_present_buffers &&
+ (newBufferCount != oldBufferCount || !This->present_buffers)) {
+ This->present_buffers = REALLOC(This->present_buffers,
+ This->present_buffers == NULL ? 0 :
+ oldBufferCount * sizeof(struct pipe_resource *),
+ newBufferCount * sizeof(struct pipe_resource *));
+ memset(This->present_buffers, 0, newBufferCount * sizeof(struct pipe_resource *));
+ }
+
for (i = 0; i < newBufferCount; ++i) {
tmplt.bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_TRANSFER_READ |
PIPE_BIND_TRANSFER_WRITE | PIPE_BIND_RENDER_TARGET;