[PATCH 1/5] wined3d: Pass stream info and needed fixups to buffer_find_decl.
Stefan Dösinger
stefan at codeweavers.com
Thu Sep 12 05:23:28 CDT 2013
---
dlls/wined3d/buffer.c | 63 ++++++++++++++++++++++++++++-----------------------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index f811a61..ecd47eb 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -269,9 +269,11 @@ static BOOL buffer_process_converted_attribute(struct wined3d_buffer *This,
return ret;
}
+#define WINED3D_BUFFER_FIXUP_D3DCOLOR 0x01
+#define WINED3D_BUFFER_FIXUP_XYZRHW 0x02
+
static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct wined3d_stream_info *si,
- UINT attrib_idx, const BOOL check_d3dcolor, const BOOL check_position, const BOOL is_ffp_color,
- DWORD *stride_this_run)
+ UINT attrib_idx, DWORD fixup_flags, DWORD *stride_this_run)
{
const struct wined3d_stream_info_element *attrib = &si->elements[attrib_idx];
enum wined3d_format_id format;
@@ -286,13 +288,11 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
format = attrib->format->id;
/* Look for newly appeared conversion */
- if (check_d3dcolor && format == WINED3DFMT_B8G8R8A8_UNORM)
+ if (fixup_flags & WINED3D_BUFFER_FIXUP_D3DCOLOR && format == WINED3DFMT_B8G8R8A8_UNORM)
{
ret = buffer_process_converted_attribute(This, CONV_D3DCOLOR, attrib, stride_this_run);
-
- if (!is_ffp_color) FIXME("Test for non-color fixed function WINED3DFMT_B8G8R8A8_UNORM format\n");
}
- else if (check_position && si->position_transformed)
+ else if (fixup_flags & WINED3D_BUFFER_FIXUP_XYZRHW && si->position_transformed)
{
if (format != WINED3DFMT_R32G32B32A32_FLOAT)
{
@@ -310,14 +310,9 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
return ret;
}
-static BOOL buffer_find_decl(struct wined3d_buffer *This)
+static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_stream_info *si,
+ DWORD fixup_flags)
{
- struct wined3d_device *device = This->resource.device;
- const struct wined3d_adapter *adapter = device->adapter;
- const struct wined3d_stream_info *si = &device->stream_info;
- const struct wined3d_state *state = &device->state;
- BOOL support_d3dcolor = adapter->gl_info.supported[ARB_VERTEX_ARRAY_BGRA];
- BOOL support_xyzrhw = adapter->d3d_info.xyzrhw;
UINT stride_this_run = 0;
BOOL ret = FALSE;
@@ -330,9 +325,9 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This)
if(This->resource.usage & WINED3DUSAGE_STATICDECL) return FALSE;
}
- if (use_vs(state))
+ if (!fixup_flags)
{
- TRACE("Vertex shaders used, no VBO conversion is needed\n");
+ TRACE("No fixup required.\n");
if(This->conversion_map)
{
HeapFree(GetProcessHeap(), 0, This->conversion_map);
@@ -391,29 +386,31 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This)
*/
ret = buffer_check_attribute(This, si, WINED3D_FFP_POSITION,
- TRUE, !support_xyzrhw, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
+ fixup_flags &= ~WINED3D_BUFFER_FIXUP_XYZRHW;
+
ret = buffer_check_attribute(This, si, WINED3D_FFP_NORMAL,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_DIFFUSE,
- !support_d3dcolor, FALSE, TRUE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_SPECULAR,
- !support_d3dcolor, FALSE, TRUE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD0,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD1,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD2,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD3,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD4,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD5,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD6,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_TEXCOORD7,
- TRUE, FALSE, FALSE, &stride_this_run) || ret;
+ fixup_flags, &stride_this_run) || ret;
if (!stride_this_run && This->conversion_map)
{
@@ -769,7 +766,17 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte
/* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */
if (device->isInDraw && buffer->resource.bind_count > 0)
{
- decl_changed = buffer_find_decl(buffer);
+ DWORD fixup_flags = 0;
+
+ if (!use_vs(&device->state))
+ {
+ if (!context->gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
+ fixup_flags |= WINED3D_BUFFER_FIXUP_D3DCOLOR;
+ if (!context->d3d_info->xyzrhw)
+ fixup_flags |= WINED3D_BUFFER_FIXUP_XYZRHW;
+ }
+
+ decl_changed = buffer_find_decl(buffer, &device->stream_info, fixup_flags);
buffer->flags |= WINED3D_BUFFER_HASDESC;
}
--
1.8.1.5
More information about the wine-patches
mailing list