d3dx9: Implement D3DXGetShaderSize().

oldstable
Luis Busquets 2008-07-14 22:47:19 +02:00 committed by Alexandre Julliard
parent 5299795a8d
commit 9a93a49174
6 changed files with 88 additions and 2 deletions

View File

@ -9,7 +9,8 @@ IMPORTS = d3d9 d3dx8 kernel32
C_SRCS = \
d3dx9_36_main.c \
font.c \
math.c
math.c \
shader.c
RC_SRCS = version.rc

View File

@ -162,7 +162,7 @@
@ stub D3DXGetShaderInputSemantics
@ stub D3DXGetShaderOutputSemantics
@ stub D3DXGetShaderSamplers
@ stub D3DXGetShaderSize
@ stdcall D3DXGetShaderSize(ptr)
@ stub D3DXGetShaderVersion
@ stub D3DXGetVertexShaderProfile
@ stdcall D3DXIntersect(ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr) d3dx8.D3DXIntersect

View File

@ -0,0 +1,49 @@
/*
* 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);
}

View File

@ -133,6 +133,7 @@ SRCDIR_INCLUDES = \
d3dx9core.h \
d3dx9math.h \
d3dx9math.inl \
d3dx9shader.h \
d3dx9tex.h \
dbghelp.h \
dbinit.idl \

View File

@ -24,6 +24,7 @@
#include "d3d9.h"
#include "d3dx9math.h"
#include "d3dx9core.h"
#include "d3dx9shader.h"
#include "d3dx9tex.h"
#define _FACDD 0x876

View File

@ -0,0 +1,34 @@
/*
* 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
*/
#ifndef __D3DX9SHADER_H__
#define __D3DX9SHADER_H__
#include "d3dx9.h"
#ifdef __cplusplus
extern "C" {
#endif
UINT WINAPI D3DXGetShaderSize(const DWORD *byte_code);
#ifdef __cplusplus
}
#endif
#endif /* __D3DX9SHADER_H__ */