Commit 961a94ac authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move the "target" field from struct wined3d_texture to struct wined3d_texture_gl.

parent 5f974076
......@@ -7542,7 +7542,7 @@ static GLuint arbfp_gen_plain_shader(const struct wined3d_gl_info *gl_info, cons
/* Context activation is done by the caller. */
static HRESULT arbfp_blit_set(struct wined3d_arbfp_blitter *blitter, struct wined3d_context *context,
const struct wined3d_texture *texture, unsigned int sub_resource_idx,
const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
const struct wined3d_color_key *color_key)
{
enum complex_fixup fixup;
......@@ -7555,18 +7555,18 @@ static HRESULT arbfp_blit_set(struct wined3d_arbfp_blitter *blitter, struct wine
unsigned int level;
GLuint shader;
level = sub_resource_idx % texture->level_count;
size.x = wined3d_texture_get_level_pow2_width(texture, level);
size.y = wined3d_texture_get_level_pow2_height(texture, level);
level = sub_resource_idx % texture_gl->t.level_count;
size.x = wined3d_texture_get_level_pow2_width(&texture_gl->t, level);
size.y = wined3d_texture_get_level_pow2_height(&texture_gl->t, level);
size.z = 1.0f;
size.w = 1.0f;
if (is_complex_fixup(texture->resource.format->color_fixup))
fixup = get_complex_fixup(texture->resource.format->color_fixup);
if (is_complex_fixup(texture_gl->t.resource.format->color_fixup))
fixup = get_complex_fixup(texture_gl->t.resource.format->color_fixup);
else
fixup = COMPLEX_FIXUP_NONE;
switch (texture->target)
switch (texture_gl->target)
{
case GL_TEXTURE_1D:
type.res_type = WINED3D_GL_RES_TYPE_TEX_1D;
......@@ -7589,7 +7589,7 @@ static HRESULT arbfp_blit_set(struct wined3d_arbfp_blitter *blitter, struct wine
break;
default:
ERR("Unexpected GL texture type %#x.\n", texture->target);
ERR("Unexpected GL texture type %#x.\n", texture_gl->target);
type.res_type = WINED3D_GL_RES_TYPE_TEX_2D;
}
type.fixup = fixup;
......@@ -7606,7 +7606,7 @@ static HRESULT arbfp_blit_set(struct wined3d_arbfp_blitter *blitter, struct wine
switch (fixup)
{
case COMPLEX_FIXUP_NONE:
if (!is_identity_fixup(texture->resource.format->color_fixup))
if (!is_identity_fixup(texture_gl->t.resource.format->color_fixup))
FIXME("Implement support for sign or swizzle fixups.\n");
shader = arbfp_gen_plain_shader(gl_info, &type);
break;
......@@ -7648,7 +7648,7 @@ err_out:
}
if (fixup == COMPLEX_FIXUP_P8)
upload_palette(blitter, texture, context);
upload_palette(blitter, &texture_gl->t, context);
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)");
......@@ -7658,7 +7658,7 @@ err_out:
checkGLcall("glProgramLocalParameter4fvARB");
if (type.use_color_key)
{
wined3d_format_get_float_color_key(texture->resource.format, color_key, float_color_key);
wined3d_format_get_float_color_key(texture_gl->t.resource.format, color_key, float_color_key);
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
ARBFP_BLIT_PARAM_COLOR_KEY_LOW, &float_color_key[0].r));
GL_EXTCALL(glProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB,
......@@ -7775,6 +7775,7 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *color_key, enum wined3d_texture_filter_type filter)
{
struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
struct wined3d_device *device = dst_texture->resource.device;
struct wined3d_texture *staging_texture = NULL;
struct wined3d_arbfp_blitter *arbfp_blitter;
......@@ -7850,7 +7851,7 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
* flip in the blitter, we don't actually need that flip anyway. So we
* use the surface's texture as scratch texture, and flip the source
* rectangle instead. */
texture2d_load_fb_texture(src_texture, src_sub_resource_idx, FALSE, context);
texture2d_load_fb_texture(src_texture_gl, src_sub_resource_idx, FALSE, context);
s = *src_rect;
src_level = src_sub_resource_idx % src_texture->level_count;
......@@ -7901,10 +7902,10 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
color_key = &alpha_test_key;
}
arbfp_blit_set(arbfp_blitter, context, src_texture, src_sub_resource_idx, color_key);
arbfp_blit_set(arbfp_blitter, context, src_texture_gl, src_sub_resource_idx, color_key);
/* Draw a textured quad */
context_draw_textured_quad(context, wined3d_texture_gl(src_texture),
context_draw_textured_quad(context, src_texture_gl,
src_sub_resource_idx, src_rect, dst_rect, filter);
/* Leave the opengl state valid for blitting */
......
......@@ -462,7 +462,7 @@ static inline void context_set_fbo_key_for_render_target(const struct wined3d_co
return;
}
key->objects[idx].target = wined3d_texture_get_sub_resource_target(&texture_gl->t, sub_resource_idx);
key->objects[idx].target = wined3d_texture_gl_get_sub_resource_target(texture_gl, sub_resource_idx);
key->objects[idx].level = sub_resource_idx % texture_gl->t.level_count;
key->objects[idx].layer = sub_resource_idx / texture_gl->t.level_count;
......@@ -5596,7 +5596,7 @@ void context_draw_shaded_quad(struct wined3d_context *context, struct wined3d_te
}
quad[4];
texture2d_get_blt_info(&texture_gl->t, sub_resource_idx, src_rect, &info);
texture2d_get_blt_info(texture_gl, sub_resource_idx, src_rect, &info);
level = sub_resource_idx % texture_gl->t.level_count;
context_bind_texture(context, info.bind_target, texture_gl->texture_rgb.name);
......@@ -5674,7 +5674,7 @@ void context_draw_textured_quad(struct wined3d_context *context, struct wined3d_
struct wined3d_blt_info info;
unsigned int level;
texture2d_get_blt_info(&texture_gl->t, sub_resource_idx, src_rect, &info);
texture2d_get_blt_info(texture_gl, sub_resource_idx, src_rect, &info);
gl_info->gl_ops.gl.p_glEnable(info.bind_target);
checkGLcall("glEnable(bind_target)");
......
......@@ -1351,7 +1351,7 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
if (InterlockedIncrement(&op->texture->resource.bind_count) == 1)
op->texture->sampler = op->stage;
if (!prev || op->texture->target != prev->target
if (!prev || wined3d_texture_gl(op->texture)->target != wined3d_texture_gl(prev)->target
|| (!is_same_fixup(new_format->color_fixup, old_format->color_fixup)
&& !(can_use_texture_swizzle(gl_info, new_format) && can_use_texture_swizzle(gl_info, old_format)))
|| (new_fmt_flags & WINED3DFMT_FLAG_SHADOW) != (old_fmt_flags & WINED3DFMT_FLAG_SHADOW))
......
......@@ -13063,7 +13063,7 @@ static void glsl_blitter_upload_palette(struct wined3d_glsl_blitter *blitter,
/* Context activation is done by the caller. */
static struct glsl_blitter_program *glsl_blitter_get_program(struct wined3d_glsl_blitter *blitter,
struct wined3d_context *context, const struct wined3d_texture *texture)
struct wined3d_context *context, const struct wined3d_texture_gl *texture_gl)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct glsl_blitter_program *program;
......@@ -13071,8 +13071,8 @@ static struct glsl_blitter_program *glsl_blitter_get_program(struct wined3d_glsl
struct wine_rb_entry *entry;
memset(&args, 0, sizeof(args));
args.texture_type = texture->target;
args.fixup = texture->resource.format->color_fixup;
args.texture_type = texture_gl->target;
args.fixup = texture_gl->t.resource.format->color_fixup;
if ((entry = wine_rb_get(&blitter->programs, &args)))
return WINE_RB_ENTRY_VALUE(entry, struct glsl_blitter_program, entry);
......@@ -13103,11 +13103,11 @@ static struct glsl_blitter_program *glsl_blitter_get_program(struct wined3d_glsl
}
static BOOL glsl_blitter_supported(enum wined3d_blit_op blit_op, const struct wined3d_context *context,
const struct wined3d_texture *src_texture, DWORD src_location,
const struct wined3d_texture *dst_texture, DWORD dst_location)
const struct wined3d_texture_gl *src_texture, DWORD src_location,
const struct wined3d_texture_gl *dst_texture, DWORD dst_location)
{
const struct wined3d_resource *src_resource = &src_texture->resource;
const struct wined3d_resource *dst_resource = &dst_texture->resource;
const struct wined3d_resource *src_resource = &src_texture->t.resource;
const struct wined3d_resource *dst_resource = &dst_texture->t.resource;
const struct wined3d_format *src_format = src_resource->format;
const struct wined3d_format *dst_format = dst_resource->format;
BOOL decompress;
......@@ -13166,6 +13166,8 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
unsigned int dst_sub_resource_idx, DWORD dst_location, const RECT *dst_rect,
const struct wined3d_color_key *colour_key, enum wined3d_texture_filter_type filter)
{
struct wined3d_texture_gl *src_texture_gl = wined3d_texture_gl(src_texture);
struct wined3d_texture_gl *dst_texture_gl = wined3d_texture_gl(dst_texture);
struct wined3d_device *device = dst_texture->resource.device;
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_texture *staging_texture = NULL;
......@@ -13182,7 +13184,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
wine_dbgstr_rect(src_rect), dst_texture, dst_sub_resource_idx, wined3d_debug_location(dst_location),
wine_dbgstr_rect(dst_rect), colour_key, debug_d3dtexturefiltertype(filter));
if (!glsl_blitter_supported(op, context, src_texture, src_location, dst_texture, dst_location))
if (!glsl_blitter_supported(op, context, src_texture_gl, src_location, dst_texture_gl, dst_location))
{
if (!(next = blitter->next))
{
......@@ -13242,7 +13244,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
* flip in the blitter, we don't actually need that flip anyway. So we
* use the surface's texture as scratch texture, and flip the source
* rectangle instead. */
texture2d_load_fb_texture(src_texture, src_sub_resource_idx, FALSE, context);
texture2d_load_fb_texture(src_texture_gl, src_sub_resource_idx, FALSE, context);
s = *src_rect;
src_level = src_sub_resource_idx % src_texture->level_count;
......@@ -13285,7 +13287,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
context_invalidate_state(context, STATE_FRAMEBUFFER);
}
if (!(program = glsl_blitter_get_program(glsl_blitter, context, src_texture)))
if (!(program = glsl_blitter_get_program(glsl_blitter, context, src_texture_gl)))
{
ERR("Failed to get blitter program.\n");
return dst_location;
......@@ -13310,8 +13312,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
default:
break;
}
context_draw_shaded_quad(context, wined3d_texture_gl(src_texture),
src_sub_resource_idx, src_rect, dst_rect, filter);
context_draw_shaded_quad(context, src_texture_gl, src_sub_resource_idx, src_rect, dst_rect, filter);
GL_EXTCALL(glUseProgram(0));
if (dst_texture->swapchain && (dst_texture->swapchain->front_buffer == dst_texture))
......
......@@ -33,6 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d);
static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD stage, struct wined3d_context *context)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_texture *texture;
BOOL bumpmap = FALSE;
if (stage > 0
......@@ -47,9 +48,9 @@ static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD st
context->texShaderBumpMap &= ~(1u << stage);
}
if (state->textures[stage])
if ((texture = state->textures[stage]))
{
switch (state->textures[stage]->target)
switch (wined3d_texture_gl(texture)->target)
{
case GL_TEXTURE_2D:
gl_info->gl_ops.gl.p_glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV,
......@@ -70,7 +71,7 @@ static void nvts_activate_dimensions(const struct wined3d_state *state, DWORD st
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB)");
break;
default:
FIXME("Unhandled target %#x.\n", state->textures[stage]->target);
FIXME("Unhandled target %#x.\n", wined3d_texture_gl(texture)->target);
break;
}
}
......
......@@ -175,7 +175,7 @@ static void texture_gl_apply_base_level(struct wined3d_texture_gl *texture_gl,
* (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_gl->t.target, GL_TEXTURE_BASE_LEVEL, base_level);
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_BASE_LEVEL, base_level);
gl_tex->base_level = base_level;
}
}
......
......@@ -3847,7 +3847,7 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
{
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_texture *texture;
struct wined3d_texture *texture;
unsigned int i;
memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set. */
......@@ -3922,18 +3922,16 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
{
for (i = 0; i < shader->limits->sampler; ++i)
{
const struct wined3d_texture *texture = state->textures[i];
if (!shader->reg_maps.resource_info[i].type)
continue;
/* Treat unbound textures as 2D. The dummy texture will provide
* the proper sample value. The tex_types bitmap defaults to
* 2D because of the memset. */
if (!texture)
if (!(texture = state->textures[i]))
continue;
switch (texture->target)
switch (wined3d_texture_gl(texture)->target)
{
/* RECT textures are distinguished from 2D textures via np2_fixup */
default:
......
......@@ -3213,12 +3213,13 @@ void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *st
if (state->render_states[WINED3D_RS_COLORKEYENABLE] && !stage && state->textures[0])
{
struct wined3d_texture *texture = state->textures[0];
GLenum texture_dimensions = texture->target;
struct wined3d_texture_gl *texture_gl = wined3d_texture_gl(state->textures[0]);
GLenum texture_dimensions = texture_gl->target;
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
if (texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT && !texture->resource.format->alpha_size)
if (texture_gl->t.async.color_key_flags & WINED3D_CKEY_SRC_BLT
&& !texture_gl->t.resource.format->alpha_size)
{
/* Color keying needs to pass alpha values from the texture through to have the alpha test work
* properly. On the other hand applications can still use texture combiners apparently. This code
......@@ -3516,7 +3517,7 @@ static void sampler_texmatrix(struct wined3d_context *context, const struct wine
}
}
static enum wined3d_texture_address wined3d_texture_address_mode(const struct wined3d_texture *texture,
static enum wined3d_texture_address wined3d_texture_gl_address_mode(const struct wined3d_texture_gl *texture_gl,
enum wined3d_texture_address t)
{
if (t < WINED3D_TADDRESS_WRAP || t > WINED3D_TADDRESS_MIRROR_ONCE)
......@@ -3526,7 +3527,7 @@ static enum wined3d_texture_address wined3d_texture_address_mode(const struct wi
}
/* Cubemaps are always set to clamp, regardless of the sampler state. */
if (texture->target == GL_TEXTURE_CUBE_MAP_ARB || ((texture->flags & WINED3D_TEXTURE_COND_NP2)
if (texture_gl->target == GL_TEXTURE_CUBE_MAP_ARB || ((texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2)
&& t == WINED3D_TADDRESS_WRAP))
return WINED3D_TADDRESS_CLAMP;
......@@ -3534,7 +3535,8 @@ static enum wined3d_texture_address wined3d_texture_address_mode(const struct wi
}
static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc *desc,
const struct wined3d_context *context, const DWORD *sampler_states, const struct wined3d_texture *texture)
const struct wined3d_context *context, const DWORD *sampler_states,
const struct wined3d_texture_gl *texture_gl)
{
union
{
......@@ -3542,9 +3544,9 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc
DWORD d;
} lod_bias;
desc->address_u = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_U]);
desc->address_v = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_V]);
desc->address_w = wined3d_texture_address_mode(texture, sampler_states[WINED3D_SAMP_ADDRESS_W]);
desc->address_u = wined3d_texture_gl_address_mode(texture_gl, sampler_states[WINED3D_SAMP_ADDRESS_U]);
desc->address_v = wined3d_texture_gl_address_mode(texture_gl, sampler_states[WINED3D_SAMP_ADDRESS_V]);
desc->address_w = wined3d_texture_gl_address_mode(texture_gl, sampler_states[WINED3D_SAMP_ADDRESS_W]);
wined3d_color_from_d3dcolor((struct wined3d_color *)desc->border_color,
sampler_states[WINED3D_SAMP_BORDER_COLOR]);
if (sampler_states[WINED3D_SAMP_MAG_FILTER] > WINED3D_TEXF_ANISOTROPIC)
......@@ -3568,20 +3570,20 @@ static void wined3d_sampler_desc_from_sampler_states(struct wined3d_sampler_desc
if ((sampler_states[WINED3D_SAMP_MAG_FILTER] != WINED3D_TEXF_ANISOTROPIC
&& sampler_states[WINED3D_SAMP_MIN_FILTER] != WINED3D_TEXF_ANISOTROPIC
&& sampler_states[WINED3D_SAMP_MIP_FILTER] != WINED3D_TEXF_ANISOTROPIC)
|| (texture->flags & WINED3D_TEXTURE_COND_NP2))
|| (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2))
desc->max_anisotropy = 1;
desc->compare = texture->resource.format_flags & WINED3DFMT_FLAG_SHADOW;
desc->compare = texture_gl->t.resource.format_flags & WINED3DFMT_FLAG_SHADOW;
desc->comparison_func = WINED3D_CMP_LESSEQUAL;
desc->srgb_decode = sampler_states[WINED3D_SAMP_SRGB_TEXTURE];
if (!(texture->resource.format_flags & WINED3DFMT_FLAG_FILTERING))
if (!(texture_gl->t.resource.format_flags & WINED3DFMT_FLAG_FILTERING))
{
desc->mag_filter = WINED3D_TEXF_POINT;
desc->min_filter = WINED3D_TEXF_POINT;
desc->mip_filter = WINED3D_TEXF_NONE;
}
if (texture->flags & WINED3D_TEXTURE_COND_NP2)
if (texture_gl->t.flags & WINED3D_TEXTURE_COND_NP2)
{
desc->mip_filter = WINED3D_TEXF_NONE;
if (context->gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
......@@ -3620,7 +3622,7 @@ static void sampler(struct wined3d_context *context, const struct wined3d_state
struct wined3d_sampler *sampler;
struct wine_rb_entry *entry;
wined3d_sampler_desc_from_sampler_states(&desc, context, sampler_states, &texture_gl->t);
wined3d_sampler_desc_from_sampler_states(&desc, context, sampler_states, texture_gl);
wined3d_texture_gl_bind(texture_gl, context, srgb);
......
......@@ -5767,7 +5767,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
for (i = 0; i < d3d_info->limits.ffp_blend_stages; ++i)
{
const struct wined3d_texture *texture;
struct wined3d_texture *texture;
settings->op[i].padding = 0;
if (state->texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
......@@ -5796,7 +5796,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
}
else
{
switch (texture->target)
switch (wined3d_texture_gl(texture)->target)
{
case GL_TEXTURE_1D:
settings->op[i].tex_type = WINED3D_GL_RES_TYPE_TEX_1D;
......@@ -5857,7 +5857,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
GLenum texture_dimensions;
texture = state->textures[0];
texture_dimensions = texture->target;
texture_dimensions = wined3d_texture_gl(texture)->target;
if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
{
......@@ -6063,11 +6063,11 @@ void add_ffp_frag_shader(struct wine_rb_tree *shaders, struct ffp_frag_desc *des
* not care for the colorop or correct gl texture unit (when using nvrc).
* Requires the caller to activate the correct unit. */
/* Context activation is done by the caller (state handler). */
void texture_activate_dimensions(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
void texture_activate_dimensions(struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
{
if (texture)
{
switch (texture->target)
switch (wined3d_texture_gl(texture)->target)
{
case GL_TEXTURE_2D:
gl_info->gl_ops.gl.p_glDisable(GL_TEXTURE_3D);
......
......@@ -33,7 +33,7 @@ static BOOL is_stencil_view_format(const struct wined3d_format *format)
}
static GLenum get_texture_view_target(const struct wined3d_gl_info *gl_info,
const struct wined3d_view_desc *desc, const struct wined3d_texture *texture)
const struct wined3d_view_desc *desc, const struct wined3d_texture_gl *texture_gl)
{
static const struct
{
......@@ -69,7 +69,7 @@ static GLenum get_texture_view_target(const struct wined3d_gl_info *gl_info,
for (i = 0; i < ARRAY_SIZE(view_types); ++i)
{
if (view_types[i].texture_target != texture->target || view_types[i].view_flags != desc->flags)
if (view_types[i].texture_target != texture_gl->target || view_types[i].view_flags != desc->flags)
continue;
if (gl_info->supported[view_types[i].extension])
return view_types[i].view_target;
......@@ -77,8 +77,8 @@ static GLenum get_texture_view_target(const struct wined3d_gl_info *gl_info,
FIXME("Extension %#x not supported.\n", view_types[i].extension);
}
FIXME("Unhandled view flags %#x for texture target %#x.\n", desc->flags, texture->target);
return texture->target;
FIXME("Unhandled view flags %#x for texture target %#x.\n", desc->flags, texture_gl->target);
return texture_gl->target;
}
static const struct wined3d_format *validate_resource_view(const struct wined3d_view_desc *desc,
......@@ -564,7 +564,7 @@ static void wined3d_render_target_view_cs_init(void *object)
return;
}
create_texture_view(&view->gl_view, texture_gl->t.target, desc, texture_gl, view->format);
create_texture_view(&view->gl_view, texture_gl->target, desc, texture_gl, view->format);
}
}
}
......@@ -747,9 +747,9 @@ static void wined3d_shader_resource_view_cs_init(void *object)
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_gl->t);
view_target = get_texture_view_target(gl_info, desc, texture_gl);
if (resource->format->id == view_format->id && texture_gl->t.target == view_target
if (resource->format->id == view_format->id && texture_gl->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))
......@@ -898,8 +898,8 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *
else
{
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);
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_BASE_LEVEL, base_level);
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target, GL_TEXTURE_MAX_LEVEL, max_level);
}
if (gl_info->supported[ARB_SAMPLER_OBJECTS])
......@@ -907,12 +907,12 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *
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_gl->t.target, GL_TEXTURE_SRGB_DECODE_EXT,
GL_SKIP_DECODE_EXT);
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target,
GL_TEXTURE_SRGB_DECODE_EXT, GL_SKIP_DECODE_EXT);
gl_tex->sampler_desc.srgb_decode = FALSE;
}
gl_info->fbo_ops.glGenerateMipmap(texture_gl->t.target);
gl_info->fbo_ops.glGenerateMipmap(texture_gl->target);
checkGLcall("glGenerateMipMap()");
for (i = 0; i < layer_count; ++i)
......@@ -927,7 +927,7 @@ void shader_resource_view_generate_mipmaps(struct wined3d_shader_resource_view *
if (!view->gl_view.name)
{
gl_tex->base_level = base_level;
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->t.target,
gl_info->gl_ops.gl.p_glTexParameteri(texture_gl->target,
GL_TEXTURE_MAX_LEVEL, texture_gl->t.level_count - 1);
}
......@@ -1141,7 +1141,7 @@ static void wined3d_unordered_access_view_cs_init(void *object)
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_gl->t),
create_texture_view(&view->gl_view, get_texture_view_target(gl_info, desc, texture_gl),
desc, texture_gl, view->format);
}
}
......
......@@ -3217,7 +3217,6 @@ struct wined3d_texture
UINT lod;
DWORD sampler;
DWORD flags;
GLenum target;
DWORD update_map_binding;
void *user_memory;
......@@ -3273,23 +3272,6 @@ static inline struct wined3d_texture *texture_from_resource(struct wined3d_resou
return CONTAINING_RECORD(resource, struct wined3d_texture, resource);
}
static inline GLenum wined3d_texture_get_sub_resource_target(const struct wined3d_texture *texture,
unsigned int sub_resource_idx)
{
static const GLenum cube_targets[] =
{
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
};
return texture->resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP
? cube_targets[sub_resource_idx / texture->level_count] : texture->target;
}
static inline unsigned int wined3d_texture_get_level_width(const struct wined3d_texture *texture,
unsigned int level)
{
......@@ -3333,11 +3315,11 @@ HRESULT texture2d_blt(struct wined3d_texture *dst_texture, unsigned int dst_sub_
const struct wined3d_box *dst_box, struct wined3d_texture *src_texture,
unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, DWORD flags,
const struct wined3d_blt_fx *blt_fx, enum wined3d_texture_filter_type filter) DECLSPEC_HIDDEN;
void texture2d_get_blt_info(const struct wined3d_texture *texture, unsigned int sub_resource_idx,
void texture2d_get_blt_info(const struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
const RECT *rect, struct wined3d_blt_info *info) DECLSPEC_HIDDEN;
BOOL texture2d_load_drawable(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context) DECLSPEC_HIDDEN;
void texture2d_load_fb_texture(struct wined3d_texture *texture, unsigned int sub_resource_idx,
void texture2d_load_fb_texture(struct wined3d_texture_gl *texture_gl, unsigned int sub_resource_idx,
BOOL srgb, struct wined3d_context *context) DECLSPEC_HIDDEN;
BOOL texture2d_load_renderbuffer(struct wined3d_texture *texture, unsigned int sub_resource_idx,
struct wined3d_context *context, DWORD dst_location) DECLSPEC_HIDDEN;
......@@ -3395,6 +3377,8 @@ struct wined3d_texture_gl
struct gl_texture texture_rgb, texture_srgb;
GLenum target;
GLuint rb_multisample;
GLuint rb_resolved;
......@@ -3413,6 +3397,23 @@ static inline struct gl_texture *wined3d_texture_gl_get_gl_texture(struct wined3
return srgb ? &texture_gl->texture_srgb : &texture_gl->texture_rgb;
}
static inline GLenum wined3d_texture_gl_get_sub_resource_target(const struct wined3d_texture_gl *texture_gl,
unsigned int sub_resource_idx)
{
static const GLenum cube_targets[] =
{
GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB,
GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
};
return texture_gl->t.resource.usage & WINED3DUSAGE_LEGACY_CUBEMAP
? cube_targets[sub_resource_idx / texture_gl->t.level_count] : texture_gl->target;
}
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,
......@@ -3986,7 +3987,7 @@ BOOL is_invalid_op(const struct wined3d_state *state, int stage,
void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state,
BOOL is_alpha, int stage, enum wined3d_texture_op op, DWORD arg1, DWORD arg2, DWORD arg3,
INT texture_idx, DWORD dst) DECLSPEC_HIDDEN;
void texture_activate_dimensions(const struct wined3d_texture *texture,
void texture_activate_dimensions(struct wined3d_texture *texture,
const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
void sampler_texdim(struct wined3d_context *context,
const struct wined3d_state *state, DWORD state_id) 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