Commit 7aac0159 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move the ARB shader program constant handling to the backend where it belongs.

parent 89d0d3ff
......@@ -1340,25 +1340,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
return NULL;
}
if (device->shader_backend->shader_dirtifyable_constants())
{
/* Create the dirty constants array and initialize them to dirty */
ret->vshader_const_dirty = HeapAlloc(GetProcessHeap(), 0,
sizeof(*ret->vshader_const_dirty) * device->d3d_vshader_constantF);
if (!ret->vshader_const_dirty)
goto out;
ret->pshader_const_dirty = HeapAlloc(GetProcessHeap(), 0,
sizeof(*ret->pshader_const_dirty) * device->d3d_pshader_constantF);
if (!ret->pshader_const_dirty)
goto out;
memset(ret->vshader_const_dirty, 1,
sizeof(*ret->vshader_const_dirty) * device->d3d_vshader_constantF);
memset(ret->pshader_const_dirty, 1,
sizeof(*ret->pshader_const_dirty) * device->d3d_pshader_constantF);
}
ret->blit_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
gl_info->limits.buffers * sizeof(*ret->blit_targets));
if (!ret->blit_targets)
......@@ -1655,8 +1636,6 @@ out:
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, ret->draw_buffers);
HeapFree(GetProcessHeap(), 0, ret->blit_targets);
HeapFree(GetProcessHeap(), 0, ret->pshader_const_dirty);
HeapFree(GetProcessHeap(), 0, ret->vshader_const_dirty);
HeapFree(GetProcessHeap(), 0, ret);
return NULL;
}
......@@ -1682,8 +1661,6 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
HeapFree(GetProcessHeap(), 0, context->draw_buffers);
HeapFree(GetProcessHeap(), 0, context->blit_targets);
HeapFree(GetProcessHeap(), 0, context->vshader_const_dirty);
HeapFree(GetProcessHeap(), 0, context->pshader_const_dirty);
device_context_remove(device, context);
if (destroy) HeapFree(GetProcessHeap(), 0, context);
}
......@@ -2455,7 +2432,7 @@ static void context_setup_target(struct wined3d_context *context, struct wined3d
}
/* Do not call while under the GL lock. */
struct wined3d_context *context_acquire(struct wined3d_device *device, struct wined3d_surface *target)
struct wined3d_context *context_acquire(const struct wined3d_device *device, struct wined3d_surface *target)
{
struct wined3d_context *current_context = context_get_current();
struct wined3d_context *context;
......@@ -2522,19 +2499,6 @@ struct wined3d_context *context_acquire(struct wined3d_device *device, struct wi
device->frag_pipe->enable_extension(!context->last_was_blit);
LEAVE_GL();
}
if (context->vshader_const_dirty)
{
memset(context->vshader_const_dirty, 1,
sizeof(*context->vshader_const_dirty) * device->d3d_vshader_constantF);
device->highest_dirty_vs_const = device->d3d_vshader_constantF;
}
if (context->pshader_const_dirty)
{
memset(context->pshader_const_dirty, 1,
sizeof(*context->pshader_const_dirty) * device->d3d_pshader_constantF);
device->highest_dirty_ps_const = device->d3d_pshader_constantF;
}
}
else if (context->restore_ctx)
{
......
......@@ -1351,8 +1351,6 @@ HRESULT CDECL wined3d_device_init_3d(struct wined3d_device *device,
if (wined3d_settings.logo)
device_load_logo(device, wined3d_settings.logo);
device->highest_dirty_ps_const = 0;
device->highest_dirty_vs_const = 0;
return WINED3D_OK;
err_out:
......
......@@ -4909,11 +4909,7 @@ static void shader_glsl_free(struct wined3d_device *device)
device->shader_priv = NULL;
}
static BOOL shader_glsl_dirty_const(void)
{
/* TODO: GL_EXT_bindable_uniform can be used to share constants across shaders */
return FALSE;
}
static void shader_glsl_context_destroyed(void *shader_priv, const struct wined3d_context *context) {}
static void shader_glsl_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps)
{
......@@ -5109,7 +5105,7 @@ const struct wined3d_shader_backend_ops glsl_shader_backend =
shader_glsl_destroy,
shader_glsl_alloc,
shader_glsl_free,
shader_glsl_dirty_const,
shader_glsl_context_destroyed,
shader_glsl_get_caps,
shader_glsl_color_fixup_supported,
};
......@@ -1502,7 +1502,7 @@ static void shader_none_load_np2fixup_constants(void *shader_priv,
static void shader_none_destroy(struct wined3d_shader *shader) {}
static HRESULT shader_none_alloc(struct wined3d_device *device) {return WINED3D_OK;}
static void shader_none_free(struct wined3d_device *device) {}
static BOOL shader_none_dirty_const(void) {return FALSE;}
static void shader_none_context_destroyed(void *shader_priv, const struct wined3d_context *context) {}
static void shader_none_get_caps(const struct wined3d_gl_info *gl_info, struct shader_caps *caps)
{
......@@ -1547,7 +1547,7 @@ const struct wined3d_shader_backend_ops none_shader_backend =
shader_none_destroy,
shader_none_alloc,
shader_none_free,
shader_none_dirty_const,
shader_none_context_destroyed,
shader_none_get_caps,
shader_none_color_fixup_supported,
};
......
......@@ -762,7 +762,7 @@ struct wined3d_shader_backend_ops
void (*shader_destroy)(struct wined3d_shader *shader);
HRESULT (*shader_alloc_private)(struct wined3d_device *device);
void (*shader_free_private)(struct wined3d_device *device);
BOOL (*shader_dirtifyable_constants)(void);
void (*shader_context_destroyed)(void *shader_priv, const struct wined3d_context *context);
void (*shader_get_caps)(const struct wined3d_gl_info *gl_info, struct shader_caps *caps);
BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup);
};
......@@ -1093,8 +1093,6 @@ struct wined3d_context
DWORD active_texture;
DWORD texture_type[MAX_COMBINED_SAMPLERS];
char *vshader_const_dirty, *pshader_const_dirty;
/* The actual opengl context */
UINT level;
HGLRC restore_ctx;
......@@ -1228,7 +1226,8 @@ HRESULT arbfp_blit_surface(struct wined3d_device *device, DWORD filter,
struct wined3d_surface *src_surface, const RECT *src_rect,
struct wined3d_surface *dst_surface, const RECT *dst_rect) DECLSPEC_HIDDEN;
struct wined3d_context *context_acquire(struct wined3d_device *device, struct wined3d_surface *target) DECLSPEC_HIDDEN;
struct wined3d_context *context_acquire(const struct wined3d_device *device,
struct wined3d_surface *target) DECLSPEC_HIDDEN;
void context_alloc_event_query(struct wined3d_context *context,
struct wined3d_event_query *query) DECLSPEC_HIDDEN;
void context_alloc_occlusion_query(struct wined3d_context *context,
......@@ -1705,7 +1704,6 @@ struct wined3d_device
struct list resources; /* a linked list to track resources created by the device */
struct list shaders; /* a linked list to track shaders (pixel and vertex) */
unsigned int highest_dirty_ps_const, highest_dirty_vs_const;
/* Render Target Support */
DWORD valid_rt_mask;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment