wined3d: Store the NPOT texture capabilities in struct wined3d_d3d_info.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2e34d2e457
commit
07dad9b150
|
@ -3664,7 +3664,7 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
|||
d3d_info->limits.vs_uniform_count = shader_caps.vs_uniform_count;
|
||||
d3d_info->limits.ps_uniform_count = shader_caps.ps_uniform_count;
|
||||
d3d_info->limits.varying_count = shader_caps.varying_count;
|
||||
d3d_info->shader_double_precision = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION;
|
||||
d3d_info->shader_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION);
|
||||
|
||||
adapter->vertex_pipe->vp_get_caps(gl_info, &vertex_caps);
|
||||
d3d_info->xyzrhw = vertex_caps.xyzrhw;
|
||||
|
@ -3676,10 +3676,14 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
|||
adapter->fragment_pipe->get_caps(gl_info, &fragment_caps);
|
||||
d3d_info->limits.ffp_blend_stages = fragment_caps.MaxTextureBlendStages;
|
||||
d3d_info->limits.ffp_textures = fragment_caps.MaxSimultaneousTextures;
|
||||
d3d_info->shader_color_key = fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY;
|
||||
d3d_info->shader_color_key = !!(fragment_caps.wined3d_caps & WINED3D_FRAGMENT_CAP_COLOR_KEY);
|
||||
d3d_info->wined3d_creation_flags = wined3d_creation_flags;
|
||||
d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps);
|
||||
|
||||
d3d_info->texture_npot = !!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO];
|
||||
d3d_info->texture_npot_conditional = gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
|
||||
|| gl_info->supported[ARB_TEXTURE_RECTANGLE];
|
||||
|
||||
TRACE("Max texture stages: %u.\n", d3d_info->limits.ffp_blend_stages);
|
||||
|
||||
d3d_info->valid_rt_mask = 0;
|
||||
|
|
|
@ -2018,32 +2018,28 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
|
|||
WINED3DPTEXTURECAPS_PROJECTED |
|
||||
WINED3DPTEXTURECAPS_PERSPECTIVE;
|
||||
|
||||
if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
||||
if (!d3d_info->texture_npot)
|
||||
{
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_POW2;
|
||||
if (gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT] || gl_info->supported[ARB_TEXTURE_RECTANGLE])
|
||||
if (d3d_info->texture_npot_conditional)
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL;
|
||||
}
|
||||
|
||||
if (gl_info->supported[EXT_TEXTURE3D])
|
||||
{
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_VOLUMEMAP |
|
||||
WINED3DPTEXTURECAPS_MIPVOLUMEMAP;
|
||||
if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
||||
{
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_VOLUMEMAP
|
||||
| WINED3DPTEXTURECAPS_MIPVOLUMEMAP;
|
||||
if (!d3d_info->texture_npot)
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_VOLUMEMAP_POW2;
|
||||
}
|
||||
}
|
||||
|
||||
if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
|
||||
{
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP |
|
||||
WINED3DPTEXTURECAPS_MIPCUBEMAP;
|
||||
if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
||||
{
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP
|
||||
| WINED3DPTEXTURECAPS_MIPCUBEMAP;
|
||||
if (!d3d_info->texture_npot)
|
||||
caps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP_POW2;
|
||||
}
|
||||
}
|
||||
|
||||
caps->TextureFilterCaps = WINED3DPTFILTERCAPS_MAGFLINEAR |
|
||||
WINED3DPTFILTERCAPS_MAGFPOINT |
|
||||
|
|
|
@ -60,6 +60,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
|||
unsigned int size, void *parent, const struct wined3d_parent_ops *parent_ops,
|
||||
const struct wined3d_resource_ops *resource_ops)
|
||||
{
|
||||
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
|
||||
enum wined3d_gl_resource_type base_type = WINED3D_GL_RES_TYPE_COUNT;
|
||||
enum wined3d_gl_resource_type gl_type = WINED3D_GL_RES_TYPE_COUNT;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
|
@ -129,7 +130,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
|||
continue;
|
||||
}
|
||||
if (((width & (width - 1)) || (height & (height - 1)))
|
||||
&& !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
|
||||
&& !d3d_info->texture_npot
|
||||
&& !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
|
||||
&& gl_type == WINED3D_GL_RES_TYPE_TEX_2D)
|
||||
{
|
||||
|
|
|
@ -1535,6 +1535,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
|||
UINT multisample_quality, void *mem, UINT pitch)
|
||||
{
|
||||
struct wined3d_texture_sub_resource *sub_resource;
|
||||
const struct wined3d_d3d_info *d3d_info;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
const struct wined3d_format *format;
|
||||
struct wined3d_device *device;
|
||||
|
@ -1548,6 +1549,7 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
|||
|
||||
device = texture->resource.device;
|
||||
gl_info = &device->adapter->gl_info;
|
||||
d3d_info = &device->adapter->d3d_info;
|
||||
format = wined3d_get_format(device->adapter, format_id, texture->resource.usage);
|
||||
resource_size = wined3d_format_calculate_size(format, device->surface_alignment, width, height, 1);
|
||||
|
||||
|
@ -1622,8 +1624,8 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
|
|||
else
|
||||
texture->target = GL_TEXTURE_2D;
|
||||
|
||||
if (((width & (width - 1)) || (height & (height - 1))) && !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO]
|
||||
&& !gl_info->supported[ARB_TEXTURE_RECTANGLE] && !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
|
||||
if (((width & (width - 1)) || (height & (height - 1))) && !d3d_info->texture_npot
|
||||
&& !d3d_info->texture_npot_conditional)
|
||||
{
|
||||
texture->flags |= WINED3D_TEXTURE_COND_NP2_EMULATED;
|
||||
texture->pow2_width = texture->pow2_height = 1;
|
||||
|
@ -2571,6 +2573,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
|
|||
unsigned int layer_count, unsigned int level_count, DWORD flags, struct wined3d_device *device,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_texture_ops *texture_ops)
|
||||
{
|
||||
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
|
||||
struct wined3d_device_parent *device_parent = device->device_parent;
|
||||
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
|
||||
unsigned int sub_count, i, j, size, offset = 0;
|
||||
|
@ -2637,7 +2640,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
|
|||
pow2_width = desc->width;
|
||||
pow2_height = desc->height;
|
||||
if (((desc->width & (desc->width - 1)) || (desc->height & (desc->height - 1)) || (desc->depth & (desc->depth - 1)))
|
||||
&& !gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
|
||||
&& !d3d_info->texture_npot)
|
||||
{
|
||||
/* level_count == 0 returns an error as well. */
|
||||
if (level_count != 1 || layer_count != 1 || desc->resource_type == WINED3D_RTYPE_TEXTURE_3D)
|
||||
|
@ -2653,8 +2656,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
|
|||
}
|
||||
texture->flags |= WINED3D_TEXTURE_COND_NP2;
|
||||
|
||||
if (desc->resource_type != WINED3D_RTYPE_TEXTURE_3D && !gl_info->supported[ARB_TEXTURE_RECTANGLE]
|
||||
&& !gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
|
||||
if (desc->resource_type != WINED3D_RTYPE_TEXTURE_3D && !d3d_info->texture_npot_conditional)
|
||||
{
|
||||
/* TODO: Add support for non-power-of-two compressed textures. */
|
||||
if (format->flags[WINED3D_GL_RES_TYPE_TEX_2D]
|
||||
|
|
|
@ -187,14 +187,16 @@ struct wined3d_d3d_info
|
|||
{
|
||||
struct wined3d_d3d_limits limits;
|
||||
struct wined3d_ffp_attrib_ops ffp_attrib_ops;
|
||||
BOOL xyzrhw;
|
||||
BOOL emulated_flatshading;
|
||||
BOOL ffp_generic_attributes;
|
||||
BOOL vs_clipping;
|
||||
BOOL shader_color_key;
|
||||
DWORD valid_rt_mask;
|
||||
DWORD wined3d_creation_flags;
|
||||
BOOL shader_double_precision;
|
||||
unsigned int xyzrhw : 1;
|
||||
unsigned int emulated_flatshading : 1;
|
||||
unsigned int ffp_generic_attributes : 1;
|
||||
unsigned int vs_clipping : 1;
|
||||
unsigned int shader_color_key : 1;
|
||||
unsigned int shader_double_precision : 1;
|
||||
unsigned int texture_npot : 1;
|
||||
unsigned int texture_npot_conditional : 1;
|
||||
enum wined3d_feature_level feature_level;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue