wined3d: Move gl_info->limits.max_texture_stages to d3d_info.

This commit is contained in:
Stefan Dösinger 2013-04-25 15:20:30 +02:00 committed by Alexandre Julliard
parent ac99d53991
commit 76941eff00
8 changed files with 39 additions and 34 deletions

View File

@ -4319,7 +4319,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(struct wined3d_shader *sh
if (!d3d_info->vs_clipping)
shader_data->clipplane_emulation = shader_find_free_input_register(&shader->reg_maps,
gl_info->limits.texture_stages - 1);
d3d_info->limits.ffp_blend_stages - 1);
else
shader_data->clipplane_emulation = ~0U;
}
@ -4555,7 +4555,7 @@ 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(state) ? gl_info->limits.texture_stages : 0;
args->clip.boolclip.clip_texcoord = ffp_clip_emul(state) ? d3d_info->limits.ffp_blend_stages : 0;
}
/* Otherwise: Setting boolclip_compare set clip_texcoord to 0 */
}

View File

@ -838,6 +838,7 @@ static void set_tex_op_atifs(struct wined3d_context *context, const struct wined
{
const struct wined3d_device *device = context->swapchain->device;
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
const struct atifs_ffp_desc *desc;
struct ffp_frag_settings settings;
struct atifs_private_data *priv = device->fragment_priv;
@ -854,7 +855,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 < gl_info->limits.texture_stages; ++i)
for (i = 0; i < d3d_info->limits.ffp_blend_stages; ++i)
{
if (settings.op[i].cop == WINED3D_TOP_DISABLE)
break;

View File

@ -2710,8 +2710,7 @@ static void device_update_fixed_function_usage_map(struct wined3d_device *device
}
}
static void device_map_fixed_function_samplers(struct wined3d_device *device, const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info)
static void device_map_fixed_function_samplers(struct wined3d_device *device, const struct wined3d_d3d_info *d3d_info)
{
unsigned int i, tex;
WORD ffu_map;
@ -2719,7 +2718,7 @@ static void device_map_fixed_function_samplers(struct wined3d_device *device, co
device_update_fixed_function_usage_map(device);
ffu_map = device->fixed_function_usage_map;
if (d3d_info->limits.ffp_textures == gl_info->limits.texture_stages
if (d3d_info->limits.ffp_textures == d3d_info->limits.ffp_blend_stages
|| device->stateBlock->state.lowest_disabled_stage <= d3d_info->limits.ffp_textures)
{
for (i = 0; ffu_map; ffu_map >>= 1, ++i)
@ -2753,7 +2752,7 @@ static void device_map_fixed_function_samplers(struct wined3d_device *device, co
}
}
static void device_map_psamplers(struct wined3d_device *device, const struct wined3d_gl_info *gl_info)
static void device_map_psamplers(struct wined3d_device *device, const struct wined3d_d3d_info *d3d_info)
{
const enum wined3d_sampler_texture_type *sampler_type =
device->stateBlock->state.pixel_shader->reg_maps.sampler_type;
@ -2765,7 +2764,7 @@ static void device_map_psamplers(struct wined3d_device *device, const struct win
{
device_map_stage(device, i, i);
device_invalidate_state(device, STATE_SAMPLER(i));
if (i < gl_info->limits.texture_stages)
if (i < d3d_info->limits.ffp_blend_stages)
device_invalidate_texture_stage(device, i);
}
}
@ -2853,9 +2852,9 @@ void device_update_tex_unit_map(struct wined3d_device *device)
* to be reset. Because of that try to work with a 1:1 mapping as much as possible
*/
if (ps)
device_map_psamplers(device, gl_info);
device_map_psamplers(device, d3d_info);
else
device_map_fixed_function_samplers(device, gl_info, d3d_info);
device_map_fixed_function_samplers(device, d3d_info);
if (vs)
device_map_vsamplers(device, ps, gl_info);
@ -3568,7 +3567,7 @@ HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device,
void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
UINT stage, enum wined3d_texture_stage_state state, DWORD value)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
DWORD old_value;
TRACE("device %p, stage %u, state %s, value %#x.\n",
@ -3580,10 +3579,10 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
return;
}
if (stage >= gl_info->limits.texture_stages)
if (stage >= d3d_info->limits.ffp_blend_stages)
{
WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n",
stage, gl_info->limits.texture_stages - 1);
stage, d3d_info->limits.ffp_blend_stages - 1);
return;
}
@ -3642,7 +3641,7 @@ void CDECL wined3d_device_set_texture_stage_state(struct wined3d_device *device,
*
* Again stage stage doesn't need to be dirtified here, it is
* handled below. */
for (i = stage + 1; i < gl_info->limits.texture_stages; ++i)
for (i = stage + 1; i < d3d_info->limits.ffp_blend_stages; ++i)
{
if (device->updateStateBlock->state.texture_states[i][WINED3D_TSS_COLOR_OP] == WINED3D_TOP_DISABLE)
break;
@ -3675,7 +3674,7 @@ DWORD CDECL wined3d_device_get_texture_stage_state(const struct wined3d_device *
HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
UINT stage, struct wined3d_texture *texture)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
struct wined3d_texture *prev;
TRACE("device %p, stage %u, texture %p.\n", device, stage, texture);
@ -3729,7 +3728,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
if (!prev || texture->target != prev->target)
device_invalidate_state(device, STATE_PIXELSHADER);
if (!prev && stage < gl_info->limits.texture_stages)
if (!prev && stage < d3d_info->limits.ffp_blend_stages)
{
/* The source arguments for color and alpha ops have different
* meanings when a NULL texture is bound, so the COLOR_OP and
@ -3746,7 +3745,7 @@ HRESULT CDECL wined3d_device_set_texture(struct wined3d_device *device,
{
LONG bind_count = InterlockedDecrement(&prev->resource.bind_count);
if (!texture && stage < gl_info->limits.texture_stages)
if (!texture && stage < d3d_info->limits.ffp_blend_stages)
{
device_invalidate_state(device, STATE_TEXTURESTAGE(stage, WINED3D_TSS_COLOR_OP));
device_invalidate_state(device, STATE_TEXTURESTAGE(stage, WINED3D_TSS_ALPHA_OP));
@ -5436,7 +5435,8 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
if (vertex_pipeline->vp_states && fragment_pipeline->states
&& FAILED(hr = compile_state_table(device->StateTable, device->multistate_funcs,
&adapter->gl_info, vertex_pipeline, fragment_pipeline, misc_state_template)))
&adapter->gl_info, &adapter->d3d_info, vertex_pipeline,
fragment_pipeline, misc_state_template)))
{
ERR("Failed to compile state table, hr %#x.\n", hr);
wined3d_decref(device->wined3d);

View File

@ -2854,9 +2854,9 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
adapter->d3d_info.limits.ps_uniform_count = shader_caps.ps_uniform_count;
adapter->fragment_pipe->get_caps(gl_info, &fragment_caps);
gl_info->limits.texture_stages = fragment_caps.MaxTextureBlendStages;
adapter->d3d_info.limits.ffp_blend_stages = fragment_caps.MaxTextureBlendStages;
adapter->d3d_info.limits.ffp_textures = fragment_caps.MaxSimultaneousTextures;
TRACE("Max texture stages: %u.\n", gl_info->limits.texture_stages);
TRACE("Max texture stages: %u.\n", adapter->d3d_info.limits.ffp_blend_stages);
if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
{

View File

@ -98,7 +98,8 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
const struct wined3d_gl_info *gl_info = context->gl_info;
UINT texture_stages = gl_info->limits.texture_stages;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
UINT texture_stages = d3d_info->limits.ffp_blend_stages;
const struct wined3d_stream_info_element *element;
UINT num_untracked_materials;
DWORD tex_mask = 0;

View File

@ -789,7 +789,7 @@ static void state_texfactor(struct wined3d_context *context, const struct wined3
D3DCOLORTOGLFLOAT4(state->render_states[WINED3D_RS_TEXTUREFACTOR], col);
/* And now the default texture color as well */
for (i = 0; i < gl_info->limits.texture_stages; ++i)
for (i = 0; i < context->d3d_info->limits.ffp_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! */
@ -3376,7 +3376,7 @@ static void load_tex_coords(const struct wined3d_context *context, const struct
unsigned int mapped_stage = 0;
unsigned int textureNo = 0;
for (textureNo = 0; textureNo < gl_info->limits.texture_stages; ++textureNo)
for (textureNo = 0; textureNo < context->d3d_info->limits.ffp_blend_stages; ++textureNo)
{
int coordIdx = state->texture_states[textureNo][WINED3D_TSS_TEXCOORD_INDEX];
@ -3751,7 +3751,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->gl_info->limits.texture_stages; ++i)
for (i = 0; i < context->d3d_info->limits.ffp_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));
@ -5813,11 +5813,12 @@ static void multistate_apply_3(struct wined3d_context *context, const struct win
context->swapchain->device->multistate_funcs[state_id][2](context, state, state_id);
}
static void prune_invalid_states(struct StateEntry *state_table, const struct wined3d_gl_info *gl_info)
static void prune_invalid_states(struct StateEntry *state_table, const struct wined3d_gl_info *gl_info,
const struct wined3d_d3d_info *d3d_info)
{
unsigned int start, last, i;
start = STATE_TEXTURESTAGE(gl_info->limits.texture_stages, 0);
start = STATE_TEXTURESTAGE(d3d_info->limits.ffp_blend_stages, 0);
last = STATE_TEXTURESTAGE(MAX_TEXTURES - 1, WINED3D_HIGHEST_TEXTURE_STATE);
for (i = start; i <= last; ++i)
{
@ -5825,7 +5826,7 @@ static void prune_invalid_states(struct StateEntry *state_table, const struct wi
state_table[i].apply = state_undefined;
}
start = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + gl_info->limits.texture_stages);
start = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + d3d_info->limits.ffp_blend_stages);
last = STATE_TRANSFORM(WINED3D_TS_TEXTURE0 + MAX_TEXTURES - 1);
for (i = start; i <= last; ++i)
{
@ -5930,8 +5931,9 @@ static void validate_state_table(struct StateEntry *state_table)
}
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
const struct wined3d_gl_info *gl_info, const struct wined3d_vertex_pipe_ops *vertex,
const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc)
const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
const struct StateEntryTemplate *misc)
{
unsigned int i, type, handlers;
APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
@ -6028,7 +6030,7 @@ HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_
}
}
prune_invalid_states(StateTable, gl_info);
prune_invalid_states(StateTable, gl_info, d3d_info);
validate_state_table(StateTable);
return WINED3D_OK;

View File

@ -3133,7 +3133,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
for (i = 0; i < gl_info->limits.texture_stages; ++i)
for (i = 0; i < d3d_info->limits.ffp_blend_stages; ++i)
{
const struct wined3d_texture *texture;

View File

@ -1221,8 +1221,9 @@ extern const struct wined3d_vertex_pipe_ops ffp_vertex_pipe DECLSPEC_HIDDEN;
/* "Base" state table */
HRESULT compile_state_table(struct StateEntry *StateTable, APPLYSTATEFUNC **dev_multistate_funcs,
const struct wined3d_gl_info *gl_info, const struct wined3d_vertex_pipe_ops *vertex,
const struct fragment_pipeline *fragment, const struct StateEntryTemplate *misc) DECLSPEC_HIDDEN;
const struct wined3d_gl_info *gl_info, const struct wined3d_d3d_info *d3d_info,
const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline *fragment,
const struct StateEntryTemplate *misc) DECLSPEC_HIDDEN;
enum wined3d_blit_op
{
@ -1528,7 +1529,6 @@ struct wined3d_gl_limits
UINT buffers;
UINT lights;
UINT textures;
UINT texture_stages;
UINT texture_coords;
UINT fragment_samplers;
UINT vertex_samplers;
@ -1593,6 +1593,7 @@ struct wined3d_d3d_limits
DWORD vs_uniform_count;
DWORD ps_uniform_count;
UINT ffp_textures;
UINT ffp_blend_stages;
};
struct wined3d_d3d_info