From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/wined3d/adapter_gl.c | 108 --------------------------------- dlls/wined3d/context.c | 2 - dlls/wined3d/context_gl.c | 82 ++----------------------- dlls/wined3d/wined3d_gl.h | 7 --- dlls/wined3d/wined3d_private.h | 3 +- 5 files changed, 6 insertions(+), 196 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 19e24aac3ca..823304600f6 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -3834,69 +3834,12 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter_gl *adapter_gl, return TRUE; }
-static void WINE_GLAPI invalid_func(const void *data) -{ - ERR("Invalid vertex attribute function called.\n"); - DebugBreak(); -} - -static void WINE_GLAPI invalid_texcoord_func(GLenum unit, const void *data) -{ - ERR("Invalid texcoord function called.\n"); - DebugBreak(); -} - static void WINE_GLAPI invalid_generic_attrib_func(GLuint idx, const void *data) { ERR("Invalid attribute function called.\n"); DebugBreak(); }
-/* Helper functions for providing vertex data to OpenGL. The arrays are - * initialised based on the extension detection and are used in - * draw_primitive_immediate_mode(). */ -static void WINE_GLAPI position_d3dcolor(const void *data) -{ - const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->gl_info; - DWORD pos = *((const DWORD *)data); - - FIXME("Add a test for fixed function position from d3dcolor type.\n"); - gl_info->gl_ops.gl.p_glVertex4s(D3DCOLOR_B_R(pos), - D3DCOLOR_B_G(pos), - D3DCOLOR_B_B(pos), - D3DCOLOR_B_A(pos)); -} - -static void WINE_GLAPI diffuse_d3dcolor(const void *data) -{ - const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->gl_info; - DWORD diffuseColor = *((const DWORD *)data); - - gl_info->gl_ops.gl.p_glColor4ub(D3DCOLOR_B_R(diffuseColor), - D3DCOLOR_B_G(diffuseColor), - D3DCOLOR_B_B(diffuseColor), - D3DCOLOR_B_A(diffuseColor)); -} - -static void WINE_GLAPI specular_d3dcolor(const void *data) -{ - const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->gl_info; - DWORD specularColor = *((const DWORD *)data); - GLubyte d[] = - { - D3DCOLOR_B_R(specularColor), - D3DCOLOR_B_G(specularColor), - D3DCOLOR_B_B(specularColor) - }; - - gl_info->gl_ops.ext.p_glSecondaryColor3ubvEXT(d); -} - -static void WINE_GLAPI warn_no_specular_func(const void *data) -{ - WARN("GL_EXT_secondary_color not supported.\n"); -} - static void WINE_GLAPI generic_d3dcolor(GLuint idx, const void *data) { const struct wined3d_gl_info *gl_info = wined3d_context_gl_get_current()->gl_info; @@ -3950,58 +3893,7 @@ static void wined3d_adapter_init_ffp_attrib_ops(struct wined3d_adapter_gl *adapt unsigned int i;
for (i = 0; i < WINED3D_FFP_EMIT_COUNT; ++i) - { - ops->position[i] = invalid_func; - ops->diffuse[i] = invalid_func; - ops->specular[i] = invalid_func; - ops->normal[i] = invalid_func; - ops->texcoord[i] = invalid_texcoord_func; ops->generic[i] = invalid_generic_attrib_func; - } - - ops->position[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glVertex3fv; - ops->position[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glVertex4fv; - ops->position[WINED3D_FFP_EMIT_D3DCOLOR] = position_d3dcolor; - ops->position[WINED3D_FFP_EMIT_SHORT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glVertex2sv; - - ops->diffuse[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor3fv; - ops->diffuse[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4fv; - ops->diffuse[WINED3D_FFP_EMIT_D3DCOLOR] = diffuse_d3dcolor; - ops->diffuse[WINED3D_FFP_EMIT_UBYTE4N] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4ubv; - ops->diffuse[WINED3D_FFP_EMIT_SHORT4N] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4sv; - ops->diffuse[WINED3D_FFP_EMIT_USHORT4N] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4usv; - - /* No 4 component entry points here. */ - if (gl_info->supported[EXT_SECONDARY_COLOR]) - ops->specular[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)GL_EXTCALL(glSecondaryColor3fvEXT); - else - ops->specular[WINED3D_FFP_EMIT_FLOAT3] = warn_no_specular_func; - if (gl_info->supported[EXT_SECONDARY_COLOR]) - ops->specular[WINED3D_FFP_EMIT_D3DCOLOR] = specular_d3dcolor; - else - ops->specular[WINED3D_FFP_EMIT_D3DCOLOR] = warn_no_specular_func; - - /* Only 3 component entry points here. Test how others behave. Float4 - * normals are used by one of our tests, trying to pass it to the pixel - * shader, which fails on Windows. */ - ops->normal[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glNormal3fv; - /* Just ignore the 4th value. */ - ops->normal[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glNormal3fv; - - ops->texcoord[WINED3D_FFP_EMIT_FLOAT1] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord1fvARB; - ops->texcoord[WINED3D_FFP_EMIT_FLOAT2] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord2fvARB; - ops->texcoord[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord3fvARB; - ops->texcoord[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord4fvARB; - ops->texcoord[WINED3D_FFP_EMIT_SHORT2] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord2svARB; - ops->texcoord[WINED3D_FFP_EMIT_SHORT4] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord4svARB; - if (gl_info->supported[NV_HALF_FLOAT]) - { - /* Not supported by ARB_HALF_FLOAT_VERTEX, so check for NV_HALF_FLOAT. */ - ops->texcoord[WINED3D_FFP_EMIT_FLOAT16_2] = - (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord2hvNV; - ops->texcoord[WINED3D_FFP_EMIT_FLOAT16_4] = - (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord4hvNV; - }
ops->generic[WINED3D_FFP_EMIT_FLOAT1] = (wined3d_generic_attrib_func)gl_info->gl_ops.ext.p_glVertexAttrib1fv; ops->generic[WINED3D_FFP_EMIT_FLOAT2] = (wined3d_generic_attrib_func)gl_info->gl_ops.ext.p_glVertexAttrib2fv; diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 30f50ea23f3..1a6ad5dc79a 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -310,6 +310,4 @@ void context_update_stream_info(struct wined3d_context *context, const struct wi
if (prev_all_vbo != stream_info->all_vbo) context_invalidate_state(context, STATE_INDEXBUFFER); - - context->use_immediate_mode_draw = FALSE; } diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 310473138a4..8072ec15500 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -4609,66 +4609,6 @@ static void wined3d_context_gl_draw_primitive_arrays(struct wined3d_context_gl * } }
-static unsigned int get_stride_idx(const void *idx_data, unsigned int idx_size, - unsigned int base_vertex_idx, unsigned int start_idx, unsigned int vertex_idx) -{ - if (!idx_data) - return start_idx + vertex_idx; - if (idx_size == 2) - return ((const WORD *)idx_data)[start_idx + vertex_idx] + base_vertex_idx; - return ((const DWORD *)idx_data)[start_idx + vertex_idx] + base_vertex_idx; -} - -/* Context activation is done by the caller. */ -static void draw_primitive_immediate_mode(struct wined3d_context_gl *context_gl, const struct wined3d_state *state, - const struct wined3d_stream_info *si, const void *idx_data, unsigned int idx_size, - int base_vertex_idx, unsigned int start_idx, unsigned int vertex_count, unsigned int instance_count) -{ - const struct wined3d_gl_info *gl_info = context_gl->gl_info; - const struct wined3d_ffp_attrib_ops *ops; - const void *ptr; - - static unsigned int once; - - if (!once++) - FIXME_(d3d_perf)("Drawing using immediate mode.\n"); - else - WARN_(d3d_perf)("Drawing using immediate mode.\n"); - - if (!idx_size && idx_data) - ERR("Non-NULL idx_data with 0 idx_size, this should never happen.\n"); - - if (instance_count) - FIXME("Instancing not implemented.\n"); - - /* Immediate mode drawing can't make use of indices in a VBO - get the - * data from the index buffer. */ - if (idx_size) - idx_data = (uint8_t *)wined3d_buffer_load_sysmem(state->index_buffer, &context_gl->c) + state->index_offset; - - ops = &gl_info->ffp_attrib_ops; - - gl_info->gl_ops.gl.p_glBegin(gl_primitive_type_from_d3d(state->primitive_type)); - - for (unsigned int vertex_idx = 0; vertex_idx < vertex_count; ++vertex_idx) - { - unsigned int stride_idx = get_stride_idx(idx_data, idx_size, base_vertex_idx, start_idx, vertex_idx); - unsigned int use_map = si->use_map; - - for (unsigned int element_idx = gl_info->limits.vertex_attribs - 1; use_map; - use_map &= ~(1u << element_idx), --element_idx) - { - if (!(use_map & 1u << element_idx)) - continue; - - ptr = si->elements[element_idx].data.addr + si->elements[element_idx].stride * stride_idx; - ops->generic[si->elements[element_idx].format->emit_idx](element_idx, ptr); - } - } - - gl_info->gl_ops.gl.p_glEnd(); -} - static void wined3d_context_gl_draw_indirect(struct wined3d_context_gl *context_gl, const struct wined3d_state *state, const struct wined3d_indirect_draw_parameters *parameters, unsigned int idx_size) { @@ -4907,23 +4847,14 @@ void draw_primitive(struct wined3d_device *device, const struct wined3d_state *s
if (parameters->indirect) { - if (!context->use_immediate_mode_draw) - wined3d_context_gl_draw_indirect(context_gl, state, ¶meters->u.indirect, idx_size); - else - FIXME("Indirect draws with immediate mode are not supported.\n"); + wined3d_context_gl_draw_indirect(context_gl, state, ¶meters->u.indirect, idx_size); } else { - unsigned int instance_count = parameters->u.direct.instance_count; - - if (context->use_immediate_mode_draw) - draw_primitive_immediate_mode(wined3d_context_gl(context), state, stream_info, idx_data, - idx_size, parameters->u.direct.base_vertex_idx, - parameters->u.direct.start_idx, parameters->u.direct.index_count, instance_count); - else - wined3d_context_gl_draw_primitive_arrays(context_gl, state, idx_data, idx_size, - parameters->u.direct.base_vertex_idx, parameters->u.direct.start_idx, - parameters->u.direct.index_count, parameters->u.direct.start_instance, instance_count); + wined3d_context_gl_draw_primitive_arrays(context_gl, state, idx_data, idx_size, + parameters->u.direct.base_vertex_idx, parameters->u.direct.start_idx, + parameters->u.direct.index_count, parameters->u.direct.start_instance, + parameters->u.direct.instance_count); }
if (context->uses_uavs) @@ -5233,9 +5164,6 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl *context_gl, const struct wined3d_state *state) { - if (context_gl->c.use_immediate_mode_draw) - return; - wined3d_context_gl_unload_vertex_data(context_gl); wined3d_context_gl_load_numbered_arrays(context_gl, &context_gl->c.stream_info, state); } diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 2da6add961d..1dfa4138894 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -331,17 +331,10 @@ void wined3d_gl_limits_get_uniform_block_range(const struct wined3d_gl_limits *g #define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200 #define WINED3D_QUIRK_NO_INDEPENDENT_BIT_DEPTHS 0x00000400
-typedef void (WINE_GLAPI *wined3d_ffp_attrib_func)(const void *data); -typedef void (WINE_GLAPI *wined3d_ffp_texcoord_func)(GLenum unit, const void *data); typedef void (WINE_GLAPI *wined3d_generic_attrib_func)(GLuint idx, const void *data);
struct wined3d_ffp_attrib_ops { - wined3d_ffp_attrib_func position[WINED3D_FFP_EMIT_COUNT]; - wined3d_ffp_attrib_func diffuse[WINED3D_FFP_EMIT_COUNT]; - wined3d_ffp_attrib_func specular[WINED3D_FFP_EMIT_COUNT]; - wined3d_ffp_attrib_func normal[WINED3D_FFP_EMIT_COUNT]; - wined3d_ffp_texcoord_func texcoord[WINED3D_FFP_EMIT_COUNT]; wined3d_generic_attrib_func generic[WINED3D_FFP_EMIT_COUNT]; };
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3fc9dfb9a8e..34c820497ad 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1925,7 +1925,6 @@ struct wined3d_context DWORD lowest_disabled_stage : 4; /* Max WINED3D_MAX_FFP_TEXTURES, 8 */
DWORD fixed_function_usage_map : 8; /* WINED3D_MAX_FFP_TEXTURES, 8 */ - DWORD use_immediate_mode_draw : 1; DWORD uses_uavs : 1; DWORD uses_fbo_attached_resources : 1; DWORD transform_feedback_active : 1; @@ -1937,7 +1936,7 @@ struct wined3d_context DWORD update_primitive_type : 1; DWORD update_patch_vertex_count : 1; DWORD update_multisample_state : 1; - DWORD padding : 12; + DWORD padding : 13;
DWORD clip_distance_mask : 8; /* WINED3D_MAX_CLIP_DISTANCES, 8 */