Commit 149a85c2 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

d3d: Remove high level patch support.

No Windows driver ever exposed this, and no game uses this. The only application that used this feature is a DirectX 8 SDK sample.
parent d7e5189c
...@@ -2711,49 +2711,23 @@ static HRESULT WINAPI d3d8_device_GetPixelShaderFunction(IDirect3DDevice8 *iface ...@@ -2711,49 +2711,23 @@ static HRESULT WINAPI d3d8_device_GetPixelShaderFunction(IDirect3DDevice8 *iface
static HRESULT WINAPI d3d8_device_DrawRectPatch(IDirect3DDevice8 *iface, UINT handle, static HRESULT WINAPI d3d8_device_DrawRectPatch(IDirect3DDevice8 *iface, UINT handle,
const float *segment_count, const D3DRECTPATCH_INFO *patch_info) const float *segment_count, const D3DRECTPATCH_INFO *patch_info)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
HRESULT hr;
TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n",
iface, handle, segment_count, patch_info); iface, handle, segment_count, patch_info);
return D3D_OK;
wined3d_mutex_lock();
hr = wined3d_device_draw_rect_patch(device->wined3d_device, handle,
segment_count, (const struct wined3d_rect_patch_info *)patch_info);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d8_device_DrawTriPatch(IDirect3DDevice8 *iface, UINT handle, static HRESULT WINAPI d3d8_device_DrawTriPatch(IDirect3DDevice8 *iface, UINT handle,
const float *segment_count, const D3DTRIPATCH_INFO *patch_info) const float *segment_count, const D3DTRIPATCH_INFO *patch_info)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
HRESULT hr;
TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n",
iface, handle, segment_count, patch_info); iface, handle, segment_count, patch_info);
return D3D_OK;
wined3d_mutex_lock();
hr = wined3d_device_draw_tri_patch(device->wined3d_device, handle,
segment_count, (const struct wined3d_tri_patch_info *)patch_info);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d8_device_DeletePatch(IDirect3DDevice8 *iface, UINT handle) static HRESULT WINAPI d3d8_device_DeletePatch(IDirect3DDevice8 *iface, UINT handle)
{ {
struct d3d8_device *device = impl_from_IDirect3DDevice8(iface); FIXME("iface %p, handle %#x unimplemented.\n", iface, handle);
HRESULT hr; return D3DERR_INVALIDCALL;
TRACE("iface %p, handle %#x.\n", iface, handle);
wined3d_mutex_lock();
hr = wined3d_device_delete_patch(device->wined3d_device, handle);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface, static HRESULT WINAPI d3d8_device_SetStreamSource(IDirect3DDevice8 *iface,
......
...@@ -2867,49 +2867,23 @@ static HRESULT WINAPI d3d9_device_GetPixelShaderConstantB(IDirect3DDevice9Ex *if ...@@ -2867,49 +2867,23 @@ static HRESULT WINAPI d3d9_device_GetPixelShaderConstantB(IDirect3DDevice9Ex *if
static HRESULT WINAPI d3d9_device_DrawRectPatch(IDirect3DDevice9Ex *iface, UINT handle, static HRESULT WINAPI d3d9_device_DrawRectPatch(IDirect3DDevice9Ex *iface, UINT handle,
const float *segment_count, const D3DRECTPATCH_INFO *patch_info) const float *segment_count, const D3DRECTPATCH_INFO *patch_info)
{ {
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
HRESULT hr;
TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n",
iface, handle, segment_count, patch_info); iface, handle, segment_count, patch_info);
return D3D_OK;
wined3d_mutex_lock();
hr = wined3d_device_draw_rect_patch(device->wined3d_device, handle,
segment_count, (const struct wined3d_rect_patch_info *)patch_info);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d9_device_DrawTriPatch(IDirect3DDevice9Ex *iface, UINT handle, static HRESULT WINAPI d3d9_device_DrawTriPatch(IDirect3DDevice9Ex *iface, UINT handle,
const float *segment_count, const D3DTRIPATCH_INFO *patch_info) const float *segment_count, const D3DTRIPATCH_INFO *patch_info)
{ {
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); FIXME("iface %p, handle %#x, segment_count %p, patch_info %p unimplemented.\n",
HRESULT hr;
TRACE("iface %p, handle %#x, segment_count %p, patch_info %p.\n",
iface, handle, segment_count, patch_info); iface, handle, segment_count, patch_info);
return D3D_OK;
wined3d_mutex_lock();
hr = wined3d_device_draw_tri_patch(device->wined3d_device, handle,
segment_count, (const struct wined3d_tri_patch_info *)patch_info);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d9_device_DeletePatch(IDirect3DDevice9Ex *iface, UINT handle) static HRESULT WINAPI d3d9_device_DeletePatch(IDirect3DDevice9Ex *iface, UINT handle)
{ {
struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface); FIXME("iface %p, handle %#x unimplemented.\n", iface, handle);
HRESULT hr; return D3DERR_INVALIDCALL;
TRACE("iface %p, handle %#x.\n", iface, handle);
wined3d_mutex_lock();
hr = wined3d_device_delete_patch(device->wined3d_device, handle);
wined3d_mutex_unlock();
return hr;
} }
static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUERYTYPE type, IDirect3DQuery9 **query) static HRESULT WINAPI d3d9_device_CreateQuery(IDirect3DDevice9Ex *iface, D3DQUERYTYPE type, IDirect3DQuery9 **query)
......
...@@ -1390,19 +1390,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device) ...@@ -1390,19 +1390,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
resource->resource_ops->resource_unload(resource); resource->resource_ops->resource_unload(resource);
} }
TRACE("Deleting high order patches\n");
for (i = 0; i < PATCHMAP_SIZE; ++i)
{
struct wined3d_rect_patch *patch;
struct list *e1, *e2;
LIST_FOR_EACH_SAFE(e1, e2, &device->patches[i])
{
patch = LIST_ENTRY(e1, struct wined3d_rect_patch, entry);
wined3d_device_delete_patch(device, patch->Handle);
}
}
/* Delete the mouse cursor texture */ /* Delete the mouse cursor texture */
if (device->cursorTexture) if (device->cursorTexture)
{ {
...@@ -4489,140 +4476,6 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device, ...@@ -4489,140 +4476,6 @@ HRESULT CDECL wined3d_device_update_surface(struct wined3d_device *device,
return surface_upload_from_surface(dst_surface, dst_point, src_surface, src_rect); return surface_upload_from_surface(dst_surface, dst_point, src_surface, src_rect);
} }
HRESULT CDECL wined3d_device_draw_rect_patch(struct wined3d_device *device, UINT handle,
const float *num_segs, const struct wined3d_rect_patch_info *rect_patch_info)
{
struct wined3d_rect_patch *patch;
GLenum old_primitive_type;
unsigned int i;
struct list *e;
BOOL found;
TRACE("device %p, handle %#x, num_segs %p, rect_patch_info %p.\n",
device, handle, num_segs, rect_patch_info);
if (!(handle || rect_patch_info))
{
/* TODO: Write a test for the return value, thus the FIXME */
FIXME("Both handle and rect_patch_info are NULL.\n");
return WINED3DERR_INVALIDCALL;
}
if (handle)
{
i = PATCHMAP_HASHFUNC(handle);
found = FALSE;
LIST_FOR_EACH(e, &device->patches[i])
{
patch = LIST_ENTRY(e, struct wined3d_rect_patch, entry);
if (patch->Handle == handle)
{
found = TRUE;
break;
}
}
if (!found)
{
TRACE("Patch does not exist. Creating a new one\n");
patch = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*patch));
patch->Handle = handle;
list_add_head(&device->patches[i], &patch->entry);
} else {
TRACE("Found existing patch %p\n", patch);
}
}
else
{
/* Since opengl does not load tesselated vertex attributes into numbered vertex
* attributes we have to tesselate, read back, and draw. This needs a patch
* management structure instance. Create one.
*
* A possible improvement is to check if a vertex shader is used, and if not directly
* draw the patch.
*/
FIXME("Drawing an uncached patch. This is slow\n");
patch = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*patch));
}
if (num_segs[0] != patch->numSegs[0] || num_segs[1] != patch->numSegs[1]
|| num_segs[2] != patch->numSegs[2] || num_segs[3] != patch->numSegs[3]
|| (rect_patch_info && memcmp(rect_patch_info, &patch->rect_patch_info, sizeof(*rect_patch_info))))
{
HRESULT hr;
TRACE("Tesselation density or patch info changed, retesselating\n");
if (rect_patch_info)
patch->rect_patch_info = *rect_patch_info;
patch->numSegs[0] = num_segs[0];
patch->numSegs[1] = num_segs[1];
patch->numSegs[2] = num_segs[2];
patch->numSegs[3] = num_segs[3];
hr = tesselate_rectpatch(device, patch);
if (FAILED(hr))
{
WARN("Patch tesselation failed.\n");
/* Do not release the handle to store the params of the patch */
if (!handle)
HeapFree(GetProcessHeap(), 0, patch);
return hr;
}
}
old_primitive_type = device->stateBlock->state.gl_primitive_type;
device->stateBlock->state.gl_primitive_type = GL_TRIANGLES;
wined3d_device_draw_primitive_strided(device, patch->numSegs[0] * patch->numSegs[1] * 2 * 3, &patch->strided);
device->stateBlock->state.gl_primitive_type = old_primitive_type;
/* Destroy uncached patches */
if (!handle)
{
HeapFree(GetProcessHeap(), 0, patch->mem);
HeapFree(GetProcessHeap(), 0, patch);
}
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_draw_tri_patch(struct wined3d_device *device, UINT handle,
const float *segment_count, const struct wined3d_tri_patch_info *patch_info)
{
FIXME("device %p, handle %#x, segment_count %p, patch_info %p stub!\n",
device, handle, segment_count, patch_info);
return WINED3D_OK;
}
HRESULT CDECL wined3d_device_delete_patch(struct wined3d_device *device, UINT handle)
{
struct wined3d_rect_patch *patch;
struct list *e;
int i;
TRACE("device %p, handle %#x.\n", device, handle);
i = PATCHMAP_HASHFUNC(handle);
LIST_FOR_EACH(e, &device->patches[i])
{
patch = LIST_ENTRY(e, struct wined3d_rect_patch, entry);
if (patch->Handle == handle)
{
TRACE("Deleting patch %p\n", patch);
list_remove(&patch->entry);
HeapFree(GetProcessHeap(), 0, patch->mem);
HeapFree(GetProcessHeap(), 0, patch);
return WINED3D_OK;
}
}
/* TODO: Write a test for the return value */
FIXME("Attempt to destroy nonexistent patch\n");
return WINED3DERR_INVALIDCALL;
}
/* Do not call while under the GL lock. */ /* Do not call while under the GL lock. */
HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device, HRESULT CDECL wined3d_device_color_fill(struct wined3d_device *device,
struct wined3d_surface *surface, const RECT *rect, const struct wined3d_color *color) struct wined3d_surface *surface, const RECT *rect, const struct wined3d_color *color)
...@@ -5656,8 +5509,6 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d, ...@@ -5656,8 +5509,6 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
device->create_parms.focus_window = focus_window; device->create_parms.focus_window = focus_window;
device->create_parms.flags = flags; device->create_parms.flags = flags;
for (i = 0; i < PATCHMAP_SIZE; ++i) list_init(&device->patches[i]);
device->shader_backend = adapter->shader_backend; device->shader_backend = adapter->shader_backend;
device->shader_backend->shader_get_caps(&adapter->gl_info, &shader_caps); device->shader_backend->shader_get_caps(&adapter->gl_info, &shader_caps);
device->vs_version = shader_caps.vs_version; device->vs_version = shader_caps.vs_version;
......
...@@ -4491,8 +4491,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte ...@@ -4491,8 +4491,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
WINED3DDEVCAPS_TEXTURESYSTEMMEMORY | WINED3DDEVCAPS_TEXTURESYSTEMMEMORY |
WINED3DDEVCAPS_CANRENDERAFTERFLIP | WINED3DDEVCAPS_CANRENDERAFTERFLIP |
WINED3DDEVCAPS_DRAWPRIMITIVES2 | WINED3DDEVCAPS_DRAWPRIMITIVES2 |
WINED3DDEVCAPS_DRAWPRIMITIVES2EX | WINED3DDEVCAPS_DRAWPRIMITIVES2EX;
WINED3DDEVCAPS_RTPATCHES;
caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_CULLNONE | caps->PrimitiveMiscCaps = WINED3DPMISCCAPS_CULLNONE |
WINED3DPMISCCAPS_CULLCCW | WINED3DPMISCCAPS_CULLCCW |
......
...@@ -41,14 +41,11 @@ ...@@ -41,14 +41,11 @@
@ cdecl wined3d_device_color_fill(ptr ptr ptr ptr) @ cdecl wined3d_device_color_fill(ptr ptr ptr ptr)
@ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr) @ cdecl wined3d_device_create(ptr long long ptr long long ptr ptr)
@ cdecl wined3d_device_decref(ptr) @ cdecl wined3d_device_decref(ptr)
@ cdecl wined3d_device_delete_patch(ptr long)
@ cdecl wined3d_device_draw_indexed_primitive(ptr long long) @ cdecl wined3d_device_draw_indexed_primitive(ptr long long)
@ cdecl wined3d_device_draw_indexed_primitive_instanced(ptr long long long long) @ cdecl wined3d_device_draw_indexed_primitive_instanced(ptr long long long long)
@ cdecl wined3d_device_draw_indexed_primitive_strided(ptr long ptr long ptr long) @ cdecl wined3d_device_draw_indexed_primitive_strided(ptr long ptr long ptr long)
@ cdecl wined3d_device_draw_primitive(ptr long long) @ cdecl wined3d_device_draw_primitive(ptr long long)
@ cdecl wined3d_device_draw_primitive_strided(ptr long ptr) @ cdecl wined3d_device_draw_primitive_strided(ptr long ptr)
@ cdecl wined3d_device_draw_rect_patch(ptr long ptr ptr)
@ cdecl wined3d_device_draw_tri_patch(ptr long ptr ptr)
@ cdecl wined3d_device_end_scene(ptr) @ cdecl wined3d_device_end_scene(ptr)
@ cdecl wined3d_device_end_stateblock(ptr ptr) @ cdecl wined3d_device_end_stateblock(ptr ptr)
@ cdecl wined3d_device_evict_managed_resources(ptr) @ cdecl wined3d_device_evict_managed_resources(ptr)
......
...@@ -1581,22 +1581,6 @@ unsigned int adapter_adjust_memory(struct wined3d_adapter *adapter, int amount) ...@@ -1581,22 +1581,6 @@ unsigned int adapter_adjust_memory(struct wined3d_adapter *adapter, int amount)
BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; BOOL initPixelFormatsNoGL(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN; extern void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
/*****************************************************************************
* High order patch management
*/
struct wined3d_rect_patch
{
UINT Handle;
float *mem;
struct wined3d_strided_data strided;
struct wined3d_rect_patch_info rect_patch_info;
float numSegs[4];
char has_normals, has_texcoords;
struct list entry;
};
HRESULT tesselate_rectpatch(struct wined3d_device *device, struct wined3d_rect_patch *patch) DECLSPEC_HIDDEN;
enum projection_types enum projection_types
{ {
proj_none = 0, proj_none = 0,
...@@ -1781,11 +1765,6 @@ struct wined3d_device ...@@ -1781,11 +1765,6 @@ struct wined3d_device
/* Context management */ /* Context management */
struct wined3d_context **contexts; struct wined3d_context **contexts;
UINT context_count; UINT context_count;
/* High level patch management */
#define PATCHMAP_SIZE 43
#define PATCHMAP_HASHFUNC(x) ((x) % PATCHMAP_SIZE) /* Primitive and simple function */
struct list patches[PATCHMAP_SIZE];
}; };
void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb, void device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
......
...@@ -2081,7 +2081,6 @@ HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx, ...@@ -2081,7 +2081,6 @@ HRESULT __cdecl wined3d_device_create(struct wined3d *wined3d, UINT adapter_idx,
enum wined3d_device_type device_type, HWND focus_window, DWORD behaviour_flags, BYTE surface_alignment, enum wined3d_device_type device_type, HWND focus_window, DWORD behaviour_flags, BYTE surface_alignment,
struct wined3d_device_parent *device_parent, struct wined3d_device **device); struct wined3d_device_parent *device_parent, struct wined3d_device **device);
ULONG __cdecl wined3d_device_decref(struct wined3d_device *device); ULONG __cdecl wined3d_device_decref(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_delete_patch(struct wined3d_device *device, UINT handle);
HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count); HRESULT __cdecl wined3d_device_draw_indexed_primitive(struct wined3d_device *device, UINT start_idx, UINT index_count);
void __cdecl wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device, void __cdecl wined3d_device_draw_indexed_primitive_instanced(struct wined3d_device *device,
UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count); UINT start_idx, UINT index_count, UINT start_instance, UINT instance_count);
...@@ -2091,10 +2090,6 @@ HRESULT __cdecl wined3d_device_draw_indexed_primitive_strided(struct wined3d_dev ...@@ -2091,10 +2090,6 @@ HRESULT __cdecl wined3d_device_draw_indexed_primitive_strided(struct wined3d_dev
HRESULT __cdecl wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count); HRESULT __cdecl wined3d_device_draw_primitive(struct wined3d_device *device, UINT start_vertex, UINT vertex_count);
HRESULT __cdecl wined3d_device_draw_primitive_strided(struct wined3d_device *device, HRESULT __cdecl wined3d_device_draw_primitive_strided(struct wined3d_device *device,
UINT vertex_count, const struct wined3d_strided_data *strided_data); UINT vertex_count, const struct wined3d_strided_data *strided_data);
HRESULT __cdecl wined3d_device_draw_rect_patch(struct wined3d_device *device, UINT handle,
const float *num_segs, const struct wined3d_rect_patch_info *rect_patch_info);
HRESULT __cdecl wined3d_device_draw_tri_patch(struct wined3d_device *device, UINT handle,
const float *num_segs, const struct wined3d_tri_patch_info *tri_patch_info);
HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device); HRESULT __cdecl wined3d_device_end_scene(struct wined3d_device *device);
HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock); HRESULT __cdecl wined3d_device_end_stateblock(struct wined3d_device *device, struct wined3d_stateblock **stateblock);
void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device); void __cdecl wined3d_device_evict_managed_resources(struct wined3d_device *device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment