From 0918f6d8eaf7ffb850e3cef46a961a0b329d1142 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 29 Feb 2016 21:01:26 +0000 Subject: [PATCH] [D3DX9_24][D3DX9_36] Sync with Wine Staging 1.9.4. CORE-10912 svn path=/trunk/; revision=70821 --- .../dll/directx/wine/d3dx9_24/d3dx9_24.spec | 22 +- reactos/dll/directx/wine/d3dx9_36/animation.c | 145 +++-- reactos/dll/directx/wine/d3dx9_36/core.c | 2 +- .../dll/directx/wine/d3dx9_36/d3dx9_36.spec | 6 +- reactos/dll/directx/wine/d3dx9_36/font.c | 18 +- reactos/dll/directx/wine/d3dx9_36/math.c | 10 +- reactos/dll/directx/wine/d3dx9_36/mesh.c | 9 + reactos/dll/directx/wine/d3dx9_36/shader.c | 583 +++++++++++++++++- reactos/dll/directx/wine/d3dx9_36/surface.c | 9 +- reactos/media/doc/README.WINE | 2 +- 10 files changed, 695 insertions(+), 111 deletions(-) diff --git a/reactos/dll/directx/wine/d3dx9_24/d3dx9_24.spec b/reactos/dll/directx/wine/d3dx9_24/d3dx9_24.spec index 086741e2b40..a87070737d8 100644 --- a/reactos/dll/directx/wine/d3dx9_24/d3dx9_24.spec +++ b/reactos/dll/directx/wine/d3dx9_24/d3dx9_24.spec @@ -43,21 +43,21 @@ @ stdcall D3DXCreateCubeTextureFromResourceExW(ptr long long long long long long long long long long ptr ptr ptr) d3dx9_36.D3DXCreateCubeTextureFromResourceExW @ stdcall D3DXCreateCubeTextureFromResourceW(ptr long ptr ptr) d3dx9_36.D3DXCreateCubeTextureFromResourceW @ stdcall D3DXCreateCylinder(ptr long long long long long ptr ptr) d3dx9_36.D3DXCreateCylinder -@ stdcall D3DXCreateEffect(ptr ptr long ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffect +@ stdcall D3DXCreateEffect(ptr ptr long ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffect # don't forward @ stdcall D3DXCreateEffectCompiler(ptr long ptr ptr long ptr ptr) d3dx9_36.D3DXCreateEffectCompiler @ stdcall D3DXCreateEffectCompilerFromFileA(str ptr ptr long ptr ptr) d3dx9_36.D3DXCreateEffectCompilerFromFileA @ stdcall D3DXCreateEffectCompilerFromFileW(wstr ptr ptr long ptr ptr) d3dx9_36.D3DXCreateEffectCompilerFromFileW @ stdcall D3DXCreateEffectCompilerFromResourceA(long str ptr ptr long ptr ptr) d3dx9_36.D3DXCreateEffectCompilerFromResourceA @ stdcall D3DXCreateEffectCompilerFromResourceW(long wstr ptr ptr long ptr ptr) d3dx9_36.D3DXCreateEffectCompilerFromResourceW -@ stdcall D3DXCreateEffectEx(ptr ptr long ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectEx -@ stdcall D3DXCreateEffectFromFileA(ptr str ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileA -@ stdcall D3DXCreateEffectFromFileExA(ptr str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileExA -@ stdcall D3DXCreateEffectFromFileExW(ptr str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileExW -@ stdcall D3DXCreateEffectFromFileW(ptr wstr ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileW -@ stdcall D3DXCreateEffectFromResourceA(ptr long str ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceA -@ stdcall D3DXCreateEffectFromResourceExA(ptr long str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceExA -@ stdcall D3DXCreateEffectFromResourceExW(ptr long str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceExW -@ stdcall D3DXCreateEffectFromResourceW(ptr long wstr ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceW +@ stdcall D3DXCreateEffectEx(ptr ptr long ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectEx # don't forward +@ stdcall D3DXCreateEffectFromFileA(ptr str ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileA # don't forward +@ stdcall D3DXCreateEffectFromFileExA(ptr str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileExA # don't forward +@ stdcall D3DXCreateEffectFromFileExW(ptr str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileExW # don't forward +@ stdcall D3DXCreateEffectFromFileW(ptr wstr ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromFileW # don't forward +@ stdcall D3DXCreateEffectFromResourceA(ptr long str ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceA # don't forward +@ stdcall D3DXCreateEffectFromResourceExA(ptr long str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceExA # don't forward +@ stdcall D3DXCreateEffectFromResourceExW(ptr long str ptr ptr str long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceExW # don't forward +@ stdcall D3DXCreateEffectFromResourceW(ptr long wstr ptr ptr long ptr ptr ptr) d3dx9_25.D3DXCreateEffectFromResourceW # don't forward @ stdcall D3DXCreateEffectPool(ptr) d3dx9_36.D3DXCreateEffectPool @ stdcall D3DXCreateFontA(ptr long long long long long long long long long str ptr) d3dx9_36.D3DXCreateFontA @ stdcall D3DXCreateFontIndirectA(ptr ptr ptr) d3dx9_36.D3DXCreateFontIndirectA @@ -115,7 +115,7 @@ @ stdcall D3DXCreateVolumeTextureFromResourceW(ptr long ptr ptr) d3dx9_36.D3DXCreateVolumeTextureFromResourceW @ stdcall D3DXDebugMute(long) d3dx9_36.D3DXDebugMute @ stdcall D3DXDeclaratorFromFVF(long ptr) d3dx9_36.D3DXDeclaratorFromFVF -@ stdcall D3DXDisassembleEffect(ptr long ptr) d3dx9_25.D3DXDisassembleEffect +@ stdcall D3DXDisassembleEffect(ptr long ptr) d3dx9_25.D3DXDisassembleEffect # don't forward @ stdcall D3DXDisassembleShader(ptr long str ptr) d3dx9_36.D3DXDisassembleShader @ stdcall D3DXFileCreate(ptr) d3dx9_36.D3DXFileCreate @ stdcall D3DXFillCubeTexture(ptr ptr ptr) d3dx9_36.D3DXFillCubeTexture diff --git a/reactos/dll/directx/wine/d3dx9_36/animation.c b/reactos/dll/directx/wine/d3dx9_36/animation.c index e91a2ccb107..e1e895f6306 100644 --- a/reactos/dll/directx/wine/d3dx9_36/animation.c +++ b/reactos/dll/directx/wine/d3dx9_36/animation.c @@ -40,39 +40,39 @@ static HRESULT WINAPI d3dx9_animation_controller_QueryInterface(ID3DXAnimationCo { TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); - if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ID3DXAnimationController)) + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_ID3DXAnimationController)) { - IUnknown_AddRef(iface); + iface->lpVtbl->AddRef(iface); *out = iface; return D3D_OK; } - WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid)); - + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); *out = NULL; return E_NOINTERFACE; } static ULONG WINAPI d3dx9_animation_controller_AddRef(ID3DXAnimationController *iface) { - struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); - ULONG refcount = InterlockedIncrement(&This->ref); + struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); + ULONG refcount = InterlockedIncrement(&animation->ref); - TRACE("%p increasing refcount to %u.\n", This, refcount); + TRACE("%p increasing refcount to %u.\n", animation, refcount); return refcount; } static ULONG WINAPI d3dx9_animation_controller_Release(ID3DXAnimationController *iface) { - struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); - ULONG refcount = InterlockedDecrement(&This->ref); + struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); + ULONG refcount = InterlockedDecrement(&animation->ref); - TRACE("%p decreasing refcount to %u.\n", This, refcount); + TRACE("%p decreasing refcount to %u.\n", animation, refcount); if (!refcount) { - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, animation); } return refcount; @@ -80,44 +80,44 @@ static ULONG WINAPI d3dx9_animation_controller_Release(ID3DXAnimationController static UINT WINAPI d3dx9_animation_controller_GetMaxNumAnimationOutputs(ID3DXAnimationController *iface) { - struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); TRACE("iface %p.\n", iface); - return This->max_outputs; + return animation->max_outputs; } static UINT WINAPI d3dx9_animation_controller_GetMaxNumAnimationSets(ID3DXAnimationController *iface) { - struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); TRACE("iface %p.\n", iface); - return This->max_sets; + return animation->max_sets; } static UINT WINAPI d3dx9_animation_controller_GetMaxNumTracks(ID3DXAnimationController *iface) { - struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); - FIXME("iface %p.\n", iface); + TRACE("iface %p.\n", iface); - return This->max_tracks; + return animation->max_tracks; } static UINT WINAPI d3dx9_animation_controller_GetMaxNumEvents(ID3DXAnimationController *iface) { - struct d3dx9_animation_controller *This = impl_from_ID3DXAnimationController(iface); + struct d3dx9_animation_controller *animation = impl_from_ID3DXAnimationController(iface); - FIXME("iface %p.\n", iface); + TRACE("iface %p.\n", iface); - return This->max_events; + return animation->max_events; } static HRESULT WINAPI d3dx9_animation_controller_RegisterAnimationOutput(ID3DXAnimationController *iface, const char *name, D3DXMATRIX *matrix, D3DXVECTOR3 *scale, D3DXQUATERNION *rotation, D3DXVECTOR3 *translation) { - FIXME("iface %p, name %s, matrix %p, scale %p, rotation %p, translation %p stub.\n", iface, wine_dbgstr_a(name), + FIXME("iface %p, name %s, matrix %p, scale %p, rotation %p, translation %p stub.\n", iface, debugstr_a(name), matrix, scale, rotation, translation); return E_NOTIMPL; @@ -157,15 +157,15 @@ static HRESULT WINAPI d3dx9_animation_controller_GetAnimationSet(ID3DXAnimationC static HRESULT WINAPI d3dx9_animation_controller_GetAnimationSetByName(ID3DXAnimationController *iface, const char *name, ID3DXAnimationSet **anim_set) { - FIXME("iface %p, name %s, anim_set %p stub.\n", iface, wine_dbgstr_a(name), anim_set); + FIXME("iface %p, name %s, anim_set %p stub.\n", iface, debugstr_a(name), anim_set); return E_NOTIMPL; } -static HRESULT WINAPI d3dx9_animation_controller_AdvanceTime(ID3DXAnimationController *iface, DOUBLE time_delta, - ID3DXAnimationCallbackHandler **callback_handler) +static HRESULT WINAPI d3dx9_animation_controller_AdvanceTime(ID3DXAnimationController *iface, double time_delta, + ID3DXAnimationCallbackHandler *callback_handler) { - FIXME("iface %p, time_delta %g, callback_handler %p stub.\n", iface, time_delta, callback_handler); + FIXME("iface %p, time_delta %.16e, callback_handler %p stub.\n", iface, time_delta, callback_handler); return E_NOTIMPL; } @@ -177,7 +177,7 @@ static HRESULT WINAPI d3dx9_animation_controller_Reset(ID3DXAnimationController return E_NOTIMPL; } -static DOUBLE WINAPI d3dx9_animation_controller_GetTime(ID3DXAnimationController *iface) +static double WINAPI d3dx9_animation_controller_GetTime(ID3DXAnimationController *iface) { FIXME("iface %p stub.\n", iface); @@ -200,34 +200,34 @@ static HRESULT WINAPI d3dx9_animation_controller_GetTrackAnimationSet(ID3DXAnima return E_NOTIMPL; } -static HRESULT WINAPI d3dx9_animation_controller_GetTrackPriority(ID3DXAnimationController *iface, - UINT track, D3DXPRIORITY_TYPE *priority) +static HRESULT WINAPI d3dx9_animation_controller_SetTrackPriority(ID3DXAnimationController *iface, + UINT track, D3DXPRIORITY_TYPE priority) { - FIXME("iface %p, track %u, priority %p stub.\n", iface, track, priority); + FIXME("iface %p, track %u, priority %u stub.\n", iface, track, priority); return E_NOTIMPL; } static HRESULT WINAPI d3dx9_animation_controller_SetTrackSpeed(ID3DXAnimationController *iface, - UINT track, FLOAT speed) + UINT track, float speed) { - FIXME("iface %p, track %u, speed %f stub.\n", iface, track, speed); + FIXME("iface %p, track %u, speed %.8e stub.\n", iface, track, speed); return E_NOTIMPL; } static HRESULT WINAPI d3dx9_animation_controller_SetTrackWeight(ID3DXAnimationController *iface, - UINT track, FLOAT weight) + UINT track, float weight) { - FIXME("iface %p, track %u, weight %f stub.\n", iface, track, weight); + FIXME("iface %p, track %u, weight %.8e stub.\n", iface, track, weight); return E_NOTIMPL; } static HRESULT WINAPI d3dx9_animation_controller_SetTrackPosition(ID3DXAnimationController *iface, - UINT track, DOUBLE position) + UINT track, double position) { - FIXME("iface %p, track %u, position %g stub.\n", iface, track, position); + FIXME("iface %p, track %u, position %.16e stub.\n", iface, track, position); return E_NOTIMPL; } @@ -235,7 +235,7 @@ static HRESULT WINAPI d3dx9_animation_controller_SetTrackPosition(ID3DXAnimation static HRESULT WINAPI d3dx9_animation_controller_SetTrackEnable(ID3DXAnimationController *iface, UINT track, BOOL enable) { - FIXME("iface %p, track %u, enable %u stub.\n", iface, track, enable); + FIXME("iface %p, track %u, enable %#x stub.\n", iface, track, enable); return E_NOTIMPL; } @@ -257,60 +257,60 @@ static HRESULT WINAPI d3dx9_animation_controller_GetTrackDesc(ID3DXAnimationCont } static HRESULT WINAPI d3dx9_animation_controller_SetPriorityBlend(ID3DXAnimationController *iface, - FLOAT blend_weight) + float blend_weight) { - FIXME("iface %p, blend_weight %f stub.\n", iface, blend_weight); + FIXME("iface %p, blend_weight %.8e stub.\n", iface, blend_weight); return E_NOTIMPL; } -static FLOAT WINAPI d3dx9_animation_controller_GetPriorityBlend(ID3DXAnimationController *iface) +static float WINAPI d3dx9_animation_controller_GetPriorityBlend(ID3DXAnimationController *iface) { FIXME("iface %p stub.\n", iface); - return 0.0; + return 0.0f; } static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackSpeed(ID3DXAnimationController *iface, - UINT track, FLOAT new_speed, DOUBLE start_time, DOUBLE duration, D3DXTRANSITION_TYPE transition) + UINT track, float new_speed, double start_time, double duration, D3DXTRANSITION_TYPE transition) { - FIXME("iface %p, track %u, new_speed %f, start_time %g, duration %g, transition %u stub.\n", iface, + FIXME("iface %p, track %u, new_speed %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface, track, new_speed, start_time, duration, transition); return 0; } static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackWeight(ID3DXAnimationController *iface, - UINT track, FLOAT new_weight, DOUBLE start_time, DOUBLE duration, D3DXTRANSITION_TYPE transition) + UINT track, float new_weight, double start_time, double duration, D3DXTRANSITION_TYPE transition) { - FIXME("iface %p, track %u, new_weight %f, start_time %g, duration %g, transition %u stub.\n", iface, + FIXME("iface %p, track %u, new_weight %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface, track, new_weight, start_time, duration, transition); return 0; } static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackPosition(ID3DXAnimationController *iface, - UINT track, DOUBLE new_position, DOUBLE start_time) + UINT track, double new_position, double start_time) { - FIXME("iface %p, track %u, new_position %g, start_time %g stub.\n", iface, + FIXME("iface %p, track %u, new_position %.16e, start_time %.16e stub.\n", iface, track, new_position, start_time); return 0; } static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackEnable(ID3DXAnimationController *iface, - UINT track, BOOL new_enable, DOUBLE start_time) + UINT track, BOOL new_enable, double start_time) { - FIXME("iface %p, track %u, new_enable %u, start_time %g stub.\n", iface, + FIXME("iface %p, track %u, new_enable %#x, start_time %.16e stub.\n", iface, track, new_enable, start_time); return 0; } static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_KeyTrackBlend(ID3DXAnimationController *iface, - FLOAT new_blend_weight, DOUBLE start_time, DOUBLE duration, D3DXTRANSITION_TYPE transition) + float new_blend_weight, double start_time, double duration, D3DXTRANSITION_TYPE transition) { - FIXME("iface %p, new_blend_weight %f, start_time %g, duration %g, transition %u stub.\n", iface, + FIXME("iface %p, new_blend_weight %.8e, start_time %.16e, duration %.16e, transition %u stub.\n", iface, new_blend_weight, start_time, duration, transition); return 0; @@ -361,9 +361,9 @@ static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_GetUpcomingTrackEvent(I } static D3DXEVENTHANDLE WINAPI d3dx9_animation_controller_GetUpcomingPriorityBlend(ID3DXAnimationController *iface, - D3DXEVENTHANDLE handle) + D3DXEVENTHANDLE event) { - FIXME("iface %p, handle %u stub.\n", iface, handle); + FIXME("iface %p, event %u stub.\n", iface, event); return 0; } @@ -383,16 +383,16 @@ static HRESULT WINAPI d3dx9_animation_controller_GetEventDesc(ID3DXAnimationCont return E_NOTIMPL; } -static HRESULT WINAPI d3dx9_animation_controller_CloneAnimationController(ID3DXAnimationController *iface, UINT max_num_anim_outputs, - UINT max_num_anim_sets, UINT max_num_tracks, UINT max_num_events, ID3DXAnimationController **anim_controller) +static HRESULT WINAPI d3dx9_animation_controller_CloneAnimationController(ID3DXAnimationController *iface, UINT max_outputs, + UINT max_sets, UINT max_tracks, UINT max_events, ID3DXAnimationController **anim_controller) { - FIXME("iface %p, max_num_anim_outputs %u, max_num_anim_sets %u, max_num_tracks %u, max_num_events %u, anim_controller %p stub.\n", - iface, max_num_anim_outputs, max_num_anim_sets, max_num_tracks, max_num_events, anim_controller); + FIXME("iface %p, max_outputs %u, max_sets %u, max_tracks %u, max_events %u, anim_controller %p stub.\n", + iface, max_outputs, max_sets, max_tracks, max_events, anim_controller); return E_NOTIMPL; } -static const struct ID3DXAnimationControllerVtbl d3dx9_animation_controller_vtbl = +static /* const */ struct ID3DXAnimationControllerVtbl d3dx9_animation_controller_vtbl = { d3dx9_animation_controller_QueryInterface, d3dx9_animation_controller_AddRef, @@ -412,7 +412,7 @@ static const struct ID3DXAnimationControllerVtbl d3dx9_animation_controller_vtbl d3dx9_animation_controller_GetTime, d3dx9_animation_controller_SetTrackAnimationSet, d3dx9_animation_controller_GetTrackAnimationSet, - d3dx9_animation_controller_GetTrackPriority, + d3dx9_animation_controller_SetTrackPriority, d3dx9_animation_controller_SetTrackSpeed, d3dx9_animation_controller_SetTrackWeight, d3dx9_animation_controller_SetTrackPosition, @@ -438,19 +438,16 @@ static const struct ID3DXAnimationControllerVtbl d3dx9_animation_controller_vtbl d3dx9_animation_controller_CloneAnimationController }; -/*********************************************************************** - * D3DXCreateAnimationController (D3DX9_36.@) - */ -HRESULT WINAPI D3DXCreateAnimationController(UINT MaxNumAnimationOutputs, UINT MaxNumAnimationSets, - UINT MaxNumTracks, UINT MaxNumEvents, ID3DXAnimationController **AnimationController) +HRESULT WINAPI D3DXCreateAnimationController(UINT max_outputs, UINT max_sets, + UINT max_tracks, UINT max_events, ID3DXAnimationController **controller) { - struct d3dx9_animation_controller* object; + struct d3dx9_animation_controller *object; - TRACE("MaxNumAnimationOutputs %u, MaxNumAnimationSets %u, MaxNumTracks %u, MaxNumEvents %u, AnimationController %p.\n", - MaxNumAnimationOutputs, MaxNumAnimationSets, MaxNumTracks, MaxNumEvents, AnimationController); + TRACE("max_outputs %u, max_sets %u, max_tracks %u, max_events %u, controller %p.\n", + max_outputs, max_sets, max_tracks, max_events, controller); - if (!AnimationController) - return D3DERR_INVALIDCALL; + if (!max_outputs || !max_sets || !max_tracks || !max_events || !controller) + return D3D_OK; object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object)); if (!object) @@ -458,12 +455,12 @@ HRESULT WINAPI D3DXCreateAnimationController(UINT MaxNumAnimationOutputs, UINT M object->ID3DXAnimationController_iface.lpVtbl = &d3dx9_animation_controller_vtbl; object->ref = 1; - object->max_outputs = MaxNumAnimationOutputs; - object->max_sets = MaxNumAnimationSets; - object->max_tracks = MaxNumTracks; - object->max_events = MaxNumEvents; + object->max_outputs = max_outputs; + object->max_sets = max_sets; + object->max_tracks = max_tracks; + object->max_events = max_events; - *AnimationController = &object->ID3DXAnimationController_iface; + *controller = &object->ID3DXAnimationController_iface; return D3D_OK; } diff --git a/reactos/dll/directx/wine/d3dx9_36/core.c b/reactos/dll/directx/wine/d3dx9_36/core.c index 51cb53a40de..e7624f2a21c 100644 --- a/reactos/dll/directx/wine/d3dx9_36/core.c +++ b/reactos/dll/directx/wine/d3dx9_36/core.c @@ -146,7 +146,7 @@ HRESULT WINAPI D3DXCreateBuffer(DWORD size, ID3DXBuffer **buffer) *buffer = &object->ID3DXBuffer_iface; - TRACE("Created ID3DBuffer %p\n", *buffer); + TRACE("Created ID3DXBuffer %p.\n", *buffer); return D3D_OK; } diff --git a/reactos/dll/directx/wine/d3dx9_36/d3dx9_36.spec b/reactos/dll/directx/wine/d3dx9_36/d3dx9_36.spec index f313d35966d..00c5a5abfb4 100644 --- a/reactos/dll/directx/wine/d3dx9_36/d3dx9_36.spec +++ b/reactos/dll/directx/wine/d3dx9_36/d3dx9_36.spec @@ -28,7 +28,7 @@ @ stdcall -stub D3DXComputeTangentFrame(ptr long) @ stdcall D3DXComputeTangentFrameEx(ptr long long long long long long long long long ptr float float float ptr ptr) @ stdcall -stub D3DXConcatenateMeshes(ptr long long ptr ptr ptr ptr ptr) -@ stdcall -stub D3DXConvertMeshSubsetToSingleStrip(ptr long long ptr ptr) +@ stdcall D3DXConvertMeshSubsetToSingleStrip(ptr long long ptr ptr) @ stdcall -stub D3DXConvertMeshSubsetToStrips(ptr long long ptr ptr ptr ptr) @ stdcall D3DXCreateAnimationController(long long long long ptr) @ stdcall D3DXCreateBox(ptr float float float ptr ptr) @@ -104,7 +104,7 @@ @ stdcall D3DXCreateTextureFromResourceExW(ptr ptr wstr long long long long long long long long long ptr ptr ptr) @ stdcall D3DXCreateTextureFromResourceW(ptr ptr wstr ptr) @ stdcall -stub D3DXCreateTextureGutterHelper(long long ptr long ptr) -@ stdcall -stub D3DXCreateTextureShader(ptr ptr) +@ stdcall D3DXCreateTextureShader(ptr ptr) @ stdcall D3DXCreateTorus(ptr long long long long ptr ptr) @ stdcall D3DXCreateVolumeTexture(ptr long long long long long long long ptr) @ stdcall D3DXCreateVolumeTextureFromFileA(ptr ptr ptr) @@ -123,7 +123,7 @@ @ stdcall D3DXDisassembleShader(ptr long str ptr) @ stdcall D3DXFileCreate(ptr) @ stdcall D3DXFillCubeTexture(ptr ptr ptr) -@ stdcall -stub D3DXFillCubeTextureTX(ptr ptr) +@ stdcall D3DXFillCubeTextureTX(ptr ptr) @ stdcall D3DXFillTexture(ptr ptr ptr) @ stdcall -stub D3DXFillTextureTX(ptr ptr) @ stdcall D3DXFillVolumeTexture(ptr ptr ptr) diff --git a/reactos/dll/directx/wine/d3dx9_36/font.c b/reactos/dll/directx/wine/d3dx9_36/font.c index 6adaf1ec32e..231cdb1790b 100644 --- a/reactos/dll/directx/wine/d3dx9_36/font.c +++ b/reactos/dll/directx/wine/d3dx9_36/font.c @@ -207,9 +207,12 @@ static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite, TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x\n", iface, sprite, debugstr_a(string), count, wine_dbgstr_rect(rect), format, color); - if (!string || count <= 0) + if (!string || count == 0) return 0; + if (count < 0) + count = -1; + countW = MultiByteToWideChar(CP_ACP, 0, string, count, NULL, 0); stringW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR)); if (stringW) @@ -226,24 +229,31 @@ static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color) { struct d3dx_font *This = impl_from_ID3DXFont(iface); - RECT calc_rect = *rect; + RECT calc_rect; INT height; TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x\n", iface, sprite, debugstr_w(string), count, wine_dbgstr_rect(rect), format, color); - if (!string || count <= 0) + if (!string || count == 0) return 0; + if (count < 0) + count = lstrlenW(string); + /* Strip terminating NULL characters */ while (count > 0 && !string[count-1]) count--; + if (rect) + calc_rect = *rect; + height = DrawTextW(This->hdc, string, count, &calc_rect, format | DT_CALCRECT); if (format & DT_CALCRECT) { - *rect = calc_rect; + if (rect) + *rect = calc_rect; return height; } diff --git a/reactos/dll/directx/wine/d3dx9_36/math.c b/reactos/dll/directx/wine/d3dx9_36/math.c index 910e4f9377d..1bfb8cc3db5 100644 --- a/reactos/dll/directx/wine/d3dx9_36/math.c +++ b/reactos/dll/directx/wine/d3dx9_36/math.c @@ -2127,21 +2127,21 @@ unsigned short float_32_to_16(const float in) if (isnan(in)) return (sign ? 0xffff : 0x7fff); if (in == 0.0f) return (sign ? 0x8000 : 0x0000); - if (tmp < powf(2, 10)) + if (tmp < (float)(1u << 10)) { do { tmp *= 2.0f; exp--; - } while (tmp < powf(2, 10)); + } while (tmp < (float)(1u << 10)); } - else if (tmp >= powf(2, 11)) + else if (tmp >= (float)(1u << 11)) { do { tmp /= 2.0f; exp++; - } while (tmp >= powf(2, 11)); + } while (tmp >= (float)(1u << 11)); } exp += 10; /* Normalize the mantissa */ @@ -2179,7 +2179,7 @@ unsigned short float_32_to_16(const float in) exp = origexp; /* the 13 extra bits from single precision are used for rounding */ - mantissa = (unsigned int)(tmp * powf(2, 13)); + mantissa = (unsigned int)(tmp * (1u << 13)); mantissa >>= 1 - exp; /* denormalize */ mantissa -= ~(mantissa >> 13) & 1; /* round half to even */ diff --git a/reactos/dll/directx/wine/d3dx9_36/mesh.c b/reactos/dll/directx/wine/d3dx9_36/mesh.c index 9a4c9312bd2..ff587a63bfe 100644 --- a/reactos/dll/directx/wine/d3dx9_36/mesh.c +++ b/reactos/dll/directx/wine/d3dx9_36/mesh.c @@ -7560,3 +7560,12 @@ HRESULT WINAPI D3DXTessellateNPatches(ID3DXMesh *mesh, const DWORD *adjacency_in return E_NOTIMPL; } + +HRESULT WINAPI D3DXConvertMeshSubsetToSingleStrip(struct ID3DXBaseMesh *mesh_in, DWORD attribute_id, + DWORD ib_flags, struct IDirect3DIndexBuffer9 **index_buffer, DWORD *index_count) +{ + FIXME("mesh_in %p, attribute_id %u, ib_flags %u, index_buffer %p, index_count %p stub.\n", + mesh_in, attribute_id, ib_flags, index_buffer, index_count); + + return E_NOTIMPL; +} diff --git a/reactos/dll/directx/wine/d3dx9_36/shader.c b/reactos/dll/directx/wine/d3dx9_36/shader.c index c66f6e0759f..d49e0aa0d19 100644 --- a/reactos/dll/directx/wine/d3dx9_36/shader.c +++ b/reactos/dll/directx/wine/d3dx9_36/shader.c @@ -20,8 +20,10 @@ */ #include "d3dx9_36_private.h" -#include "d3dcompiler.h" +#include + +#include "d3dcompiler.h" /* This function is not declared in the SDK headers yet. */ HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filename, @@ -363,7 +365,7 @@ HRESULT WINAPI D3DXAssembleShaderFromFileW(const WCHAR *filename, const D3DXMACR WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL); EnterCriticalSection(&from_file_mutex); - hr = ID3DXInclude_Open(include, D3D_INCLUDE_LOCAL, filename_a, NULL, &buffer, &len); + hr = ID3DXInclude_Open(include, D3DXINC_LOCAL, filename_a, NULL, &buffer, &len); if (FAILED(hr)) { LeaveCriticalSection(&from_file_mutex); @@ -533,7 +535,7 @@ HRESULT WINAPI D3DXCompileShaderFromFileW(const WCHAR *filename, const D3DXMACRO WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, filename_len, NULL, NULL); EnterCriticalSection(&from_file_mutex); - hr = ID3DXInclude_Open(include, D3D_INCLUDE_LOCAL, filename_a, NULL, &buffer, &len); + hr = ID3DXInclude_Open(include, D3DXINC_LOCAL, filename_a, NULL, &buffer, &len); if (FAILED(hr)) { LeaveCriticalSection(&from_file_mutex); @@ -656,7 +658,7 @@ HRESULT WINAPI D3DXPreprocessShaderFromFileW(const WCHAR *filename, const D3DXMA WideCharToMultiByte(CP_ACP, 0, filename, -1, filename_a, len, NULL, NULL); EnterCriticalSection(&from_file_mutex); - hr = ID3DXInclude_Open(include, D3D_INCLUDE_LOCAL, filename_a, NULL, &buffer, &len); + hr = ID3DXInclude_Open(include, D3DXINC_LOCAL, filename_a, NULL, &buffer, &len); if (FAILED(hr)) { LeaveCriticalSection(&from_file_mutex); @@ -2172,10 +2174,302 @@ HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **sample return D3D_OK; } +static const struct +{ + const char *name; + int length; +} +opcode[] = +{ + { "nop", 0 }, /* D3DSIO_NOP */ + { "mov", 2 }, /* D3DSIO_MOV */ + { "add", 3 }, /* D3DSIO_ADD */ + { "sub", 3 }, /* D3DSIO_SUB */ + { "mad", 4 }, /* D3DSIO_MAD */ + { "mul", 3 }, /* D3DSIO_MUL */ + { "rcp", 2 }, /* D3DSIO_RCP */ + { "rsq", 2 }, /* D3DSIO_RSQ */ + { "dp3", 3 }, /* D3DSIO_DP3 */ + { "dp4", 3 }, /* D3DSIO_DP4 */ + { "min", 3 }, /* D3DSIO_MIN */ + { "max", 3 }, /* D3DSIO_MAX */ + { "slt", 3 }, /* D3DSIO_SLT */ + { "sge", 3 }, /* D3DSIO_SGE */ + { "exp", 2 }, /* D3DSIO_EXP */ + { "log", 2 }, /* D3DSIO_LOG */ + { "lit", 2 }, /* D3DSIO_LIT */ + { "dst", 3 }, /* D3DSIO_DST */ + { "lrp", 4 }, /* D3DSIO_LRP */ + { "frc", 2 }, /* D3DSIO_FRC */ + { "m4x4", 3 }, /* D3DSIO_M4x4 */ + { "m4x3", 3 }, /* D3DSIO_M4x3 */ + { "m3x4", 3 }, /* D3DSIO_M3x4 */ + { "m3x3", 3 }, /* D3DSIO_M3x3 */ + { "m3x2", 3 }, /* D3DSIO_M3x2 */ + { "call", 1 }, /* D3DSIO_CALL */ + { "callnz", 2 }, /* D3DSIO_CALLNZ */ + { "loop", 2 }, /* D3DSIO_LOOP */ + { "ret", 0 }, /* D3DSIO_RET */ + { "endloop", 1 }, /* D3DSIO_ENDLOOP */ + { "label", 1 }, /* D3DSIO_LABEL */ + { "dcl", 1 }, /* D3DSIO_DCL (handled separately) */ + { "pow", 3 }, /* D3DSIO_POW */ + { "crs", 3 }, /* D3DSIO_CRS */ + { "sgn", 4 }, /* D3DSIO_SGN */ + { "abs", 2 }, /* D3DSIO_ABS */ + { "nrm", 2 }, /* D3DSIO_NRM */ + { "sincos", 4 }, /* D3DSIO_SINCOS */ + { "rep", 1 }, /* D3DSIO_REP */ + { "endrep", 0 }, /* D3DSIO_ENDREP */ + { "if", 1 }, /* D3DSIO_IF */ + { "if", 2 }, /* D3DSIO_IFC */ + { "else", 0 }, /* D3DSIO_ELSE */ + { "endif", 0 }, /* D3DSIO_ENDIF */ + { "break", 0 }, /* D3DSIO_BREAK */ + { "break", 2 }, /* D3DSIO_BREAKC */ + { "mova", 2 }, /* D3DSIO_MOVA */ + { "defb", 2 }, /* D3DSIO_DEFB */ + { "defi", 2 }, /* D3DSIO_DEFI */ + { "texcoord", 1 }, /* D3DSIO_TEXCOORD */ + { "texkill", 1 }, /* D3DSIO_TEXKILL */ + { "texld", 3 }, /* D3DSIO_TEX */ + { "texbem", 2 }, /* D3DSIO_TEXBEM */ + { "texbeml", 2 }, /* D3DSIO_TEXBEML */ + { "texreg2ar", 2 }, /* D3DSIO_TEXREG2AR */ + { "texreg2gb", 2 }, /* D3DSIO_TEXREG2GB */ + { "texm3x2pad", 2 }, /* D3DSIO_TEXM3x2PAD */ + { "texm3x2tex", 2 }, /* D3DSIO_TEXM3x2TEX */ + { "texm3x3pad", 2 }, /* D3DSIO_TEXM3x3PAD */ + { "texm3x3tex", 2 }, /* D3DSIO_TEXM3x3TEX */ + { "texm3x3diff", 2 }, /* D3DSIO_TEXM3x3DIFF */ + { "texm3x3spec", 3 }, /* D3DSIO_TEXM3x3SPEC */ + { "texm3x3vspec", 2 }, /* D3DSIO_TEXM3x3VSPEC */ + { "expp", 2 }, /* D3DSIO_EXPP */ + { "logp", 2 }, /* D3DSIO_LOGP */ + { "cnd", 4 }, /* D3DSIO_CND */ + { "def", 5 }, /* D3DSIO_DEF (handled separately) */ + { "texreg2rgb", 2 }, /* D3DSIO_TEXREG2RGB */ + { "texdp3tex", 2 }, /* D3DSIO_TEXDP3TEX */ + { "texm3x2depth", 2 }, /* D3DSIO_TEXM3x2DEPTH */ + { "texdp3", 2 }, /* D3DSIO_TEXDP3 */ + { "texm3x3", 2 }, /* D3DSIO_TEXM3x3 */ + { "texdepth", 1 }, /* D3DSIO_TEXDEPTH */ + { "cmp", 4 }, /* D3DSIO_CMP */ + { "bem", 3 }, /* D3DSIO_BEM */ + { "dp2add", 4 }, /* D3DSIO_DP2ADD */ + { "dsx", 2 }, /* D3DSIO_DSX */ + { "dsy", 2 }, /* D3DSIO_DSY */ + { "texldd", 5 }, /* D3DSIO_TEXLDD */ + { "setp", 3 }, /* D3DSIO_SETP */ + { "texldl", 3 }, /* D3DSIO_TEXLDL */ + { "breakp", 1 } /* D3DSIO_BREAKP */ +}; + +static const char *decl_usage[] = { "position", "blendweight", "blendindices", "normal", "psize", "texcoord", + "tangent", "binormal", "tessfactor", "positiont", "color" }; + +static const char *tex_type[] = { "", "1d", "2d", "cube", "volume" }; + +static int add_modifier(char *buffer, DWORD param) +{ + char *buf = buffer; + DWORD dst_mod = param & D3DSP_DSTMOD_MASK; + + if (dst_mod & D3DSPDM_SATURATE) + buf += sprintf(buf, "_sat"); + if (dst_mod & D3DSPDM_PARTIALPRECISION) + buf += sprintf(buf, "_pp"); + if (dst_mod & D3DSPDM_MSAMPCENTROID) + buf += sprintf(buf, "_centroid"); + + return buf - buffer; +} + +static int add_register(char *buffer, DWORD param, BOOL dst, BOOL ps) +{ + char *buf = buffer; + DWORD reg_type = ((param & D3DSP_REGTYPE_MASK2) >> D3DSP_REGTYPE_SHIFT2) + | ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT); + DWORD reg_num = param & D3DSP_REGNUM_MASK; + + if (reg_type == D3DSPR_INPUT) + buf += sprintf(buf, "v%d", reg_num); + else if (reg_type == D3DSPR_CONST) + buf += sprintf(buf, "c%d", reg_num); + else if (reg_type == D3DSPR_TEMP) + buf += sprintf(buf, "r%d", reg_num); + else if (reg_type == D3DSPR_ADDR) + buf += sprintf(buf, "%s%d", ps ? "t" : "a", reg_num); + else if (reg_type == D3DSPR_SAMPLER) + buf += sprintf(buf, "s%d", reg_num); + else if (reg_type == D3DSPR_RASTOUT) + buf += sprintf(buf, "oPos"); + else if (reg_type == D3DSPR_COLOROUT) + buf += sprintf(buf, "oC%d", reg_num); + else if (reg_type == D3DSPR_TEXCRDOUT) + buf += sprintf(buf, "oT%d", reg_num); + else if (reg_type == D3DSPR_ATTROUT) + buf += sprintf(buf, "oD%d", reg_num); + else + buf += sprintf(buf, "? (%d)", reg_type); + + if (dst) + { + if ((param & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) + { + buf += sprintf(buf, ".%s%s%s%s", param & D3DSP_WRITEMASK_0 ? "x" : "", + param & D3DSP_WRITEMASK_1 ? "y" : "", + param & D3DSP_WRITEMASK_2 ? "z" : "", + param & D3DSP_WRITEMASK_3 ? "w" : ""); + } + } + else + { + if ((param & D3DVS_SWIZZLE_MASK) != D3DVS_NOSWIZZLE) + { + if ( ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_X | D3DVS_Y_X | D3DVS_Z_X | D3DVS_W_X)) || + ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Y | D3DVS_Y_Y | D3DVS_Z_Y | D3DVS_W_Y)) || + ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_Z | D3DVS_Y_Z | D3DVS_Z_Z | D3DVS_W_Z)) || + ((param & D3DSP_SWIZZLE_MASK) == (D3DVS_X_W | D3DVS_Y_W | D3DVS_Z_W | D3DVS_W_W)) ) + buf += sprintf(buf, ".%c", 'w' + (((param >> D3DVS_SWIZZLE_SHIFT) + 1) & 0x3)); + else + buf += sprintf(buf, ".%c%c%c%c", 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+0)) + 1) & 0x3), + 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+2)) + 1) & 0x3), + 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+4)) + 1) & 0x3), + 'w' + (((param >> (D3DVS_SWIZZLE_SHIFT+6)) + 1) & 0x3)); + } + } + + return buf - buffer; +} + HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const char *comments, ID3DXBuffer **disassembly) { - FIXME("%p %d %s %p: stub\n", shader, colorcode, debugstr_a(comments), disassembly); - return E_OUTOFMEMORY; + DWORD *ptr = (DWORD *)shader; + char *buffer, *buf; + UINT capacity = 4096; + BOOL ps; + HRESULT hr; + + TRACE("%p %d %s %p\n", shader, colorcode, debugstr_a(comments), disassembly); + + if (!shader || !disassembly) + return D3DERR_INVALIDCALL; + + buf = buffer = HeapAlloc(GetProcessHeap(), 0, capacity); + if (!buffer) + return E_OUTOFMEMORY; + + ps = (*ptr >> 16) & 1; + buf += sprintf(buf, " %s_%d_%d\n", ps ? "ps" : "vs", D3DSHADER_VERSION_MAJOR(*ptr), D3DSHADER_VERSION_MINOR(*ptr)); + ptr++; + + while (*ptr != D3DSIO_END) + { + if ((buf - buffer + 128) > capacity) + { + UINT count = buf - buffer; + char *new_buffer = HeapReAlloc(GetProcessHeap(), 0, buffer, capacity * 2); + if (!new_buffer) + { + HeapFree(GetProcessHeap(), 0, buffer); + return E_OUTOFMEMORY; + } + capacity *= 2; + buffer = new_buffer; + buf = buffer + count; + } + + if ((*ptr & D3DSI_OPCODE_MASK) == D3DSIO_COMMENT) + { + ptr += 1 + ((*ptr & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT); + } + else if ((*ptr & D3DSI_OPCODE_MASK) == D3DSIO_DEF) + { + buf += sprintf(buf, " def c%d, %g, %g, %g, %g\n", *(ptr+1) & D3DSP_REGNUM_MASK, + (double)*(float*)(ptr+2), (double)*(float*)(ptr+3), + (double)*(float*)(ptr+4), (double)*(float*)(ptr+5)); + ptr += 6; + } + else if ((*ptr & D3DSI_OPCODE_MASK) == D3DSIO_DCL) + { + DWORD param1 = *++ptr; + DWORD param2 = *++ptr; + DWORD usage = (param1 & D3DSP_DCL_USAGE_MASK) >> D3DSP_DCL_USAGE_SHIFT; + DWORD usage_index = (param1 & D3DSP_DCL_USAGEINDEX_MASK) >> D3DSP_DCL_USAGEINDEX_SHIFT; + + buf += sprintf(buf, " dcl"); + if (ps) + { + if (param1 & D3DSP_TEXTURETYPE_MASK) + buf += sprintf(buf, "_%s", (usage <= D3DSTT_VOLUME) ? + tex_type[(param1 & D3DSP_TEXTURETYPE_MASK) >> D3DSP_TEXTURETYPE_SHIFT] : "???"); + } + else + { + buf += sprintf(buf, "_%s", (usage <= D3DDECLUSAGE_COLOR) ? decl_usage[usage] : "???"); + if (usage_index) + buf += sprintf(buf, "%d", usage_index); + } + + buf += add_modifier(buf, param2); + buf += sprintf(buf, " "); + buf += add_register(buf, param2, TRUE, TRUE); + buf += sprintf(buf, "\n"); + ptr++; + } + else if ((*ptr & D3DSI_OPCODE_MASK) <= D3DSIO_BREAKP) + { + DWORD index = *ptr & D3DSI_OPCODE_MASK; + int j; + + if (index >= 64) + index -= 15; + buf += sprintf(buf, " %s", opcode[index].name); + ptr++; + + if (opcode[index].length) + { + buf += add_modifier(buf, *ptr); + + for (j = 0; j < opcode[index].length; j++) + { + buf += sprintf(buf, "%s ", j ? "," : ""); + + if ((j != 0) && ((*ptr & D3DSP_SRCMOD_MASK) != D3DSPSM_NONE)) + { + if ((*ptr & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) + buf += sprintf(buf, "-"); + else + buf += sprintf(buf, "*"); + } + + buf += add_register(buf, *ptr, j == 0, ps); + + if (*ptr++ & D3DVS_ADDRESSMODE_MASK) + { + buf += sprintf(buf, "["); + buf += add_register(buf, *ptr, FALSE, FALSE); + buf += sprintf(buf, "]"); + ptr++; + } + } + } + buf += sprintf(buf, "\n"); + } + else + { + buf += sprintf(buf, " ???\n"); + ptr++; + } + } + + hr = D3DXCreateBuffer(buf - buffer + 1 , disassembly); + if (SUCCEEDED(hr)) + strcpy(ID3DXBuffer_GetBufferPointer(*disassembly), buffer); + HeapFree(GetProcessHeap(), 0, buffer); + + return hr; } static const DWORD* skip_instruction(const DWORD *byte_code, UINT shader_model) @@ -2287,3 +2581,280 @@ HRESULT WINAPI D3DXGetShaderOutputSemantics(const DWORD *byte_code, D3DXSEMANTIC return D3D_OK; } + +struct d3dx9_texture_shader +{ + ID3DXTextureShader ID3DXTextureShader_iface; + LONG ref; +}; + +static inline struct d3dx9_texture_shader *impl_from_ID3DXTextureShader(ID3DXTextureShader *iface) +{ + return CONTAINING_RECORD(iface, struct d3dx9_texture_shader, ID3DXTextureShader_iface); +} + +static HRESULT WINAPI d3dx9_texture_shader_QueryInterface(ID3DXTextureShader *iface, REFIID riid, void **out) +{ + TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out); + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_ID3DXTextureShader)) + { + iface->lpVtbl->AddRef(iface); + *out = iface; + return D3D_OK; + } + + WARN("Interface %s not found.\n", debugstr_guid(riid)); + *out = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI d3dx9_texture_shader_AddRef(ID3DXTextureShader *iface) +{ + struct d3dx9_texture_shader *texture_shader = impl_from_ID3DXTextureShader(iface); + ULONG refcount = InterlockedIncrement(&texture_shader->ref); + + TRACE("%p increasing refcount to %u.\n", texture_shader, refcount); + + return refcount; +} + +static ULONG WINAPI d3dx9_texture_shader_Release(ID3DXTextureShader *iface) +{ + struct d3dx9_texture_shader *texture_shader = impl_from_ID3DXTextureShader(iface); + ULONG refcount = InterlockedDecrement(&texture_shader->ref); + + TRACE("%p decreasing refcount to %u.\n", texture_shader, refcount); + + if (!refcount) + { + HeapFree(GetProcessHeap(), 0, texture_shader); + } + + return refcount; +} + +static HRESULT WINAPI d3dx9_texture_shader_GetFunction(ID3DXTextureShader *iface, struct ID3DXBuffer **function) +{ + FIXME("iface %p, function %p stub.\n", iface, function); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_GetConstantBuffer(ID3DXTextureShader *iface, struct ID3DXBuffer **constant_buffer) +{ + FIXME("iface %p, constant_buffer %p stub.\n", iface, constant_buffer); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_GetDesc(ID3DXTextureShader *iface, D3DXCONSTANTTABLE_DESC *desc) +{ + FIXME("iface %p, desc %p stub.\n", iface, desc); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_GetConstantDesc(ID3DXTextureShader *iface, D3DXHANDLE constant, D3DXCONSTANT_DESC *constant_desc, UINT *count) +{ + FIXME("iface %p, constant %p, constant_desc %p, count %p stub.\n", iface, constant, constant_desc, count); + + return E_NOTIMPL; +} + +static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstant(ID3DXTextureShader *iface, D3DXHANDLE constant, UINT index) +{ + FIXME("iface %p, constant %p, index %u stub.\n", iface, constant, index); + + return NULL; +} + +static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstantByName(ID3DXTextureShader *iface, D3DXHANDLE constant, const char *name) +{ + FIXME("iface %p, constant %p, name %s stub.\n", iface, constant, debugstr_a(name)); + + return NULL; +} + +static D3DXHANDLE WINAPI d3dx9_texture_shader_GetConstantElement(ID3DXTextureShader *iface, D3DXHANDLE constant, UINT index) +{ + FIXME("iface %p, constant %p, index %u stub.\n", iface, constant, index); + + return NULL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetDefaults(ID3DXTextureShader *iface) +{ + FIXME("iface %p stub.\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetValue(ID3DXTextureShader *iface, D3DXHANDLE constant, const void *data, UINT bytes) +{ + FIXME("iface %p, constant %p, data %p, bytes %u stub.\n", iface, constant, data, bytes); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetBool(ID3DXTextureShader *iface, D3DXHANDLE constant, BOOL b) +{ + FIXME("iface %p, constant %p, b %u stub.\n", iface, constant, b); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetBoolArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const BOOL *b, UINT count) +{ + FIXME("iface %p, constant %p, b %p, count %u stub.\n", iface, constant, b, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetInt(ID3DXTextureShader *iface, D3DXHANDLE constant, INT n) +{ + FIXME("iface %p, constant %p, n %d stub.\n", iface, constant, n); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetIntArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const INT *n, UINT count) +{ + FIXME("iface %p, constant %p, n %p, count %u stub.\n", iface, constant, n, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetFloat(ID3DXTextureShader *iface, D3DXHANDLE constant, FLOAT f) +{ + FIXME("iface %p, constant %p, f %f stub.\n", iface, constant, f); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetFloatArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const FLOAT *f, UINT count) +{ + FIXME("iface %p, constant %p, f %p, count %u stub.\n", iface, constant, f, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetVector(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXVECTOR4 *vector) +{ + FIXME("iface %p, constant %p, vector %p stub.\n", iface, constant, vector); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetVectorArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXVECTOR4 *vector, UINT count) +{ + FIXME("iface %p, constant %p, vector %p, count %u stub.\n", iface, constant, vector, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetMatrix(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix) +{ + FIXME("iface %p, constant %p, matrix %p stub.\n", iface, constant, matrix); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetMatrixArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix, UINT count) +{ + FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetMatrixPointerArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX **matrix, UINT count) +{ + FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTranspose(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix) +{ + FIXME("iface %p, constant %p, matrix %p stub.\n", iface, constant, matrix); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTransposeArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX *matrix, UINT count) +{ + FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count); + + return E_NOTIMPL; +} + +static HRESULT WINAPI d3dx9_texture_shader_SetMatrixTransposePointerArray(ID3DXTextureShader *iface, D3DXHANDLE constant, const D3DXMATRIX **matrix, UINT count) +{ + FIXME("iface %p, constant %p, matrix %p, count %u stub.\n", iface, constant, matrix, count); + + return E_NOTIMPL; +} + +static const struct ID3DXTextureShaderVtbl d3dx9_texture_shader_vtbl = +{ + /*** IUnknown methods ***/ + d3dx9_texture_shader_QueryInterface, + d3dx9_texture_shader_AddRef, + d3dx9_texture_shader_Release, + /*** ID3DXTextureShader methods ***/ + d3dx9_texture_shader_GetFunction, + d3dx9_texture_shader_GetConstantBuffer, + d3dx9_texture_shader_GetDesc, + d3dx9_texture_shader_GetConstantDesc, + d3dx9_texture_shader_GetConstant, + d3dx9_texture_shader_GetConstantByName, + d3dx9_texture_shader_GetConstantElement, + d3dx9_texture_shader_SetDefaults, + d3dx9_texture_shader_SetValue, + d3dx9_texture_shader_SetBool, + d3dx9_texture_shader_SetBoolArray, + d3dx9_texture_shader_SetInt, + d3dx9_texture_shader_SetIntArray, + d3dx9_texture_shader_SetFloat, + d3dx9_texture_shader_SetFloatArray, + d3dx9_texture_shader_SetVector, + d3dx9_texture_shader_SetVectorArray, + d3dx9_texture_shader_SetMatrix, + d3dx9_texture_shader_SetMatrixArray, + d3dx9_texture_shader_SetMatrixPointerArray, + d3dx9_texture_shader_SetMatrixTranspose, + d3dx9_texture_shader_SetMatrixTransposeArray, + d3dx9_texture_shader_SetMatrixTransposePointerArray +}; + +HRESULT WINAPI D3DXCreateTextureShader(const DWORD *function, ID3DXTextureShader **texture_shader) +{ + struct d3dx9_texture_shader *object; + + TRACE("function %p, texture_shader %p.\n", function, texture_shader); + + if (!function || !texture_shader) + return D3DERR_INVALIDCALL; + + object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object)); + if (!object) + return E_OUTOFMEMORY; + + object->ID3DXTextureShader_iface.lpVtbl = &d3dx9_texture_shader_vtbl; + object->ref = 1; + + *texture_shader = &object->ID3DXTextureShader_iface; + + return D3D_OK; +} + +HRESULT WINAPI D3DXFillCubeTextureTX(IDirect3DCubeTexture9 *texture, ID3DXTextureShader *texture_shader) +{ + FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader); + + if (!texture || !texture_shader) + return E_POINTER; + + return D3D_OK; +} diff --git a/reactos/dll/directx/wine/d3dx9_36/surface.c b/reactos/dll/directx/wine/d3dx9_36/surface.c index 23fd13c371e..bfdb85faf4e 100644 --- a/reactos/dll/directx/wine/d3dx9_36/surface.c +++ b/reactos/dll/directx/wine/d3dx9_36/surface.c @@ -493,13 +493,10 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur memset(header, 0, sizeof(*header)); header->signature = MAKEFOURCC('D','D','S',' '); /* The signature is not really part of the DDS header */ - header->size = sizeof(*header) - sizeof(header->signature); + header->size = sizeof(*header) - FIELD_OFFSET(struct dds_header, size); header->flags = DDS_CAPS | DDS_HEIGHT | DDS_WIDTH | DDS_PIXELFORMAT; - /* Note that native does not set DDS_LINEARSIZE flag nor pitch_or_linear_size field for DXTn */ - header->flags |= (pixel_format->block_width != 1) || (pixel_format->block_height != 1) ? DDS_LINEARSIZE : DDS_PITCH; header->height = src_desc.Height; header->width = src_desc.Width; - header->pitch_or_linear_size = dst_pitch; header->caps = DDS_CAPS_TEXTURE; hr = d3dformat_to_dds_pixel_format(&header->pixel_format, src_desc.Format); if (FAILED(hr)) @@ -1593,7 +1590,6 @@ void copy_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, * Copies the source buffer to the destination buffer, performing * any necessary format conversion and color keying. * Pixels outsize the source rect are blacked out. - * Works only for ARGB formats with 1 - 4 bytes per pixel. */ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, const struct volume *src_size, const struct pixel_format_desc *src_format, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, @@ -1630,6 +1626,7 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit for (x = 0; x < min_width; x++) { if (!src_format->to_rgba && !dst_format->from_rgba + && src_format->type == dst_format->type && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4) { DWORD val; @@ -1696,7 +1693,6 @@ void convert_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pit * Copies the source buffer to the destination buffer, performing * any necessary format conversion, color keying and stretching * using a point filter. - * Works only for ARGB formats with 1 - 4 bytes per pixel. */ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, const struct volume *src_size, const struct pixel_format_desc *src_format, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, @@ -1733,6 +1729,7 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic const BYTE *src_ptr = src_row_ptr + (x * src_size->width / dst_size->width) * src_format->bytes_per_pixel; if (!src_format->to_rgba && !dst_format->from_rgba + && src_format->type == dst_format->type && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4) { DWORD val; diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 5564daf98ab..36cec293a30 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -26,7 +26,7 @@ reactos/dll/directx/wine/d3d8 # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/d3d9 # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/d3dcompiler_43 # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/d3drm # Synced to WineStaging-1.9.4 -reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.7.55 +reactos/dll/directx/wine/d3dx9_24 => 43 # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/d3dxof # Synced to WineStaging-1.7.55 reactos/dll/directx/wine/ddraw # Synced to WineStaging-1.9.4 reactos/dll/directx/wine/devenum # Synced to WineStaging-1.7.55 -- 2.17.1