ReactOS 0.4.17-dev-1037-g720d112
executebuffer.c File Reference
#include "ddraw_private.h"
Include dependency graph for executebuffer.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ddraw)
 
static void _dump_executedata (const D3DEXECUTEDATA *lpData)
 
static void _dump_D3DEXECUTEBUFFERDESC (const D3DEXECUTEBUFFERDESC *lpDesc)
 
HRESULT d3d_execute_buffer_execute (struct d3d_execute_buffer *buffer, struct d3d_device *device)
 
static struct d3d_execute_buffer * impl_from_IDirect3DExecuteBuffer (IDirect3DExecuteBuffer *iface)
 
static HRESULT WINAPI d3d_execute_buffer_QueryInterface (IDirect3DExecuteBuffer *iface, REFIID iid, void **out)
 
static ULONG WINAPI d3d_execute_buffer_AddRef (IDirect3DExecuteBuffer *iface)
 
static ULONG WINAPI d3d_execute_buffer_Release (IDirect3DExecuteBuffer *iface)
 
static HRESULT WINAPI d3d_execute_buffer_Initialize (IDirect3DExecuteBuffer *iface, IDirect3DDevice *device, D3DEXECUTEBUFFERDESC *desc)
 
static HRESULT WINAPI d3d_execute_buffer_Lock (IDirect3DExecuteBuffer *iface, D3DEXECUTEBUFFERDESC *desc)
 
static HRESULT WINAPI d3d_execute_buffer_Unlock (IDirect3DExecuteBuffer *iface)
 
