From 4f2f51526b75deebae1c8a49ca4cefefd901dd9d Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Wed, 20 Mar 2024 17:51:07 -0500 Subject: [PATCH] wined3d: Remove the no longer needed wined3d_vertex_caps.ffp_generic_attributes flag. --- dlls/wined3d/adapter_gl.c | 1 - dlls/wined3d/adapter_vk.c | 1 - dlls/wined3d/buffer.c | 39 +-- dlls/wined3d/context.c | 25 +- dlls/wined3d/context_gl.c | 463 +-------------------------------- dlls/wined3d/cs.c | 9 - dlls/wined3d/glsl_shader.c | 1 - dlls/wined3d/shader_spirv.c | 1 - dlls/wined3d/wined3d_gl.h | 2 - dlls/wined3d/wined3d_private.h | 3 - 10 files changed, 13 insertions(+), 532 deletions(-) diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index 073a41644b7..19e24aac3ca 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -5016,7 +5016,6 @@ static void wined3d_adapter_gl_init_d3d_info(struct wined3d_adapter_gl *adapter_ d3d_info->wined3d_creation_flags = wined3d_creation_flags; d3d_info->emulated_flatshading = vertex_caps.emulated_flatshading; - 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_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION); diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index c23ee92c84f..8e004339525 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -2326,7 +2326,6 @@ static void wined3d_adapter_vk_init_d3d_info(struct wined3d_adapter_vk *adapter_ d3d_info->wined3d_creation_flags = wined3d_creation_flags; d3d_info->emulated_flatshading = vertex_caps.emulated_flatshading; - 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_double_precision = !!(shader_caps.wined3d_caps & WINED3D_SHADER_CAP_DOUBLE_PRECISION); diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index ad58aa4a152..4fa8b811661 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -305,13 +305,10 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *buffer, return ret; } -#define WINED3D_BUFFER_FIXUP_D3DCOLOR 0x01 - static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct wined3d_stream_info *si, const struct wined3d_state *state, UINT attrib_idx, DWORD fixup_flags, UINT *stride_this_run) { const struct wined3d_stream_info_element *attrib = &si->elements[attrib_idx]; - enum wined3d_format_id format; BOOL ret = FALSE; /* Ignore attributes that do not have our vbo. After that check we can be sure that the attribute is @@ -321,11 +318,8 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win || state->streams[attrib->stream_idx].buffer != This) return FALSE; - format = attrib->format->id; /* Look for newly appeared conversion */ - if (fixup_flags & WINED3D_BUFFER_FIXUP_D3DCOLOR && format == WINED3DFMT_B8G8R8A8_UNORM) - ret = buffer_process_converted_attribute(This, CONV_D3DCOLOR, attrib, stride_this_run); - else if (This->conversion_map) + if (This->conversion_map) ret = buffer_process_converted_attribute(This, CONV_NONE, attrib, stride_this_run); return ret; @@ -450,27 +444,6 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_s return ret; } -static inline unsigned int fixup_d3dcolor(DWORD *dst_color) -{ - DWORD src_color = *dst_color; - - /* Color conversion like in draw_primitive_immediate_mode(). Watch out for - * endianness. If we want this to work on big-endian machines as well we - * have to consider more things. - * - * 0xff000000: Alpha mask - * 0x00ff0000: Blue mask - * 0x0000ff00: Green mask - * 0x000000ff: Red mask - */ - *dst_color = 0; - *dst_color |= (src_color & 0xff00ff00u); /* Alpha Green */ - *dst_color |= (src_color & 0x00ff0000u) >> 16; /* Red */ - *dst_color |= (src_color & 0x000000ffu) << 16; /* Blue */ - - return sizeof(*dst_color); -} - ULONG CDECL wined3d_buffer_incref(struct wined3d_buffer *buffer) { unsigned int refcount = InterlockedIncrement(&buffer->resource.ref); @@ -518,9 +491,6 @@ static void buffer_conversion_upload(struct wined3d_buffer *buffer, struct wined /* Done already */ j += sizeof(DWORD); break; - case CONV_D3DCOLOR: - j += fixup_d3dcolor((DWORD *) (data + i * buffer->stride + j)); - break; default: FIXME("Unimplemented conversion %d in shifted conversion.\n", buffer->conversion_map[j]); ++j; @@ -779,7 +749,6 @@ void * CDECL wined3d_buffer_get_parent(const struct wined3d_buffer *buffer) void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_state *state) { - const struct wined3d_d3d_info *d3d_info = context->d3d_info; BOOL decl_changed = FALSE; TRACE("buffer %p.\n", buffer); @@ -813,12 +782,6 @@ void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context * { DWORD fixup_flags = 0; - if (!use_vs(state)) - { - if (!d3d_info->vertex_bgra && !d3d_info->ffp_generic_attributes) - fixup_flags |= WINED3D_BUFFER_FIXUP_D3DCOLOR; - } - decl_changed = buffer_find_decl(buffer, &context->stream_info, state, fixup_flags); buffer->flags |= WINED3D_BUFFER_HASDESC; } diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index bfee98e470f..30f50ea23f3 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -162,7 +162,6 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf { /* We need to deal with frequency data! */ struct wined3d_vertex_declaration *declaration = state->vertex_declaration; - BOOL generic_attributes = d3d_info->ffp_generic_attributes; BOOL use_vshader = use_vs(state); unsigned int i; @@ -213,16 +212,7 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf } else { - if (!generic_attributes && !element->ffp_valid) - { - WARN("Skipping unsupported fixed function element of format %s and usage %s.\n", - debug_d3dformat(element->format->id), debug_d3ddeclusage(element->usage)); - stride_used = FALSE; - } - else - { - stride_used = fixed_get_input(element->usage, element->usage_idx, &idx); - } + stride_used = fixed_get_input(element->usage, element->usage_idx, &idx); } if (stride_used) @@ -322,17 +312,4 @@ void context_update_stream_info(struct wined3d_context *context, const struct wi context_invalidate_state(context, STATE_INDEXBUFFER); context->use_immediate_mode_draw = FALSE; - - if (stream_info->all_vbo) - return; - - if (!use_vs(state)) - { - WORD slow_mask = -!d3d_info->ffp_generic_attributes & (1u << WINED3D_FFP_PSIZE); - slow_mask |= -(!d3d_info->vertex_bgra && !d3d_info->ffp_generic_attributes) - & ((1u << WINED3D_FFP_DIFFUSE) | (1u << WINED3D_FFP_SPECULAR) | (1u << WINED3D_FFP_BLENDWEIGHT)); - - if (stream_info->use_map & slow_mask) - context->use_immediate_mode_draw = TRUE; - } } diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index ad6334016ec..d245a87526f 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -4624,18 +4624,8 @@ static void draw_primitive_immediate_mode(struct wined3d_context_gl *context_gl, 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 BYTE *position = NULL, *normal = NULL, *diffuse = NULL, *specular = NULL; - const struct wined3d_d3d_info *d3d_info = context_gl->c.d3d_info; const struct wined3d_gl_info *gl_info = context_gl->gl_info; - unsigned int coord_idx, stride_idx, texture_idx, vertex_idx; - const struct wined3d_stream_info_element *element; - const BYTE *tex_coords[WINED3DDP_MAXTEXCOORD]; - unsigned int texture_unit, texture_stages; const struct wined3d_ffp_attrib_ops *ops; - unsigned int untracked_material_count; - unsigned int tex_mask = 0; - BOOL specular_fog = FALSE; - BOOL ps = use_ps(state); const void *ptr; static unsigned int once; @@ -4660,183 +4650,23 @@ static void draw_primitive_immediate_mode(struct wined3d_context_gl *context_gl, gl_info->gl_ops.gl.p_glBegin(gl_primitive_type_from_d3d(state->primitive_type)); - if (use_vs(state) || d3d_info->ffp_generic_attributes) + for (unsigned int vertex_idx = 0; vertex_idx < vertex_count; ++vertex_idx) { - for (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) { - unsigned int use_map = si->use_map; - unsigned int element_idx; + if (!(use_map & 1u << element_idx)) + continue; - stride_idx = get_stride_idx(idx_data, idx_size, base_vertex_idx, start_idx, vertex_idx); - for (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(); - return; - } - - if (si->use_map & (1u << WINED3D_FFP_POSITION)) - position = si->elements[WINED3D_FFP_POSITION].data.addr; - - if (si->use_map & (1u << WINED3D_FFP_NORMAL)) - normal = si->elements[WINED3D_FFP_NORMAL].data.addr; - else - gl_info->gl_ops.gl.p_glNormal3f(0.0f, 0.0f, 0.0f); - - untracked_material_count = context_gl->untracked_material_count; - if (si->use_map & (1u << WINED3D_FFP_DIFFUSE)) - { - element = &si->elements[WINED3D_FFP_DIFFUSE]; - diffuse = element->data.addr; - - if (untracked_material_count && element->format->id != WINED3DFMT_B8G8R8A8_UNORM) - FIXME("Implement diffuse color tracking from %s.\n", debug_d3dformat(element->format->id)); - } - else - { - gl_info->gl_ops.gl.p_glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - } - - if (si->use_map & (1u << WINED3D_FFP_SPECULAR)) - { - element = &si->elements[WINED3D_FFP_SPECULAR]; - specular = element->data.addr; - - /* Special case where the fog density is stored in the specular alpha channel. */ - if (state->render_states[WINED3D_RS_FOGENABLE] - && (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE - || si->elements[WINED3D_FFP_POSITION].format->id == WINED3DFMT_R32G32B32A32_FLOAT) - && state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) - { - if (gl_info->supported[EXT_FOG_COORD]) - { - if (element->format->id == WINED3DFMT_B8G8R8A8_UNORM) - specular_fog = TRUE; - else - FIXME("Implement fog coordinates from %s.\n", debug_d3dformat(element->format->id)); - } - else - { - static unsigned int once; - - if (!once++) - FIXME("Implement fog for transformed vertices in software.\n"); - } - } - } - else if (gl_info->supported[EXT_SECONDARY_COLOR]) - { - GL_EXTCALL(glSecondaryColor3fEXT)(0.0f, 0.0f, 0.0f); - } - - 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) - { - FIXME("Program using multiple concurrent textures which this OpenGL implementation doesn't support.\n"); - continue; - } - - if (!ps && !wined3d_state_get_ffp_texture(state, texture_idx)) - continue; - - texture_unit = context_gl->tex_unit_map[texture_idx]; - if (texture_unit == WINED3D_UNMAPPED_STAGE) - continue; - - coord_idx = state->texture_states[texture_idx][WINED3D_TSS_TEXCOORD_INDEX]; - if (coord_idx > 7) - { - TRACE("Skipping generated coordinates (%#x) for texture %u.\n", coord_idx, texture_idx); - continue; - } - - if (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx))) - { - tex_coords[coord_idx] = si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].data.addr; - tex_mask |= (1u << texture_idx); - } - else - { - TRACE("Setting default coordinates for texture %u.\n", texture_idx); - if (gl_info->supported[ARB_MULTITEXTURE]) - GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + texture_unit, 0.0f, 0.0f, 0.0f, 1.0f)); - else - gl_info->gl_ops.gl.p_glTexCoord4f(0.0f, 0.0f, 0.0f, 1.0f); - } - } - - /* Blending data and point sizes are not supported by this function. They - * are not supported by the fixed function pipeline at all. A FIXME for - * them is printed after decoding the vertex declaration. */ - for (vertex_idx = 0; vertex_idx < vertex_count; ++vertex_idx) - { - uint32_t tmp_tex_mask; - - stride_idx = get_stride_idx(idx_data, idx_size, base_vertex_idx, start_idx, vertex_idx); - - if (normal) - { - ptr = normal + stride_idx * si->elements[WINED3D_FFP_NORMAL].stride; - ops->normal[si->elements[WINED3D_FFP_NORMAL].format->emit_idx](ptr); - } - - if (diffuse) - { - ptr = diffuse + stride_idx * si->elements[WINED3D_FFP_DIFFUSE].stride; - ops->diffuse[si->elements[WINED3D_FFP_DIFFUSE].format->emit_idx](ptr); - - if (untracked_material_count) - { - struct wined3d_color color; - unsigned int i; - - wined3d_color_from_d3dcolor(&color, *(const DWORD *)ptr); - for (i = 0; i < untracked_material_count; ++i) - { - gl_info->gl_ops.gl.p_glMaterialfv(GL_FRONT_AND_BACK, - context_gl->untracked_materials[i], &color.r); - } - } - } - - if (specular) - { - ptr = specular + stride_idx * si->elements[WINED3D_FFP_SPECULAR].stride; - ops->specular[si->elements[WINED3D_FFP_SPECULAR].format->emit_idx](ptr); - - if (specular_fog) - GL_EXTCALL(glFogCoordfEXT((float)(*(const DWORD *)ptr >> 24))); - } - - tmp_tex_mask = tex_mask; - while (tmp_tex_mask) - { - texture_idx = wined3d_bit_scan(&tmp_tex_mask); - coord_idx = state->texture_states[texture_idx][WINED3D_TSS_TEXCOORD_INDEX]; - ptr = tex_coords[coord_idx] + (stride_idx * si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].stride); - ops->texcoord[si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->emit_idx]( - GL_TEXTURE0_ARB + context_gl->tex_unit_map[texture_idx], ptr); - } - - if (position) - { - ptr = position + stride_idx * si->elements[WINED3D_FFP_POSITION].stride; - ops->position[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptr); + 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(); - checkGLcall("draw immediate mode"); } static void wined3d_context_gl_draw_indirect(struct wined3d_context_gl *context_gl, const struct wined3d_state *state, @@ -5193,71 +5023,6 @@ static const void *get_vertex_attrib_pointer(const struct wined3d_stream_info_el return offset; } -void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl, - const struct wined3d_stream_info *si, GLuint *current_bo, const struct wined3d_state *state) -{ - const struct wined3d_gl_info *gl_info = context_gl->gl_info; - const struct wined3d_format_gl *format_gl; - unsigned int mapped_stage = 0; - unsigned int texture_idx; - GLuint bo; - - 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]; - - if ((mapped_stage = context_gl->tex_unit_map[texture_idx]) == WINED3D_UNMAPPED_STAGE) - continue; - - if (mapped_stage >= gl_info->limits.texture_coords) - { - FIXME("Attempted to load unsupported texture coordinate %u.\n", mapped_stage); - continue; - } - - if (coord_idx < WINED3D_MAX_FFP_TEXTURES && (si->use_map & (1u << (WINED3D_FFP_TEXCOORD0 + coord_idx)))) - { - const struct wined3d_stream_info_element *e = &si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx]; - - TRACE("Setting up texture %u, idx %u, coord_idx %u, data %s.\n", - texture_idx, mapped_stage, coord_idx, debug_bo_address(&e->data)); - - bo = wined3d_bo_gl_id(e->data.buffer_object); - if (*current_bo != bo) - { - GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, bo)); - checkGLcall("glBindBuffer"); - *current_bo = bo; - } - - GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); - checkGLcall("glClientActiveTextureARB"); - - /* The coords to supply depend completely on the fvf/vertex shader. */ - format_gl = wined3d_format_gl(e->format); - gl_info->gl_ops.gl.p_glTexCoordPointer(format_gl->vtx_format, format_gl->vtx_type, e->stride, - get_vertex_attrib_pointer(e, state)); - gl_info->gl_ops.gl.p_glEnableClientState(GL_TEXTURE_COORD_ARRAY); - if (bo) - wined3d_buffer_validate_user(state->streams[e->stream_idx].buffer); - } - else - { - GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1)); - } - } - if (gl_info->supported[NV_REGISTER_COMBINERS]) - { - /* The number of the mapped stages increases monotonically, so it's fine to use the last used one. */ - for (texture_idx = mapped_stage + 1; texture_idx < gl_info->limits.ffp_textures; ++texture_idx) - { - GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + texture_idx, 0, 0, 0, 1)); - } - } - - checkGLcall("loadTexCoords"); -} - /* This should match any arrays loaded in wined3d_context_gl_load_vertex_data(). */ static void wined3d_context_gl_unload_vertex_data(struct wined3d_context_gl *context_gl) { @@ -5274,202 +5039,6 @@ static void wined3d_context_gl_unload_vertex_data(struct wined3d_context_gl *con context_gl->c.namedArraysLoaded = FALSE; } -static void wined3d_context_gl_load_vertex_data(struct wined3d_context_gl *context_gl, - const struct wined3d_stream_info *si, const struct wined3d_state *state) -{ - const struct wined3d_gl_info *gl_info = context_gl->gl_info; - const struct wined3d_stream_info_element *e; - const struct wined3d_format_gl *format_gl; - GLuint current_bo, bo; - const void *offset; - - TRACE("context_gl %p, si %p, state %p.\n", context_gl, si, state); - - /* This is used for the fixed-function pipeline only, and the - * fixed-function pipeline doesn't do instancing. */ - current_bo = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0u : 0; - - /* Blend data */ - if ((si->use_map & (1u << WINED3D_FFP_BLENDWEIGHT)) - || si->use_map & (1u << WINED3D_FFP_BLENDINDICES)) - { - /* TODO: Support vertex blending in immediate mode draws. No need to - * write a FIXME here, this is done after the general vertex - * declaration decoding. */ - WARN("Vertex blending not supported.\n"); - } - - /* Point Size */ - if (si->use_map & (1u << WINED3D_FFP_PSIZE)) - { - /* No such functionality in the fixed-function GL pipeline. */ - WARN("Per-vertex point size not supported.\n"); - } - - /* Position */ - if (si->use_map & (1u << WINED3D_FFP_POSITION)) - { - e = &si->elements[WINED3D_FFP_POSITION]; - format_gl = wined3d_format_gl(e->format); - offset = get_vertex_attrib_pointer(e, state); - - bo = wined3d_bo_gl_id(e->data.buffer_object); - if (current_bo != bo) - { - GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, bo)); - checkGLcall("glBindBuffer"); - current_bo = bo; - } - - TRACE("glVertexPointer(%#x, %#x, %#x, %p);\n", format_gl->vtx_format, format_gl->vtx_type, e->stride, offset); - gl_info->gl_ops.gl.p_glVertexPointer(format_gl->vtx_format, format_gl->vtx_type, e->stride, offset); - checkGLcall("glVertexPointer(...)"); - gl_info->gl_ops.gl.p_glEnableClientState(GL_VERTEX_ARRAY); - checkGLcall("glEnableClientState(GL_VERTEX_ARRAY)"); - if (bo) - wined3d_buffer_validate_user(state->streams[e->stream_idx].buffer); - } - - /* Normals */ - if (si->use_map & (1u << WINED3D_FFP_NORMAL)) - { - e = &si->elements[WINED3D_FFP_NORMAL]; - format_gl = wined3d_format_gl(e->format); - offset = get_vertex_attrib_pointer(e, state); - - bo = wined3d_bo_gl_id(e->data.buffer_object); - if (current_bo != bo) - { - GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, bo)); - checkGLcall("glBindBuffer"); - current_bo = bo; - } - - TRACE("glNormalPointer(%#x, %#x, %p);\n", format_gl->vtx_type, e->stride, offset); - gl_info->gl_ops.gl.p_glNormalPointer(format_gl->vtx_type, e->stride, offset); - checkGLcall("glNormalPointer(...)"); - gl_info->gl_ops.gl.p_glEnableClientState(GL_NORMAL_ARRAY); - checkGLcall("glEnableClientState(GL_NORMAL_ARRAY)"); - if (bo) - wined3d_buffer_validate_user(state->streams[e->stream_idx].buffer); - } - else - { - gl_info->gl_ops.gl.p_glNormal3f(0, 0, 0); - checkGLcall("glNormal3f(0, 0, 0)"); - } - - /* Diffuse colour */ - if (si->use_map & (1u << WINED3D_FFP_DIFFUSE)) - { - e = &si->elements[WINED3D_FFP_DIFFUSE]; - format_gl = wined3d_format_gl(e->format); - offset = get_vertex_attrib_pointer(e, state); - - bo = wined3d_bo_gl_id(e->data.buffer_object); - if (current_bo != bo) - { - GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, bo)); - checkGLcall("glBindBuffer"); - current_bo = bo; - } - - TRACE("glColorPointer(%#x, %#x %#x, %p);\n", - format_gl->vtx_format, format_gl->vtx_type, e->stride, offset); - gl_info->gl_ops.gl.p_glColorPointer(format_gl->vtx_format, format_gl->vtx_type, e->stride, offset); - checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)"); - gl_info->gl_ops.gl.p_glEnableClientState(GL_COLOR_ARRAY); - checkGLcall("glEnableClientState(GL_COLOR_ARRAY)"); - if (bo) - wined3d_buffer_validate_user(state->streams[e->stream_idx].buffer); - } - else - { - gl_info->gl_ops.gl.p_glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - checkGLcall("glColor4f(1, 1, 1, 1)"); - } - - /* Specular colour */ - if (si->use_map & (1u << WINED3D_FFP_SPECULAR)) - { - TRACE("Setting specular colour.\n"); - - e = &si->elements[WINED3D_FFP_SPECULAR]; - offset = get_vertex_attrib_pointer(e, state); - - if (gl_info->supported[EXT_SECONDARY_COLOR]) - { - GLint format; - GLenum type; - - format_gl = wined3d_format_gl(e->format); - type = format_gl->vtx_type; - format = format_gl->vtx_format; - - bo = wined3d_bo_gl_id(e->data.buffer_object); - if (current_bo != bo) - { - GL_EXTCALL(glBindBuffer(GL_ARRAY_BUFFER, bo)); - checkGLcall("glBindBuffer"); - current_bo = bo; - } - - if (format != 4 || (gl_info->quirks & WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA)) - { - /* Usually specular colors only allow 3 components, since they have no alpha. In D3D, the specular alpha - * contains the fog coordinate, which is passed to GL with GL_EXT_fog_coord. However, the fixed function - * vertex pipeline can pass the specular alpha through, and pixel shaders can read it. So it GL accepts - * 4 component secondary colors use it - */ - TRACE("glSecondaryColorPointer(%#x, %#x, %#x, %p);\n", format, type, e->stride, offset); - GL_EXTCALL(glSecondaryColorPointerEXT(format, type, e->stride, offset)); - checkGLcall("glSecondaryColorPointerEXT(format, type, ...)"); - } - else - { - switch (type) - { - case GL_UNSIGNED_BYTE: - TRACE("glSecondaryColorPointer(3, GL_UNSIGNED_BYTE, %#x, %p);\n", e->stride, offset); - GL_EXTCALL(glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, e->stride, offset)); - checkGLcall("glSecondaryColorPointerEXT(3, GL_UNSIGNED_BYTE, ...)"); - break; - - default: - FIXME("Add 4 component specular colour pointers for type %#x.\n", type); - /* Make sure that the right colour component is dropped. */ - TRACE("glSecondaryColorPointer(3, %#x, %#x, %p);\n", type, e->stride, offset); - GL_EXTCALL(glSecondaryColorPointerEXT(3, type, e->stride, offset)); - checkGLcall("glSecondaryColorPointerEXT(3, type, ...)"); - } - } - gl_info->gl_ops.gl.p_glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT); - checkGLcall("glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT)"); - if (bo) - wined3d_buffer_validate_user(state->streams[e->stream_idx].buffer); - } - else - { - WARN("Specular colour is not supported in this GL implementation.\n"); - } - } - else - { - if (gl_info->supported[EXT_SECONDARY_COLOR]) - { - GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0); - checkGLcall("glSecondaryColor3fEXT(0, 0, 0)"); - } - else - { - WARN("Specular colour is not supported in this GL implementation.\n"); - } - } - - /* Texture coordinates */ - wined3d_context_gl_load_tex_coords(context_gl, si, ¤t_bo, state); -} - static void wined3d_context_gl_unload_numbered_array(struct wined3d_context_gl *context_gl, unsigned int i) { const struct wined3d_gl_info *gl_info = context_gl->gl_info; @@ -5726,17 +5295,7 @@ void wined3d_context_gl_update_stream_sources(struct wined3d_context_gl *context return; wined3d_context_gl_unload_vertex_data(context_gl); - if (context_gl->c.d3d_info->ffp_generic_attributes || use_vs(state)) - { - TRACE("Loading numbered arrays.\n"); - wined3d_context_gl_load_numbered_arrays(context_gl, &context_gl->c.stream_info, state); - return; - } - - TRACE("Loading named arrays.\n"); - wined3d_context_gl_unload_numbered_arrays(context_gl); - wined3d_context_gl_load_vertex_data(context_gl, &context_gl->c.stream_info, state); - context_gl->c.namedArraysLoaded = TRUE; + wined3d_context_gl_load_numbered_arrays(context_gl, &context_gl->c.stream_info, state); } static void apply_texture_blit_state(const struct wined3d_gl_info *gl_info, struct gl_texture *texture, diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index f473a0e8c2c..a462f717bdf 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -3072,20 +3072,11 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)) { - const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info; struct wined3d_device *device = context->device; struct wined3d_bo_address addr; struct wined3d_bo *bo; uint8_t *map_ptr; - /* We can't use persistent maps if we might need to do vertex attribute - * conversion; that will cause the CS thread to invalidate the BO. */ - if (!d3d_info->vertex_bgra || !d3d_info->ffp_generic_attributes) - { - TRACE("Not returning a persistent buffer because we might need to do vertex attribute conversion.\n"); - return false; - } - if (resource->pin_sysmem) { TRACE("Not allocating an upload buffer because system memory is pinned for this resource.\n"); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7b46c648db7..c114734e013 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -11683,7 +11683,6 @@ static void glsl_vertex_pipe_vp_get_caps(const struct wined3d_adapter *adapter, const struct wined3d_gl_info *gl_info = &wined3d_adapter_gl_const(adapter)->gl_info; caps->emulated_flatshading = !needs_legacy_glsl_syntax(gl_info); - caps->ffp_generic_attributes = TRUE; caps->max_active_lights = WINED3D_MAX_ACTIVE_LIGHTS; caps->max_vertex_blend_matrices = MAX_VERTEX_BLENDS; caps->max_vertex_blend_matrix_index = 0; diff --git a/dlls/wined3d/shader_spirv.c b/dlls/wined3d/shader_spirv.c index b5cba701103..1079c19b99b 100644 --- a/dlls/wined3d/shader_spirv.c +++ b/dlls/wined3d/shader_spirv.c @@ -1134,7 +1134,6 @@ static void spirv_vertex_pipe_vk_vp_disable(const struct wined3d_context *contex static void spirv_vertex_pipe_vk_vp_get_caps(const struct wined3d_adapter *adapter, struct wined3d_vertex_caps *caps) { memset(caps, 0, sizeof(*caps)); - caps->ffp_generic_attributes = TRUE; } static unsigned int spirv_vertex_pipe_vk_vp_get_emul_mask(const struct wined3d_adapter *adapter) diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index 52d3b01b8cd..9a27bb5b2bf 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -762,8 +762,6 @@ GLenum wined3d_context_gl_get_offscreen_gl_buffer(const struct wined3d_context_g const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl *context_gl, const struct wined3d_shader_version *shader_version, unsigned int *base, unsigned int *count); HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wined3d_swapchain_gl *swapchain_gl); -void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl, - const struct wined3d_stream_info *si, GLuint *current_bo, const struct wined3d_state *state); void *wined3d_context_gl_map_bo_address(struct wined3d_context_gl *context_gl, const struct wined3d_bo_address *data, size_t size, uint32_t flags); struct wined3d_context_gl *wined3d_context_gl_reacquire(struct wined3d_context_gl *context_gl); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0167000343e..4df086464c8 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -221,7 +221,6 @@ struct wined3d_d3d_info struct wined3d_d3d_limits limits; uint32_t wined3d_creation_flags; uint32_t emulated_flatshading : 1; - uint32_t ffp_generic_attributes : 1; uint32_t ffp_alpha_test : 1; uint32_t vs_clipping : 1; uint32_t shader_double_precision : 1; @@ -1999,7 +1998,6 @@ struct wined3d_fragment_pipe_ops struct wined3d_vertex_caps { BOOL emulated_flatshading; - BOOL ffp_generic_attributes; DWORD max_active_lights; DWORD max_vertex_blend_matrices; DWORD max_vertex_blend_matrix_index; @@ -3795,7 +3793,6 @@ static inline void wined3d_resource_wait_idle(const struct wined3d_resource *res enum wined3d_buffer_conversion_type { CONV_NONE, - CONV_D3DCOLOR, }; struct wined3d_buffer