wined3d: Move the draw buffer array to the context.
This commit is contained in:
parent
3ad82a82bb
commit
237f39377f
|
@ -1408,6 +1408,10 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
|
||||||
gl_info->limits.buffers * sizeof(*ret->blit_targets));
|
gl_info->limits.buffers * sizeof(*ret->blit_targets));
|
||||||
if (!ret->blit_targets) goto out;
|
if (!ret->blit_targets) goto out;
|
||||||
|
|
||||||
|
ret->draw_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
|
gl_info->limits.buffers * sizeof(*ret->draw_buffers));
|
||||||
|
if (!ret->draw_buffers) goto out;
|
||||||
|
|
||||||
ret->free_occlusion_query_size = 4;
|
ret->free_occlusion_query_size = 4;
|
||||||
ret->free_occlusion_queries = HeapAlloc(GetProcessHeap(), 0,
|
ret->free_occlusion_queries = HeapAlloc(GetProcessHeap(), 0,
|
||||||
ret->free_occlusion_query_size * sizeof(*ret->free_occlusion_queries));
|
ret->free_occlusion_query_size * sizeof(*ret->free_occlusion_queries));
|
||||||
|
@ -1558,6 +1562,7 @@ struct wined3d_context *context_create(IWineD3DSwapChainImpl *swapchain, IWineD3
|
||||||
out:
|
out:
|
||||||
HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
|
HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
|
||||||
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
|
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
|
||||||
|
HeapFree(GetProcessHeap(), 0, ret->draw_buffers);
|
||||||
HeapFree(GetProcessHeap(), 0, ret->blit_targets);
|
HeapFree(GetProcessHeap(), 0, ret->blit_targets);
|
||||||
HeapFree(GetProcessHeap(), 0, ret->pshader_const_dirty);
|
HeapFree(GetProcessHeap(), 0, ret->pshader_const_dirty);
|
||||||
HeapFree(GetProcessHeap(), 0, ret->vshader_const_dirty);
|
HeapFree(GetProcessHeap(), 0, ret->vshader_const_dirty);
|
||||||
|
@ -1593,6 +1598,7 @@ void context_destroy(IWineD3DDeviceImpl *This, struct wined3d_context *context)
|
||||||
destroy = FALSE;
|
destroy = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(), 0, context->draw_buffers);
|
||||||
HeapFree(GetProcessHeap(), 0, context->blit_targets);
|
HeapFree(GetProcessHeap(), 0, context->blit_targets);
|
||||||
HeapFree(GetProcessHeap(), 0, context->vshader_const_dirty);
|
HeapFree(GetProcessHeap(), 0, context->vshader_const_dirty);
|
||||||
HeapFree(GetProcessHeap(), 0, context->pshader_const_dirty);
|
HeapFree(GetProcessHeap(), 0, context->pshader_const_dirty);
|
||||||
|
@ -1953,19 +1959,19 @@ static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit
|
||||||
for (i = 0; i < gl_info->limits.buffers; ++i)
|
for (i = 0; i < gl_info->limits.buffers; ++i)
|
||||||
{
|
{
|
||||||
if (device->render_targets[i])
|
if (device->render_targets[i])
|
||||||
device->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
|
context->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
|
||||||
else
|
else
|
||||||
device->draw_buffers[i] = GL_NONE;
|
context->draw_buffers[i] = GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gl_info->supported[ARB_DRAW_BUFFERS])
|
if (gl_info->supported[ARB_DRAW_BUFFERS])
|
||||||
{
|
{
|
||||||
GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, device->draw_buffers));
|
GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, context->draw_buffers));
|
||||||
checkGLcall("glDrawBuffers()");
|
checkGLcall("glDrawBuffers()");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glDrawBuffer(device->draw_buffers[0]);
|
glDrawBuffer(context->draw_buffers[0]);
|
||||||
checkGLcall("glDrawBuffer()");
|
checkGLcall("glDrawBuffer()");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -2139,18 +2145,17 @@ void context_apply_clear_state(struct wined3d_context *context, IWineD3DDeviceIm
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||||
GLenum buffers[gl_info->limits.buffers];
|
|
||||||
|
|
||||||
for (i = 0; i < gl_info->limits.buffers; ++i)
|
for (i = 0; i < gl_info->limits.buffers; ++i)
|
||||||
{
|
{
|
||||||
if (i < rt_count && rts[i])
|
if (i < rt_count && rts[i])
|
||||||
buffers[i] = GL_COLOR_ATTACHMENT0 + i;
|
context->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
|
||||||
else
|
else
|
||||||
buffers[i] = GL_NONE;
|
context->draw_buffers[i] = GL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ENTER_GL();
|
ENTER_GL();
|
||||||
GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, buffers));
|
GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, context->draw_buffers));
|
||||||
checkGLcall("glDrawBuffers()");
|
checkGLcall("glDrawBuffers()");
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
|
|
||||||
|
|
|
@ -1802,12 +1802,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
|
||||||
|
|
||||||
This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||||
sizeof(*This->render_targets) * gl_info->limits.buffers);
|
sizeof(*This->render_targets) * gl_info->limits.buffers);
|
||||||
This->draw_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
||||||
sizeof(GLenum) * gl_info->limits.buffers);
|
|
||||||
|
|
||||||
This->NumberOfPalettes = 1;
|
This->NumberOfPalettes = 1;
|
||||||
This->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*));
|
This->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*));
|
||||||
if(!This->palettes || !This->render_targets || !This->draw_buffers) {
|
if (!This->palettes || !This->render_targets)
|
||||||
|
{
|
||||||
ERR("Out of memory!\n");
|
ERR("Out of memory!\n");
|
||||||
hr = E_OUTOFMEMORY;
|
hr = E_OUTOFMEMORY;
|
||||||
goto err_out;
|
goto err_out;
|
||||||
|
@ -1946,7 +1945,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
|
||||||
|
|
||||||
err_out:
|
err_out:
|
||||||
HeapFree(GetProcessHeap(), 0, This->render_targets);
|
HeapFree(GetProcessHeap(), 0, This->render_targets);
|
||||||
HeapFree(GetProcessHeap(), 0, This->draw_buffers);
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->swapchains);
|
HeapFree(GetProcessHeap(), 0, This->swapchains);
|
||||||
This->NumberOfSwapChains = 0;
|
This->NumberOfSwapChains = 0;
|
||||||
if(This->palettes) {
|
if(This->palettes) {
|
||||||
|
@ -2150,9 +2148,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
|
||||||
This->NumberOfPalettes = 0;
|
This->NumberOfPalettes = 0;
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->render_targets);
|
HeapFree(GetProcessHeap(), 0, This->render_targets);
|
||||||
HeapFree(GetProcessHeap(), 0, This->draw_buffers);
|
|
||||||
This->render_targets = NULL;
|
This->render_targets = NULL;
|
||||||
This->draw_buffers = NULL;
|
|
||||||
|
|
||||||
This->d3d_initialized = FALSE;
|
This->d3d_initialized = FALSE;
|
||||||
|
|
||||||
|
|
|
@ -1060,6 +1060,7 @@ struct wined3d_context
|
||||||
GLuint fbo_draw_binding;
|
GLuint fbo_draw_binding;
|
||||||
BOOL rebind_fbo;
|
BOOL rebind_fbo;
|
||||||
IWineD3DSurfaceImpl **blit_targets;
|
IWineD3DSurfaceImpl **blit_targets;
|
||||||
|
GLenum *draw_buffers;
|
||||||
|
|
||||||
/* Queries */
|
/* Queries */
|
||||||
GLuint *free_occlusion_queries;
|
GLuint *free_occlusion_queries;
|
||||||
|
@ -1637,7 +1638,6 @@ struct IWineD3DDeviceImpl
|
||||||
UINT currentPalette;
|
UINT currentPalette;
|
||||||
|
|
||||||
/* For rendering to a texture using glCopyTexImage */
|
/* For rendering to a texture using glCopyTexImage */
|
||||||
GLenum *draw_buffers;
|
|
||||||
GLuint depth_blt_texture;
|
GLuint depth_blt_texture;
|
||||||
GLuint depth_blt_rb;
|
GLuint depth_blt_rb;
|
||||||
UINT depth_blt_rb_w;
|
UINT depth_blt_rb_w;
|
||||||
|
|
Loading…
Reference in New Issue