static HRESULT WINAPI d3d_execute_buffer_SetExecuteData (IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
 
static HRESULT WINAPI d3d_execute_buffer_GetExecuteData (IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
 
static HRESULT WINAPI d3d_execute_buffer_Validate (IDirect3DExecuteBuffer *iface, DWORD *offset, LPD3DVALIDATECALLBACK callback, void *context, DWORD reserved)
 
static HRESULT WINAPI d3d_execute_buffer_Optimize (IDirect3DExecuteBuffer *iface, DWORD reserved)
 
HRESULT d3d_execute_buffer_init (struct d3d_execute_buffer *execute_buffer, struct d3d_device *device, D3DEXECUTEBUFFERDESC *desc)
 
struct d3d_execute_buffer * unsafe_impl_from_IDirect3DExecuteBuffer (IDirect3DExecuteBuffer *iface)
 

Variables

static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl
 

Function Documentation

◆ _dump_D3DEXECUTEBUFFERDESC()

static void _dump_D3DEXECUTEBUFFERDESC ( const D3DEXECUTEBUFFERDESC *  lpDesc)
static

Definition at line 40 of file executebuffer.c.

40 {
41 TRACE("dwSize : %lu\n", lpDesc->dwSize);
42 TRACE("dwFlags : %#lx\n", lpDesc->dwFlags);
43 TRACE("dwCaps : %#lx\n", lpDesc->dwCaps);
44 TRACE("dwBufferSize : %lu\n", lpDesc->dwBufferSize);
45 TRACE("lpData : %p\n", lpDesc->lpData);
46}
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by d3d_execute_buffer_Lock().

◆ _dump_executedata()

static void _dump_executedata ( const D3DEXECUTEDATA *  lpData)
static

Definition at line 33 of file executebuffer.c.

33 {
34 TRACE("dwSize : %lu\n", lpData->dwSize);
35 TRACE("Vertex Offset : %lu Count : %lu\n", lpData->dwVertexOffset, lpData->dwVertexCount);
36 TRACE("Instruction Offset : %lu Length : %lu\n", lpData->dwInstructionOffset, lpData->dwInstructionLength);
37 TRACE("HVertex Offset : %lu\n", lpData->dwHVertexOffset);
38}
DWORD dwInstructionOffset
Definition: d3dtypes.h:1263
DWORD dwVertexCount
Definition: d3dtypes.h:1262
DWORD dwVertexOffset
Definition: d3dtypes.h:1261
DWORD dwInstructionLength
Definition: d3dtypes.h:1264
DWORD dwHVertexOffset
Definition: d3dtypes.h:1265

Referenced by d3d_execute_buffer_GetExecuteData(), and d3d_execute_buffer_SetExecuteData().

◆ d3d_execute_buffer_AddRef()

static ULONG WINAPI d3d_execute_buffer_AddRef ( IDirect3DExecuteBuffer *  iface)
static

Definition at line 457 of file executebuffer.c.

458{
461
462 TRACE("%p increasing refcount to %lu.\n", buffer, ref);
463
464 return ref;
465}
#define InterlockedIncrement
Definition: armddk.h:53
static struct d3d_execute_buffer * impl_from_IDirect3DExecuteBuffer(IDirect3DExecuteBuffer *iface)
GLuint buffer
Definition: glext.h:5915
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ d3d_execute_buffer_execute()

HRESULT d3d_execute_buffer_execute ( struct d3d_execute_buffer *  buffer,
struct d3d_device *  device 
)

Definition at line 48 of file executebuffer.c.

49{
50 DWORD is = buffer->data.dwInstructionOffset;
51 char *instr = (char *)buffer->desc.lpData + is;
52 unsigned int i, primitive_size;
53 struct wined3d_map_desc map_desc;
54 struct wined3d_box box = {0};
55 HRESULT hr;
56
57 TRACE("ExecuteData :\n");
58 if (TRACE_ON(ddraw))
59 _dump_executedata(&(buffer->data));
60
61 for (;;)
62 {
64 BYTE size;
65 WORD count;
66
67 count = current->wCount;
68 size = current->bSize;
69 instr += sizeof(*current);
70 primitive_size = 0;
71
72 switch (current->bOpcode)
73 {
74 case D3DOP_POINT:
75 {
76 const D3DPOINT *p = (D3DPOINT *)instr;
79 buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
82
84 for (i = 0; i < count; ++i)
85 wined3d_device_context_draw(device->immediate_context, p[i].wFirst, p[i].wCount, 0, 0);
86
87 instr += sizeof(*p) * count;
88 break;
89 }
90
91 case D3DOP_LINE:
92 primitive_size = 2;
94 /* Drop through. */
95 case D3DOP_TRIANGLE:
96 {
98 unsigned int index_pos = buffer->index_pos, index_count;
99 TRACE("TRIANGLE (%d)\n", count);
100
101 if (!count)
102 break;
103
104 if (!primitive_size)
105 {
107 primitive_size = 3;
108 }
109
110 index_count = count * primitive_size;
111 if (buffer->index_size < index_count)
112 {
113 unsigned int new_size = max(buffer->index_size * 2, index_count);
114 struct wined3d_buffer *new_buffer;
116
117 desc.byte_width = new_size * sizeof(*indices);
119 desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
121 desc.misc_flags = 0;
122 desc.structure_byte_stride = 0;
123
124 if (FAILED(hr = wined3d_buffer_create(device->wined3d_device, &desc,
125 NULL, NULL, &ddraw_null_wined3d_parent_ops, &new_buffer)))
126 return hr;
127
128 buffer->index_size = new_size;
129 if (buffer->index_buffer)
130 wined3d_buffer_decref(buffer->index_buffer);
131 buffer->index_buffer = new_buffer;
132 index_pos = 0;
133 }
134 else if (buffer->index_size - index_count < index_pos)
135 {
136 index_pos = 0;
137 }
138
139 box.left = index_pos * sizeof(*indices);
140 box.right = (index_pos + index_count) * sizeof(*indices);
141 if (FAILED(hr = wined3d_resource_map(wined3d_buffer_get_resource(buffer->index_buffer), 0, &map_desc,
143 return hr;
144 indices = map_desc.data;
145
146 for (i = 0; i < count; ++i)
147 {
148 D3DTRIANGLE *ci = (D3DTRIANGLE *)instr;
149 TRACE(" v1: %d v2: %d v3: %d\n",ci->v1, ci->v2, ci->v3);
150 TRACE(" Flags : ");
151 if (TRACE_ON(ddraw))
152 {
153 /* Wireframe */
155 TRACE("EDGEENABLE1 ");
157 TRACE("EDGEENABLE2 ");
159 TRACE("EDGEENABLE3 ");
160 /* Strips / Fans */
161 if (ci->wFlags == D3DTRIFLAG_EVEN)
162 TRACE("EVEN ");
163 if (ci->wFlags == D3DTRIFLAG_ODD)
164 TRACE("ODD ");
165 if (ci->wFlags == D3DTRIFLAG_START)
166 TRACE("START ");
167 if ((ci->wFlags > 0) && (ci->wFlags < 30))
168 TRACE("STARTFLAT(%u) ", ci->wFlags);
169 TRACE("\n");
170 }
171
172 switch (primitive_size)
173 {
174 case 3:
175 indices[(i * primitive_size) + 2] = ci->v3;
176 /* Drop through. */
177 case 2:
178 indices[(i * primitive_size) + 1] = ci->v2;
179 indices[(i * primitive_size) ] = ci->v1;
180 }
181 instr += size;
182 }
183
185
187 buffer->dst_vertex_buffer, 0, sizeof(D3DTLVERTEX));
192 wined3d_device_context_draw_indexed(device->immediate_context, 0, index_pos, index_count, 0, 0);
193
194 buffer->index_pos = index_pos + index_count;
195 break;
196 }
197
198 case D3DOP_MATRIXLOAD:
199 WARN("MATRIXLOAD-s (%u)\n", count);
200 instr += count * size;
201 break;
202
204 TRACE("MATRIXMULTIPLY (%d)\n", count);
205 for (i = 0; i < count; ++i)
206 {
208 struct wined3d_matrix *a, *b, *c;
209
213
214 if (!a || !b || !c)
215 {
216 ERR("Invalid matrix handle (a %#lx -> %p, b %#lx -> %p, c %#lx -> %p).\n",
217 ci->hDestMatrix, a, ci->hSrcMatrix1, b, ci->hSrcMatrix2, c);
218 }
219 else
220 {
221 TRACE("dst %p, src1 %p, src2 %p.\n", a, b, c);
222 multiply_matrix(a, c, b);
223 }
224
225 instr += size;
226 }
227 break;
228
230 TRACE("STATETRANSFORM (%d)\n", count);
231 for (i = 0; i < count; ++i)
232 {
233 D3DSTATE *ci = (D3DSTATE *)instr;
234 D3DMATRIX *m;
235
237 if (!m)
238 {
239 ERR("Invalid matrix handle %#lx.\n", ci->dwArg[0]);
240 }
241 else
242 {
244 device->world = ci->dwArg[0];
246 device->view = ci->dwArg[0];
248 device->proj = ci->dwArg[0];
249 IDirect3DDevice3_SetTransform(&device->IDirect3DDevice3_iface,
251 }
252
253 instr += size;
254 }
255 break;
256
257 case D3DOP_STATELIGHT:
258 TRACE("STATELIGHT (%d)\n", count);
259 for (i = 0; i < count; ++i)
260 {
261 D3DSTATE *ci = (D3DSTATE *)instr;
262
263 if (FAILED(IDirect3DDevice3_SetLightState(&device->IDirect3DDevice3_iface,
264 ci->dlstLightStateType, ci->dwArg[0])))
265 WARN("Failed to set light state.\n");
266
267 instr += size;
268 }
269 break;
270
272 TRACE("STATERENDER (%d)\n", count);
273 for (i = 0; i < count; ++i)
274 {
275 D3DSTATE *ci = (D3DSTATE *)instr;
276
277 if (FAILED(IDirect3DDevice3_SetRenderState(&device->IDirect3DDevice3_iface,
278 ci->drstRenderStateType, ci->dwArg[0])))
279 WARN("Failed to set render state.\n");
280
281 instr += size;
282 }
283 break;
284
286 TRACE("PROCESSVERTICES (%d)\n", count);
287
288 for (i = 0; i < count; ++i)
289 {
292
293 TRACE(" start %u, dest %u, count %lu, flags %#lx.\n",
294 ci->wStart, ci->wDest, ci->dwCount, ci->dwFlags);
295
297 FIXME("D3DPROCESSVERTICES_UPDATEEXTENTS not implemented.\n");
299 FIXME("D3DPROCESSVERTICES_NOCOLOR not implemented.\n");
300
301 switch (op)
302 {
306 buffer->src_vertex_buffer, buffer->src_vertex_pos * sizeof(D3DVERTEX), sizeof(D3DVERTEX));
313 wined3d_device_process_vertices(device->wined3d_device, device->state, ci->wStart,
314 ci->wDest, ci->dwCount, buffer->dst_vertex_buffer, NULL, 0, D3DFVF_TLVERTEX);
315 break;
316
318 box.left = (buffer->src_vertex_pos + ci->wStart) * sizeof(D3DTLVERTEX);
319 box.right = box.left + ci->dwCount * sizeof(D3DTLVERTEX);
320 box.top = box.front = 0;
321 box.bottom = box.back = 1;
323 wined3d_buffer_get_resource(buffer->dst_vertex_buffer), 0,
324 ci->wDest * sizeof(D3DTLVERTEX), 0, 0,
325 wined3d_buffer_get_resource(buffer->src_vertex_buffer), 0, &box, 0);
326 break;
327
328 default:
329 FIXME("Unhandled vertex processing op %#lx.\n", op);
330 break;
331 }
332
333 instr += size;
334 }
335 break;
336
338 TRACE("TEXTURELOAD (%u)\n", count);
339
340 for (i = 0; i < count; ++i)
341 {
342 D3DTEXTURELOAD *ci = (D3DTEXTURELOAD *)instr;
343 struct ddraw_surface *dst, *src;
344
345 instr += size;
346
348 {
349 WARN("Invalid destination texture handle %#lx.\n", ci->hDestTexture);
350 continue;
351 }
353 {
354 WARN("Invalid source texture handle %#lx.\n", ci->hSrcTexture);
355 continue;
356 }
357
358 IDirect3DTexture2_Load(&dst->IDirect3DTexture2_iface, &src->IDirect3DTexture2_iface);
359 }
360 break;
361
362 case D3DOP_EXIT:
363 TRACE("EXIT (%u)\n", count);
364 instr += size;
365 goto end_of_buffer;
366
368 TRACE("BRANCHFORWARD (%d)\n", count);
369 for (i = 0; i < count; ++i)
370 {
371 D3DBRANCH *ci = (D3DBRANCH *)instr;
372
373 if ((buffer->data.dsStatus.dwStatus & ci->dwMask) == ci->dwValue)
374 {
375 if (!ci->bNegate)
376 {
377 TRACE(" Branch to %ld\n", ci->dwOffset);
378 if (ci->dwOffset) {
379 instr = (char*)current + ci->dwOffset;
380 break;
381 }
382 }
383 }
384 else
385 {
386 if (ci->bNegate)
387 {
388 TRACE(" Branch to %ld\n", ci->dwOffset);
389 if (ci->dwOffset) {
390 instr = (char*)current + ci->dwOffset;
391 break;
392 }
393 }
394 }
395
396 instr += size;
397 }
398 break;
399
400 case D3DOP_SPAN:
401 WARN("SPAN-s (%u)\n", count);
402 instr += count * size;
403 break;
404
405 case D3DOP_SETSTATUS:
406 TRACE("SETSTATUS (%d)\n", count);
407 for (i = 0; i < count; ++i)
408 {
409 buffer->data.dsStatus = *(D3DSTATUS *)instr;
410 instr += size;
411 }
412 break;
413
414 default:
415 ERR("Unhandled OpCode %#x.\n",current->bOpcode);
416 instr += count * size;
417 break;
418 }
419 }
420
421end_of_buffer:
422 return D3D_OK;
423}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define IDirect3DDevice3_SetRenderState(p, a, b)
Definition: d3d.h:1213
#define IDirect3DDevice3_SetLightState(p, a, b)
Definition: d3d.h:1215
#define IDirect3DTexture2_Load(p, a)
Definition: d3d.h:632
#define D3D_OK
Definition: d3d.h:106
#define IDirect3DDevice3_SetTransform(p, a, b)
Definition: d3d.h:1216
@ D3DOP_STATELIGHT
Definition: d3dtypes.h:650
@ D3DOP_TEXTURELOAD
Definition: d3dtypes.h:653
@ D3DOP_MATRIXMULTIPLY
Definition: d3dtypes.h:648
@ D3DOP_PROCESSVERTICES
Definition: d3dtypes.h:652
@ D3DOP_MATRIXLOAD
Definition: d3dtypes.h:647
@ D3DOP_STATETRANSFORM
Definition: d3dtypes.h:649
@ D3DOP_TRIANGLE
Definition: d3dtypes.h:646
@ D3DOP_SPAN
Definition: d3dtypes.h:656
@ D3DOP_LINE
Definition: d3dtypes.h:645
@ D3DOP_STATERENDER
Definition: d3dtypes.h:651
@ D3DOP_SETSTATUS
Definition: d3dtypes.h:657
@ D3DOP_POINT
Definition: d3dtypes.h:644
@ D3DOP_EXIT
Definition: d3dtypes.h:654
@ D3DOP_BRANCHFORWARD
Definition: d3dtypes.h:655
#define D3DTRIFLAG_ODD
Definition: d3dtypes.h:1172
#define D3DTRIFLAG_START
Definition: d3dtypes.h:1170
#define D3DTRIFLAG_EDGEENABLE1
Definition: d3dtypes.h:1175
#define D3DFVF_VERTEX
Definition: d3dtypes.h:1328
#define D3DPROCESSVERTICES_COPY
Definition: d3dtypes.h:1056
#define D3DTRIFLAG_EVEN
Definition: d3dtypes.h:1173
#define D3DPROCESSVERTICES_OPMASK
Definition: d3dtypes.h:1057
#define D3DPROCESSVERTICES_NOCOLOR
Definition: d3dtypes.h:1060
#define D3DFVF_LVERTEX
Definition: d3dtypes.h:1329
#define D3DFVF_TLVERTEX
Definition: d3dtypes.h:1331
struct _D3DTLVERTEX D3DTLVERTEX
#define D3DPROCESSVERTICES_UPDATEEXTENTS
Definition: d3dtypes.h:1059
#define D3DPROCESSVERTICES_TRANSFORMLIGHT
Definition: d3dtypes.h:1054
#define D3DPROCESSVERTICES_TRANSFORM
Definition: d3dtypes.h:1055
#define D3DTRIFLAG_EDGEENABLE2
Definition: d3dtypes.h:1176
void d3d_device_apply_state(struct d3d_device *device, BOOL clear_state)
Definition: device.c:3454
void multiply_matrix(struct wined3d_matrix *dst, const struct wined3d_matrix *src1, const struct wined3d_matrix *src2)
Definition: utils.c:1153
void * ddraw_get_object(struct ddraw_handle_table *t, DWORD handle, enum ddraw_handle_type type)
Definition: main.c:213
void d3d_device_sync_surfaces(struct d3d_device *device)
Definition: device.c:3427
@ DDRAW_HANDLE_SURFACE
@ DDRAW_HANDLE_MATRIX
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
UINT op
Definition: effect.c:235
struct wined3d_vertex_declaration * ddraw_find_decl(struct ddraw *This, DWORD fvf)
Definition: ddraw.c:4917
const struct wined3d_parent_ops ddraw_null_wined3d_parent_ops
Definition: ddraw.c:82
HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer)
Definition: buffer.c:1329
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer)
Definition: buffer.c:459
struct wined3d_resource *CDECL wined3d_buffer_get_resource(struct wined3d_buffer *buffer)
Definition: buffer.c:520
void CDECL wined3d_device_context_draw(struct wined3d_device_context *context, unsigned int start_vertex, unsigned int vertex_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2635
void CDECL wined3d_device_context_set_primitive_type(struct wined3d_device_context *context, enum wined3d_primitive_type primitive_type, unsigned int patch_vertex_count)
Definition: device.c:3779
HRESULT CDECL wined3d_device_context_copy_sub_resource_region(struct wined3d_device_context *context, struct wined3d_resource *dst_resource, unsigned int dst_sub_resource_idx, unsigned int dst_x, unsigned int dst_y, unsigned int dst_z, struct wined3d_resource *src_resource, unsigned int src_sub_resource_idx, const struct wined3d_box *src_box, unsigned int flags)
Definition: device.c:4220
void CDECL wined3d_device_context_draw_indexed(struct wined3d_device_context *context, int base_vertex_index, unsigned int start_index, unsigned int index_count, unsigned int start_instance, unsigned int instance_count)
Definition: device.c:2649
HRESULT CDECL wined3d_device_process_vertices(struct wined3d_device *device, struct wined3d_stateblock *stateblock, UINT src_start_idx, UINT dst_idx, UINT vertex_count, struct wined3d_buffer *dst_buffer, const struct wined3d_vertex_declaration *declaration, uint32_t flags, uint32_t dst_fvf)
Definition: device.c:3598
HRESULT CDECL wined3d_resource_unmap(struct wined3d_resource *resource, unsigned int sub_resource_idx)
Definition: resource.c:304
HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags)
Definition: resource.c:295
#define TRACE_ON(x)
Definition: compat.h:75
#define D3DTRANSFORMSTATE_WORLD
Definition: dx7todx8.h:22
#define D3DTRANSFORMSTATE_VIEW
Definition: dx7todx8.h:21
#define D3DTRANSFORMSTATE_PROJECTION
Definition: dx7todx8.h:12
static void _dump_executedata(const D3DEXECUTEDATA *lpData)
Definition: executebuffer.c:33
size_t const new_size
Definition: expand.cpp:66
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum const GLvoid * indices
Definition: gl.h:1545
GLenum src
Definition: glext.h:6340
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLenum dst
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FAILED(hr)
Definition: intsafe.h:51
#define a
Definition: ke_i.h:78
#define c
Definition: ke_i.h:80
#define b
Definition: ke_i.h:79
struct task_struct * current
Definition: linux.c:32
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
BOOL bNegate
Definition: d3dtypes.h:1221
DWORD dwOffset
Definition: d3dtypes.h:1222
DWORD dwValue
Definition: d3dtypes.h:1220
DWORD dwMask
Definition: d3dtypes.h:1219
D3DMATRIXHANDLE hDestMatrix
Definition: d3dtypes.h:1041
D3DMATRIXHANDLE hSrcMatrix1
Definition: d3dtypes.h:1042
D3DMATRIXHANDLE hSrcMatrix2
Definition: d3dtypes.h:1043
DWORD dwArg[1]
Definition: d3dtypes.h:1030
D3DLIGHTSTATETYPE dlstLightStateType
Definition: d3dtypes.h:1026
D3DTRANSFORMSTATETYPE dtstTransformStateType
Definition: d3dtypes.h:1025
D3DRENDERSTATETYPE drstRenderStateType
Definition: d3dtypes.h:1027
D3DTEXTUREHANDLE hSrcTexture
Definition: d3dtypes.h:670
D3DTEXTUREHANDLE hDestTexture
Definition: d3dtypes.h:669
Definition: palette.c:466
Definition: devices.h:37
#define max(a, b)
Definition: svc.c:63
void CDECL wined3d_stateblock_set_vertex_declaration(struct wined3d_stateblock *stateblock, struct wined3d_vertex_declaration *declaration)
Definition: stateblock.c:1571
void CDECL wined3d_stateblock_set_index_buffer(struct wined3d_stateblock *stateblock, struct wined3d_buffer *buffer, enum wined3d_format_id format_id)
Definition: stateblock.c:1918
void CDECL wined3d_stateblock_set_render_state(struct wined3d_stateblock *stateblock, enum wined3d_render_state state, unsigned int value)
Definition: stateblock.c:1623
HRESULT CDECL wined3d_stateblock_set_stream_source(struct wined3d_stateblock *stateblock, UINT stream_idx, struct wined3d_buffer *buffer, UINT offset, UINT stride)
Definition: stateblock.c:1939
@ WINED3D_RS_LIGHTING
Definition: wined3d.h:347
@ WINED3D_PT_LINELIST
Definition: wined3d.h:77
@ WINED3D_PT_POINTLIST
Definition: wined3d.h:76
@ WINED3D_PT_TRIANGLELIST
Definition: wined3d.h:79
#define WINED3D_RESOURCE_ACCESS_GPU
Definition: wined3d.h:51
@ WINED3DFMT_R16_UINT
Definition: wined3d.h:214
#define WINED3D_MAP_DISCARD
Definition: wined3d.h:953
#define WINED3D_MAP_WRITE
Definition: wined3d.h:956
#define WINED3D_MAP_NOOVERWRITE
Definition: wined3d.h:952
#define WINED3DUSAGE_DYNAMIC
Definition: wined3d.h:924
#define WINED3DUSAGE_STATICDECL
Definition: wined3d.h:936
#define WINED3D_BIND_INDEX_BUFFER
Definition: wined3d.h:910
#define WINED3D_RESOURCE_ACCESS_MAP_W
Definition: wined3d.h:54
unsigned char BYTE
Definition: xxhash.c:193

Referenced by d3d_device1_Execute().

◆ d3d_execute_buffer_GetExecuteData()

static HRESULT WINAPI d3d_execute_buffer_GetExecuteData ( IDirect3DExecuteBuffer *  iface,
D3DEXECUTEDATA *  data 
)
static

Definition at line 678 of file executebuffer.c.

679{
681
682 TRACE("iface %p, data %p.\n", iface, data);
683
684 /* Tests show that dwSize is ignored. */
685 memcpy(data, &buffer->data, sizeof(*data));
686
687 if (TRACE_ON(ddraw))
688 {
689 TRACE("Returning data :\n");
691 }
692
693 return DD_OK;
694}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define DD_OK
Definition: ddraw.h:188

◆ d3d_execute_buffer_init()

HRESULT d3d_execute_buffer_init ( struct d3d_execute_buffer *  execute_buffer,
struct d3d_device *  device,
D3DEXECUTEBUFFERDESC *  desc 
)

Definition at line 756 of file executebuffer.c.

758{
760 execute_buffer->ref = 1;
761 execute_buffer->d3ddev = device;
762
763 /* Initializes memory */
764 memcpy(&execute_buffer->desc, desc, desc->dwSize);
765
766 /* No buffer given */
767 if (!(execute_buffer->desc.dwFlags & D3DDEB_LPDATA))
768 execute_buffer->desc.lpData = NULL;
769
770 /* No buffer size given */
771 if (!(execute_buffer->desc.dwFlags & D3DDEB_BUFSIZE))
772 execute_buffer->desc.dwBufferSize = 0;
773
774 /* Create buffer if asked */
775 if (!execute_buffer->desc.lpData && execute_buffer->desc.dwBufferSize)
776 {
777 execute_buffer->need_free = TRUE;
778 if (!(execute_buffer->desc.lpData = calloc(1, execute_buffer->desc.dwBufferSize)))
779 {
780 ERR("Failed to allocate execute buffer data.\n");
781 return DDERR_OUTOFMEMORY;
782 }
783 }
784
785 execute_buffer->desc.dwFlags |= D3DDEB_LPDATA;
786
787 return D3D_OK;
788}
#define TRUE
Definition: types.h:120
#define D3DDEB_BUFSIZE
Definition: d3dcaps.h:142
#define D3DDEB_LPDATA
Definition: d3dcaps.h:144
static const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl
#define calloc
Definition: rosglue.h:14
#define DDERR_OUTOFMEMORY
Definition: ddraw.h:113
IDirect3DExecuteBuffer IDirect3DExecuteBuffer_iface
D3DEXECUTEBUFFERDESC desc
struct d3d_device * d3ddev

Referenced by d3d_device1_CreateExecuteBuffer().

◆ d3d_execute_buffer_Initialize()

static HRESULT WINAPI d3d_execute_buffer_Initialize ( IDirect3DExecuteBuffer *  iface,
IDirect3DDevice *  device,
D3DEXECUTEBUFFERDESC *  desc 
)
static

Definition at line 510 of file executebuffer.c.

512{
513 TRACE("iface %p, device %p, desc %p.\n", iface, device, desc);
514
515 return D3D_OK;
516}

◆ d3d_execute_buffer_Lock()

static HRESULT WINAPI d3d_execute_buffer_Lock ( IDirect3DExecuteBuffer *  iface,
D3DEXECUTEBUFFERDESC *  desc 
)
static

Definition at line 531 of file executebuffer.c.

532{
535
536 TRACE("iface %p, desc %p.\n", iface, desc);
537
538 dwSize = desc->dwSize;
539 memcpy(desc, &buffer->desc, dwSize);
540
541 if (TRACE_ON(ddraw))
542 {
543 TRACE(" Returning description :\n");
545 }
546 return D3D_OK;
547}
static void _dump_D3DEXECUTEBUFFERDESC(const D3DEXECUTEBUFFERDESC *lpDesc)
Definition: executebuffer.c:40
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56

◆ d3d_execute_buffer_Optimize()

static HRESULT WINAPI d3d_execute_buffer_Optimize ( IDirect3DExecuteBuffer *  iface,
DWORD  reserved 
)
static

Definition at line 733 of file executebuffer.c.

734{
735 TRACE("iface %p, reserved %#lx.\n", iface, reserved);
736
737 WARN("Not implemented.\n");
738
739 return DDERR_UNSUPPORTED; /* Unchecked */
740}
r reserved
Definition: btrfs.c:3006
#define DDERR_UNSUPPORTED
Definition: ddraw.h:129

◆ d3d_execute_buffer_QueryInterface()

static HRESULT WINAPI d3d_execute_buffer_QueryInterface ( IDirect3DExecuteBuffer *  iface,
REFIID  iid,
void **  out 
)
static

Definition at line 430 of file executebuffer.c.

431{
432 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
433
434 if (IsEqualGUID(&IID_IDirect3DExecuteBuffer, iid)
435 || IsEqualGUID(&IID_IUnknown, iid))
436 {
438 *out = iface;
439 return S_OK;
440 }
441
442 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
443
444 *out = NULL;
445 return E_NOINTERFACE;
446}
const GUID IID_IUnknown
#define IDirect3DExecuteBuffer_AddRef(p)
Definition: d3d.h:903
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ d3d_execute_buffer_Release()

static ULONG WINAPI d3d_execute_buffer_Release ( IDirect3DExecuteBuffer *  iface)
static

Definition at line 476 of file executebuffer.c.

477{
480
481 TRACE("%p decreasing refcount to %lu.\n", buffer, ref);
482
483 if (!ref)
484 {
485 if (buffer->need_free)
486 free(buffer->desc.lpData);
487 if (buffer->index_buffer)
488 wined3d_buffer_decref(buffer->index_buffer);
489 if (buffer->dst_vertex_buffer)
490 {
491 wined3d_buffer_decref(buffer->src_vertex_buffer);
492 wined3d_buffer_decref(buffer->dst_vertex_buffer);
493 }
494 free(buffer);
495 }
496
497 return ref;
498}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5

◆ d3d_execute_buffer_SetExecuteData()

static HRESULT WINAPI d3d_execute_buffer_SetExecuteData ( IDirect3DExecuteBuffer *  iface,
D3DEXECUTEDATA *  data 
)
static

Definition at line 579 of file executebuffer.c.

580{
582 struct wined3d_map_desc map_desc;
583 struct wined3d_box box = {0};
584 HRESULT hr;
585 DWORD buf_size = buffer->desc.dwBufferSize, copy_size;
586
587 TRACE("iface %p, data %p.\n", iface, data);
588
589 if (data->dwSize != sizeof(*data))
590 {
591 WARN("data->dwSize is %lu, returning DDERR_INVALIDPARAMS.\n", data->dwSize);
592 return DDERR_INVALIDPARAMS;
593 }
594
595 /* Skip past previous vertex data. */
596 buffer->src_vertex_pos += buffer->data.dwVertexCount;
597
598 if (buffer->vertex_size < data->dwVertexCount)
599 {
600 unsigned int new_size = max(data->dwVertexCount, buffer->vertex_size * 2);
601 struct wined3d_buffer *src_buffer, *dst_buffer;
603
604 desc.byte_width = new_size * sizeof(D3DVERTEX);
605 desc.usage = 0;
606 desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
608 desc.misc_flags = 0;
609 desc.structure_byte_stride = 0;
610
611 if (FAILED(hr = wined3d_buffer_create(buffer->d3ddev->wined3d_device, &desc,
612 NULL, NULL, &ddraw_null_wined3d_parent_ops, &src_buffer)))
613 return hr;
614
615 desc.byte_width = new_size * sizeof(D3DTLVERTEX);
618
619 if (FAILED(hr = wined3d_buffer_create(buffer->d3ddev->wined3d_device, &desc,
620 NULL, NULL, &ddraw_null_wined3d_parent_ops, &dst_buffer)))
621 {
622 wined3d_buffer_decref(src_buffer);
623 return hr;
624 }
625
626 if (buffer->dst_vertex_buffer)
627 {
628 wined3d_buffer_decref(buffer->src_vertex_buffer);
629 wined3d_buffer_decref(buffer->dst_vertex_buffer);
630 }
631 buffer->src_vertex_buffer = src_buffer;
632 buffer->dst_vertex_buffer = dst_buffer;
633 buffer->vertex_size = new_size;
634 buffer->src_vertex_pos = 0;
635 }
636 else if (buffer->vertex_size - data->dwVertexCount < buffer->src_vertex_pos)
637 {
638 buffer->src_vertex_pos = 0;
639 }
640
641 if (data->dwVertexCount && (!buf_size || data->dwVertexOffset < buf_size))
642 {
643 box.left = buffer->src_vertex_pos * sizeof(D3DVERTEX);
644 box.right = box.left + data->dwVertexCount * sizeof(D3DVERTEX);
646 0, &map_desc, &box, WINED3D_MAP_WRITE)))
647 return hr;
648
649 copy_size = data->dwVertexCount * sizeof(D3DVERTEX);
650 if (buf_size)
651 copy_size = min(copy_size, buf_size - data->dwVertexOffset);
652
653 memcpy(map_desc.data, ((BYTE *)buffer->desc.lpData) + data->dwVertexOffset, copy_size);
654
656 }
657
658 memcpy(&buffer->data, data, data->dwSize);
659
660 if (TRACE_ON(ddraw))
662
663 return D3D_OK;
664}
struct _D3DVERTEX D3DVERTEX
#define min(a, b)
Definition: monoChain.cc:55
#define DDERR_INVALIDPARAMS
Definition: ddraw.h:81
#define WINED3D_BIND_VERTEX_BUFFER
Definition: wined3d.h:909
#define WINED3D_RESOURCE_ACCESS_CPU
Definition: wined3d.h:52
#define WINED3D_RESOURCE_ACCESS_MAP_R
Definition: wined3d.h:53

◆ d3d_execute_buffer_Unlock()

static HRESULT WINAPI d3d_execute_buffer_Unlock ( IDirect3DExecuteBuffer *  iface)
static

Definition at line 558 of file executebuffer.c.

559{
560 TRACE("iface %p.\n", iface);
561
562 return D3D_OK;
563}

◆ d3d_execute_buffer_Validate()

static HRESULT WINAPI d3d_execute_buffer_Validate ( IDirect3DExecuteBuffer *  iface,
DWORD *  offset,
LPD3DVALIDATECALLBACK  callback,
void *  context,
DWORD  reserved 
)
static

Definition at line 709 of file executebuffer.c.

711{
712 TRACE("iface %p, offset %p, callback %p, context %p, reserved %#lx.\n",
713 iface, offset, callback, context, reserved);
714
715 WARN("Not implemented.\n");
716
717 return DDERR_UNSUPPORTED; /* Unchecked */
718}
GLintptr offset
Definition: glext.h:5920
static IPrintDialogCallback callback
Definition: printdlg.c:325
Definition: http.c:7252

◆ impl_from_IDirect3DExecuteBuffer()

static struct d3d_execute_buffer * impl_from_IDirect3DExecuteBuffer ( IDirect3DExecuteBuffer *  iface)
inlinestatic

