[D3DX9_24 => 43] Sync with Wine Staging 3.9. CORE-14656

This commit is contained in:
Amine Khaldi 2018-05-27 03:54:15 +01:00
parent 61ea4c528e
commit 561fd57166
8 changed files with 463 additions and 352 deletions

View file

@ -24,6 +24,8 @@
#define NONAMELESSUNION
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/rbtree.h"
#define COBJMACROS
#include "d3dx9.h"
@ -67,6 +69,14 @@ struct pixel_format_desc {
void (*to_rgba)(const struct vec4 *src, struct vec4 *dst, const PALETTEENTRY *palette);
};
struct d3dx_include_from_file
{
ID3DXInclude ID3DXInclude_iface;
};
extern CRITICAL_SECTION from_file_mutex DECLSPEC_HIDDEN;
extern const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl DECLSPEC_HIDDEN;
static inline BOOL is_conversion_from_supported(const struct pixel_format_desc *format)
{
if (format->type == FORMAT_ARGB || format->type == FORMAT_ARGBF16
@ -280,6 +290,13 @@ struct d3dx_param_eval
ULONG64 *version_counter;
};
struct param_rb_entry
{
struct wine_rb_entry entry;
char *full_name;
struct d3dx_parameter *param;
};
struct d3dx_shared_data;
struct d3dx_top_level_parameter;
@ -302,6 +319,9 @@ struct d3dx_parameter
struct d3dx_parameter *members;
char *semantic;
char *full_name;
struct wine_rb_entry rb_entry;
};
struct d3dx_top_level_parameter

File diff suppressed because it is too large Load diff

View file

@ -1987,27 +1987,33 @@ D3DXVECTOR3* WINAPI D3DXVec3TransformNormalArray(D3DXVECTOR3* out, UINT outstrid
return out;
}
D3DXVECTOR3* WINAPI D3DXVec3Unproject(D3DXVECTOR3 *pout, const D3DXVECTOR3 *pv, const D3DVIEWPORT9 *pviewport, const D3DXMATRIX *pprojection, const D3DXMATRIX *pview, const D3DXMATRIX *pworld)
D3DXVECTOR3 * WINAPI D3DXVec3Unproject(D3DXVECTOR3 *out, const D3DXVECTOR3 *v,
const D3DVIEWPORT9 *viewport, const D3DXMATRIX *projection, const D3DXMATRIX *view,
const D3DXMATRIX *world)
{
D3DXMATRIX m;
TRACE("pout %p, pv %p, pviewport %p, pprojection %p, pview %p, pworlds %p\n", pout, pv, pviewport, pprojection, pview, pworld);
TRACE("out %p, v %p, viewport %p, projection %p, view %p, world %p.\n",
out, v, viewport, projection, view, world);
D3DXMatrixIdentity(&m);
if (pworld) D3DXMatrixMultiply(&m, &m, pworld);
if (pview) D3DXMatrixMultiply(&m, &m, pview);
if (pprojection) D3DXMatrixMultiply(&m, &m, pprojection);
if (world)
D3DXMatrixMultiply(&m, &m, world);
if (view)
D3DXMatrixMultiply(&m, &m, view);
if (projection)
D3DXMatrixMultiply(&m, &m, projection);
D3DXMatrixInverse(&m, NULL, &m);
*pout = *pv;
if (pviewport)
*out = *v;
if (viewport)
{
pout->x = 2.0f * ( pout->x - pviewport->X ) / pviewport->Width - 1.0f;
pout->y = 1.0f - 2.0f * ( pout->y - pviewport->Y ) / pviewport->Height;
pout->z = ( pout->z - pviewport->MinZ) / ( pviewport->MaxZ - pviewport->MinZ );
out->x = 2.0f * (out->x - viewport->X) / viewport->Width - 1.0f;
out->y = 1.0f - 2.0f * (out->y - viewport->Y) / viewport->Height;
out->z = (out->z - viewport->MinZ) / (viewport->MaxZ - viewport->MinZ);
}
D3DXVec3TransformCoord(pout, pout, &m);
return pout;
D3DXVec3TransformCoord(out, out, &m);
return out;
}
D3DXVECTOR3* WINAPI D3DXVec3UnprojectArray(D3DXVECTOR3* out, UINT outstride, const D3DXVECTOR3* in, UINT instride, const D3DVIEWPORT9* viewport, const D3DXMATRIX* projection, const D3DXMATRIX* view, const D3DXMATRIX* world, UINT elements)

View file

