wined3d: Move the material tracking fields from struct wined3d_context to struct wined3d_context_gl.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
955549c4ca
commit
b1c5c9b226
|
@ -4552,7 +4552,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context_gl *context_gl,
|
|||
else
|
||||
gl_info->gl_ops.gl.p_glNormal3f(0.0f, 0.0f, 0.0f);
|
||||
|
||||
untracked_material_count = context_gl->c.num_untracked_materials;
|
||||
untracked_material_count = context_gl->untracked_material_count;
|
||||
if (si->use_map & (1u << WINED3D_FFP_DIFFUSE))
|
||||
{
|
||||
element = &si->elements[WINED3D_FFP_DIFFUSE];
|
||||
|
@ -4665,7 +4665,7 @@ static void draw_primitive_immediate_mode(struct wined3d_context_gl *context_gl,
|
|||
for (i = 0; i < untracked_material_count; ++i)
|
||||
{
|
||||
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK,
|
||||
context_gl->c.untracked_materials[i], &color.r);
|
||||
context_gl->untracked_materials[i], &color.r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4794,6 +4794,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
|
|||
struct wined3d_stream_info si_emulated;
|
||||
struct wined3d_fence *ib_fence = NULL;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
struct wined3d_context_gl *context_gl;
|
||||
struct wined3d_context *context;
|
||||
unsigned int i, idx_size = 0;
|
||||
const void *idx_data = NULL;
|
||||
|
@ -4820,6 +4821,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
|
|||
WARN("Invalid context, skipping draw.\n");
|
||||
return;
|
||||
}
|
||||
context_gl = wined3d_context_gl(context);
|
||||
gl_info = context->gl_info;
|
||||
|
||||
if (!use_transform_feedback(state))
|
||||
|
@ -4898,7 +4900,7 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
|
|||
|
||||
if (!use_vs(state))
|
||||
{
|
||||
if (!stream_info->position_transformed && context->num_untracked_materials
|
||||
if (!stream_info->position_transformed && context_gl->untracked_material_count
|
||||
&& state->render_states[WINED3D_RS_LIGHTING])
|
||||
{
|
||||
static BOOL warned;
|
||||
|
|
|
@ -1297,19 +1297,18 @@ void state_fogdensity(struct wined3d_context *context, const struct wined3d_stat
|
|||
|
||||
static void state_colormat(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
|
||||
const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
|
||||
GLenum Parm = 0;
|
||||
|
||||
/* Depends on the decoded vertex declaration to read the existence of diffuse data.
|
||||
* The vertex declaration will call this function if the fixed function pipeline is used.
|
||||
*/
|
||||
|
||||
if(isStateDirty(context, STATE_VDECL)) {
|
||||
/* Depends on the decoded vertex declaration to read the existence of
|
||||
* diffuse data. The vertex declaration will call this function if the
|
||||
* fixed function pipeline is used. */
|
||||
if (isStateDirty(&context_gl->c, STATE_VDECL))
|
||||
return;
|
||||
}
|
||||
|
||||
context->num_untracked_materials = 0;
|
||||
if ((context->stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE))
|
||||
context_gl->untracked_material_count = 0;
|
||||
if ((context_gl->c.stream_info.use_map & (1u << WINED3D_FFP_DIFFUSE))
|
||||
&& state->render_states[WINED3D_RS_COLORVERTEX])
|
||||
{
|
||||
TRACE("diff %d, amb %d, emis %d, spec %d\n",
|
||||
|
@ -1325,38 +1324,23 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d
|
|||
else
|
||||
Parm = GL_DIFFUSE;
|
||||
if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
||||
context->num_untracked_materials++;
|
||||
}
|
||||
context_gl->untracked_materials[context_gl->untracked_material_count++] = GL_EMISSION;
|
||||
if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
||||
context->num_untracked_materials++;
|
||||
}
|
||||
context_gl->untracked_materials[context_gl->untracked_material_count++] = GL_SPECULAR;
|
||||
}
|
||||
else if (state->render_states[WINED3D_RS_AMBIENTMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
Parm = GL_AMBIENT;
|
||||
if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
context->untracked_materials[context->num_untracked_materials] = GL_EMISSION;
|
||||
context->num_untracked_materials++;
|
||||
}
|
||||
context_gl->untracked_materials[context_gl->untracked_material_count++] = GL_EMISSION;
|
||||
if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
||||
context->num_untracked_materials++;
|
||||
}
|
||||
context_gl->untracked_materials[context_gl->untracked_material_count++] = GL_SPECULAR;
|
||||
}
|
||||
else if (state->render_states[WINED3D_RS_EMISSIVEMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
Parm = GL_EMISSION;
|
||||
if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
context->untracked_materials[context->num_untracked_materials] = GL_SPECULAR;
|
||||
context->num_untracked_materials++;
|
||||
}
|
||||
context_gl->untracked_materials[context_gl->untracked_material_count++] = GL_SPECULAR;
|
||||
}
|
||||
else if (state->render_states[WINED3D_RS_SPECULARMATERIALSOURCE] == WINED3D_MCS_COLOR1)
|
||||
{
|
||||
|
@ -1365,7 +1349,8 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d
|
|||
}
|
||||
|
||||
/* Nothing changed, return. */
|
||||
if (Parm == context->tracking_parm) return;
|
||||
if (Parm == context_gl->tracking_parm)
|
||||
return;
|
||||
|
||||
if (!Parm)
|
||||
{
|
||||
|
@ -1382,7 +1367,7 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d
|
|||
|
||||
/* Apparently calls to glMaterialfv are ignored for properties we're
|
||||
* tracking with glColorMaterial, so apply those here. */
|
||||
switch (context->tracking_parm)
|
||||
switch (context_gl->tracking_parm)
|
||||
{
|
||||
case GL_AMBIENT_AND_DIFFUSE:
|
||||
gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float *)&state->material.ambient);
|
||||
|
@ -1421,7 +1406,7 @@ static void state_colormat(struct wined3d_context *context, const struct wined3d
|
|||
break;
|
||||
}
|
||||
|
||||
context->tracking_parm = Parm;
|
||||
context_gl->tracking_parm = Parm;
|
||||
}
|
||||
|
||||
static void state_linepattern(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
|
||||
|
|
|
@ -1927,23 +1927,20 @@ struct wined3d_context
|
|||
DWORD lowest_disabled_stage : 4; /* Max WINED3D_MAX_TEXTURES, 8 */
|
||||
DWORD use_immediate_mode_draw : 1;
|
||||
DWORD needs_set : 1;
|
||||
DWORD num_untracked_materials : 2; /* Max value 2 */
|
||||
DWORD transform_feedback_active : 1;
|
||||
DWORD transform_feedback_paused : 1;
|
||||
|
||||
DWORD update_shader_resource_bindings : 1;
|
||||
DWORD update_compute_shader_resource_bindings : 1;
|
||||
DWORD update_unordered_access_view_bindings : 1;
|
||||
DWORD update_compute_unordered_access_view_bindings : 1;
|
||||
DWORD uses_uavs : 1;
|
||||
DWORD transform_feedback_active : 1;
|
||||
DWORD transform_feedback_paused : 1;
|
||||
DWORD shader_update_mask : 6; /* WINED3D_SHADER_TYPE_COUNT, 6 */
|
||||
DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */
|
||||
DWORD padding : 11;
|
||||
DWORD padding : 13;
|
||||
|
||||
DWORD constant_update_mask;
|
||||
DWORD numbered_array_mask;
|
||||
GLenum tracking_parm; /* Which source is tracking current colour */
|
||||
GLenum untracked_materials[2];
|
||||
enum fogsource fog_source;
|
||||
|
||||
UINT instance_count;
|
||||
|
@ -1977,10 +1974,13 @@ struct wined3d_context_gl
|
|||
uint32_t fog_enabled : 1;
|
||||
uint32_t diffuse_attrib_to_1 : 1;
|
||||
uint32_t rebind_fbo : 1;
|
||||
uint32_t padding : 27;
|
||||
uint32_t untracked_material_count : 2; /* Max value 2 */
|
||||
uint32_t padding : 25;
|
||||
|
||||
uint32_t default_attrib_value_set;
|
||||
|
||||
GLenum tracking_parm; /* Which source is tracking current colour. */
|
||||
GLenum untracked_materials[2];
|
||||
SIZE blit_size;
|
||||
unsigned int active_texture;
|
||||
|
||||
|
|
Loading…
Reference in New Issue