mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 12:49:45 +00:00
57 lines
1.6 KiB
C
57 lines
1.6 KiB
C
/*
|
|
* Copyright 2008 Luis Busquets
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* 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
|
|
*/
|
|
|
|
#include "config.h"
|
|
#include "wine/port.h"
|
|
#include "wine/debug.h"
|
|
#include "windef.h"
|
|
#include "wingdi.h"
|
|
#include "d3dx9.h"
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
|
|
|
|
UINT WINAPI D3DXGetShaderSize(const DWORD *byte_code)
|
|
{
|
|
const DWORD *ptr = byte_code;
|
|
|
|
TRACE("byte_code %p\n", byte_code);
|
|
|
|
if (!ptr) return 0;
|
|
|
|
/* Look for the END token, skipping the VERSION token */
|
|
while (*++ptr != D3DSIO_END)
|
|
{
|
|
/* Skip comments */
|
|
if ((*ptr & D3DSI_OPCODE_MASK) == D3DSIO_COMMENT)
|
|
{
|
|
ptr += ((*ptr & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT);
|
|
}
|
|
}
|
|
++ptr;
|
|
|
|
/* Return the shader size in bytes */
|
|
return (ptr - byte_code) * sizeof(*ptr);
|
|
}
|
|
|
|
DWORD WINAPI D3DXGetShaderVersion(const DWORD *byte_code)
|
|
{
|
|
TRACE("byte_code %p\n", byte_code);
|
|
|
|
return byte_code ? *byte_code : 0;
|
|
}
|