@ -4568,7 +4568,7 @@ HRESULT WINAPI D3DXCreatePolygon(struct IDirect3DDevice9 *device, float length,
struct vertex *vertices;
WORD (*faces)[3];
DWORD (*adjacency_buf)[3];
float scale;
float angle, scale;
unsigned int i;
TRACE("device %p, length %f, sides %u, mesh %p, adjacency %p.\n",
@ -4596,7 +4596,9 @@ HRESULT WINAPI D3DXCreatePolygon(struct IDirect3DDevice9 *device, float length,
return hr;
}
scale = 0.5f * length / sinf(D3DX_PI / sides);
angle = D3DX_PI / sides;
scale = 0.5f * length / sinf(angle);
angle *= 2.0f;
vertices[0].position.x = 0.0f;
vertices[0].position.y = 0.0f;
@ -4607,8 +4609,8 @@ HRESULT WINAPI D3DXCreatePolygon(struct IDirect3DDevice9 *device, float length,
for (i = 0; i < sides; ++i)
{
vertices[i + 1].position.x = cosf(2.0f * D3DX_PI * i / sides) * scale;
vertices[i + 1].position.y = sinf(2.0f * D3DX_PI * i / sides) * scale;
vertices[i + 1].position.x = cosf(angle * i) * scale;
vertices[i + 1].position.y = sinf(angle * i) * scale;
vertices[i + 1].position.z = 0.0f;
vertices[i + 1].normal.x = 0.0f;
vertices[i + 1].normal.y = 0.0f;
@ -7574,18 +7576,6 @@ HRESULT WINAPI D3DXComputeNormals(struct ID3DXBaseMesh *mesh, const DWORD *adjac
adjacency, -1.01f, -0.01f, -1.01f, NULL, NULL);
}
/*************************************************************************
* D3DXComputeNormalMap (D3DX9_36.@)
*/
HRESULT WINAPI D3DXComputeNormalMap(IDirect3DTexture9 *texture, IDirect3DTexture9 *src_texture,
const PALETTEENTRY *src_palette, DWORD flags, DWORD channel, FLOAT amplitude)
{
FIXME("texture %p, src_texture %p, src_palette %p, flags %#x, channel %u, amplitude %f stub.\n",
texture, src_texture, src_palette, flags, channel, amplitude);
return D3D_OK;
}
/*************************************************************************
* D3DXIntersect (D3DX9_36.@)
*/

View file

@ -1213,7 +1213,8 @@ static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, u
}
if (reg_idx >= pres->regs.table_sizes[table])
{
FIXME("Out of bounds register index, i %u, j %u, table %u, reg_idx %u.\n",
/* Native accepts these broken preshaders. */
FIXME("Out of bounds register index, i %u, j %u, table %u, reg_idx %u, preshader parsing failed.\n",
i, j, table, reg_idx);
return D3DXERR_INVALIDDATA;
}

View file

@ -216,7 +216,6 @@ HRESULT WINAPI D3DXAssembleShader(const char *data, UINT data_len, const D3DXMAC
static const void *main_file_data;
static CRITICAL_SECTION from_file_mutex;
static CRITICAL_SECTION_DEBUG from_file_mutex_debug =
{
0, 0, &from_file_mutex,
@ -226,14 +225,14 @@ static CRITICAL_SECTION_DEBUG from_file_mutex_debug =
},
0, 0, {(DWORD_PTR)(__FILE__ ": from_file_mutex")}
};
static CRITICAL_SECTION from_file_mutex = {&from_file_mutex_debug, -1, 0, 0, 0, 0};
CRITICAL_SECTION from_file_mutex = {&from_file_mutex_debug, -1, 0, 0, 0, 0};
/* D3DXInclude private implementation, used to implement
* D3DXAssembleShaderFromFile() from D3DXAssembleShader(). */
/* To be able to correctly resolve include search paths we have to store the
* pathname of each include file. We store the pathname pointer right before
* the file data. */
static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_TYPE include_type,
static HRESULT WINAPI d3dx_include_from_file_open(ID3DXInclude *iface, D3DXINCLUDE_TYPE include_type,
const char *filename, const void *parent_data, const void **data, UINT *bytes)
{
const char *p, *parent_name = "";
@ -252,7 +251,7 @@ static HRESULT WINAPI d3dincludefromfile_open(ID3DXInclude *iface, D3DXINCLUDE_T
parent_name = *((const char **)main_file_data - 1);
}
TRACE("Looking up for include file %s, parent %s\n", debugstr_a(filename), debugstr_a(parent_name));
TRACE("Looking up include file %s, parent %s.\n", debugstr_a(filename), debugstr_a(parent_name));
if ((p = strrchr(parent_name, '\\')))
++p;
@ -303,7 +302,7 @@ error:
return HRESULT_FROM_WIN32(GetLastError());
}
static HRESULT WINAPI d3dincludefromfile_close(ID3DXInclude *iface, const void *data)
static HRESULT WINAPI d3dx_include_from_file_close(ID3DXInclude *iface, const void *data)
{
HeapFree(GetProcessHeap(), 0, *((char **)data - 1));
HeapFree(GetProcessHeap(), 0, (char **)data - 1);
@ -312,13 +311,10 @@ static HRESULT WINAPI d3dincludefromfile_close(ID3DXInclude *iface, const void *
return S_OK;
}
static const struct ID3DXIncludeVtbl D3DXInclude_Vtbl = {
d3dincludefromfile_open,
d3dincludefromfile_close
};
struct D3DXIncludeImpl {
ID3DXInclude ID3DXInclude_iface;
const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl =
{
d3dx_include_from_file_open,
d3dx_include_from_file_close
};
HRESULT WINAPI D3DXAssembleShaderFromFileA(const char *filename, const D3DXMACRO *defines,
@ -350,7 +346,7 @@ HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACR
const void *buffer;
DWORD len;
HRESULT hr;
struct D3DXIncludeImpl includefromfile;
struct d3dx_include_from_file include_from_file;
char *filename_a;
TRACE("filename %s, defines %p, include %p, flags %#x, shader %p, error_messages %p.\n",
@ -358,8 +354,8 @@ HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACR
if(!include)
{
includefromfile.ID3DXInclude_iface.lpVtbl = &D3DXInclude_Vtbl;
include = &includefromfile.ID3DXInclude_iface;
include_from_file.ID3DXInclude_iface.lpVtbl = &d3dx_include_from_file_vtbl;
include = &include_from_file.ID3DXInclude_iface;
}
len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL);
@ -518,7 +514,7 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
const void *buffer;
DWORD len, filename_len;
HRESULT hr;
struct D3DXIncludeImpl includefromfile;
struct d3dx_include_from_file include_from_file;
char *filename_a;
TRACE("filename %s, defines %p, include %p, entrypoint %s, profile %s, "
@ -528,8 +524,8 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO
if (!include)
{
includefromfile.ID3DXInclude_iface.lpVtbl = &D3DXInclude_Vtbl;
include = &includefromfile.ID3DXInclude_iface;
include_from_file.ID3DXInclude_iface.lpVtbl = &d3dx_include_from_file_vtbl;
include = &include_from_file.ID3DXInclude_iface;
}
filename_len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL);
@ -643,7 +639,7 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMA
const void *buffer;
DWORD len;
HRESULT hr;
struct D3DXIncludeImpl includefromfile;
struct d3dx_include_from_file include_from_file;
char *filename_a;
TRACE("filename %s, defines %p, include %p, shader %p, error_messages %p.\n",
@ -651,8 +647,8 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMA
if (!include)
{
includefromfile.ID3DXInclude_iface.lpVtbl = &D3DXInclude_Vtbl;
include = &includefromfile.ID3DXInclude_iface;
include_from_file.ID3DXInclude_iface.lpVtbl = &d3dx_include_from_file_vtbl;
include = &include_from_file.ID3DXInclude_iface;
}
len = WideCharToMultiByte(CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL);

View file

@ -1916,3 +1916,12 @@ HRESULT WINAPI D3DXSaveTextureToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
return hr;
}
HRESULT WINAPI D3DXComputeNormalMap(IDirect3DTexture9 *texture, IDirect3DTexture9 *src_texture,
const PALETTEENTRY *src_palette, DWORD flags, DWORD channel, float amplitude)
{
FIXME("texture %p, src_texture %p, src_palette %p, flags %#x, channel %u, amplitude %.8e stub.\n",
texture, src_texture, src_palette, flags, channel, amplitude);
return D3D_OK;
}

View file

@ -26,7 +26,7 @@ reactos/dll/directx/wine/d3d8 # Synced to WineStaging-3.9
reactos/dll/directx/wine/d3d9 # Synced to WineStaging-3.9
reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-3.3
reactos/dll/directx/wine/d3drm # Synced to WineStaging-3.9
reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-3.3
reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-3.9
reactos/dll/directx/wine/d3dxof # Synced to WineStaging-3.3
reactos/dll/directx/wine/ddraw # Synced to WineStaging-3.9
reactos/dll/directx/wine/devenum # Synced to WineStaging-3.3