Commit 5ce02389 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Store a fragment_caps structure in struct wined3d_d3d_info.

Instead of duplicating multiple members.
parent ef2ad5ef
......@@ -5171,14 +5171,13 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
const struct wined3d_gl_info *gl_info = &adapter_gl->gl_info;
struct wined3d_d3d_info *d3d_info = &adapter_gl->a.d3d_info;
struct wined3d_vertex_caps vertex_caps;
struct fragment_caps fragment_caps;
struct shader_caps shader_caps;
GLfloat f[2];
adapter_gl->a.shader_backend->shader_get_caps(&adapter_gl->a, &shader_caps);
adapter_gl->a.vertex_pipe->vp_get_caps(&adapter_gl->a, &vertex_caps);
adapter_gl->a.misc_state_template = misc_state_template_gl;
adapter_gl->a.fragment_pipe->get_caps(&adapter_gl->a, &fragment_caps);
adapter_gl->a.fragment_pipe->get_caps(&adapter_gl->a, &d3d_info->ffp_fragment_caps);
d3d_info->limits.vs_version = shader_caps.vs_version;
d3d_info->limits.hs_version = shader_caps.hs_version;
......@@ -5189,9 +5188,7 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *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->limits.ffp_textures = fragment_caps.max_textures;
d3d_info->limits.ffp_blend_stages = fragment_caps.max_blend_stages;
TRACE("Max texture stages: %u.\n", d3d_info->limits.ffp_blend_stages);
TRACE("Max texture stages: %u.\n", d3d_info->ffp_fragment_caps.max_blend_stages);
d3d_info->limits.ffp_vertex_blend_matrices = vertex_caps.max_vertex_blend_matrices;
d3d_info->limits.active_light_count = vertex_caps.max_active_lights;
......@@ -5211,7 +5208,6 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
d3d_info->ffp_generic_attributes = vertex_caps.ffp_generic_attributes;
d3d_info->ffp_alpha_test = !!gl_info->supported[WINED3D_GL_LEGACY_CONTEXT];
d3d_info->vs_clipping = shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING;
d3d_info->shader_color_key = fragment_caps.color_key;
d3d_info->shader_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION);
d3d_info->shader_output_interpolation = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION);
d3d_info->frag_coord_correction = !!gl_info->supported[ARB_FRAGMENT_COORD_CONVENTIONS];
......@@ -5231,7 +5227,7 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_
d3d_info->pbo = !!gl_info->supported[ARB_PIXEL_BUFFER_OBJECT];
d3d_info->subpixel_viewport = gl_info->limits.viewport_subpixel_bits >= 8;
d3d_info->fences = wined3d_fence_supported(gl_info);
d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &fragment_caps);
d3d_info->feature_level = feature_level_from_caps(gl_info, &shader_caps, &d3d_info->ffp_fragment_caps);
d3d_info->filling_convention_offset = gl_info->filling_convention_offset;
d3d_info->persistent_map = !!gl_info->supported[ARB_BUFFER_STORAGE];
......@@ -5365,7 +5361,7 @@ static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl,
wined3d_adapter_gl_init_d3d_info(adapter_gl, wined3d_creation_flags);
if (!adapter_gl->a.d3d_info.shader_color_key)
if (!adapter_gl->a.d3d_info.ffp_fragment_caps.color_key)
{
/* We do not want to deal with re-creating immutable texture storage
* for colour-keying emulation. */
......
......@@ -2294,7 +2294,6 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_
struct wined3d_vk_info *vk_info = &adapter_vk->vk_info;
struct wined3d_physical_device_info device_info;
struct wined3d_vertex_caps vertex_caps;
struct fragment_caps fragment_caps;
unsigned int sample_counts_mask;
struct shader_caps shader_caps;
......@@ -2308,7 +2307,7 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_
adapter_vk->a.shader_backend->shader_get_caps(&adapter_vk->a, &shader_caps);
adapter_vk->a.vertex_pipe->vp_get_caps(&adapter_vk->a, &vertex_caps);
adapter_vk->a.fragment_pipe->get_caps(&adapter_vk->a, &fragment_caps);
adapter_vk->a.fragment_pipe->get_caps(&adapter_vk->a, &d3d_info->ffp_fragment_caps);
d3d_info->limits.vs_version = shader_caps.vs_version;
d3d_info->limits.hs_version = shader_caps.hs_version;
......@@ -2319,8 +2318,6 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *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->limits.ffp_textures = fragment_caps.max_textures;
d3d_info->limits.ffp_blend_stages = fragment_caps.max_blend_stages;
d3d_info->limits.ffp_vertex_blend_matrices = vertex_caps.max_vertex_blend_matrices;
d3d_info->limits.active_light_count = vertex_caps.max_active_lights;
......@@ -2341,7 +2338,6 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_
d3d_info->ffp_generic_attributes = vertex_caps.ffp_generic_attributes;
d3d_info->ffp_alpha_test = false;
d3d_info->vs_clipping = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_VS_CLIPPING);
d3d_info->shader_color_key = fragment_caps.color_key;
d3d_info->shader_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION);
d3d_info->shader_output_interpolation = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_OUTPUT_INTERPOLATION);
d3d_info->viewport_array_index_any_shader = false; /* VK_EXT_shader_viewport_index_layer */
......
......@@ -4267,7 +4267,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_context_gl
if (!d3d_info->vs_clipping)
shader_data->clipplane_emulation = shader_find_free_input_register(&shader->reg_maps,
d3d_info->limits.ffp_blend_stages - 1);
d3d_info->ffp_fragment_caps.max_blend_stages - 1);
else
shader_data->clipplane_emulation = ~0U;
}
......@@ -4514,7 +4514,12 @@ static void find_arb_vs_compile_args(const struct wined3d_state *state,
{
args->ps_signature = ~0;
if (!d3d_info->vs_clipping && adapter->fragment_pipe == &arbfp_fragment_pipeline)
args->clip.boolclip.clip_texcoord = ffp_clip_emul(&context_gl->c) ? d3d_info->limits.ffp_blend_stages : 0;
{
if (ffp_clip_emul(&context_gl->c))
args->clip.boolclip.clip_texcoord = d3d_info->ffp_fragment_caps.max_blend_stages;
else
args->clip.boolclip.clip_texcoord = 0;
}
/* Otherwise: Setting boolclip_compare set clip_texcoord to 0 */
}
......@@ -7720,7 +7725,7 @@ static BOOL arbfp_blit_supported(enum wined3d_blit_op blit_op, const struct wine
switch (blit_op)
{
case WINED3D_BLIT_OP_COLOR_BLIT_CKEY:
if (!context->d3d_info->shader_color_key)
if (!context->d3d_info->ffp_fragment_caps.color_key)
{
/* The conversion modifies the alpha channel so the color key might no longer match. */
TRACE("Color keying not supported with converted textures.\n");
......
......@@ -1034,7 +1034,7 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined
return;
}
new_desc->num_textures_used = 0;
for (i = 0; i < d3d_info->limits.ffp_blend_stages; ++i)
for (i = 0; i < d3d_info->ffp_fragment_caps.max_blend_stages; ++i)
{
if (settings.op[i].cop == WINED3D_TOP_DISABLE)
break;
......
......@@ -3798,8 +3798,8 @@ static void wined3d_context_gl_map_fixed_function_samplers(struct wined3d_contex
ffu_map = context_gl->c.fixed_function_usage_map;
if (d3d_info->limits.ffp_textures == d3d_info->limits.ffp_blend_stages
|| context_gl->c.lowest_disabled_stage <= d3d_info->limits.ffp_textures)
if (d3d_info->ffp_fragment_caps.max_textures == d3d_info->ffp_fragment_caps.max_blend_stages
|| context_gl->c.lowest_disabled_stage <= d3d_info->ffp_fragment_caps.max_textures)
{
while (ffu_map)
{
......@@ -3843,7 +3843,7 @@ static void wined3d_context_gl_map_psamplers(struct wined3d_context_gl *context_
{
wined3d_context_gl_map_stage(context_gl, i, i);
context_invalidate_state(&context_gl->c, STATE_SAMPLER(i));
if (i < d3d_info->limits.ffp_blend_stages)
if (i < d3d_info->ffp_fragment_caps.max_blend_stages)
context_invalidate_texture_stage(&context_gl->c, i);
}
}
......@@ -4897,7 +4897,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context_gl *context_gl,
GL_EXTCALL(glSecondaryColor3fEXT)(0.0f, 0.0f, 0.0f);
}
texture_stages = d3d_info->limits.ffp_blend_stages;
texture_stages = d3d_info->ffp_fragment_caps.max_blend_stages;
for (texture_idx = 0; texture_idx < texture_stages; ++texture_idx)
{
if (!gl_info->supported[ARB_MULTITEXTURE] && texture_idx > 0)
......@@ -5363,7 +5363,7 @@ void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context
unsigned int texture_idx;
GLuint bo;
for (texture_idx = 0; texture_idx < context_gl->c.d3d_info->limits.ffp_blend_stages; ++texture_idx)
for (texture_idx = 0; texture_idx < context_gl->c.d3d_info->ffp_fragment_caps.max_blend_stages; ++texture_idx)
{
unsigned int coord_idx = state->texture_states[texture_idx][WINED3D_TSS_TEXCOORD_INDEX];
......
......@@ -1490,7 +1490,7 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
|| (new_fmt_caps & WINED3D_FORMAT_CAP_SHADOW) != (old_fmt_caps & WINED3D_FORMAT_CAP_SHADOW))
device_invalidate_state(cs->c.device, STATE_SHADER(WINED3D_SHADER_TYPE_PIXEL));
if (!prev && op->stage < d3d_info->limits.ffp_blend_stages)
if (!prev && op->stage < d3d_info->ffp_fragment_caps.max_blend_stages)
{
/* The source arguments for color and alpha ops have different
* meanings when a NULL texture is bound, so the COLOR_OP and
......@@ -1523,7 +1523,7 @@ static void wined3d_cs_exec_set_texture(struct wined3d_cs *cs, const void *data)
}
}
if (!op->texture && op->stage < d3d_info->limits.ffp_blend_stages)
if (!op->texture && op->stage < d3d_info->ffp_fragment_caps.max_blend_stages)
{
device_invalidate_state(cs->c.device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_COLOR_OP));
device_invalidate_state(cs->c.device, STATE_TEXTURESTAGE(op->stage, WINED3D_TSS_ALPHA_OP));
......
......@@ -1010,7 +1010,7 @@ static void state_texfactor(struct wined3d_context *context, const struct wined3
wined3d_color_from_d3dcolor(&color, state->render_states[WINED3D_RS_TEXTUREFACTOR]);
/* And now the default texture color as well */
for (i = 0; i < context->d3d_info->limits.ffp_blend_stages; ++i)
for (i = 0; i < context->d3d_info->ffp_fragment_caps.max_blend_stages; ++i)
{
/* Note the WINED3D_RS value applies to all textures, but GL has one
* per texture, so apply it now ready to be used! */
......@@ -3626,7 +3626,7 @@ void apply_pixelshader(struct wined3d_context *context, const struct wined3d_sta
{
/* Disabled the pixel shader - color ops weren't applied while it was
* enabled, so re-apply them. */
for (i = 0; i < context->d3d_info->limits.ffp_blend_stages; ++i)
for (i = 0; i < context->d3d_info->ffp_fragment_caps.max_blend_stages; ++i)
{
if (!isStateDirty(context, STATE_TEXTURESTAGE(i, WINED3D_TSS_COLOR_OP)))
context_apply_state(context, state, STATE_TEXTURESTAGE(i, WINED3D_TSS_COLOR_OP));
......@@ -5303,7 +5303,7 @@ static void prune_invalid_states(struct wined3d_state_entry *state_table, const
{
unsigned int start, last, i;
start = STATE_TEXTURESTAGE(d3d_info->limits.ffp_blend_stages, 0);
start = STATE_TEXTURESTAGE(d3d_info->ffp_fragment_caps.max_blend_stages, 0);
last = STATE_TEXTURESTAGE(WINED3D_MAX_FFP_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE);
for (i = start; i <= last; ++i)
{
......@@ -5311,7 +5311,7 @@ static void prune_invalid_states(struct wined3d_state_entry *state_table, const
state_table[i].apply = state_undefined;
}
start = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + d3d_info->limits.ffp_blend_stages);
start = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + d3d_info->ffp_fragment_caps.max_blend_stages);
last = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + WINED3D_MAX_FFP_TEXTURES - 1);
for (i = start; i <= last; ++i)
{
......
......@@ -1669,7 +1669,7 @@ void wined3d_texture_load(struct wined3d_texture *texture,
else
flag = WINED3D_TEXTURE_RGB_VALID;
if (!d3d_info->shader_color_key
if (!d3d_info->ffp_fragment_caps.color_key
&& (!(texture->async.flags & WINED3D_TEXTURE_ASYNC_COLOR_KEY)
!= !(texture->async.color_key_flags & WINED3D_CKEY_SRC_BLT)
|| (texture->async.flags & WINED3D_TEXTURE_ASYNC_COLOR_KEY
......@@ -2062,7 +2062,7 @@ void wined3d_texture_gl_prepare_texture(struct wined3d_texture_gl *texture_gl,
TRACE("texture_gl %p, context_gl %p, srgb %d, format %s.\n",
texture_gl, context_gl, srgb, debug_d3dformat(format->id));
if (!d3d_info->shader_color_key
if (!d3d_info->ffp_fragment_caps.color_key
&& !(texture_gl->t.async.flags & WINED3D_TEXTURE_ASYNC_COLOR_KEY)
!= !(texture_gl->t.async.color_key_flags & WINED3D_CKEY_SRC_BLT))
{
......@@ -5795,7 +5795,7 @@ static bool ffp_blit_supported(enum wined3d_blit_op blit_op, const struct wined3
switch (blit_op)
{
case WINED3D_BLIT_OP_COLOR_BLIT_CKEY:
if (context->d3d_info->shader_color_key)
if (context->d3d_info->ffp_fragment_caps.color_key)
{
TRACE("Colour keying requires converted textures.\n");
return false;
......
......@@ -6411,7 +6411,7 @@ void wined3d_ffp_get_fs_settings(const struct wined3d_context *context, const st
settings->padding = 0;
for (i = 0; i < d3d_info->limits.ffp_blend_stages; ++i)
for (i = 0; i < d3d_info->ffp_fragment_caps.max_blend_stages; ++i)
{
struct wined3d_texture *texture;
......
......@@ -180,14 +180,23 @@ struct color_fixup_desc
};
#include <poppack.h>
struct fragment_caps
{
unsigned int PrimitiveMiscCaps;
unsigned int TextureOpCaps;
unsigned int max_blend_stages;
unsigned int max_textures;
bool proj_control;
bool srgb_write;
bool color_key;
};
struct wined3d_d3d_limits
{
unsigned int vs_version, hs_version, ds_version, gs_version, ps_version, cs_version;
DWORD vs_uniform_count;
DWORD ps_uniform_count;
unsigned int varying_count;
unsigned int ffp_textures;
unsigned int ffp_blend_stages;
unsigned int ffp_vertex_blend_matrices;
unsigned int active_light_count;
......@@ -200,6 +209,7 @@ struct wined3d_d3d_limits
struct wined3d_d3d_info
{
struct fragment_caps ffp_fragment_caps;
struct wined3d_d3d_limits limits;
uint32_t wined3d_creation_flags;
uint32_t xyzrhw : 1;
......@@ -207,7 +217,6 @@ struct wined3d_d3d_info
uint32_t ffp_generic_attributes : 1;
uint32_t ffp_alpha_test : 1;
uint32_t vs_clipping : 1;
uint32_t shader_color_key : 1;
uint32_t shader_double_precision : 1;
uint32_t shader_output_interpolation : 1;
uint32_t frag_coord_correction : 1;
......@@ -1988,17 +1997,6 @@ struct wined3d_state_entry_template
unsigned int extension;
};
struct fragment_caps
{
DWORD PrimitiveMiscCaps;
DWORD TextureOpCaps;
unsigned int max_blend_stages;
unsigned int max_textures;
bool proj_control;
bool srgb_write;
bool color_key;
};
#define GL_EXT_EMUL_ARB_MULTITEXTURE 0x00000001
#define GL_EXT_EMUL_EXT_FOG_COORD 0x00000002
......
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