[D3DX9_36] Revert wine staged patches

This commit is contained in:
Jérôme Gardou 2019-12-20 11:53:44 +01:00 committed by Jérôme Gardou
parent 3435c3b503
commit c530f34e79
32 changed files with 96 additions and 1012 deletions

View file

@ -20,7 +20,7 @@
@ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -226,7 +226,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -20,7 +20,7 @@
@ stdcall D3DXComputeBoundingSphere(ptr long long ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -226,7 +226,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -230,7 +230,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -230,7 +230,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -230,7 +230,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -230,7 +230,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -230,7 +230,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -227,7 +227,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -227,7 +227,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -227,7 +227,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -227,7 +227,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -227,7 +227,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -35,7 +35,7 @@ function(add_d3dx9_target __version)
set_module_type(${module} win32dll)
add_dependencies(${module} d3d_idl_headers)
target_link_libraries(${module} dxguid wine)
add_importlibs(${module} d3dcompiler_43 d3dxof d3dwine user32 ole32 gdi32 msvcrt kernel32 ntdll)
add_importlibs(${module} d3dcompiler_43 d3dxof user32 ole32 gdi32 msvcrt kernel32 ntdll)
add_pch(${module} ../d3dx9_36/precomp.h SOURCE)
add_cd_file(TARGET ${module} DESTINATION reactos/system32 FOR all)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -229,7 +229,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -121,8 +121,6 @@ HRESULT load_volume_from_dds(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *d
const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN;
HRESULT load_volume_texture_from_dds(IDirect3DVolumeTexture9 *volume_texture, const void *src_data,
const PALETTEENTRY *palette, DWORD filter, DWORD color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN;
HRESULT save_dds_texture_to_memory(ID3DXBuffer **dst_buffer, IDirect3DBaseTexture9 *src_texture,
const PALETTEENTRY *src_palette) DECLSPEC_HIDDEN;
unsigned short float_32_to_16(const float in) DECLSPEC_HIDDEN;
float float_16_to_32(const unsigned short in) DECLSPEC_HIDDEN;
@ -406,6 +404,4 @@ struct ctab_constant {
const struct ctab_constant *d3dx_shader_get_ctab_constant(ID3DXConstantTable *iface,
D3DXHANDLE constant) DECLSPEC_HIDDEN;
HRESULT create_dummy_skin(ID3DXSkinInfo **iface) DECLSPEC_HIDDEN;
#endif /* __WINE_D3DX9_PRIVATE_H */

View file

@ -4511,9 +4511,7 @@ static HRESULT WINAPI ID3DXEffectImpl_CloneEffect(ID3DXEffect *iface,
if (!device)
return D3DERR_INVALIDCALL;
iface->lpVtbl->AddRef(iface);
*effect = iface;
return S_OK;
return E_NOTIMPL;
}
#if D3DX_SDK_VERSION >= 27

View file

@ -35,29 +35,8 @@ struct d3dx_font
HDC hdc;
HFONT hfont;
UINT tex_width;
UINT tex_height;
IDirect3DTexture9 *texture;
HBITMAP bitmap;
BYTE *bits;
};
/* Returns the smallest power of 2 which is greater than or equal to num */
static UINT make_pow2(UINT num)
{
UINT result = 1;
/* In the unlikely event somebody passes a large value, make sure we don't enter an infinite loop */
if (num >= 0x80000000)
return 0x80000000;
while (result < num)
result <<= 1;
return result;
}
static inline struct d3dx_font *impl_from_ID3DXFont(ID3DXFont *iface)
{
return CONTAINING_RECORD(iface, struct d3dx_font, ID3DXFont_iface);
@ -84,27 +63,19 @@ static HRESULT WINAPI ID3DXFontImpl_QueryInterface(ID3DXFont *iface, REFIID riid
static ULONG WINAPI ID3DXFontImpl_AddRef(ID3DXFont *iface)
{
struct d3dx_font *This = impl_from_ID3DXFont(iface);
ULONG ref = InterlockedIncrement(&This->ref);
ULONG ref=InterlockedIncrement(&This->ref);
TRACE("%p increasing refcount to %u\n", iface, ref);
return ref;
}
static ULONG WINAPI ID3DXFontImpl_Release(ID3DXFont *iface)
{
struct d3dx_font *This = impl_from_ID3DXFont(iface);
ULONG ref = InterlockedDecrement(&This->ref);
ULONG ref=InterlockedDecrement(&This->ref);
TRACE("%p decreasing refcount to %u\n", iface, ref);
if (!ref)
{
if (This->texture)
{
IDirect3DTexture9_Release(This->texture);
DeleteObject(This->bitmap);
}
if(ref==0) {
DeleteObject(This->hfont);
DeleteDC(This->hdc);
IDirect3DDevice9_Release(This->device);
@ -207,187 +178,17 @@ static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, const WCHAR *
static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite,
const char *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
{
LPWSTR stringW;
INT countW, ret = 0;
TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x\n",
FIXME("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x stub!\n",
iface, sprite, debugstr_a(string), count, wine_dbgstr_rect(rect), format, color);
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)
{
MultiByteToWideChar(CP_ACP, 0, string, count, stringW, countW);
ret = ID3DXFont_DrawTextW(iface, sprite, stringW, countW, rect, format, color);
HeapFree(GetProcessHeap(), 0, stringW);
}
return ret;
return 1;
}
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;
INT height;
TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x\n",
FIXME("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x stub!\n",
iface, sprite, debugstr_w(string), count, wine_dbgstr_rect(rect), format, color);
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)
{
if (rect)
*rect = calc_rect;
return height;
}
if (format & DT_CENTER)
{
UINT new_width = calc_rect.right - calc_rect.left;
calc_rect.left = (rect->right + rect->left - new_width) / 2;
calc_rect.right = calc_rect.left + new_width;
}
if (height && (calc_rect.left < calc_rect.right))
{
D3DLOCKED_RECT locked_rect;
D3DXVECTOR3 position;
UINT text_width, text_height;
RECT text_rect;
ID3DXSprite *target = sprite;
HRESULT hr;
int i, j;
/* Get rect position and dimensions */
position.x = calc_rect.left;
position.y = calc_rect.top;
position.z = 0;
text_width = calc_rect.right - calc_rect.left;
text_height = calc_rect.bottom - calc_rect.top;
text_rect.left = 0;
text_rect.top = 0;
text_rect.right = text_width;
text_rect.bottom = text_height;
/* We need to flush as it seems all draws in the begin/end sequence use only the latest updated texture */
if (sprite)
ID3DXSprite_Flush(sprite);
/* Extend texture and DIB section to contain text */
if ((text_width > This->tex_width) || (text_height > This->tex_height))
{
BITMAPINFOHEADER header;
if (text_width > This->tex_width)
This->tex_width = make_pow2(text_width);
if (text_height > This->tex_height)
This->tex_height = make_pow2(text_height);
if (This->texture)
{
IDirect3DTexture9_Release(This->texture);
DeleteObject(This->bitmap);
}
hr = D3DXCreateTexture(This->device, This->tex_width, This->tex_height, 1, 0,
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &This->texture);
if (FAILED(hr))
{
This->texture = NULL;
return 0;
}
header.biSize = sizeof(header);
header.biWidth = This->tex_width;
header.biHeight = -This->tex_height;
header.biPlanes = 1;
header.biBitCount = 32;
header.biCompression = BI_RGB;
header.biSizeImage = sizeof(DWORD) * This->tex_width * This->tex_height;
header.biXPelsPerMeter = 0;
header.biYPelsPerMeter = 0;
header.biClrUsed = 0;
header.biClrImportant = 0;
This->bitmap = CreateDIBSection(This->hdc, (const BITMAPINFO*)&header,
DIB_RGB_COLORS, (void**)&This->bits, NULL, 0);
if (!This->bitmap)
{
IDirect3DTexture9_Release(This->texture);
This->texture = NULL;
return 0;
}
SelectObject(This->hdc, This->bitmap);
}
if (FAILED(IDirect3DTexture9_LockRect(This->texture, 0, &locked_rect, &text_rect, D3DLOCK_DISCARD)))
return 0;
/* Clear rect */
for (i = 0; i < text_height; i++)
memset(This->bits + i * This->tex_width * sizeof(DWORD), 0,
text_width * sizeof(DWORD));
DrawTextW(This->hdc, string, count, &text_rect, format);
/* All RGB components are equal so take one as alpha and set RGB
* color to white, so it can be modulated with color parameter */
for (i = 0; i < text_height; i++)
{
DWORD *src = (DWORD *)This->bits + i * This->tex_width;
DWORD *dst = (DWORD *)((BYTE *)locked_rect.pBits + i * locked_rect.Pitch);
for (j = 0; j < text_width; j++)
{
*dst++ = (*src++ << 24) | 0xFFFFFF;
}
}
IDirect3DTexture9_UnlockRect(This->texture, 0);
if (!sprite)
{
hr = D3DXCreateSprite(This->device, &target);
if (FAILED(hr))
return 0;
ID3DXSprite_Begin(target, 0);
}
hr = target->lpVtbl->Draw(target, This->texture, &text_rect, NULL, &position, color);
if (!sprite)
{
ID3DXSprite_End(target);
ID3DXSprite_Release(target);
}
if (FAILED(hr))
return 0;
}
return height;
return 1;
}
static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(ID3DXFont *iface)
@ -500,55 +301,46 @@ HRESULT WINAPI D3DXCreateFontIndirectW(IDirect3DDevice9 *device, const D3DXFONT_
TRACE("(%p, %p, %p)\n", device, desc, font);
if (!device || !desc || !font) return D3DERR_INVALIDCALL;
if( !device || !desc || !font ) return D3DERR_INVALIDCALL;
TRACE("desc: %d %d %d %d %d %d %d %d %d %s\n", desc->Height, desc->Width, desc->Weight, desc->MipLevels, desc->Italic,
desc->CharSet, desc->OutputPrecision, desc->Quality, desc->PitchAndFamily, debugstr_w(desc->FaceName));
/* The device MUST support D3DFMT_A8R8G8B8 */
/* the device MUST support D3DFMT_A8R8G8B8 */
IDirect3DDevice9_GetDirect3D(device, &d3d);
IDirect3DDevice9_GetCreationParameters(device, &cpars);
IDirect3DDevice9_GetDisplayMode(device, 0, &mode);
hr = IDirect3D9_CheckDeviceFormat(d3d, cpars.AdapterOrdinal, cpars.DeviceType, mode.Format, 0, D3DRTYPE_TEXTURE, D3DFMT_A8R8G8B8);
if (FAILED(hr))
{
if(FAILED(hr)) {
IDirect3D9_Release(d3d);
return D3DXERR_INVALIDDATA;
}
IDirect3D9_Release(d3d);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct d3dx_font));
if (!object)
{
*font = NULL;
object = HeapAlloc(GetProcessHeap(), 0, sizeof(struct d3dx_font));
if(object==NULL) {
*font=NULL;
return E_OUTOFMEMORY;
}
object->ID3DXFont_iface.lpVtbl = &D3DXFont_Vtbl;
object->ref = 1;
object->device = device;
object->desc = *desc;
object->ref=1;
object->device=device;
object->desc=*desc;
object->hdc = CreateCompatibleDC(NULL);
if (!object->hdc)
{
if( !object->hdc ) {
HeapFree(GetProcessHeap(), 0, object);
return D3DXERR_INVALIDDATA;
}
object->hfont = CreateFontW(desc->Height, desc->Width, 0, 0, desc->Weight, desc->Italic, FALSE, FALSE, desc->CharSet,
desc->OutputPrecision, CLIP_DEFAULT_PRECIS, desc->Quality, desc->PitchAndFamily, desc->FaceName);
if (!object->hfont)
{
if( !object->hfont ) {
DeleteDC(object->hdc);
HeapFree(GetProcessHeap(), 0, object);
return D3DXERR_INVALIDDATA;
}
SelectObject(object->hdc, object->hfont);
SetTextColor(object->hdc, 0x00ffffff);
SetBkColor(object->hdc, 0x00000000);
IDirect3DDevice9_AddRef(device);
*font = &object->ID3DXFont_iface;
*font=&object->ID3DXFont_iface;
return D3D_OK;
}

View file

@ -794,34 +794,24 @@ D3DXMATRIX* WINAPI D3DXMatrixTransformation(D3DXMATRIX *pout, const D3DXVECTOR3
D3DXMatrixTranslation(&m1, -psc.x, -psc.y, -psc.z);
if ( !pscalingrotation || !pscaling )
if ( !pscalingrotation )
{
D3DXMatrixIdentity(&m2);
D3DXMatrixIdentity(&m4);
}
else
{
D3DXQUATERNION temp;
D3DXMatrixRotationQuaternion(&m4, pscalingrotation);
temp.w = pscalingrotation->w;
temp.x = -pscalingrotation->x;
temp.y = -pscalingrotation->y;
temp.z = -pscalingrotation->z;
D3DXMatrixRotationQuaternion(&m2, &temp);
D3DXMatrixInverse(&m2, NULL, &m4);
}
if ( !pscaling )
D3DXMatrixIdentity(&m3);
else
D3DXMatrixScaling(&m3, pscaling->x, pscaling->y, pscaling->z);
if ( !pscaling ) D3DXMatrixIdentity(&m3);
else D3DXMatrixScaling(&m3, pscaling->x, pscaling->y, pscaling->z);
if ( !protation )
D3DXMatrixIdentity(&m6);
else
D3DXMatrixRotationQuaternion(&m6, protation);
if ( !protation ) D3DXMatrixIdentity(&m6);
else D3DXMatrixRotationQuaternion(&m6, protation);
D3DXMatrixTranslation(&m5, psc.x - prc.x, psc.y - prc.y, psc.z - prc.z);
D3DXMatrixTranslation(&m5, psc.x - prc.x, psc.y - prc.y, psc.z - prc.z);
D3DXMatrixTranslation(&m7, prc.x + pt.x, prc.y + pt.y, prc.z + pt.z);
D3DXMatrixMultiply(&m1, &m1, &m2);
D3DXMatrixMultiply(&m1, &m1, &m3);

View file

@ -1695,7 +1695,11 @@ static HRESULT WINAPI d3dx9_mesh_OptimizeInplace(ID3DXMesh *iface, DWORD flags,
if (FAILED(hr)) goto cleanup;
} else if (flags & D3DXMESHOPT_ATTRSORT) {
if (!(flags & D3DXMESHOPT_IGNOREVERTS))
{
FIXME("D3DXMESHOPT_ATTRSORT vertex reordering not implemented.\n");
hr = E_NOTIMPL;
goto cleanup;
}
hr = iface->lpVtbl->LockAttributeBuffer(iface, 0, &attrib_buffer);
if (FAILED(hr)) goto cleanup;
@ -3328,13 +3332,6 @@ static HRESULT parse_mesh(ID3DXFileData *filedata, struct mesh_data *mesh_data,
goto end;
}
if ((provide_flags & PROVIDE_SKININFO) && !mesh_data->skin_info)
{
hr = create_dummy_skin(&mesh_data->skin_info);
if (FAILED(hr))
goto end;
}
hr = D3D_OK;
end:
@ -7189,33 +7186,6 @@ cleanup:
return hr;
}
/*************************************************************************
* D3DXOptimizeVertices (D3DX9_36.@)
*/
HRESULT WINAPI D3DXOptimizeVertices(const void *indices, UINT num_faces,
UINT num_vertices, BOOL indices_are_32bit, DWORD *vertex_remap)
{
UINT i;
FIXME("indices %p, num_faces %u, num_vertices %u, indices_are_32bit %#x, vertex_remap %p semi-stub.\n",
indices, num_faces, num_vertices, indices_are_32bit, vertex_remap);
if (!vertex_remap)
{
WARN("vertex remap pointer is NULL.\n");
return D3DERR_INVALIDCALL;
}
for (i = 0; i < num_vertices; i++)
{
vertex_remap[i] = i;
}
return D3D_OK;
}
/*************************************************************************
* D3DXOptimizeFaces (D3DX9_36.@)
*
@ -7539,24 +7509,6 @@ done:
return hr;
}
/*************************************************************************
* D3DXComputeTangent (D3DX9_36.@)
*/
HRESULT WINAPI D3DXComputeTangent(ID3DXMesh *mesh, DWORD stage_idx, DWORD tangent_idx,
DWORD binorm_idx, DWORD wrap, const DWORD *adjacency)
{
TRACE("mesh %p, stage_idx %d, tangent_idx %d, binorm_idx %d, wrap %d, adjacency %p.\n",
mesh, stage_idx, tangent_idx, binorm_idx, wrap, adjacency);
return D3DXComputeTangentFrameEx( mesh, D3DDECLUSAGE_TEXCOORD, stage_idx,
( binorm_idx == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_BINORMAL,
binorm_idx,
( tangent_idx == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_TANGENT,
tangent_idx, D3DX_DEFAULT, 0,
( wrap ? D3DXTANGENT_WRAP_UV : 0 ) | D3DXTANGENT_GENERATE_IN_PLACE | D3DXTANGENT_ORTHOGONALIZE_FROM_U,
adjacency, -1.01f, -0.01f, -1.01f, NULL, NULL);
}
/*************************************************************************
* D3DXComputeNormals (D3DX9_36.@)
*/

View file

@ -26,9 +26,11 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
#ifdef __REACTOS__
/* ReactOS FIXME: Insect */
#define fmin min
#define fmax max
#endif
enum pres_ops
{

View file

@ -1,7 +1,6 @@
/*
* Copyright 2008 Luis Busquets
* Copyright 2009 Matteo Bruni
* Copyright 2010, 2013, 2016 Christian Costa
* Copyright 2011 Travis Athougies
*
* This library is free software; you can redistribute it and/or
@ -21,7 +20,6 @@
#include "config.h"
#include "wine/port.h"
#include <stdio.h>
#include "d3dx9_private.h"
#include "d3dcommon.h"
@ -441,41 +439,6 @@ HRESULT WINAPI D3DXCompileShader(const char *data, UINT length, const D3DXMACRO
}
}
/* Filter out D3DCompile warning messages that are not present with D3DCompileShader */
if (SUCCEEDED(hr) && error_msgs && *error_msgs)
{
char *messages = ID3DXBuffer_GetBufferPointer(*error_msgs);
DWORD size = ID3DXBuffer_GetBufferSize(*error_msgs);
/* Ensure messages are null terminated for safe processing */
if (size) messages[size - 1] = 0;
while (size > 1)
{
char *prev, *next;
/* Warning has the form "warning X3206: ... implicit truncation of vector type"
but we only search for "X3206:" in case d3dcompiler_43 has localization */
prev = next = strstr(messages, "X3206:");
if (!prev) break;
/* get pointer to beginning and end of current line */
while (prev > messages && *(prev - 1) != '\n') prev--;
while (next < messages + size - 1 && *next != '\n') next++;
if (next < messages + size - 1 && *next == '\n') next++;
memmove(prev, next, messages + size - next);
size -= (next - prev);
}
/* Only return a buffer if the resulting string is not empty as some apps depend on that */
if (size <= 1)
{
ID3DXBuffer_Release(*error_msgs);
*error_msgs = NULL;
}
}
return hr;
}
@ -2177,334 +2140,10 @@ HRESULT WINAPI D3DXGetShaderSamplers(const DWORD *byte_code, const char **sample
return D3D_OK;
}
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;
}
struct instr_info
{
DWORD opcode;
const char *name;
int length;
int (*function)(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps);
WORD min_version;
WORD max_version;
};
static int instr_comment(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
{
*ptr += 1 + ((**ptr & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT);
return 0;
}
static int instr_def(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
{
int len = sprintf(buffer, " 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;
return len;
}
static int instr_dcl(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
{
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;
char *buf = buffer;
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)++;
return buf - buffer;
}
static int instr_generic(const struct instr_info *info, DWORD **ptr, char *buffer, BOOL ps)
{
char *buf = buffer;
int j;
buf += sprintf(buf, " %s", info->name);
(*ptr)++;
if (info->length)
{
buf += add_modifier(buf, **ptr);
for (j = 0; j < info->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");
return buf - buffer;
}
const struct instr_info instructions[] =
{
{ D3DSIO_NOP, "nop", 0, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_MOV, "mov", 2, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_ADD, "add", 3, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_SUB, "sub", 3, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_MAD, "mad", 4, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_MUL, "mul", 3, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_RCP, "rcp", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_RSQ, "rsq", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_DP3, "dp3", 3, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_DP4, "dp4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 1.2 for PS */
{ D3DSIO_MIN, "min", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_MAX, "max", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_SLT, "slt", 3, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_SGE, "sge", 3, instr_generic, 0x0100, 0xFFFF }, /* VS only */
{ D3DSIO_EXP, "exp", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_LOG, "log", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_LIT, "lit", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */
{ D3DSIO_DST, "dst", 3, instr_generic, 0x0100, 0xFFFF }, /* VS only */
{ D3DSIO_LRP, "lrp", 4, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for VS */
{ D3DSIO_FRC, "frc", 2, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_M4x4, "m4x4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_M4x3, "m4x3", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_M3x4, "m3x4", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_M3x3, "m3x3", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_M3x2, "m3x2", 3, instr_generic, 0x0100, 0xFFFF }, /* >= 2.0 for PS */
{ D3DSIO_CALL, "call", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_CALLNZ, "callnz", 2, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_LOOP, "loop", 2, instr_generic, 0x0200, 0xFFFF }, /* >= 3.0 for PS */
{ D3DSIO_RET, "ret", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_ENDLOOP, "endloop", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 3.0 for PS */
{ D3DSIO_LABEL, "label", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_DCL, "dcl", 1, instr_dcl, 0x0100, 0xFFFF },
{ D3DSIO_POW, "pow", 3, instr_generic, 0x0200, 0xFFFF },
{ D3DSIO_CRS, "crs", 3, instr_generic, 0x0200, 0xFFFF },
{ D3DSIO_SGN, "sgn", 4, instr_generic, 0x0200, 0xFFFF }, /* VS only */
{ D3DSIO_ABS, "abs", 2, instr_generic, 0x0200, 0xFFFF },
{ D3DSIO_NRM, "nrm", 2, instr_generic, 0x0200, 0xFFFF },
{ D3DSIO_SINCOS, "sincos", 4, instr_generic, 0x0200, 0x02FF },
{ D3DSIO_SINCOS, "sincos", 2, instr_generic, 0x0300, 0xFFFF },
{ D3DSIO_REP, "rep", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_ENDREP, "endrep", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_IF, "if", 1, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_IFC, "if_comp", 2, instr_generic, 0x0200, 0xFFFF },
{ D3DSIO_ELSE, "else", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_ENDIF, "endif", 0, instr_generic, 0x0200, 0xFFFF }, /* >= 2.a for PS */
{ D3DSIO_BREAK, "break", 0, instr_generic, 0x0201, 0xFFFF },
{ D3DSIO_BREAKC, "break_comp", 2, instr_generic, 0x0201, 0xFFFF },
{ D3DSIO_MOVA, "mova", 2, instr_generic, 0x0200, 0xFFFF }, /* VS only */
{ D3DSIO_DEFB, "defb", 2, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_DEFI, "defi", 2, instr_generic, 0x0100, 0xFFFF },
{ D3DSIO_TEXCOORD, "texcoord", 1, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXCOORD, "texcrd", 2, instr_generic, 0x0104, 0x0104 }, /* PS only */
{ D3DSIO_TEXKILL, "texkill", 1, instr_generic, 0x0100, 0xFFFF }, /* PS only */
{ D3DSIO_TEX, "tex", 1, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEX, "texld", 2, instr_generic, 0x0104, 0x0104 }, /* PS only */
{ D3DSIO_TEX, "texld", 3, instr_generic, 0x0200, 0xFFFF }, /* PS only */
{ D3DSIO_TEXBEM, "texbem", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXBEML, "texbeml", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXREG2AR, "texreg2ar", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXREG2GB, "texreg2gb", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x2PAD, "texm3x2pad", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x2TEX, "texm3x2tex", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x3PAD, "texm3x3pad", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x3TEX, "texm3x3tex", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x3DIFF, "texm3x3diff", 2, instr_generic, 0x0100, 0xFFFF }, /* PS only - Not documented */
{ D3DSIO_TEXM3x3SPEC, "texm3x3spec", 3, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x3VSPEC, "texm3x3vspec", 2, instr_generic, 0x0100, 0x0103 }, /* PS only */
{ D3DSIO_EXPP, "expp", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */
{ D3DSIO_LOGP, "logp", 2, instr_generic, 0x0100, 0xFFFF }, /* VS only */
{ D3DSIO_CND, "cnd", 4, instr_generic, 0x0100, 0x0104 }, /* PS only */
{ D3DSIO_DEF, "def", 5, instr_def, 0x0100, 0xFFFF },
{ D3DSIO_TEXREG2RGB, "texreg2rgb", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */
{ D3DSIO_TEXDP3TEX, "texdp3tex", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x2DEPTH, "texm3x2depth", 2, instr_generic, 0x0103, 0x0103 }, /* PS only */
{ D3DSIO_TEXDP3, "texdp3", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */
{ D3DSIO_TEXM3x3, "texm3x3", 2, instr_generic, 0x0102, 0x0103 }, /* PS only */
{ D3DSIO_TEXDEPTH, "texdepth", 1, instr_generic, 0x0104, 0x0104 }, /* PS only */
{ D3DSIO_CMP, "cmp", 4, instr_generic, 0x0102, 0xFFFF }, /* PS only */
{ D3DSIO_BEM, "bem", 3, instr_generic, 0x0104, 0x0104 }, /* PS only */
{ D3DSIO_DP2ADD, "dp2add", 4, instr_generic, 0x0200, 0xFFFF }, /* PS only */
{ D3DSIO_DSX, "dsx", 2, instr_generic, 0x0201, 0xFFFF }, /* PS only */
{ D3DSIO_DSY, "dsy", 2, instr_generic, 0x0201, 0xFFFF }, /* PS only */
{ D3DSIO_TEXLDD, "texldd", 5, instr_generic, 0x0201, 0xFFFF }, /* PS only - not existing for 2.b */
{ D3DSIO_SETP, "setp_comp", 3, instr_generic, 0x0201, 0xFFFF },
{ D3DSIO_TEXLDL, "texldl", 3, instr_generic, 0x0300, 0xFFFF },
{ D3DSIO_BREAKP, "breakp", 1, instr_generic, 0x0201, 0xFFFF },
{ D3DSIO_PHASE, "phase", 0, instr_generic, 0x0104, 0x0104 }, /* PS only */
{ D3DSIO_COMMENT, "", 0, instr_comment, 0x0100, 0xFFFF }
};
HRESULT WINAPI D3DXDisassembleShader(const DWORD *shader, BOOL colorcode, const char *comments, ID3DXBuffer **disassembly)
{
DWORD *ptr = (DWORD *)shader;
char *buffer, *buf;
UINT capacity = 4096;
BOOL ps;
WORD version;
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;
version = *ptr & 0xFFFF;
buf += sprintf(buf, " %s_%d_%d\n", ps ? "ps" : "vs", D3DSHADER_VERSION_MAJOR(*ptr), D3DSHADER_VERSION_MINOR(*ptr));
ptr++;
while (*ptr != D3DSIO_END)
{
DWORD index;
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;
}
for (index = 0; index < sizeof(instructions)/sizeof(instructions[0]); index++)
if (((*ptr & D3DSI_OPCODE_MASK) == instructions[index].opcode) &&
(version >= instructions[index].min_version) && (version <= instructions[index].max_version))
break;
if (index != sizeof(instructions)/sizeof(instructions[0]))
{
buf += instructions[index].function(&(instructions[index]), &ptr, buf, ps);
}
else
{
buf += sprintf(buf, " ??? (Unknown opcode %x)\n", *ptr);
while (*++ptr & (1u << 31));
}
}
hr = D3DXCreateBuffer(buf - buffer + 1 , disassembly);
if (SUCCEEDED(hr))
strcpy(ID3DXBuffer_GetBufferPointer(*disassembly), buffer);
HeapFree(GetProcessHeap(), 0, buffer);
return hr;
FIXME("%p %d %s %p: stub\n", shader, colorcode, debugstr_a(comments), disassembly);
return E_OUTOFMEMORY;
}
struct d3dx9_texture_shader

View file

@ -2,7 +2,6 @@
* Skin Info operations specific to D3DX9.
*
* Copyright (C) 2011 Dylan Smith
* Copyright (C) 2013 Christian Costa
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -95,7 +94,7 @@ static ULONG WINAPI d3dx9_skin_info_Release(ID3DXSkinInfo *iface)
HeapFree(GetProcessHeap(), 0, skin->bones[i].vertices);
HeapFree(GetProcessHeap(), 0, skin->bones[i].weights);
}
if (skin->bones) HeapFree(GetProcessHeap(), 0, skin->bones);
HeapFree(GetProcessHeap(), 0, skin->bones);
HeapFree(GetProcessHeap(), 0, skin);
}
@ -378,89 +377,10 @@ static HRESULT WINAPI d3dx9_skin_info_GetDeclaration(ID3DXSkinInfo *iface,
static HRESULT WINAPI d3dx9_skin_info_UpdateSkinnedMesh(ID3DXSkinInfo *iface, const D3DXMATRIX *bone_transforms,
const D3DXMATRIX *bone_inv_transpose_transforms, const void *src_vertices, void *dst_vertices)
{
struct d3dx9_skin_info *skin = impl_from_ID3DXSkinInfo(iface);
DWORD size = D3DXGetFVFVertexSize(skin->fvf);
DWORD i, j;
FIXME("iface %p, bone_transforms %p, bone_inv_transpose_transforms %p, src_vertices %p, dst_vertices %p stub!\n",
iface, bone_transforms, bone_inv_transpose_transforms, src_vertices, dst_vertices);
TRACE("iface %p, bone_transforms %p, bone_inv_transpose_transforms %p, src_vertices %p, dst_vertices %p\n",
skin, bone_transforms, bone_inv_transpose_transforms, src_vertices, dst_vertices);
if (bone_inv_transpose_transforms)
FIXME("Skinning vertices with two position elements not supported\n");
if ((skin->fvf & D3DFVF_POSITION_MASK) != D3DFVF_XYZ) {
FIXME("Vertex type %#x not supported\n", skin->fvf & D3DFVF_POSITION_MASK);
return E_FAIL;
}
/* Reset all positions */
for (i = 0; i < skin->num_vertices; i++) {
D3DXVECTOR3 *position = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i);
position->x = 0.0f;
position->y = 0.0f;
position->z = 0.0f;
}
/* Update positions that are influenced by bones */
for (i = 0; i < skin->num_bones; i++) {
D3DXMATRIX bone_inverse, matrix;
D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
D3DXMatrixMultiply(&matrix, &bone_transforms[i], &bone_inverse);
D3DXMatrixMultiply(&matrix, &matrix, &skin->bones[i].transform);
for (j = 0; j < skin->bones[i].num_influences; j++) {
D3DXVECTOR3 position;
D3DXVECTOR3 *position_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j]);
D3DXVECTOR3 *position_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j]);
FLOAT weight = skin->bones[i].weights[j];
D3DXVec3TransformCoord(&position, position_src, &matrix);
position_dest->x += weight * position.x;
position_dest->y += weight * position.y;
position_dest->z += weight * position.z;
}
}
if (skin->fvf & D3DFVF_NORMAL) {
/* Reset all normals */
for (i = 0; i < skin->num_vertices; i++) {
D3DXVECTOR3 *normal = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * i + sizeof(D3DXVECTOR3));
normal->x = 0.0f;
normal->y = 0.0f;
normal->z = 0.0f;
}
/* Update normals that are influenced by bones */
for (i = 0; i < skin->num_bones; i++) {
D3DXMATRIX bone_inverse, matrix;
D3DXMatrixInverse(&bone_inverse, NULL, &skin->bones[i].transform);
D3DXMatrixMultiply(&matrix, &skin->bones[i].transform, &bone_transforms[i]);
for (j = 0; j < skin->bones[i].num_influences; j++) {
D3DXVECTOR3 normal;
D3DXVECTOR3 *normal_src = (D3DXVECTOR3*)((BYTE*)src_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + size * skin->bones[i].vertices[j] + sizeof(D3DXVECTOR3));
FLOAT weight = skin->bones[i].weights[j];
D3DXVec3TransformNormal(&normal, normal_src, &bone_inverse);
D3DXVec3TransformNormal(&normal, &normal, &matrix);
normal_dest->x += weight * normal.x;
normal_dest->y += weight * normal.y;
normal_dest->z += weight * normal.z;
}
}
/* Normalize all normals that are influenced by bones*/
for (i = 0; i < skin->num_vertices; i++) {
D3DXVECTOR3 *normal_dest = (D3DXVECTOR3*)((BYTE*)dst_vertices + (i * size) + sizeof(D3DXVECTOR3));
if ((normal_dest->x != 0.0f) && (normal_dest->y != 0.0f) && (normal_dest->z != 0.0f))
D3DXVec3Normalize(normal_dest, normal_dest);
}
}
return D3D_OK;
return E_NOTIMPL;
}
static HRESULT WINAPI d3dx9_skin_info_ConvertToBlendedMesh(ID3DXSkinInfo *iface, ID3DXMesh *mesh_in,
@ -575,23 +495,3 @@ HRESULT WINAPI D3DXCreateSkinInfoFVF(DWORD num_vertices, DWORD fvf, DWORD num_bo
return D3DXCreateSkinInfo(num_vertices, declaration, num_bones, skin_info);
}
HRESULT create_dummy_skin(ID3DXSkinInfo **iface)
{
static const D3DVERTEXELEMENT9 empty_declaration = D3DDECL_END();
struct d3dx9_skin_info *object = NULL;
object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
if (!object) return E_OUTOFMEMORY;
object->ID3DXSkinInfo_iface.lpVtbl = &d3dx9_skin_info_vtbl;
object->ref = 1;
object->num_vertices = 0;
object->num_bones = 0;
object->vertex_declaration[0] = empty_declaration;
object->fvf = 0;
object->bones = NULL;
*iface = &object->ID3DXSkinInfo_iface;
return D3D_OK;
}

View file

@ -27,8 +27,6 @@
#include "ole2.h"
#include "wincodec.h"
#include "wine/wined3d.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
@ -112,7 +110,6 @@ static const GUID *d3dformat_to_wic_guid(D3DFORMAT format)
#define DDS_PF_RGB 0x40
#define DDS_PF_YUV 0x200
#define DDS_PF_LUMINANCE 0x20000
#define DDS_PF_BUMPLUMINANCE 0x40000
#define DDS_PF_BUMPDUDV 0x80000
struct dds_pixel_format
@ -268,17 +265,6 @@ static D3DFORMAT dds_bump_to_d3dformat(const struct dds_pixel_format *pixel_form
return D3DFMT_UNKNOWN;
}
static D3DFORMAT dds_bump_luminance_to_d3dformat(const struct dds_pixel_format *pixel_format)
{
if (pixel_format->bpp == 32 && pixel_format->rmask == 0x000000ff && pixel_format->gmask == 0x0000ff00
&& pixel_format->bmask == 0x00ff0000)
return D3DFMT_X8L8V8U8;
WARN("Unknown bump pixel format (%u, %#x, %#x, %#x, %#x)\n", pixel_format->bpp,
pixel_format->rmask, pixel_format->gmask, pixel_format->bmask, pixel_format->amask);
return D3DFMT_UNKNOWN;
}
static D3DFORMAT dds_pixel_format_to_d3dformat(const struct dds_pixel_format *pixel_format)
{
TRACE("pixel_format: size %u, flags %#x, fourcc %#x, bpp %u.\n", pixel_format->size,
@ -296,8 +282,6 @@ static D3DFORMAT dds_pixel_format_to_d3dformat(const struct dds_pixel_format *pi
return dds_alpha_to_d3dformat(pixel_format);
if (pixel_format->flags & DDS_PF_BUMPDUDV)
return dds_bump_to_d3dformat(pixel_format);
if (pixel_format->flags & DDS_PF_BUMPLUMINANCE)
return dds_bump_luminance_to_d3dformat(pixel_format);
WARN("Unknown pixel format (flags %#x, fourcc %#x, bpp %u, r %#x, g %#x, b %#x, a %#x)\n",
pixel_format->flags, pixel_format->fourcc, pixel_format->bpp,
@ -328,14 +312,6 @@ static HRESULT d3dformat_to_dds_pixel_format(struct dds_pixel_format *pixel_form
}
}
/* Reuse dds_fourcc_to_d3dformat as D3DFORMAT and FOURCC are DWORD with same values */
if (dds_fourcc_to_d3dformat(d3dformat) != D3DFMT_UNKNOWN)
{
pixel_format->flags |= DDS_PF_FOURCC;
pixel_format->fourcc = d3dformat;
return D3D_OK;
}
WARN("Unknown pixel format %#x\n", d3dformat);
return E_NOTIMPL;
}
@ -544,68 +520,6 @@ static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSur
return D3D_OK;
}
static HRESULT get_surface(D3DRESOURCETYPE type, struct IDirect3DBaseTexture9 *tex,
int face, UINT level, struct IDirect3DSurface9 **surf)
{
switch (type)
{
case D3DRTYPE_TEXTURE:
return IDirect3DTexture9_GetSurfaceLevel((IDirect3DTexture9*) tex, level, surf);
case D3DRTYPE_CUBETEXTURE:
return IDirect3DCubeTexture9_GetCubeMapSurface((IDirect3DCubeTexture9*) tex, face, level, surf);
default:
ERR("Unexpected texture type\n");
return E_NOTIMPL;
}
}
HRESULT save_dds_texture_to_memory(ID3DXBuffer **dst_buffer, IDirect3DBaseTexture9 *src_texture, const PALETTEENTRY *src_palette)
{
HRESULT hr;
D3DRESOURCETYPE type;
UINT mip_levels;
IDirect3DSurface9 *surface;
type = IDirect3DBaseTexture9_GetType(src_texture);
if ((type != D3DRTYPE_TEXTURE) && (type != D3DRTYPE_CUBETEXTURE) && (type != D3DRTYPE_VOLUMETEXTURE))
return D3DERR_INVALIDCALL;
if (type == D3DRTYPE_CUBETEXTURE)
{
FIXME("Cube texture not supported yet\n");
return E_NOTIMPL;
}
else if (type == D3DRTYPE_VOLUMETEXTURE)
{
FIXME("Volume texture not supported yet\n");
return E_NOTIMPL;
}
mip_levels = IDirect3DTexture9_GetLevelCount(src_texture);
if (mip_levels > 1)
{
FIXME("Mipmap not supported yet\n");
return E_NOTIMPL;
}
if (src_palette)
{
FIXME("Saving surfaces with palettized pixel formats not implemented yet\n");
return E_NOTIMPL;
}
hr = get_surface(type, src_texture, D3DCUBEMAP_FACE_POSITIVE_X, 0, &surface);
if (SUCCEEDED(hr))
{
hr = save_dds_surface_to_memory(dst_buffer, surface, NULL);
IDirect3DSurface9_Release(surface);
}
return hr;
}
HRESULT load_volume_from_dds(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *dst_palette,
const D3DBOX *dst_box, const void *src_data, const D3DBOX *src_box, DWORD filter, D3DCOLOR color_key,
const D3DXIMAGE_INFO *src_info)
@ -973,24 +887,6 @@ HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize,
}
}
/* For 32 bpp BMP, windowscodecs.dll never returns a format with alpha while
* d3dx9_xx.dll returns one if at least 1 pixel has a non zero alpha component */
if (SUCCEEDED(hr) && (info->Format == D3DFMT_X8R8G8B8) && (info->ImageFileFormat == D3DXIFF_BMP)) {
DWORD size = sizeof(DWORD) * info->Width * info->Height;
BYTE *buffer = HeapAlloc(GetProcessHeap(), 0, size);
hr = IWICBitmapFrameDecode_CopyPixels(frame, NULL, sizeof(DWORD) * info->Width, size, buffer);
if (SUCCEEDED(hr)) {
DWORD i;
for (i = 0; i < info->Width * info->Height; i++) {
if (buffer[i*4+3]) {
info->Format = D3DFMT_A8R8G8B8;
break;
}
}
}
HeapFree(GetProcessHeap(), 0, buffer);
}
if (frame)
IWICBitmapFrameDecode_Release(frame);
@ -1819,24 +1715,6 @@ void point_filter_argb_pixels(const BYTE *src, UINT src_row_pitch, UINT src_slic
}
}
typedef BOOL (*dxtn_conversion_func)(const BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out,
enum wined3d_format_id format, unsigned int w, unsigned int h);
static dxtn_conversion_func get_dxtn_conversion_func(D3DFORMAT format, BOOL encode)
{
switch (format)
{
case D3DFMT_DXT1:
return encode ? wined3d_dxt1_encode : wined3d_dxt1_decode;
case D3DFMT_DXT3:
return encode ? wined3d_dxt3_encode : wined3d_dxt3_decode;
case D3DFMT_DXT5:
return encode ? wined3d_dxt5_encode : wined3d_dxt5_decode;
default:
return NULL;
}
}
/************************************************************
* D3DXLoadSurfaceFromMemory
*
@ -1875,14 +1753,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
DWORD filter, D3DCOLOR color_key)
{
const struct pixel_format_desc *srcformatdesc, *destformatdesc;
void *tmp_src_memory = NULL, *tmp_dst_memory = NULL;
dxtn_conversion_func pre_convert = NULL, post_convert = NULL;
IDirect3DSurface9 *surface = dst_surface;
IDirect3DDevice9 *device;
D3DSURFACE_DESC surfdesc;
D3DLOCKED_RECT lockrect;
struct volume src_size, dst_size;
HRESULT hr = D3D_OK;
HRESULT hr;
TRACE("(%p, %p, %s, %p, %#x, %u, %p, %s, %#x, 0x%08x)\n",
dst_surface, dst_palette, wine_dbgstr_rect(dst_rect), src_memory, src_format,
@ -1980,65 +1856,18 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
}
else /* Stretching or format conversion. */
{
UINT tmp_src_pitch, tmp_dst_pitch;
pre_convert = get_dxtn_conversion_func(srcformatdesc->format, FALSE);
post_convert = get_dxtn_conversion_func(destformatdesc->format, TRUE);
if ((!pre_convert && !is_conversion_from_supported(srcformatdesc)) ||
(!post_convert && !is_conversion_to_supported(destformatdesc)))
if (!is_conversion_from_supported(srcformatdesc)
|| !is_conversion_to_supported(destformatdesc))
{
FIXME("Unsupported format conversion %#x -> %#x.\n", src_format, surfdesc.Format);
hr = E_NOTIMPL;
goto done;
}
/* handle pre-conversion */
if (pre_convert)
{
tmp_src_memory = HeapAlloc(GetProcessHeap(), 0, src_size.width * src_size.height * sizeof(DWORD));
if (!tmp_src_memory)
{
hr = E_OUTOFMEMORY;
goto done;
}
tmp_src_pitch = src_size.width * sizeof(DWORD);
if (!pre_convert(src_memory, tmp_src_memory, src_pitch, tmp_src_pitch,
WINED3DFMT_B8G8R8A8_UNORM, src_size.width, src_size.height))
{
hr = E_FAIL;
goto done;
}
srcformatdesc = get_format_info(D3DFMT_A8R8G8B8);
}
else
{
tmp_src_memory = (void *)src_memory;
tmp_src_pitch = src_pitch;
}
/* handle post-conversion */
if (post_convert)
{
tmp_dst_memory = HeapAlloc(GetProcessHeap(), 0, dst_size.width * dst_size.height * sizeof(DWORD));
if (!tmp_dst_memory)
{
hr = E_OUTOFMEMORY;
goto done;
}
tmp_dst_pitch = dst_size.width * sizeof(DWORD);
destformatdesc = get_format_info(D3DFMT_A8R8G8B8);
}
else
{
tmp_dst_memory = lockrect.pBits;
tmp_dst_pitch = lockrect.Pitch;
}
if ((filter & 0xf) == D3DX_FILTER_NONE)
{
convert_argb_pixels(tmp_src_memory, tmp_src_pitch, 0, &src_size, srcformatdesc,
tmp_dst_memory, tmp_dst_pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
convert_argb_pixels(src_memory, src_pitch, 0, &src_size, srcformatdesc,
lockrect.pBits, lockrect.Pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
}
else /* if ((filter & 0xf) == D3DX_FILTER_POINT) */
{
@ -2047,22 +1876,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(IDirect3DSurface9 *dst_surface,
/* Always apply a point filter until D3DX_FILTER_LINEAR,
* D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */
point_filter_argb_pixels(tmp_src_memory, tmp_src_pitch, 0, &src_size, srcformatdesc,
tmp_dst_memory, tmp_dst_pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
}
/* handle post-conversion */
if (post_convert)
{
if (!post_convert(tmp_dst_memory, lockrect.pBits, tmp_dst_pitch, lockrect.Pitch,
WINED3DFMT_B8G8R8A8_UNORM, dst_size.width, dst_size.height))
{
hr = E_FAIL;
goto done;
}
point_filter_argb_pixels(src_memory, src_pitch, 0, &src_size, srcformatdesc,
lockrect.pBits, lockrect.Pitch, 0, &dst_size, destformatdesc, color_key, src_palette);
}
}
hr = D3D_OK;
done:
IDirect3DSurface9_UnlockRect(surface);
if (surface != dst_surface)
@ -2074,12 +1893,6 @@ done:
IDirect3DDevice9_Release(device);
}
IDirect3DSurface9_Release(surface);
if (pre_convert)
HeapFree(GetProcessHeap(), 0, tmp_src_memory);
if (post_convert)
HeapFree(GetProcessHeap(), 0, tmp_dst_memory);
IDirect3DSurface9_UnlockRect(dst_surface);
}
return hr;

View file

@ -335,10 +335,10 @@ HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UIN
if (fmt->block_width != 1 || fmt->block_height != 1)
{
if (w % fmt->block_width)
w += fmt->block_width - w % fmt->block_width;
if (h % fmt->block_height)
h += fmt->block_height - h % fmt->block_height;
if (w < fmt->block_width)
w = fmt->block_width;
if (h < fmt->block_height)
h = fmt->block_height;
}
if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w)))
@ -1892,7 +1892,10 @@ HRESULT WINAPI D3DXSaveTextureToFileInMemory(ID3DXBuffer **dst_buffer, D3DXIMAGE
if (!dst_buffer || !src_texture) return D3DERR_INVALIDCALL;
if (file_format == D3DXIFF_DDS)
return save_dds_texture_to_memory(dst_buffer, src_texture, src_palette);
{
FIXME("DDS file format isn't supported yet\n");
return E_NOTIMPL;
}
type = IDirect3DBaseTexture9_GetType(src_texture);
switch (type)

View file

@ -90,7 +90,6 @@ static const struct pixel_format_desc formats[] =
{D3DFMT_G32R32F, { 0, 32, 32, 0}, { 0, 0, 32, 0}, 8, 1, 1, 8, FORMAT_ARGBF, NULL, NULL },
{D3DFMT_A32B32G32R32F, {32, 32, 32, 32}, {96, 0, 32, 64}, 16, 1, 1, 16, FORMAT_ARGBF, NULL, NULL },
{D3DFMT_P8, { 8, 8, 8, 8}, { 0, 0, 0, 0}, 1, 1, 1, 1, FORMAT_INDEX, NULL, index_to_rgba},
{D3DFMT_X8L8V8U8, { 0, 8, 8, 8}, { 0, 0, 8, 16}, 4, 1, 1, 4, FORMAT_ARGB, NULL, NULL },
/* marks last element */
{D3DFMT_UNKNOWN, { 0, 0, 0, 0}, { 0, 0, 0, 0}, 0, 1, 1, 0, FORMAT_UNKNOWN, NULL, NULL },
};

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -229,7 +229,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -229,7 +229,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -229,7 +229,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -229,7 +229,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -229,7 +229,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -222,7 +222,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)

View file

@ -24,7 +24,7 @@
@ stdcall -stub D3DXComputeIMTFromTexture(ptr ptr long long ptr ptr ptr)
@ stdcall D3DXComputeNormalMap(ptr ptr ptr long long float)
@ stdcall D3DXComputeNormals(ptr ptr)
@ stdcall D3DXComputeTangent(ptr long long long long ptr)
@ stdcall -stub D3DXComputeTangent(ptr long long long long ptr)
@ 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)
@ -222,7 +222,7 @@
@ stdcall D3DXMatrixTranslation(ptr float float float)
@ stdcall D3DXMatrixTranspose(ptr ptr)
@ stdcall D3DXOptimizeFaces(ptr long long long ptr)
@ stdcall D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall -stub D3DXOptimizeVertices(ptr long long long ptr)
@ stdcall D3DXPlaneFromPointNormal(ptr ptr ptr)
@ stdcall D3DXPlaneFromPoints(ptr ptr ptr ptr)
@ stdcall D3DXPlaneIntersectLine(ptr ptr ptr ptr)