Definition at line 425 of file executebuffer.c.

426{
427 return CONTAINING_RECORD(iface, struct d3d_execute_buffer, IDirect3DExecuteBuffer_iface);
428}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by d3d_execute_buffer_AddRef(), d3d_execute_buffer_GetExecuteData(), d3d_execute_buffer_Lock(), d3d_execute_buffer_Release(), d3d_execute_buffer_SetExecuteData(), and unsafe_impl_from_IDirect3DExecuteBuffer().

◆ unsafe_impl_from_IDirect3DExecuteBuffer()

struct d3d_execute_buffer * unsafe_impl_from_IDirect3DExecuteBuffer ( IDirect3DExecuteBuffer *  iface)

Definition at line 790 of file executebuffer.c.

791{
792 if (!iface)
793 return NULL;
794 assert(iface->lpVtbl == &d3d_execute_buffer_vtbl);
795
797}
#define assert(_expr)
Definition: assert.h:32

Referenced by d3d_device1_Execute().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ddraw  )

Variable Documentation

◆ d3d_execute_buffer_vtbl

const struct IDirect3DExecuteBufferVtbl d3d_execute_buffer_vtbl
static
Initial value:
=
{
}
static ULONG WINAPI d3d_execute_buffer_Release(IDirect3DExecuteBuffer *iface)
static HRESULT WINAPI d3d_execute_buffer_QueryInterface(IDirect3DExecuteBuffer *iface, REFIID iid, void **out)
static HRESULT WINAPI d3d_execute_buffer_Lock(IDirect3DExecuteBuffer *iface, D3DEXECUTEBUFFERDESC *desc)
static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
static HRESULT WINAPI d3d_execute_buffer_Unlock(IDirect3DExecuteBuffer *iface)
static HRESULT WINAPI d3d_execute_buffer_Initialize(IDirect3DExecuteBuffer *iface, IDirect3DDevice *device, D3DEXECUTEBUFFERDESC *desc)
static HRESULT WINAPI d3d_execute_buffer_Validate(IDirect3DExecuteBuffer *iface, DWORD *offset, LPD3DVALIDATECALLBACK callback, void *context, DWORD reserved)
static HRESULT WINAPI d3d_execute_buffer_GetExecuteData(IDirect3DExecuteBuffer *iface, D3DEXECUTEDATA *data)
static HRESULT WINAPI d3d_execute_buffer_Optimize(IDirect3DExecuteBuffer *iface, DWORD reserved)
static ULONG WINAPI d3d_execute_buffer_AddRef(IDirect3DExecuteBuffer *iface)

Definition at line 742 of file executebuffer.c.

Referenced by d3d_execute_buffer_init(), and unsafe_impl_from_IDirect3DExecuteBuffer().