vertexdeclaration.c revision 589fd26cedb2b4ebbed14f2964cad03cc8ebbca2
/*
* IDirect3DVertexDeclaration9 implementation
*
* Copyright 2002-2003 Raphael Junqueira
* Jason Edmeades
*
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/*
* Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Sun elects to use only
* the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
* a choice of LGPL license versions is made available with the language indicating
* that LGPLv2 or any later version may be used, or where a choice of which version
* of the LGPL is applied is otherwise unspecified.
*/
#include "config.h"
#include "d3d9_private.h"
typedef struct _D3DDECLTYPE_INFO {
int size;
int typesize;
unsigned int offset;
(fvf & D3DFVF_LASTBETA_D3DCOLOR) ||
(fvf & D3DFVF_LASTBETA_UBYTE4));
unsigned int size;
if (has_blend_idx) num_blends--;
/* Compute declaration size */
/* convert the declaration */
if (!elements)
return D3DERR_OUTOFVIDEOMEMORY;
idx = 0;
if (has_pos) {
}
}
else {
}
idx++;
}
if (has_blend && (num_blends > 0)) {
else {
switch(num_blends) {
default:
}
}
idx++;
}
if (has_blend_idx) {
if (fvf & D3DFVF_LASTBETA_UBYTE4 ||
else if (fvf & D3DFVF_LASTBETA_D3DCOLOR)
else
idx++;
}
if (has_normal) {
idx++;
}
if (has_psize) {
idx++;
}
if (has_diffuse) {
idx++;
}
if (has_specular) {
idx++;
}
switch (numcoords) {
case D3DFVF_TEXTUREFORMAT1:
break;
case D3DFVF_TEXTUREFORMAT2:
break;
case D3DFVF_TEXTUREFORMAT3:
break;
case D3DFVF_TEXTUREFORMAT4:
break;
}
idx++;
}
/* Now compute offsets, and initialize the rest of the fields */
}
return D3D_OK;
}
/* IDirect3DVertexDeclaration9 IUnknown parts follow: */
static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_QueryInterface(LPDIRECT3DVERTEXDECLARATION9 iface, REFIID riid, LPVOID* ppobj) {
return S_OK;
}
return E_NOINTERFACE;
}
if(ref == 1) {
}
return ref;
}
/* Should not happen unless wine has a bug or the application releases references it does not own */
ERR("Destroying vdecl with ref != 0\n");
}
}
if (ref == 0) {
}
}
return ref;
}
/* IDirect3DVertexDeclaration9 Interface follow: */
static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_GetDevice(LPDIRECT3DVERTEXDECLARATION9 iface, IDirect3DDevice9** ppDevice) {
}
return hr;
}
static HRESULT WINAPI IDirect3DVertexDeclaration9Impl_GetDeclaration(LPDIRECT3DVERTEXDECLARATION9 iface, D3DVERTEXELEMENT9* pDecl, UINT* pNumElements) {
/* Passing a NULL pDecl is used to just retrieve the number of elements */
if (!pDecl) {
TRACE("NULL pDecl passed. Returning D3D_OK.\n");
return D3D_OK;
}
return D3D_OK;
}
static const IDirect3DVertexDeclaration9Vtbl Direct3DVertexDeclaration9_Vtbl =
{
/* IUnknown */
/* IDirect3DVertexDeclaration9 */
};
{
const D3DVERTEXELEMENT9* element;
UINT i;
/* Skip the END element */
--count;
if (!*wined3d_elements) {
FIXME("Memory allocation failed\n");
return D3DERR_OUTOFVIDEOMEMORY;
}
for (i = 0; i < count; ++i)
{
{
return E_FAIL;
}
(*wined3d_elements)[i].output_slot = ~0U;
}
*element_count = count;
return D3D_OK;
}
/* IDirect3DDevice9 IDirect3DVertexDeclaration9 Methods follow: */
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9EX iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) {
return D3DERR_INVALIDCALL;
}
{
return hr;
}
/* Allocate the storage for the device */
FIXME("Allocation of memory failed, returning D3DERR_OUTOFVIDEOMEMORY\n");
return D3DERR_OUTOFVIDEOMEMORY;
}
ERR("Memory allocation failed\n");
return D3DERR_OUTOFVIDEOMEMORY;
}
/* free up object */
} else {
}
return hr;
}
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9* pDecl) {
hr = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, pDeclImpl == NULL ? NULL : pDeclImpl->wineD3DVertexDeclaration);
return hr;
}
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl) {
return D3DERR_INVALIDCALL;
}
} else {
}
return hr;
}