[PATCH 1/5] wined3d: Add support for appending vertex declaration elements.
Henri Verbeet
hverbeet at codeweavers.com
Fri Feb 13 03:40:48 CST 2015
---
dlls/d3d10core/inputlayout.c | 2 --
dlls/wined3d/vertexdeclaration.c | 13 +++++++++++++
dlls/wined3d/wined3d_private.h | 4 ++--
include/wine/wined3d.h | 6 ++++--
4 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d10core/inputlayout.c b/dlls/d3d10core/inputlayout.c
index e6ac25e..8350875 100644
--- a/dlls/d3d10core/inputlayout.c
+++ b/dlls/d3d10core/inputlayout.c
@@ -83,8 +83,6 @@ static HRESULT d3d10_input_layout_to_wined3d_declaration(const D3D10_INPUT_ELEME
e->usage = 0;
e->usage_idx = 0;
- if (f->AlignedByteOffset == D3D10_APPEND_ALIGNED_ELEMENT)
- FIXME("D3D10_APPEND_ALIGNED_ELEMENT not supported\n");
if (f->InputSlotClass != D3D10_INPUT_PER_VERTEX_DATA)
FIXME("Ignoring input slot class (%#x)\n", f->InputSlotClass);
if (f->InstanceDataStepRate)
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index cf5378c..df3d8ba 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -216,6 +216,19 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
return E_FAIL;
}
+ if (e->offset == WINED3D_APPEND_ALIGNED_ELEMENT)
+ {
+ if (!i)
+ {
+ e->offset = 0;
+ }
+ else
+ {
+ struct wined3d_vertex_declaration_element *prev = &declaration->elements[i - 1];
+ e->offset = (prev->offset + prev->format->byte_count + 3) & ~3;
+ }
+ }
+
if (e->offset & 0x3)
{
WARN("Declaration element %u is not 4 byte aligned(%u), returning E_FAIL.\n", i, e->offset);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2c1a00c..d924271 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2422,8 +2422,8 @@ struct wined3d_vertex_declaration_element
{
const struct wined3d_format *format;
BOOL ffp_valid;
- WORD input_slot;
- WORD offset;
+ unsigned int input_slot;
+ unsigned int offset;
UINT output_slot;
BYTE method;
BYTE usage;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 2d3336a..089db9e 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1494,6 +1494,8 @@ enum wined3d_display_rotation
#define WINED3D_SURFACE_DISCARD 0x00000002
#define WINED3D_SURFACE_PIN_SYSMEM 0x00000004
+#define WINED3D_APPEND_ALIGNED_ELEMENT 0xffffffff
+
struct wined3d_display_mode
{
UINT width;
@@ -1670,8 +1672,8 @@ struct wined3d_clip_status
struct wined3d_vertex_element
{
enum wined3d_format_id format;
- WORD input_slot;
- WORD offset;
+ unsigned int input_slot;
+ unsigned int offset;
UINT output_slot; /* D3D 8 & 10 */
BYTE method;
BYTE usage;
--
1.7.10.4
More information about the wine-patches
mailing list