vertexdeclaration.c revision 4b9d6701570cb98fd36e209314239d104ec584d3
/*
* vertex declaration implementation
*
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2004 Jason Edmeades
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
* Copyright 2009 Henri Verbeet for CodeWeavers
*
* 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
*/
/*
* Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
* other than GPL or LGPL is available it will apply instead, Oracle 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 "wined3d_private.h"
}
/* *******************************************
IWineD3DVertexDeclaration IUnknown parts follow
******************************************* */
static HRESULT WINAPI IWineD3DVertexDeclarationImpl_QueryInterface(IWineD3DVertexDeclaration *iface, REFIID riid, LPVOID *ppobj)
{
return S_OK;
}
return E_NOINTERFACE;
}
}
if (!ref)
{
}
return ref;
}
/* *******************************************
IWineD3DVertexDeclaration parts follow
******************************************* */
static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration *iface, IUnknown** parent){
return WINED3D_OK;
}
{
{
{
case WINED3DFMT_R32G32_FLOAT:
case WINED3DFMT_R16G16_SINT:
case WINED3DFMT_R16G16_FLOAT:
return TRUE;
default:
return FALSE;
}
{
case WINED3DFMT_R32_FLOAT:
case WINED3DFMT_R32G32_FLOAT:
case WINED3DFMT_R8G8B8A8_UINT:
case WINED3DFMT_R16G16_SINT:
case WINED3DFMT_R16G16_FLOAT:
return TRUE;
default:
return FALSE;
}
case WINED3DDECLUSAGE_NORMAL:
{
return TRUE;
default:
return FALSE;
}
{
case WINED3DFMT_R32_FLOAT:
case WINED3DFMT_R32G32_FLOAT:
case WINED3DFMT_R16G16_SINT:
case WINED3DFMT_R16G16_FLOAT:
return TRUE;
default:
return FALSE;
}
case WINED3DDECLUSAGE_COLOR:
{
case WINED3DFMT_R8G8B8A8_UINT:
return TRUE;
default:
return FALSE;
}
default:
return FALSE;
}
}
static const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl =
{
/* IUnknown */
/* IWineD3DVertexDeclaration */
};
HRESULT vertexdeclaration_init(IWineD3DVertexDeclarationImpl *declaration, IWineD3DDeviceImpl *device,
{
unsigned int i;
{
for (i = 0; i < element_count; ++i)
{
}
}
declaration->elements = HeapAlloc(GetProcessHeap(), 0, sizeof(*declaration->elements) * element_count);
if (!declaration->elements)
{
ERR("Failed to allocate elements memory.\n");
return E_OUTOFMEMORY;
}
/* Do some static analysis on the elements to make reading the
* declaration more comfortable for the drawing code. */
for (i = 0; i < element_count; ++i)
{
/* Find the streams used in the declaration. The vertex buffers have
* to be loaded when drawing, but filter tesselation pseudo streams. */
if (e->input_slot >= MAX_STREAMS) continue;
if (!e->format_desc->gl_vtx_format)
{
FIXME("The application tries to use an unsupported format (%s), returning E_FAIL.\n",
return E_FAIL;
}
if (e->offset & 0x3)
{
return E_FAIL;
}
{
}
if (elements[i].format == WINED3DFMT_R16G16_FLOAT || elements[i].format == WINED3DFMT_R16G16B16A16_FLOAT)
{
}
}
return WINED3D_OK;
}