Commit 258f0d20 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass a wined3d_context_gl structure to context_enable_clip_distances().

parent 50dfd232
......@@ -2401,17 +2401,18 @@ static void wined3d_context_gl_get_rt_size(const struct wined3d_context_gl *cont
size->cy = wined3d_texture_get_level_height(rt, level);
}
void context_enable_clip_distances(struct wined3d_context *context, unsigned int enable_mask)
void wined3d_context_gl_enable_clip_distances(struct wined3d_context_gl *context_gl, uint32_t enable_mask)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
unsigned int clip_distance_count = gl_info->limits.user_clip_distances;
unsigned int i, disable_mask, current_mask;
const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
unsigned int clip_distance_count, i;
uint32_t disable_mask, current_mask;
clip_distance_count = gl_info->limits.user_clip_distances;
disable_mask = ~enable_mask;
enable_mask &= (1u << clip_distance_count) - 1;
disable_mask &= (1u << clip_distance_count) - 1;
current_mask = context->clip_distance_mask;
context->clip_distance_mask = enable_mask;
current_mask = context_gl->c.clip_distance_mask;
context_gl->c.clip_distance_mask = enable_mask;
enable_mask &= ~current_mask;
while (enable_mask)
......@@ -2850,7 +2851,7 @@ void wined3d_context_gl_apply_blit_state(struct wined3d_context_gl *context_gl,
context->last_was_rhw = TRUE;
context_invalidate_state(context, STATE_VDECL); /* because of last_was_rhw = TRUE */
context_enable_clip_distances(context, 0);
wined3d_context_gl_enable_clip_distances(context_gl, 0);
context_invalidate_state(context, STATE_RENDER(WINED3D_RS_CLIPPING));
/* FIXME: Make draw_textured_quad() able to work with a upper left origin. */
......
......@@ -10533,6 +10533,7 @@ static void shader_glsl_precompile(void *shader_priv, struct wined3d_shader *sha
static void shader_glsl_select(void *shader_priv, struct wined3d_context *context,
const struct wined3d_state *state)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
struct glsl_context_data *ctx_data = context->shader_backend_data;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_glsl_priv *priv = shader_priv;
......@@ -10552,7 +10553,7 @@ static void shader_glsl_select(void *shader_priv, struct wined3d_context *contex
program_id = glsl_program->id;
current_vertex_color_clamp = glsl_program->vs.vertex_color_clamp;
if (glsl_program->shader_controlled_clip_distances)
context_enable_clip_distances(context, glsl_program->clip_distance_mask);
wined3d_context_gl_enable_clip_distances(context_gl, glsl_program->clip_distance_mask);
}
else
{
......
......@@ -693,7 +693,8 @@ void state_alpha_test(struct wined3d_context *context, const struct wined3d_stat
void state_clipping(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
unsigned int enable_mask;
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
uint32_t enable_mask;
if (use_vs(state) && !context->d3d_info->vs_clipping)
{
......@@ -721,7 +722,7 @@ void state_clipping(struct wined3d_context *context, const struct wined3d_state
*/
enable_mask = state->render_states[WINED3D_RS_CLIPPING] ?
state->render_states[WINED3D_RS_CLIPPLANEENABLE] : 0;
context_enable_clip_distances(context, enable_mask);
wined3d_context_gl_enable_clip_distances(context_gl, enable_mask);
}
static void state_specularenable(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
......@@ -3864,6 +3865,7 @@ static void vdecl_miscpart(struct wined3d_context *context, const struct wined3d
static void vertexdeclaration(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info = context->gl_info;
BOOL useVertexShaderFunction = use_vs(state);
BOOL updateFog = FALSE;
......@@ -3940,7 +3942,7 @@ static void vertexdeclaration(struct wined3d_context *context, const struct wine
/* Disable all clip planes to get defined results on all drivers. See comment in the
* state_clipping state handler
*/
context_enable_clip_distances(context, 0);
wined3d_context_gl_enable_clip_distances(context_gl, 0);
if (!warned && state->render_states[WINED3D_RS_CLIPPLANEENABLE])
{
......
......@@ -2090,6 +2090,7 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl,
const struct wined3d_bo_address *dst, GLenum dst_binding,
const struct wined3d_bo_address *src, GLenum src_binding, size_t size) DECLSPEC_HIDDEN;
void wined3d_context_gl_destroy(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
void wined3d_context_gl_enable_clip_distances(struct wined3d_context_gl *context_gl, uint32_t mask) DECLSPEC_HIDDEN;
void wined3d_context_gl_free_fence(struct wined3d_fence *fence) DECLSPEC_HIDDEN;
void wined3d_context_gl_free_occlusion_query(struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
void wined3d_context_gl_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query *query) DECLSPEC_HIDDEN;
......@@ -2249,7 +2250,6 @@ void context_draw_shaded_quad(struct wined3d_context *context, struct wined3d_te
void context_draw_textured_quad(struct wined3d_context *context, struct wined3d_texture_gl *texture_gl,
unsigned int sub_resource_idx, const RECT *src_rect, const RECT *dst_rect,
enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
void context_enable_clip_distances(struct wined3d_context *context, unsigned int mask) DECLSPEC_HIDDEN;
void context_end_transform_feedback(struct wined3d_context *context) DECLSPEC_HIDDEN;
struct wined3d_context *context_get_current(void) DECLSPEC_HIDDEN;
DWORD context_get_tls_idx(void) DECLSPEC_HIDDEN;
......
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