Commit a1d39392 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass a wined3d_context_gl structure to context_get_tex_unit_mapping().

parent a9e199e5
......@@ -2369,16 +2369,16 @@ void wined3d_context_destroy(struct wined3d_context *context)
device->adapter->adapter_ops->adapter_destroy_context(context);
}
const DWORD *context_get_tex_unit_mapping(const struct wined3d_context *context,
const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl *context_gl,
const struct wined3d_shader_version *shader_version, unsigned int *base, unsigned int *count)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
if (!shader_version)
{
*base = 0;
*count = WINED3D_MAX_TEXTURES;
return context->tex_unit_map;
return context_gl->c.tex_unit_map;
}
if (shader_version->major >= 4)
......@@ -2403,7 +2403,7 @@ const DWORD *context_get_tex_unit_mapping(const struct wined3d_context *context,
*count = 0;
}
return context->tex_unit_map;
return context_gl->c.tex_unit_map;
}
static void context_get_rt_size(const struct wined3d_context *context, SIZE *size)
......@@ -3777,18 +3777,19 @@ static void context_load_shader_resources(struct wined3d_context *context, const
static void context_bind_shader_resources(struct wined3d_context *context,
const struct wined3d_state *state, enum wined3d_shader_type shader_type)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
unsigned int bind_idx, shader_sampler_count, base, count, i;
const struct wined3d_device *device = context->device;
struct wined3d_shader_sampler_map_entry *entry;
struct wined3d_shader_resource_view *view;
const struct wined3d_shader *shader;
const unsigned int *tex_unit_map;
struct wined3d_sampler *sampler;
const DWORD *tex_unit_map;
if (!(shader = state->shader[shader_type]))
return;
tex_unit_map = context_get_tex_unit_mapping(context,
tex_unit_map = wined3d_context_gl_get_tex_unit_mapping(context_gl,
&shader->reg_maps.shader_version, &base, &count);
shader_sampler_count = shader->reg_maps.sampler_map.count;
......
......@@ -705,10 +705,11 @@ static void shader_glsl_load_samplers_range(const struct wined3d_gl_info *gl_inf
static unsigned int shader_glsl_map_tex_unit(const struct wined3d_context *context,
const struct wined3d_shader_version *shader_version, unsigned int sampler_idx)
{
const DWORD *tex_unit_map;
const struct wined3d_context_gl *context_gl = wined3d_context_gl_const(context);
const unsigned int *tex_unit_map;
unsigned int base, count;
tex_unit_map = context_get_tex_unit_mapping(context, shader_version, &base, &count);
tex_unit_map = wined3d_context_gl_get_tex_unit_mapping(context_gl, shader_version, &base, &count);
if (sampler_idx >= count)
return WINED3D_UNMAPPED_STAGE;
if (!tex_unit_map)
......@@ -731,9 +732,10 @@ static void shader_glsl_append_sampler_binding_qualifier(struct wined3d_string_b
static void shader_glsl_load_samplers(const struct wined3d_context *context,
struct shader_glsl_priv *priv, GLuint program_id, const struct wined3d_shader_reg_maps *reg_maps)
{
const struct wined3d_context_gl *context_gl = wined3d_context_gl_const(context);
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_shader_version *shader_version;
const DWORD *tex_unit_map;
const unsigned int *tex_unit_map;
unsigned int base, count;
const char *prefix;
......@@ -742,7 +744,7 @@ static void shader_glsl_load_samplers(const struct wined3d_context *context,
shader_version = reg_maps ? &reg_maps->shader_version : NULL;
prefix = shader_glsl_get_prefix(shader_version ? shader_version->type : WINED3D_SHADER_TYPE_PIXEL);
tex_unit_map = context_get_tex_unit_mapping(context, shader_version, &base, &count);
tex_unit_map = wined3d_context_gl_get_tex_unit_mapping(context_gl, shader_version, &base, &count);
shader_glsl_load_samplers_range(gl_info, priv, program_id, prefix, base, count, tex_unit_map);
}
......
......@@ -2049,9 +2049,16 @@ static inline struct wined3d_context_gl *wined3d_context_gl(struct wined3d_conte
return CONTAINING_RECORD(context, struct wined3d_context_gl, c);
}
static inline const struct wined3d_context_gl *wined3d_context_gl_const(const struct wined3d_context *context)
{
return CONTAINING_RECORD(context, struct wined3d_context_gl, c);
}
void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl,
GLenum target, GLuint name) DECLSPEC_HIDDEN;
void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl *context_gl,
const struct wined3d_shader_version *shader_version, unsigned int *base, unsigned int *count) DECLSPEC_HIDDEN;
HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl,
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl,
......@@ -2231,8 +2238,6 @@ void context_free_fence(struct wined3d_fence *fence) DECLSPEC_HIDDEN;
void context_free_occlusion_query(struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
struct wined3d_context *context_get_current(void) DECLSPEC_HIDDEN;
GLenum context_get_offscreen_gl_buffer(const struct wined3d_context *context) DECLSPEC_HIDDEN;
const DWORD *context_get_tex_unit_mapping(const struct wined3d_context *context,
const struct wined3d_shader_version *shader_version, unsigned int *base, unsigned int *count) DECLSPEC_HIDDEN;
DWORD context_get_tls_idx(void) DECLSPEC_HIDDEN;
void context_gl_resource_released(struct wined3d_device *device,
GLuint name, BOOL rb_namespace) 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