wined3d: Move the OpenGL textures from struct wined3d_texture to struct wined3d_texture_gl.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3ebd2f0be3
commit
5f9740762a
|
@ -7904,7 +7904,8 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
|
|||
arbfp_blit_set(arbfp_blitter, context, src_texture, src_sub_resource_idx, color_key);
|
||||
|
||||
/* Draw a textured quad */
|
||||
context_draw_textured_quad(context, src_texture, src_sub_resource_idx, src_rect, dst_rect, filter);
|
||||
context_draw_textured_quad(context, wined3d_texture_gl(src_texture),
|
||||
src_sub_resource_idx, src_rect, dst_rect, filter);
|
||||
|
||||
/* Leave the opengl state valid for blitting */
|
||||
arbfp_blit_unset(context->gl_info);
|
||||
|
|
|
@ -472,11 +472,11 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
|
|||
switch (location)
|
||||
{
|
||||
case WINED3D_LOCATION_TEXTURE_RGB:
|
||||
key->objects[idx].object = wined3d_texture_get_texture_name(&texture_gl->t, context, FALSE);
|
||||
key->objects[idx].object = wined3d_texture_gl_get_texture_name(texture_gl, context, FALSE);
|
||||
break;
|
||||
|
||||
case WINED3D_LOCATION_TEXTURE_SRGB:
|
||||
key->objects[idx].object = wined3d_texture_get_texture_name(&texture_gl->t, context, TRUE);
|
||||
key->objects[idx].object = wined3d_texture_gl_get_texture_name(texture_gl, context, TRUE);
|
||||
break;
|
||||
|
||||
case WINED3D_LOCATION_RB_MULTISAMPLE:
|
||||
|
@ -1089,7 +1089,7 @@ void context_gl_resource_released(struct wined3d_device *device,
|
|||
context_enum_fbo_entries(device, name, rb_namespace, context_queue_fbo_entry_destruction);
|
||||
}
|
||||
|
||||
void context_texture_update(struct wined3d_context *context, const struct wined3d_texture *texture)
|
||||
void context_texture_update(struct wined3d_context *context, const struct wined3d_texture_gl *texture_gl)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
struct fbo_entry *entry = context->current_fbo;
|
||||
|
@ -1099,10 +1099,10 @@ void context_texture_update(struct wined3d_context *context, const struct wined3
|
|||
|
||||
for (i = 0; i < gl_info->limits.buffers + 1; ++i)
|
||||
{
|
||||
if (texture->texture_rgb.name == entry->key.objects[i].object
|
||||
|| texture->texture_srgb.name == entry->key.objects[i].object)
|
||||
if (texture_gl->texture_rgb.name == entry->key.objects[i].object
|
||||
|| texture_gl->texture_srgb.name == entry->key.objects[i].object)
|
||||
{
|
||||
TRACE("Updated texture %p is bound as attachment %u to the current FBO.\n", texture, i);
|
||||
TRACE("Updated texture %p is bound as attachment %u to the current FBO.\n", texture_gl, i);
|
||||
context->rebind_fbo = TRUE;
|
||||
return;
|
||||
}
|
||||
|
@ -3896,8 +3896,8 @@ static void context_bind_unordered_access_views(struct wined3d_context *context,
|
|||
}
|
||||
else if (view->resource->type != WINED3D_RTYPE_BUFFER)
|
||||
{
|
||||
struct wined3d_texture *texture = texture_from_resource(view->resource);
|
||||
texture_name = wined3d_texture_get_texture_name(texture, context, FALSE);
|
||||
struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(texture_from_resource(view->resource));
|
||||
texture_name = wined3d_texture_gl_get_texture_name(texture_gl, context, FALSE);
|
||||
level = view->desc.u.texture.level_idx;
|
||||
}
|
||||
else
|
||||
|
@ -4195,14 +4195,14 @@ static void context_setup_target(struct wined3d_context *context,
|
|||
&& old_render_offscreen && (context->current_rt.texture != texture
|
||||
|| context->current_rt.sub_resource_idx != sub_resource_idx))
|
||||
{
|
||||
struct wined3d_texture_gl *prev_texture = wined3d_texture_gl(context->current_rt.texture);
|
||||
unsigned int prev_sub_resource_idx = context->current_rt.sub_resource_idx;
|
||||
struct wined3d_texture *prev_texture = context->current_rt.texture;
|
||||
|
||||
/* Read the back buffer of the old drawable into the destination texture. */
|
||||
if (prev_texture->texture_srgb.name)
|
||||
wined3d_texture_load(prev_texture, context, TRUE);
|
||||
wined3d_texture_load(prev_texture, context, FALSE);
|
||||
wined3d_texture_invalidate_location(prev_texture, prev_sub_resource_idx, WINED3D_LOCATION_DRAWABLE);
|
||||
wined3d_texture_load(&prev_texture->t, context, TRUE);
|
||||
wined3d_texture_load(&prev_texture->t, context, FALSE);
|
||||
wined3d_texture_invalidate_location(&prev_texture->t, prev_sub_resource_idx, WINED3D_LOCATION_DRAWABLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5581,7 +5581,7 @@ static void apply_texture_blit_state(const struct wined3d_gl_info *gl_info, stru
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
void context_draw_shaded_quad(struct wined3d_context *context, struct wined3d_texture *texture,
|
||||
void context_draw_shaded_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)
|
||||
{
|
||||
|
@ -5596,11 +5596,11 @@ void context_draw_shaded_quad(struct wined3d_context *context, struct wined3d_te
|
|||
}
|
||||
quad[4];
|
||||
|
||||
texture2d_get_blt_info(texture, sub_resource_idx, src_rect, &info);
|
||||
texture2d_get_blt_info(&texture_gl->t, sub_resource_idx, src_rect, &info);
|
||||
|
||||
level = sub_resource_idx % texture->level_count;
|
||||
context_bind_texture(context, info.bind_target, texture->texture_rgb.name);
|
||||
apply_texture_blit_state(gl_info, &texture->texture_rgb, info.bind_target, level, filter);
|
||||
level = sub_resource_idx % texture_gl->t.level_count;
|
||||
context_bind_texture(context, info.bind_target, texture_gl->texture_rgb.name);
|
||||
apply_texture_blit_state(gl_info, &texture_gl->texture_rgb, info.bind_target, level, filter);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(info.bind_target, GL_TEXTURE_MAX_LEVEL, level);
|
||||
|
||||
context_get_rt_size(context, &dst_size);
|
||||
|
@ -5661,12 +5661,12 @@ void context_draw_shaded_quad(struct wined3d_context *context, struct wined3d_te
|
|||
}
|
||||
checkGLcall("draw");
|
||||
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(info.bind_target, GL_TEXTURE_MAX_LEVEL, texture->level_count - 1);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(info.bind_target, GL_TEXTURE_MAX_LEVEL, texture_gl->t.level_count - 1);
|
||||
context_bind_texture(context, info.bind_target, 0);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
void context_draw_textured_quad(struct wined3d_context *context, struct wined3d_texture *texture,
|
||||
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)
|
||||
{
|
||||
|
@ -5674,14 +5674,14 @@ void context_draw_textured_quad(struct wined3d_context *context, struct wined3d_
|
|||
struct wined3d_blt_info info;
|
||||
unsigned int level;
|
||||
|
||||
texture2d_get_blt_info(texture, sub_resource_idx, src_rect, &info);
|
||||
texture2d_get_blt_info(&texture_gl->t, sub_resource_idx, src_rect, &info);
|
||||
|
||||
gl_info->gl_ops.gl.p_glEnable(info.bind_target);
|
||||
checkGLcall("glEnable(bind_target)");
|
||||
|
||||
level = sub_resource_idx % texture->level_count;
|
||||
context_bind_texture(context, info.bind_target, texture->texture_rgb.name);
|
||||
apply_texture_blit_state(gl_info, &texture->texture_rgb, info.bind_target, level, filter);
|
||||
level = sub_resource_idx % texture_gl->t.level_count;
|
||||
context_bind_texture(context, info.bind_target, texture_gl->texture_rgb.name);
|
||||
apply_texture_blit_state(gl_info, &texture_gl->texture_rgb, info.bind_target, level, filter);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(info.bind_target, GL_TEXTURE_MAX_LEVEL, level);
|
||||
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
checkGLcall("glTexEnvi");
|
||||
|
@ -5701,6 +5701,6 @@ void context_draw_textured_quad(struct wined3d_context *context, struct wined3d_
|
|||
gl_info->gl_ops.gl.p_glVertex2i(dst_rect->right, dst_rect->bottom);
|
||||
gl_info->gl_ops.gl.p_glEnd();
|
||||
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(info.bind_target, GL_TEXTURE_MAX_LEVEL, texture->level_count - 1);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(info.bind_target, GL_TEXTURE_MAX_LEVEL, texture_gl->t.level_count - 1);
|
||||
context_bind_texture(context, info.bind_target, 0);
|
||||
}
|
||||
|
|
|
@ -2227,7 +2227,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *
|
|||
wined3d_texture_get_pitch(src_texture, op->src_sub_resource_idx % src_texture->level_count,
|
||||
&row_pitch, &slice_pitch);
|
||||
|
||||
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(dst_texture), context, FALSE);
|
||||
wined3d_texture_upload_data(dst_texture, op->dst_sub_resource_idx, context,
|
||||
dst_texture->resource.format, &op->src_box, wined3d_const_bo_address(&addr),
|
||||
row_pitch, slice_pitch, op->dst_box.left, op->dst_box.top, op->dst_box.front, FALSE);
|
||||
|
@ -2325,7 +2325,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
|
|||
wined3d_texture_prepare_texture(texture, context, FALSE);
|
||||
else
|
||||
wined3d_texture_load_location(texture, op->sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, FALSE);
|
||||
|
||||
wined3d_box_set(&src_box, 0, 0, box->right - box->left, box->bottom - box->top, 0, box->back - box->front);
|
||||
wined3d_texture_upload_data(texture, op->sub_resource_idx, context, texture->resource.format, &src_box,
|
||||
|
|
|
@ -13310,7 +13310,8 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
|
|||
default:
|
||||
break;
|
||||
}
|
||||
context_draw_shaded_quad(context, src_texture, src_sub_resource_idx, src_rect, dst_rect, filter);
|
||||
context_draw_shaded_quad(context, wined3d_texture_gl(src_texture),
|
||||
src_sub_resource_idx, src_rect, dst_rect, filter);
|
||||
GL_EXTCALL(glUseProgram(0));
|
||||
|
||||
if (dst_texture->swapchain && (dst_texture->swapchain->front_buffer == dst_texture))
|
||||
|
|
|
@ -155,34 +155,34 @@ HRESULT CDECL wined3d_sampler_create(struct wined3d_device *device, const struct
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static void texture_apply_base_level(struct wined3d_texture *texture,
|
||||
static void texture_gl_apply_base_level(struct wined3d_texture_gl *texture_gl,
|
||||
const struct wined3d_sampler_desc *desc, const struct wined3d_gl_info *gl_info)
|
||||
{
|
||||
struct gl_texture *gl_tex;
|
||||
unsigned int base_level;
|
||||
|
||||
if (texture->flags & WINED3D_TEXTURE_COND_NP2)
|
||||
if (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2)
|
||||
base_level = 0;
|
||||
else if (desc->mip_filter == WINED3D_TEXF_NONE)
|
||||
base_level = texture->lod;
|
||||
base_level = texture_gl->t.lod;
|
||||
else
|
||||
base_level = min(max(desc->mip_base_level, texture->lod), texture->level_count - 1);
|
||||
base_level = min(max(desc->mip_base_level, texture_gl->t.lod), texture_gl->t.level_count - 1);
|
||||
|
||||
gl_tex = wined3d_texture_get_gl_texture(texture, texture->flags & WINED3D_TEXTURE_IS_SRGB);
|
||||
gl_tex = wined3d_texture_gl_get_gl_texture(texture_gl, texture_gl->t.flags & WINED3D_TEXTURE_IS_SRGB);
|
||||
if (base_level != gl_tex->base_level)
|
||||
{
|
||||
/* Note that WINED3D_SAMP_MAX_MIP_LEVEL specifies the largest mipmap
|
||||
* (default 0), while GL_TEXTURE_MAX_LEVEL specifies the smallest
|
||||
* mipmap used (default 1000). So WINED3D_SAMP_MAX_MIP_LEVEL
|
||||
* corresponds to GL_TEXTURE_BASE_LEVEL. */
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, base_level);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->t.target, GL_TEXTURE_BASE_LEVEL, base_level);
|
||||
gl_tex->base_level = base_level;
|
||||
}
|
||||
}
|
||||
|
||||
/* This function relies on the correct texture being bound and loaded. */
|
||||
void wined3d_sampler_bind(struct wined3d_sampler *sampler, unsigned int unit,
|
||||
struct wined3d_texture *texture, const struct wined3d_context *context)
|
||||
struct wined3d_texture_gl *texture_gl, const struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
|
||||
|
@ -191,15 +191,15 @@ void wined3d_sampler_bind(struct wined3d_sampler *sampler, unsigned int unit,
|
|||
GL_EXTCALL(glBindSampler(unit, sampler->name));
|
||||
checkGLcall("bind sampler");
|
||||
}
|
||||
else if (texture)
|
||||
else if (texture_gl)
|
||||
{
|
||||
wined3d_texture_apply_sampler_desc(texture, &sampler->desc, context);
|
||||
wined3d_texture_gl_apply_sampler_desc(texture_gl, &sampler->desc, context);
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Could not apply sampler state.\n");
|
||||
}
|
||||
|
||||
if (texture)
|
||||
texture_apply_base_level(texture, &sampler->desc, gl_info);
|
||||
if (texture_gl)
|
||||
texture_gl_apply_base_level(texture_gl, &sampler->desc, gl_info);
|
||||
}
|
||||
|
|
|
@ -3612,17 +3612,17 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
|
|||
|
||||
if (state->textures[sampler_idx])
|
||||
{
|
||||
struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(state->textures[sampler_idx]);
|
||||
BOOL srgb = state->sampler_states[sampler_idx][WINED3D_SAMP_SRGB_TEXTURE];
|
||||
const DWORD *sampler_states = state->sampler_states[sampler_idx];
|
||||
struct wined3d_texture *texture = state->textures[sampler_idx];
|
||||
struct wined3d_device *device = context->device;
|
||||
struct wined3d_sampler_desc desc;
|
||||
struct wined3d_sampler *sampler;
|
||||
struct wine_rb_entry *entry;
|
||||
|
||||
wined3d_sampler_desc_from_sampler_states(&desc, context, sampler_states, texture);
|
||||
wined3d_sampler_desc_from_sampler_states(&desc, context, sampler_states, &texture_gl->t);
|
||||
|
||||
wined3d_texture_bind(texture, context, srgb);
|
||||
wined3d_texture_gl_bind(texture_gl, context, srgb);
|
||||
|
||||
if ((entry = wine_rb_get(&device->samplers, &desc)))
|
||||
{
|
||||
|
@ -3643,10 +3643,10 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
|
|||
}
|
||||
}
|
||||
|
||||
wined3d_sampler_bind(sampler, mapped_stage, texture, context);
|
||||
wined3d_sampler_bind(sampler, mapped_stage, texture_gl, context);
|
||||
|
||||
/* Trigger shader constant reloading (for NP2 texcoord fixup) */
|
||||
if (!(texture->flags & WINED3D_TEXTURE_POW2_MAT_IDENT))
|
||||
if (!(texture_gl->t.flags & WINED3D_TEXTURE_POW2_MAT_IDENT))
|
||||
context->constant_update_mask |= WINED3D_SHADER_CONST_PS_NP2_FIXUP;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -687,7 +687,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
|
|||
TRACE("Using upload conversion.\n");
|
||||
|
||||
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(dst_texture), context, FALSE);
|
||||
wined3d_texture_upload_data(dst_texture, 0, context, src_format, &src_box,
|
||||
wined3d_const_bo_address(&src_data), src_row_pitch, src_slice_pitch, 0, 0, 0, FALSE);
|
||||
|
||||
|
@ -855,7 +855,7 @@ void texture2d_load_fb_texture(struct wined3d_texture *texture,
|
|||
device_invalidate_state(device, STATE_FRAMEBUFFER);
|
||||
|
||||
wined3d_texture_prepare_texture(texture, context, srgb);
|
||||
wined3d_texture_bind_and_dirtify(texture, context, srgb);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, srgb);
|
||||
|
||||
TRACE("Reading back offscreen render target %p, %u.\n", texture, sub_resource_idx);
|
||||
|
||||
|
@ -878,11 +878,11 @@ void texture2d_load_fb_texture(struct wined3d_texture *texture,
|
|||
|
||||
/* Does a direct frame buffer -> texture copy. Stretching is done with single
|
||||
* pixel copy calls. */
|
||||
static void fb_copy_to_texture_direct(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
const RECT *dst_rect_in, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
|
||||
static void fb_copy_to_texture_direct(struct wined3d_texture_gl *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
const RECT *dst_rect_in, struct wined3d_texture_gl *src_texture, unsigned int src_sub_resource_idx,
|
||||
const RECT *src_rect, enum wined3d_texture_filter_type filter)
|
||||
{
|
||||
struct wined3d_device *device = dst_texture->resource.device;
|
||||
struct wined3d_device *device = dst_texture->t.resource.device;
|
||||
unsigned int src_height, src_level, dst_level;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
float xrel, yrel;
|
||||
|
@ -901,14 +901,14 @@ static void fb_copy_to_texture_direct(struct wined3d_texture *dst_texture, unsig
|
|||
upsidedown = TRUE;
|
||||
}
|
||||
|
||||
context = context_acquire(device, src_texture, src_sub_resource_idx);
|
||||
context = context_acquire(device, &src_texture->t, src_sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
context_apply_blit_state(context, device);
|
||||
wined3d_texture_load(dst_texture, context, FALSE);
|
||||
wined3d_texture_load(&dst_texture->t, context, FALSE);
|
||||
|
||||
/* Bind the target texture */
|
||||
context_bind_texture(context, dst_texture->target, dst_texture->texture_rgb.name);
|
||||
if (wined3d_resource_is_offscreen(&src_texture->resource))
|
||||
context_bind_texture(context, dst_texture->t.target, dst_texture->texture_rgb.name);
|
||||
if (wined3d_resource_is_offscreen(&src_texture->t.resource))
|
||||
{
|
||||
TRACE("Reading from an offscreen target\n");
|
||||
upsidedown = !upsidedown;
|
||||
|
@ -916,7 +916,7 @@ static void fb_copy_to_texture_direct(struct wined3d_texture *dst_texture, unsig
|
|||
}
|
||||
else
|
||||
{
|
||||
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(src_texture));
|
||||
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(&src_texture->t));
|
||||
}
|
||||
checkGLcall("glReadBuffer");
|
||||
|
||||
|
@ -936,11 +936,11 @@ static void fb_copy_to_texture_direct(struct wined3d_texture *dst_texture, unsig
|
|||
ERR("Texture filtering not supported in direct blit\n");
|
||||
}
|
||||
|
||||
src_level = src_sub_resource_idx % src_texture->level_count;
|
||||
dst_level = dst_sub_resource_idx % dst_texture->level_count;
|
||||
src_level = src_sub_resource_idx % src_texture->t.level_count;
|
||||
dst_level = dst_sub_resource_idx % dst_texture->t.level_count;
|
||||
|
||||
src_height = wined3d_texture_get_level_height(src_texture, src_level);
|
||||
dst_target = wined3d_texture_get_sub_resource_target(dst_texture, dst_sub_resource_idx);
|
||||
src_height = wined3d_texture_get_level_height(&src_texture->t, src_level);
|
||||
dst_target = wined3d_texture_get_sub_resource_target(&dst_texture->t, dst_sub_resource_idx);
|
||||
if (upsidedown
|
||||
&& !((xrel - 1.0f < -eps) || (xrel - 1.0f > eps))
|
||||
&& !((yrel - 1.0f < -eps) || (yrel - 1.0f > eps)))
|
||||
|
@ -990,17 +990,17 @@ static void fb_copy_to_texture_direct(struct wined3d_texture *dst_texture, unsig
|
|||
|
||||
/* The texture is now most up to date - If the surface is a render target
|
||||
* and has a drawable, this path is never entered. */
|
||||
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_validate_location(&dst_texture->t, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_invalidate_location(&dst_texture->t, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
}
|
||||
|
||||
/* Uses the hardware to stretch and flip the image */
|
||||
static void fb_copy_to_texture_hwstretch(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
const RECT *dst_rect_in, struct wined3d_texture *src_texture, unsigned int src_sub_resource_idx,
|
||||
static void fb_copy_to_texture_hwstretch(struct wined3d_texture_gl *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
const RECT *dst_rect_in, struct wined3d_texture_gl *src_texture, unsigned int src_sub_resource_idx,
|
||||
const RECT *src_rect, enum wined3d_texture_filter_type filter)
|
||||
{
|
||||
unsigned int src_width, src_height, src_pow2_width, src_pow2_height, src_level;
|
||||
struct wined3d_device *device = dst_texture->resource.device;
|
||||
struct wined3d_device *device = dst_texture->t.resource.device;
|
||||
GLenum src_target, dst_target, texture_target;
|
||||
GLuint src, backup = 0;
|
||||
float left, right, top, bottom; /* Texture coordinates */
|
||||
|
@ -1015,28 +1015,28 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_texture *dst_texture, un
|
|||
|
||||
TRACE("Using hwstretch blit\n");
|
||||
|
||||
src_target = wined3d_texture_get_sub_resource_target(src_texture, src_sub_resource_idx);
|
||||
dst_target = wined3d_texture_get_sub_resource_target(dst_texture, dst_sub_resource_idx);
|
||||
src_target = wined3d_texture_get_sub_resource_target(&src_texture->t, src_sub_resource_idx);
|
||||
dst_target = wined3d_texture_get_sub_resource_target(&dst_texture->t, dst_sub_resource_idx);
|
||||
|
||||
/* Activate the Proper context for reading from the source surface, set it up for blitting */
|
||||
context = context_acquire(device, src_texture, src_sub_resource_idx);
|
||||
context = context_acquire(device, &src_texture->t, src_sub_resource_idx);
|
||||
gl_info = context->gl_info;
|
||||
context_apply_ffp_blit_state(context, device);
|
||||
wined3d_texture_load(dst_texture, context, FALSE);
|
||||
wined3d_texture_load(&dst_texture->t, context, FALSE);
|
||||
|
||||
offscreen_buffer = context_get_offscreen_gl_buffer(context);
|
||||
src_level = src_sub_resource_idx % src_texture->level_count;
|
||||
src_width = wined3d_texture_get_level_width(src_texture, src_level);
|
||||
src_height = wined3d_texture_get_level_height(src_texture, src_level);
|
||||
src_pow2_width = wined3d_texture_get_level_pow2_width(src_texture, src_level);
|
||||
src_pow2_height = wined3d_texture_get_level_pow2_height(src_texture, src_level);
|
||||
src_level = src_sub_resource_idx % src_texture->t.level_count;
|
||||
src_width = wined3d_texture_get_level_width(&src_texture->t, src_level);
|
||||
src_height = wined3d_texture_get_level_height(&src_texture->t, src_level);
|
||||
src_pow2_width = wined3d_texture_get_level_pow2_width(&src_texture->t, src_level);
|
||||
src_pow2_height = wined3d_texture_get_level_pow2_height(&src_texture->t, src_level);
|
||||
|
||||
src_offscreen = wined3d_resource_is_offscreen(&src_texture->resource);
|
||||
src_offscreen = wined3d_resource_is_offscreen(&src_texture->t.resource);
|
||||
noBackBufferBackup = src_offscreen && wined3d_settings.offscreen_rendering_mode == ORM_FBO;
|
||||
if (!noBackBufferBackup && !src_texture->texture_rgb.name)
|
||||
{
|
||||
/* Get it a description */
|
||||
wined3d_texture_load(src_texture, context, FALSE);
|
||||
wined3d_texture_load(&src_texture->t, context, FALSE);
|
||||
}
|
||||
|
||||
/* Try to use an aux buffer for drawing the rectangle. This way it doesn't need restoring.
|
||||
|
@ -1071,7 +1071,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_texture *dst_texture, un
|
|||
checkGLcall("glEnable(texture_target)");
|
||||
|
||||
/* For now invalidate the texture copy of the back buffer. Drawable and sysmem copy are untouched */
|
||||
src_texture->sub_resources[src_sub_resource_idx].locations &= ~WINED3D_LOCATION_TEXTURE_RGB;
|
||||
src_texture->t.sub_resources[src_sub_resource_idx].locations &= ~WINED3D_LOCATION_TEXTURE_RGB;
|
||||
}
|
||||
|
||||
/* Make sure that the top pixel is always above the bottom pixel, and keep a separate upside down flag
|
||||
|
@ -1092,7 +1092,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_texture *dst_texture, un
|
|||
}
|
||||
else
|
||||
{
|
||||
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(src_texture));
|
||||
gl_info->gl_ops.gl.p_glReadBuffer(wined3d_texture_get_gl_buffer(&src_texture->t));
|
||||
}
|
||||
|
||||
/* TODO: Only back up the part that will be overwritten */
|
||||
|
@ -1107,7 +1107,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_texture *dst_texture, un
|
|||
wined3d_gl_min_mip_filter(filter, WINED3D_TEXF_NONE));
|
||||
checkGLcall("glTexParameteri");
|
||||
|
||||
if (!src_texture->swapchain || src_texture == src_texture->swapchain->back_buffers[0])
|
||||
if (!src_texture->t.swapchain || &src_texture->t == src_texture->t.swapchain->back_buffers[0])
|
||||
{
|
||||
src = backup ? backup : src_texture->texture_rgb.name;
|
||||
}
|
||||
|
@ -1159,7 +1159,7 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_texture *dst_texture, un
|
|||
bottom = src_height - src_rect->top;
|
||||
}
|
||||
|
||||
if (src_texture->flags & WINED3D_TEXTURE_NORMALIZED_COORDS)
|
||||
if (src_texture->t.flags & WINED3D_TEXTURE_NORMALIZED_COORDS)
|
||||
{
|
||||
left /= src_pow2_width;
|
||||
right /= src_pow2_width;
|
||||
|
@ -1271,8 +1271,8 @@ static void fb_copy_to_texture_hwstretch(struct wined3d_texture *dst_texture, un
|
|||
|
||||
/* The texture is now most up to date - If the surface is a render target
|
||||
* and has a drawable, this path is never entered. */
|
||||
wined3d_texture_validate_location(dst_texture, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_invalidate_location(dst_texture, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_validate_location(&dst_texture->t, dst_sub_resource_idx, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_invalidate_location(&dst_texture->t, dst_sub_resource_idx, ~WINED3D_LOCATION_TEXTURE_RGB);
|
||||
}
|
||||
|
||||
static HRESULT wined3d_texture_blt_special(struct wined3d_texture *dst_texture, unsigned int dst_sub_resource_idx,
|
||||
|
@ -1395,14 +1395,14 @@ static HRESULT wined3d_texture_blt_special(struct wined3d_texture *dst_texture,
|
|||
|| dst_rect->bottom - dst_rect->top > src_height)
|
||||
{
|
||||
TRACE("No stretching in x direction, using direct framebuffer -> texture copy.\n");
|
||||
fb_copy_to_texture_direct(dst_texture, dst_sub_resource_idx, dst_rect,
|
||||
src_texture, src_sub_resource_idx, src_rect, filter);
|
||||
fb_copy_to_texture_direct(wined3d_texture_gl(dst_texture), dst_sub_resource_idx, dst_rect,
|
||||
wined3d_texture_gl(src_texture), src_sub_resource_idx, src_rect, filter);
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Using hardware stretching to flip / stretch the texture.\n");
|
||||
fb_copy_to_texture_hwstretch(dst_texture, dst_sub_resource_idx, dst_rect,
|
||||
src_texture, src_sub_resource_idx, src_rect, filter);
|
||||
fb_copy_to_texture_hwstretch(wined3d_texture_gl(dst_texture), dst_sub_resource_idx, dst_rect,
|
||||
wined3d_texture_gl(src_texture), src_sub_resource_idx, src_rect, filter);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
|
@ -1438,7 +1438,7 @@ BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_res
|
|||
if (sub_resource->locations & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB))
|
||||
{
|
||||
struct wined3d_bo_address data;
|
||||
wined3d_texture_bind_and_dirtify(texture, context,
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context,
|
||||
!(sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB));
|
||||
wined3d_texture_get_memory(texture, sub_resource_idx, &data, dst_location);
|
||||
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
|
||||
|
@ -1605,7 +1605,7 @@ BOOL texture2d_load_texture(struct wined3d_texture *texture, unsigned int sub_re
|
|||
}
|
||||
|
||||
wined3d_texture_prepare_texture(texture, context, srgb);
|
||||
wined3d_texture_bind_and_dirtify(texture, context, srgb);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, srgb);
|
||||
wined3d_texture_get_pitch(texture, level, &src_row_pitch, &src_slice_pitch);
|
||||
|
||||
format = texture->resource.format;
|
||||
|
@ -1879,7 +1879,8 @@ static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
|
|||
? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
|
||||
if (!wined3d_texture_load_location(src_texture, src_sub_resource_idx, context, location))
|
||||
ERR("Failed to load the source sub-resource into %s.\n", wined3d_debug_location(location));
|
||||
src_name = wined3d_texture_get_texture_name(src_texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
src_name = wined3d_texture_gl_get_texture_name(wined3d_texture_gl(src_texture),
|
||||
context, location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
|
||||
location = dst_location & (WINED3D_LOCATION_TEXTURE_RGB | WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
if (!location)
|
||||
|
@ -1895,7 +1896,8 @@ static DWORD raw_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
|
|||
if (!wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, location))
|
||||
ERR("Failed to load the destination sub-resource into %s.\n", wined3d_debug_location(location));
|
||||
}
|
||||
dst_name = wined3d_texture_get_texture_name(dst_texture, context, location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
dst_name = wined3d_texture_gl_get_texture_name(wined3d_texture_gl(dst_texture),
|
||||
context, location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
|
||||
GL_EXTCALL(glCopyImageSubData(src_name, src_texture->target, src_level,
|
||||
src_rect->left, src_rect->top, src_layer, dst_name, dst_texture->target, dst_level,
|
||||
|
@ -2218,7 +2220,8 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
|
|||
checkGLcall("glAlphaFunc");
|
||||
}
|
||||
|
||||
context_draw_textured_quad(context, src_texture, src_sub_resource_idx, src_rect, dst_rect, filter);
|
||||
context_draw_textured_quad(context, wined3d_texture_gl(src_texture),
|
||||
src_sub_resource_idx, src_rect, dst_rect, filter);
|
||||
|
||||
if (op == WINED3D_BLIT_OP_COLOR_BLIT_ALPHATEST || color_key)
|
||||
{
|
||||
|
|
|
@ -356,7 +356,7 @@ static void wined3d_swapchain_gl_rotate(struct wined3d_swapchain *swapchain, str
|
|||
texture_prev = wined3d_texture_gl(swapchain->back_buffers[0]);
|
||||
|
||||
/* Back buffer 0 is already in the draw binding. */
|
||||
tex0 = texture_prev->t.texture_rgb;
|
||||
tex0 = texture_prev->texture_rgb;
|
||||
rb0 = texture_prev->rb_multisample;
|
||||
locations0 = texture_prev->t.sub_resources[0].locations;
|
||||
|
||||
|
@ -368,7 +368,7 @@ static void wined3d_swapchain_gl_rotate(struct wined3d_swapchain *swapchain, str
|
|||
if (!(sub_resource->locations & supported_locations))
|
||||
wined3d_texture_load_location(&texture->t, 0, context, texture->t.resource.draw_binding);
|
||||
|
||||
texture_prev->t.texture_rgb = texture->t.texture_rgb;
|
||||
texture_prev->texture_rgb = texture->texture_rgb;
|
||||
texture_prev->rb_multisample = texture->rb_multisample;
|
||||
|
||||
wined3d_texture_validate_location(&texture_prev->t, 0, sub_resource->locations & supported_locations);
|
||||
|
@ -377,7 +377,7 @@ static void wined3d_swapchain_gl_rotate(struct wined3d_swapchain *swapchain, str
|
|||
texture_prev = texture;
|
||||
}
|
||||
|
||||
texture_prev->t.texture_rgb = tex0;
|
||||
texture_prev->texture_rgb = tex0;
|
||||
texture_prev->rb_multisample = rb0;
|
||||
|
||||
wined3d_texture_validate_location(&texture_prev->t, 0, locations0 & supported_locations);
|
||||
|
|
|
@ -670,18 +670,18 @@ static void wined3d_texture_gl_unload_texture(struct wined3d_texture_gl *texture
|
|||
const struct wined3d_gl_info *gl_info = NULL;
|
||||
struct wined3d_context *context = NULL;
|
||||
|
||||
if (texture_gl->t.texture_rgb.name || texture_gl->t.texture_srgb.name
|
||||
if (texture_gl->texture_rgb.name || texture_gl->texture_srgb.name
|
||||
|| texture_gl->rb_multisample || texture_gl->rb_resolved)
|
||||
{
|
||||
context = context_acquire(device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
}
|
||||
|
||||
if (texture_gl->t.texture_rgb.name)
|
||||
gltexture_delete(device, context->gl_info, &texture_gl->t.texture_rgb);
|
||||
if (texture_gl->texture_rgb.name)
|
||||
gltexture_delete(device, context->gl_info, &texture_gl->texture_rgb);
|
||||
|
||||
if (texture_gl->t.texture_srgb.name)
|
||||
gltexture_delete(device, context->gl_info, &texture_gl->t.texture_srgb);
|
||||
if (texture_gl->texture_srgb.name)
|
||||
gltexture_delete(device, context->gl_info, &texture_gl->texture_srgb);
|
||||
|
||||
if (texture_gl->rb_multisample)
|
||||
{
|
||||
|
@ -957,28 +957,28 @@ void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
void wined3d_texture_bind(struct wined3d_texture *texture,
|
||||
void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
struct wined3d_context *context, BOOL srgb)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
const struct wined3d_format *format = texture->resource.format;
|
||||
const struct wined3d_format *format = texture_gl->t.resource.format;
|
||||
const struct color_fixup_desc fixup = format->color_fixup;
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
struct gl_texture *gl_tex;
|
||||
GLenum target;
|
||||
|
||||
TRACE("texture %p, context %p, srgb %#x.\n", texture, context, srgb);
|
||||
TRACE("texture_gl %p, context %p, srgb %#x.\n", texture_gl, context, srgb);
|
||||
|
||||
if (!needs_separate_srgb_gl_texture(context, texture))
|
||||
if (!needs_separate_srgb_gl_texture(context, &texture_gl->t))
|
||||
srgb = FALSE;
|
||||
|
||||
/* sRGB mode cache for preload() calls outside drawprim. */
|
||||
if (srgb)
|
||||
texture->flags |= WINED3D_TEXTURE_IS_SRGB;
|
||||
texture_gl->t.flags |= WINED3D_TEXTURE_IS_SRGB;
|
||||
else
|
||||
texture->flags &= ~WINED3D_TEXTURE_IS_SRGB;
|
||||
texture_gl->t.flags &= ~WINED3D_TEXTURE_IS_SRGB;
|
||||
|
||||
gl_tex = wined3d_texture_get_gl_texture(texture, srgb);
|
||||
target = texture->target;
|
||||
gl_tex = wined3d_texture_gl_get_gl_texture(texture_gl, srgb);
|
||||
target = texture_gl->t.target;
|
||||
|
||||
if (gl_tex->name)
|
||||
{
|
||||
|
@ -1016,7 +1016,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
|
|||
else
|
||||
gl_tex->sampler_desc.srgb_decode = srgb;
|
||||
gl_tex->base_level = 0;
|
||||
wined3d_texture_set_dirty(texture);
|
||||
wined3d_texture_set_dirty(&texture_gl->t);
|
||||
|
||||
context_bind_texture(context, target, gl_tex->name);
|
||||
|
||||
|
@ -1028,8 +1028,8 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
|
|||
* GL_TEXTURE_RECTANGLE_ARB.) */
|
||||
if (target != GL_TEXTURE_RECTANGLE_ARB)
|
||||
{
|
||||
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", texture->level_count - 1);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, texture->level_count - 1);
|
||||
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %u.\n", texture_gl->t.level_count - 1);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, texture_gl->t.level_count - 1);
|
||||
checkGLcall("glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, texture->level_count)");
|
||||
}
|
||||
|
||||
|
@ -1041,7 +1041,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
|
|||
gl_info->gl_ops.gl.p_glTexParameteri(target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
|
||||
if (texture->flags & WINED3D_TEXTURE_COND_NP2)
|
||||
if (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2)
|
||||
{
|
||||
/* Conditinal non power of two textures use a different clamping
|
||||
* default. If we're using the GL_WINE_normalized_texrect partial
|
||||
|
@ -1080,7 +1080,7 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
|
||||
void wined3d_texture_gl_bind_and_dirtify(struct wined3d_texture_gl *texture_gl,
|
||||
struct wined3d_context *context, BOOL srgb)
|
||||
{
|
||||
/* We don't need a specific texture unit, but after binding the texture
|
||||
|
@ -1103,22 +1103,22 @@ void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
|
|||
context_invalidate_compute_state(context, STATE_COMPUTE_SHADER_RESOURCE_BINDING);
|
||||
context_invalidate_state(context, STATE_GRAPHICS_SHADER_RESOURCE_BINDING);
|
||||
|
||||
wined3d_texture_bind(texture, context, srgb);
|
||||
wined3d_texture_gl_bind(texture_gl, context, srgb);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller (state handler). */
|
||||
/* This function relies on the correct texture being bound and loaded. */
|
||||
void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
|
||||
void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl *texture_gl,
|
||||
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
GLenum target = texture->target;
|
||||
GLenum target = texture_gl->t.target;
|
||||
struct gl_texture *gl_tex;
|
||||
DWORD state;
|
||||
|
||||
TRACE("texture %p, sampler_desc %p, context %p.\n", texture, sampler_desc, context);
|
||||
TRACE("texture_gl %p, sampler_desc %p, context %p.\n", texture_gl, sampler_desc, context);
|
||||
|
||||
gl_tex = wined3d_texture_get_gl_texture(texture, texture->flags & WINED3D_TEXTURE_IS_SRGB);
|
||||
gl_tex = wined3d_texture_gl_get_gl_texture(texture_gl, texture_gl->t.flags & WINED3D_TEXTURE_IS_SRGB);
|
||||
|
||||
state = sampler_desc->address_u;
|
||||
if (state != gl_tex->sampler_desc.address_u)
|
||||
|
@ -1402,16 +1402,18 @@ void CDECL wined3d_texture_get_pitch(const struct wined3d_texture *texture,
|
|||
|
||||
DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod)
|
||||
{
|
||||
struct wined3d_resource *resource;
|
||||
DWORD old = texture->lod;
|
||||
|
||||
TRACE("texture %p, lod %u.\n", texture, lod);
|
||||
|
||||
/* The d3d9:texture test shows that SetLOD is ignored on non-managed
|
||||
* textures. The call always returns 0, and GetLOD always returns 0. */
|
||||
if (!wined3d_resource_access_is_managed(texture->resource.access))
|
||||
resource = &texture->resource;
|
||||
if (!wined3d_resource_access_is_managed(resource->access))
|
||||
{
|
||||
TRACE("Ignoring LOD on texture with resource access %s.\n",
|
||||
wined3d_debug_resource_access(texture->resource.access));
|
||||
wined3d_debug_resource_access(resource->access));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1420,14 +1422,14 @@ DWORD CDECL wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod)
|
|||
|
||||
if (texture->lod != lod)
|
||||
{
|
||||
struct wined3d_device *device = texture->resource.device;
|
||||
struct wined3d_device *device = resource->device;
|
||||
|
||||
wined3d_resource_wait_idle(&texture->resource);
|
||||
wined3d_resource_wait_idle(resource);
|
||||
texture->lod = lod;
|
||||
|
||||
texture->texture_rgb.base_level = ~0u;
|
||||
texture->texture_srgb.base_level = ~0u;
|
||||
if (texture->resource.bind_count)
|
||||
wined3d_texture_gl(texture)->texture_rgb.base_level = ~0u;
|
||||
wined3d_texture_gl(texture)->texture_srgb.base_level = ~0u;
|
||||
if (resource->bind_count)
|
||||
wined3d_cs_emit_set_sampler_state(device->cs, texture->sampler, WINED3D_SAMP_MAX_MIP_LEVEL,
|
||||
device->state.sampler_states[texture->sampler][WINED3D_SAMP_MAX_MIP_LEVEL]);
|
||||
}
|
||||
|
@ -1777,7 +1779,7 @@ void wined3d_texture_prepare_texture(struct wined3d_texture *texture, struct win
|
|||
}
|
||||
format_gl = wined3d_format_gl(format);
|
||||
|
||||
wined3d_texture_bind_and_dirtify(texture, context, srgb);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, srgb);
|
||||
|
||||
if (srgb)
|
||||
internal = format_gl->srgb_internal;
|
||||
|
@ -2152,7 +2154,7 @@ void wined3d_texture_upload_data(struct wined3d_texture *texture, unsigned int s
|
|||
|
||||
for (i = 0; i < device->context_count; ++i)
|
||||
{
|
||||
context_texture_update(device->contexts[i], texture);
|
||||
context_texture_update(device->contexts[i], wined3d_texture_gl(texture));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2773,8 +2775,8 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
struct wined3d_box src_box;
|
||||
|
||||
data.addr += sub_resource->offset;
|
||||
wined3d_texture_bind_and_dirtify(texture, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture),
|
||||
context, location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||
wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
||||
|
@ -2785,7 +2787,7 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
|
||||
struct wined3d_box src_box;
|
||||
|
||||
wined3d_texture_bind_and_dirtify(texture, context,
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||
|
@ -2806,9 +2808,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
|
||||
data.addr += sub_resource->offset;
|
||||
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, FALSE);
|
||||
else
|
||||
wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, TRUE);
|
||||
|
||||
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
|
||||
++texture->download_count;
|
||||
|
@ -2827,9 +2829,9 @@ static BOOL texture1d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
struct wined3d_bo_address data = {sub_resource->buffer_object, NULL};
|
||||
|
||||
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, FALSE);
|
||||
else
|
||||
wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, TRUE);
|
||||
|
||||
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
|
||||
}
|
||||
|
@ -3214,9 +3216,9 @@ static void texture3d_srgb_transfer(struct wined3d_texture *texture, unsigned in
|
|||
|
||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||
wined3d_texture_bind_and_dirtify(texture, context, !dest_is_srgb);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, !dest_is_srgb);
|
||||
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
|
||||
wined3d_texture_bind_and_dirtify(texture, context, dest_is_srgb);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, dest_is_srgb);
|
||||
wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
||||
&src_box, wined3d_const_bo_address(&data), row_pitch, slice_pitch, 0, 0, 0, FALSE);
|
||||
|
||||
|
@ -3243,8 +3245,8 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
struct wined3d_box src_box;
|
||||
|
||||
data.addr += sub_resource->offset;
|
||||
wined3d_texture_bind_and_dirtify(texture, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture),
|
||||
context, location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||
wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
||||
|
@ -3255,8 +3257,8 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
struct wined3d_const_bo_address data = {sub_resource->buffer_object, NULL};
|
||||
struct wined3d_box src_box;
|
||||
|
||||
wined3d_texture_bind_and_dirtify(texture, context,
|
||||
location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture),
|
||||
context, location == WINED3D_LOCATION_TEXTURE_SRGB);
|
||||
wined3d_texture_get_pitch(texture, sub_resource_idx, &row_pitch, &slice_pitch);
|
||||
wined3d_texture_get_level_box(texture, sub_resource_idx % texture->level_count, &src_box);
|
||||
wined3d_texture_upload_data(texture, sub_resource_idx, context, texture->resource.format,
|
||||
|
@ -3284,9 +3286,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
|
||||
data.addr += sub_resource->offset;
|
||||
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, FALSE);
|
||||
else
|
||||
wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, TRUE);
|
||||
|
||||
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
|
||||
++texture->download_count;
|
||||
|
@ -3305,9 +3307,9 @@ static BOOL texture3d_load_location(struct wined3d_texture *texture, unsigned in
|
|||
struct wined3d_bo_address data = {sub_resource->buffer_object, NULL};
|
||||
|
||||
if (sub_resource->locations & WINED3D_LOCATION_TEXTURE_RGB)
|
||||
wined3d_texture_bind_and_dirtify(texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, FALSE);
|
||||
else
|
||||
wined3d_texture_bind_and_dirtify(texture, context, TRUE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(texture), context, TRUE);
|
||||
|
||||
wined3d_texture_download_data(texture, sub_resource_idx, context, &data);
|
||||
}
|
||||
|
@ -3843,7 +3845,7 @@ void wined3d_texture_upload_from_texture(struct wined3d_texture *dst_texture, un
|
|||
wined3d_texture_prepare_texture(dst_texture, context, FALSE);
|
||||
else
|
||||
wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, context, WINED3D_LOCATION_TEXTURE_RGB);
|
||||
wined3d_texture_bind_and_dirtify(dst_texture, context, FALSE);
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(dst_texture), context, FALSE);
|
||||
|
||||
src_level = src_sub_resource_idx % src_texture->level_count;
|
||||
wined3d_texture_get_memory(src_texture, src_sub_resource_idx, &data,
|
||||
|
@ -3871,7 +3873,7 @@ void wined3d_texture_download_from_texture(struct wined3d_texture *dst_texture,
|
|||
|
||||
wined3d_texture_prepare_location(dst_texture, dst_sub_resource_idx, context, dst_location);
|
||||
wined3d_texture_get_memory(dst_texture, dst_sub_resource_idx, &data, dst_location);
|
||||
wined3d_texture_bind_and_dirtify(src_texture, context,
|
||||
wined3d_texture_gl_bind_and_dirtify(wined3d_texture_gl(src_texture), context,
|
||||
!(src_texture->sub_resources[src_sub_resource_idx].locations & WINED3D_LOCATION_TEXTURE_RGB));
|
||||
wined3d_texture_download_data(src_texture, src_sub_resource_idx, context, &data);
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ static const struct wined3d_format *validate_resource_view(const struct wined3d_
|
|||
}
|
||||
|
||||
static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target,
|
||||
const struct wined3d_view_desc *desc, struct wined3d_texture *texture,
|
||||
const struct wined3d_view_desc *desc, struct wined3d_texture_gl *texture_gl,
|
||||
const struct wined3d_format *view_format)
|
||||
{
|
||||
const struct wined3d_format_gl *view_format_gl;
|
||||
|
@ -178,7 +178,7 @@ static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target
|
|||
view_format_gl = wined3d_format_gl(view_format);
|
||||
view->target = view_target;
|
||||
|
||||
context = context_acquire(texture->resource.device, NULL, 0);
|
||||
context = context_acquire(texture_gl->t.resource.device, NULL, 0);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (!gl_info->supported[ARB_TEXTURE_VIEW])
|
||||
|
@ -188,15 +188,15 @@ static void create_texture_view(struct wined3d_gl_view *view, GLenum view_target
|
|||
return;
|
||||
}
|
||||
|
||||
wined3d_texture_prepare_texture(texture, context, FALSE);
|
||||
texture_name = wined3d_texture_get_texture_name(texture, context, FALSE);
|
||||
wined3d_texture_prepare_texture(&texture_gl->t, context, FALSE);
|
||||
texture_name = wined3d_texture_gl_get_texture_name(texture_gl, context, FALSE);
|
||||
|
||||
level_idx = desc->u.texture.level_idx;
|
||||
layer_idx = desc->u.texture.layer_idx;
|
||||
layer_count = desc->u.texture.layer_count;
|
||||
if (view_target == GL_TEXTURE_3D)
|
||||
{
|
||||
if (layer_idx || layer_count != wined3d_texture_get_level_depth(texture, level_idx))
|
||||
if (layer_idx || layer_count != wined3d_texture_get_level_depth(&texture_gl->t, level_idx))
|
||||
FIXME("Depth slice (%u-%u) not supported.\n", layer_idx, layer_count);
|
||||
layer_idx = 0;
|
||||
layer_count = 1;
|
||||
|
@ -537,13 +537,13 @@ static void wined3d_render_target_view_cs_init(void *object)
|
|||
}
|
||||
else
|
||||
{
|
||||
struct wined3d_texture *texture = texture_from_resource(resource);
|
||||
struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(texture_from_resource(resource));
|
||||
unsigned int depth_or_layer_count;
|
||||
|
||||
if (resource->type == WINED3D_RTYPE_TEXTURE_3D)
|
||||
depth_or_layer_count = wined3d_texture_get_level_depth(texture, desc->u.texture.level_idx);
|
||||
depth_or_layer_count = wined3d_texture_get_level_depth(&texture_gl->t, desc->u.texture.level_idx);
|
||||
else
|
||||
depth_or_layer_count = texture->layer_count;
|
||||
depth_or_layer_count = texture_gl->t.layer_count;
|
||||
|
||||
if (resource->format->id != view->format->id
|
||||
|| (view->layer_count != 1 && view->layer_count != depth_or_layer_count))
|
||||
|
@ -558,13 +558,13 @@ static void wined3d_render_target_view_cs_init(void *object)
|
|||
debug_d3dformat(resource->format->id), debug_d3dformat(view->format->id));
|
||||
return;
|
||||
}
|
||||
if (texture->swapchain && texture->swapchain->desc.backbuffer_count > 1)
|
||||
if (texture_gl->t.swapchain && texture_gl->t.swapchain->desc.backbuffer_count > 1)
|
||||
{
|
||||
FIXME("Swapchain views not supported.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
create_texture_view(&view->gl_view, texture->target, desc, texture, view->format);
|
||||
create_texture_view(&view->gl_view, texture_gl->t.target, desc, texture_gl, view->format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -742,32 +742,32 @@ static void wined3d_shader_resource_view_cs_init(void *object)
|
|||
}
|
||||
else
|
||||
{
|
||||
struct wined3d_texture *texture = texture_from_resource(resource);
|
||||
struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(texture_from_resource(resource));
|
||||
GLenum resource_class, view_class;
|
||||
|
||||
resource_class = wined3d_format_gl(resource->format)->view_class;
|
||||
view_class = wined3d_format_gl(view_format)->view_class;
|
||||
view_target = get_texture_view_target(gl_info, desc, texture);
|
||||
view_target = get_texture_view_target(gl_info, desc, &texture_gl->t);
|
||||
|
||||
if (resource->format->id == view_format->id && texture->target == view_target
|
||||
&& !desc->u.texture.level_idx && desc->u.texture.level_count == texture->level_count
|
||||
&& !desc->u.texture.layer_idx && desc->u.texture.layer_count == texture->layer_count
|
||||
if (resource->format->id == view_format->id && texture_gl->t.target == view_target
|
||||
&& !desc->u.texture.level_idx && desc->u.texture.level_count == texture_gl->t.level_count
|
||||
&& !desc->u.texture.layer_idx && desc->u.texture.layer_count == texture_gl->t.layer_count
|
||||
&& !is_stencil_view_format(view_format))
|
||||
{
|
||||
TRACE("Creating identity shader resource view.\n");
|
||||
}
|
||||
else if (texture->swapchain && texture->swapchain->desc.backbuffer_count > 1)
|
||||
else if (texture_gl->t.swapchain && texture_gl->t.swapchain->desc.backbuffer_count > 1)
|
||||
{
|
||||
FIXME("Swapchain shader resource views not supported.\n");
|
||||
}
|
||||
else if (resource->format->typeless_id == view_format->typeless_id
|
||||
&& resource_class == view_class)
|
||||
{
|
||||
create_texture_view(&view->gl_view, view_target, desc, texture, view_format);
|
||||
create_texture_view(&view->gl_view, view_target, desc, texture_gl, view_format);
|
||||
}
|
||||
else if (wined3d_format_is_depth_view(resource->format->id, view_format->id))
|
||||
{
|
||||
create_texture_view(&view->gl_view, view_target, desc, texture, resource->format);
|
||||
create_texture_view(&view->gl_view, view_target, desc, texture_gl, resource->format);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -826,7 +826,7 @@ void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view
|
|||
unsigned int unit, struct wined3d_sampler *sampler, struct wined3d_context *context)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
struct wined3d_texture *texture;
|
||||
struct wined3d_texture_gl *texture_gl;
|
||||
|
||||
context_active_texture(context, gl_info, unit);
|
||||
|
||||
|
@ -843,9 +843,9 @@ void wined3d_shader_resource_view_bind(struct wined3d_shader_resource_view *view
|
|||
return;
|
||||
}
|
||||
|
||||
texture = wined3d_texture_from_resource(view->resource);
|
||||
wined3d_texture_bind(texture, context, FALSE);
|
||||
wined3d_sampler_bind(sampler, unit, texture, context);
|
||||
texture_gl = wined3d_texture_gl(wined3d_texture_from_resource(view->resource));
|
||||
wined3d_texture_gl_bind(texture_gl, context, FALSE);
|
||||
wined3d_sampler_bind(sampler, unit, texture_gl, context);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
|
@ -868,9 +868,9 @@ static void shader_resource_view_bind_and_dirtify(struct wined3d_shader_resource
|
|||
|
||||
void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *view)
|
||||
{
|
||||
struct wined3d_texture *texture = texture_from_resource(view->resource);
|
||||
unsigned int i, j, layer_count, level_count, base_level, max_level;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_texture_gl *texture_gl;
|
||||
struct wined3d_context *context;
|
||||
struct gl_texture *gl_tex;
|
||||
DWORD location;
|
||||
|
@ -885,10 +885,11 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *
|
|||
base_level = view->desc.u.texture.level_idx;
|
||||
max_level = base_level + level_count - 1;
|
||||
|
||||
srgb = !!(texture->flags & WINED3D_TEXTURE_IS_SRGB);
|
||||
texture_gl = wined3d_texture_gl(texture_from_resource(view->resource));
|
||||
srgb = !!(texture_gl->t.flags & WINED3D_TEXTURE_IS_SRGB);
|
||||
location = srgb ? WINED3D_LOCATION_TEXTURE_SRGB : WINED3D_LOCATION_TEXTURE_RGB;
|
||||
for (i = 0; i < layer_count; ++i)
|
||||
wined3d_texture_load_location(texture, i * level_count + base_level, context, location);
|
||||
wined3d_texture_load_location(&texture_gl->t, i * level_count + base_level, context, location);
|
||||
|
||||
if (view->gl_view.name)
|
||||
{
|
||||
|
@ -896,37 +897,38 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *
|
|||
}
|
||||
else
|
||||
{
|
||||
wined3d_texture_bind_and_dirtify(texture, context, srgb);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_BASE_LEVEL, base_level);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, max_level);
|
||||
wined3d_texture_gl_bind_and_dirtify(texture_gl, context, srgb);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->t.target, GL_TEXTURE_BASE_LEVEL, base_level);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->t.target, GL_TEXTURE_MAX_LEVEL, max_level);
|
||||
}
|
||||
|
||||
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
|
||||
GL_EXTCALL(glBindSampler(context->active_texture, 0));
|
||||
gl_tex = wined3d_texture_get_gl_texture(texture, srgb);
|
||||
gl_tex = wined3d_texture_gl_get_gl_texture(texture_gl, srgb);
|
||||
if (context->d3d_info->wined3d_creation_flags & WINED3D_SRGB_READ_WRITE_CONTROL)
|
||||
{
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_SRGB_DECODE_EXT,
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->t.target, GL_TEXTURE_SRGB_DECODE_EXT,
|
||||
GL_SKIP_DECODE_EXT);
|
||||
gl_tex->sampler_desc.srgb_decode = FALSE;
|
||||
}
|
||||
|
||||
gl_info->fbo_ops.glGenerateMipmap(texture->target);
|
||||
gl_info->fbo_ops.glGenerateMipmap(texture_gl->t.target);
|
||||
checkGLcall("glGenerateMipMap()");
|
||||
|
||||
for (i = 0; i < layer_count; ++i)
|
||||
{
|
||||
for (j = base_level + 1; j <= max_level; ++j)
|
||||
{
|
||||
wined3d_texture_validate_location(texture, i * level_count + j, location);
|
||||
wined3d_texture_invalidate_location(texture, i * level_count + j, ~location);
|
||||
wined3d_texture_validate_location(&texture_gl->t, i * level_count + j, location);
|
||||
wined3d_texture_invalidate_location(&texture_gl->t, i * level_count + j, ~location);
|
||||
}
|
||||
}
|
||||
|
||||
if (!view->gl_view.name)
|
||||
{
|
||||
gl_tex->base_level = base_level;
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture->target, GL_TEXTURE_MAX_LEVEL, texture->level_count - 1);
|
||||
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->t.target,
|
||||
GL_TEXTURE_MAX_LEVEL, texture_gl->t.level_count - 1);
|
||||
}
|
||||
|
||||
context_release(context);
|
||||
|
@ -1129,18 +1131,18 @@ static void wined3d_unordered_access_view_cs_init(void *object)
|
|||
}
|
||||
else
|
||||
{
|
||||
struct wined3d_texture *texture = texture_from_resource(resource);
|
||||
struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(texture_from_resource(resource));
|
||||
unsigned int depth_or_layer_count;
|
||||
|
||||
if (resource->type == WINED3D_RTYPE_TEXTURE_3D)
|
||||
depth_or_layer_count = wined3d_texture_get_level_depth(texture, desc->u.texture.level_idx);
|
||||
depth_or_layer_count = wined3d_texture_get_level_depth(&texture_gl->t, desc->u.texture.level_idx);
|
||||
else
|
||||
depth_or_layer_count = texture->layer_count;
|
||||
depth_or_layer_count = texture_gl->t.layer_count;
|
||||
|
||||
if (desc->u.texture.layer_idx || desc->u.texture.layer_count != depth_or_layer_count)
|
||||
{
|
||||
create_texture_view(&view->gl_view, get_texture_view_target(gl_info, desc, texture),
|
||||
desc, texture, view->format);
|
||||
create_texture_view(&view->gl_view, get_texture_view_target(gl_info, desc, &texture_gl->t),
|
||||
desc, texture_gl, view->format);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,12 @@
|
|||
#define WINED3D_QUIRK_LIMITED_TEX_FILTERING 0x00000100
|
||||
#define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200
|
||||
|
||||
struct fragment_pipeline;
|
||||
struct wined3d_context;
|
||||
struct wined3d_state;
|
||||
struct wined3d_texture_gl;
|
||||
struct wined3d_vertex_pipe_ops;
|
||||
|
||||
enum wined3d_ffp_idx
|
||||
{
|
||||
WINED3D_FFP_POSITION = 0,
|
||||
|
@ -1392,11 +1398,6 @@ struct gs_compile_args
|
|||
DWORD interpolation_mode[WINED3D_PACKED_INTERPOLATION_SIZE];
|
||||
};
|
||||
|
||||
struct wined3d_context;
|
||||
struct wined3d_state;
|
||||
struct fragment_pipeline;
|
||||
struct wined3d_vertex_pipe_ops;
|
||||
|
||||
struct wined3d_shader_backend_ops
|
||||
{
|
||||
void (*shader_handle_instruction)(const struct wined3d_shader_instruction *);
|
||||
|
@ -2166,10 +2167,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, stru
|
|||
const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
|
||||
HGLRC context_create_wgl_attribs(const struct wined3d_gl_info *gl_info, HDC hdc, HGLRC share_ctx) DECLSPEC_HIDDEN;
|
||||
void context_destroy(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void context_draw_shaded_quad(struct wined3d_context *context, struct wined3d_texture *texture,
|
||||
void context_draw_shaded_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_draw_textured_quad(struct wined3d_context *context, struct wined3d_texture *texture,
|
||||
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;
|
||||
|
@ -2202,7 +2203,8 @@ void context_state_drawbuf(struct wined3d_context *context,
|
|||
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
|
||||
void context_state_fb(struct wined3d_context *context,
|
||||
const struct wined3d_state *state, DWORD state_id) DECLSPEC_HIDDEN;
|
||||
void context_texture_update(struct wined3d_context *context, const struct wined3d_texture *texture) DECLSPEC_HIDDEN;
|
||||
void context_texture_update(struct wined3d_context *context,
|
||||
const struct wined3d_texture_gl *texture_gl) DECLSPEC_HIDDEN;
|
||||
void context_unload_tex_coords(const struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void context_unmap_bo_address(struct wined3d_context *context,
|
||||
const struct wined3d_bo_address *data, GLenum binding) DECLSPEC_HIDDEN;
|
||||
|
@ -3169,13 +3171,6 @@ void wined3d_resource_update_draw_binding(struct wined3d_resource *resource) DEC
|
|||
#define RESOURCE_ALIGNMENT 16
|
||||
#define WINED3D_CONSTANT_BUFFER_ALIGNMENT 16
|
||||
|
||||
struct gl_texture
|
||||
{
|
||||
struct wined3d_sampler_desc sampler_desc;
|
||||
unsigned int base_level;
|
||||
GLuint name;
|
||||
};
|
||||
|
||||
struct wined3d_blt_info
|
||||
{
|
||||
GLenum bind_target;
|
||||
|
@ -3211,7 +3206,6 @@ struct wined3d_texture
|
|||
{
|
||||
struct wined3d_resource resource;
|
||||
const struct wined3d_texture_ops *texture_ops;
|
||||
struct gl_texture texture_rgb, texture_srgb;
|
||||
struct wined3d_swapchain *swapchain;
|
||||
unsigned int pow2_width;
|
||||
unsigned int pow2_height;
|
||||
|
@ -3296,12 +3290,6 @@ static inline GLenum wined3d_texture_get_sub_resource_target(const struct wined3
|
|||
? cube_targets[sub_resource_idx / texture->level_count] : texture->target;
|
||||
}
|
||||
|
||||
static inline struct gl_texture *wined3d_texture_get_gl_texture(struct wined3d_texture *texture,
|
||||
BOOL srgb)
|
||||
{
|
||||
return srgb ? &texture->texture_srgb : &texture->texture_rgb;
|
||||
}
|
||||
|
||||
static inline unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture,
|
||||
unsigned int level)
|
||||
{
|
||||
|
@ -3358,12 +3346,6 @@ BOOL texture2d_load_sysmem(struct wined3d_texture *texture, unsigned int sub_res
|
|||
BOOL texture2d_load_texture(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
|
||||
void wined3d_texture_apply_sampler_desc(struct wined3d_texture *texture,
|
||||
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_bind(struct wined3d_texture *texture,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_bind_and_dirtify(struct wined3d_texture *texture,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
HRESULT wined3d_texture_check_box_dimensions(const struct wined3d_texture *texture,
|
||||
unsigned int level, const struct wined3d_box *box) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_download_data(struct wined3d_texture *texture, unsigned int sub_resource_idx,
|
||||
|
@ -3400,10 +3382,19 @@ void wined3d_texture_validate_location(struct wined3d_texture *texture,
|
|||
|
||||
void wined3d_gl_texture_swizzle_from_color_fixup(GLint swizzle[4], struct color_fixup_desc fixup) DECLSPEC_HIDDEN;
|
||||
|
||||
struct gl_texture
|
||||
{
|
||||
struct wined3d_sampler_desc sampler_desc;
|
||||
unsigned int base_level;
|
||||
GLuint name;
|
||||
};
|
||||
|
||||
struct wined3d_texture_gl
|
||||
{
|
||||
struct wined3d_texture t;
|
||||
|
||||
struct gl_texture texture_rgb, texture_srgb;
|
||||
|
||||
GLuint rb_multisample;
|
||||
GLuint rb_resolved;
|
||||
|
||||
|
@ -3416,6 +3407,18 @@ static inline struct wined3d_texture_gl *wined3d_texture_gl(struct wined3d_textu
|
|||
return CONTAINING_RECORD(texture, struct wined3d_texture_gl, t);
|
||||
}
|
||||
|
||||
static inline struct gl_texture *wined3d_texture_gl_get_gl_texture(struct wined3d_texture_gl *texture_gl,
|
||||
BOOL srgb)
|
||||
{
|
||||
return srgb ? &texture_gl->texture_srgb : &texture_gl->texture_rgb;
|
||||
}
|
||||
|
||||
void wined3d_texture_gl_apply_sampler_desc(struct wined3d_texture_gl *texture_gl,
|
||||
const struct wined3d_sampler_desc *sampler_desc, const struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_gl_bind(struct wined3d_texture_gl *texture_gl,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_gl_bind_and_dirtify(struct wined3d_texture_gl *texture_gl,
|
||||
struct wined3d_context *context, BOOL srgb) DECLSPEC_HIDDEN;
|
||||
void wined3d_texture_gl_set_compatible_renderbuffer(struct wined3d_texture_gl *texture_gl,
|
||||
struct wined3d_context *context, unsigned int level,
|
||||
const struct wined3d_rendertarget_info *rt) DECLSPEC_HIDDEN;
|
||||
|
@ -3476,7 +3479,7 @@ struct wined3d_sampler
|
|||
};
|
||||
|
||||
void wined3d_sampler_bind(struct wined3d_sampler *sampler, unsigned int unit,
|
||||
struct wined3d_texture *texture, const struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
struct wined3d_texture_gl *texture_gl, const struct wined3d_context *context) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_vertex_declaration_element
|
||||
{
|
||||
|
@ -4506,11 +4509,11 @@ static inline BOOL needs_srgb_write(const struct wined3d_context *context,
|
|||
&& fb->render_targets[0] && fb->render_targets[0]->format_flags & WINED3DFMT_FLAG_SRGB_WRITE;
|
||||
}
|
||||
|
||||
static inline GLuint wined3d_texture_get_texture_name(const struct wined3d_texture *texture,
|
||||
static inline GLuint wined3d_texture_gl_get_texture_name(const struct wined3d_texture_gl *texture_gl,
|
||||
const struct wined3d_context *context, BOOL srgb)
|
||||
{
|
||||
return srgb && needs_separate_srgb_gl_texture(context, texture)
|
||||
? texture->texture_srgb.name : texture->texture_rgb.name;
|
||||
return srgb && needs_separate_srgb_gl_texture(context, &texture_gl->t)
|
||||
? texture_gl->texture_srgb.name : texture_gl->texture_rgb.name;
|
||||
}
|
||||
|
||||
static inline BOOL can_use_texture_swizzle(const struct wined3d_gl_info *gl_info, const struct wined3d_format *format)
|
||||
|
|
Loading…
Reference in New Issue