Commit 9400874e authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dcompiler: Always use vkd3d-shader's preprocessor.

parent 8956862e
MODULE = d3dcompiler_33.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=33
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_34.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=34
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_35.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=35
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_36.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=36
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_37.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=37
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_38.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=38
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_39.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=39
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_40.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=40
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_41.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=41
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_42.dll
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=42
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
......@@ -11,16 +11,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
......@@ -34,6 +34,7 @@ HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filena
struct shader_test {
const char *text;
const DWORD bytes[128];
BOOL todo;
};
static void dump_shader(DWORD *shader) {
......@@ -59,6 +60,7 @@ static void exec_tests(const char *name, struct shader_test tests[], unsigned in
messages = NULL;
hr = D3DAssemble(tests[i].text, strlen(tests[i].text), NULL, NULL,
NULL, D3DCOMPILE_SKIP_VALIDATION, &shader, &messages);
todo_wine_if(tests[i].todo)
ok(hr == S_OK, "Test %s, shader %u: D3DAssemble failed with error %#lx - %ld.\n", name, i, hr, hr & 0xffff);
if(messages) {
trace("D3DAssemble messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
......@@ -211,7 +213,8 @@ static void vs_1_1_test(void) {
"vs_1_1\n"
"def c12, 0, -1, -0.5, 1024\n",
{0xfffe0101, 0x00000051, 0xa00f000c, 0x00000000, 0xbf800000, 0xbf000000,
0x44800000, 0x0000ffff}
0x44800000, 0x0000ffff},
TRUE
},
{ /* shader 14: writemasks, swizzles */
"vs_1_1\n"
......@@ -759,7 +762,8 @@ static void vs_2_0_test(void) {
"defi i1, 0, 40, 30, 10\n",
{0xfffe0200, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
0x0000000a, 0x0000ffff}
0x0000000a, 0x0000ffff},
TRUE
},
{ /* shader 23 */
"vs_2_0\n"
......@@ -971,7 +975,8 @@ static void ps_2_x_test(void) {
"defi i1, 0, 40, 30, 10\n",
{0xffff0201, 0x05000030, 0xf00f0000, 0xffffffff, 0x00000001, 0x0000000a,
0x00000000, 0x05000030, 0xf00f0001, 0x00000000, 0x00000028, 0x0000001e,
0x0000000a, 0x0000ffff}
0x0000000a, 0x0000ffff},
TRUE
},
{ /* shader 2 */
"ps_2_x\n"
......@@ -1660,7 +1665,7 @@ static void d3dpreprocess_test(void)
/* NULL shader test */
messages = NULL;
hr = D3DPreprocess(test1, strlen(test1), NULL, defines, NULL, NULL, &messages);
ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
todo_wine ok(hr == E_INVALIDARG, "Got unexpected hr %#lx.\n", hr);
if (messages)
{
trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
......@@ -1671,7 +1676,7 @@ static void d3dpreprocess_test(void)
shader = NULL;
messages = NULL;
hr = D3DPreprocess(quotation_marks_test, strlen(quotation_marks_test), NULL, NULL, NULL, &shader, &messages);
todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
if (messages)
{
trace("D3DPreprocess messages:\n%s", (char *)ID3D10Blob_GetBufferPointer(messages));
......
......@@ -1620,7 +1620,8 @@ static void test_include(void)
#if D3D_COMPILER_VERSION >= 46
hr = tests[i](NULL, D3D_COMPILE_STANDARD_FILE_INCLUDE, &blob, &errors);
todo_wine_if (i != 1) ok(hr == (i == 0 ? D3DXERR_INVALIDDATA : E_FAIL), "Got unexpected hr %#lx.\n", hr);
todo_wine_if (!i)
ok(hr == (i == 0 ? D3DXERR_INVALIDDATA : E_FAIL), "Got unexpected hr %#lx.\n", hr);
ok(!blob, "Got unexpected blob.\n");
ok(!!errors, "Got unexpected errors.\n");
ID3D10Blob_Release(errors);
......
/*
* Copyright 1998 Bertho A. Stultiens (BS)
* Copyright 2002 Alexandre Julliard
*
* 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 __WPP_PRIVATE_H
#define __WPP_PRIVATE_H
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "windef.h"
/* Return value == 0 means successful execution */
extern int wpp_add_define( const char *name, const char *value );
extern void wpp_del_define( const char *name );
extern char *wpp_lookup(const char *filename, int type, const char *parent_name);
extern void *wpp_open(const char *filename, int type);
extern void wpp_close(void *file);
extern int wpp_read(void *file, char *buffer, unsigned int len);
extern void wpp_write(const char *buffer, unsigned int len);
extern int wpp_parse( const char *input, FILE *output );
struct pp_entry; /* forward */
/*
* Include logic
* A stack of files which are already included and
* are protected in the #ifndef/#endif way.
*/
typedef struct includelogicentry {
struct includelogicentry *next;
struct includelogicentry *prev;
struct pp_entry *ppp; /* The define which protects the file */
char *filename; /* The filename of the include */
} includelogicentry_t;
/*
* The arguments of a macrodefinition
*/
typedef enum {
arg_single,
arg_list
} def_arg_t;
typedef struct marg {
def_arg_t type; /* Normal or ... argument */
char *arg; /* The textual argument */
int nnl; /* Number of newlines in the text to subst */
} marg_t;
/*
* The expansiontext of a macro
*/
typedef enum {
exp_text, /* Simple text substitution */
exp_concat, /* Concat (##) operator requested */
exp_stringize, /* Stringize (#) operator requested */
exp_subst /* Substitute argument */
} def_exp_t;
typedef struct mtext {
struct mtext *next;
struct mtext *prev;
def_exp_t type;
union {
char *text;
int argidx; /* For exp_subst and exp_stringize reference */
} subst;
} mtext_t;
/*
* The define descriptor
*/
typedef enum {
def_none, /* Not-a-define; used as return value */
def_define, /* Simple defines */
def_macro, /* Macro defines */
def_special /* Special expansions like __LINE__ and __FILE__ */
} def_type_t;
typedef struct pp_entry {
struct pp_entry *next;
struct pp_entry *prev;
def_type_t type; /* Define or macro */
char *ident; /* The key */
marg_t **margs; /* Macro arguments array or NULL if none */
int nargs;
union {
mtext_t *mtext; /* The substitution sequence or NULL if none */
char *text;
} subst;
int expanding; /* Set when feeding substitution into the input */
char *filename; /* Filename where it was defined */
int linenumber; /* Linenumber where it was defined */
includelogicentry_t *iep; /* Points to the include it protects */
} pp_entry_t;
/*
* If logic
*/
#define MAXIFSTACK 64 /* If this isn't enough you should alter the source... */
typedef enum {
if_false,
if_true,
if_elif,
if_elsefalse,
if_elsetrue,
if_ignore,
if_error
} pp_if_state_t;
/*
* Trace the include files to prevent double reading.
* This save 20..30% of processing time for most stuff
* that uses complex includes.
* States:
* -1 Don't track or seen junk
* 0 New include, waiting for "#ifndef __xxx_h"
* 1 Seen #ifndef, waiting for "#define __xxx_h ..."
* 2 Seen #endif, waiting for EOF
*/
typedef struct
{
int state;
char *ppp; /* The define to be set from the #ifndef */
int ifdepth; /* The level of ifs at the #ifdef */
int seen_junk; /* Set when junk is seen */
} include_state_t;
#define SIZE_CHAR 1
#define SIZE_SHORT 2
#define SIZE_INT 3
#define SIZE_LONG 4
#define SIZE_LONGLONG 5
#define SIZE_MASK 0x00ff
#define FLAG_SIGNED 0x0100
typedef enum {
#if 0
cv_schar = SIZE_CHAR + FLAG_SIGNED,
cv_uchar = SIZE_CHAR,
cv_sshort = SIZE_SHORT + FLAG_SIGNED,
cv_ushort = SIZE_SHORT,
#endif
cv_sint = SIZE_INT + FLAG_SIGNED,
cv_uint = SIZE_INT,
cv_slong = SIZE_LONG + FLAG_SIGNED,
cv_ulong = SIZE_LONG,
cv_sll = SIZE_LONGLONG + FLAG_SIGNED,
cv_ull = SIZE_LONGLONG
} ctype_t;
typedef struct cval {
ctype_t type;
union {
#if 0
signed char sc; /* Explicitly signed because compilers are stupid */
unsigned char uc;
short ss;
unsigned short us;
#endif
int si;
unsigned int ui;
long sl;
unsigned long ul;
__int64 sll;
unsigned __int64 ull;
} val;
} cval_t;
void *pp_xmalloc(size_t);
void *pp_xrealloc(void *, size_t);
char *pp_xstrdup(const char *str);
pp_entry_t *pplookup(const char *ident);
int pp_push_define_state(void);
void pp_pop_define_state(void);
pp_entry_t *pp_add_define(const char *def, const char *text);
pp_entry_t *pp_add_macro(char *ident, marg_t *args[], int nargs, mtext_t *exp);
void pp_del_define(const char *name);
void *pp_open_include(const char *name, int type, const char *parent_name, char **newpath);
void pp_push_if(pp_if_state_t s);
void pp_next_if_state(int);
pp_if_state_t pp_pop_if(void);
pp_if_state_t pp_if_state(void);
int pp_get_if_depth(void);
#ifndef __GNUC__
#define __attribute__(x) /*nothing*/
#endif
extern const struct wpp_callbacks *wpp_callbacks;
int WINAPIV ppy_error(const char *s, ...) __attribute__((format (printf, 1, 2)));
int WINAPIV ppy_warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
void WINAPIV pp_internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4)));
/* current preprocessor state */
/* everything is in this structure to avoid polluting the global symbol space */
struct pp_status
{
char *input; /* current input file name */
void *file; /* current input file descriptor */
int line_number; /* current line number */
int char_number; /* current char number in line */
int state; /* current error state */
int pedantic; /* pedantic option */
};
extern struct pp_status pp_status;
extern include_state_t pp_incl_state;
extern includelogicentry_t *pp_includelogiclist;
/*
* From ppl.l
*/
extern FILE *ppy_out;
extern char *ppy_text;
int ppy_lex(void);
int ppy_lex_destroy(void);
void pp_do_include(char *fname, int type);
void pp_push_ignore_state(void);
void pp_pop_ignore_state(void);
void WINAPIV pp_writestring(const char *format, ...) __attribute__((format (printf, 1, 2)));
/*
* From ppy.y
*/
int ppy_parse(void);
#endif /* __WPP_PRIVATE_H */
MODULE = d3dcompiler_46.dll
IMPORTLIB = d3dcompiler_46
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=46
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -12,16 +12,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
MODULE = d3dcompiler_47.dll
IMPORTLIB = d3dcompiler
IMPORTS = wined3d dxguid uuid
IMPORTS = wined3d
EXTRADEFS = -DD3D_COMPILER_VERSION=47
PARENTSRC = ../d3dcompiler_43
EXTRAINCL = $(VKD3D_PE_CFLAGS)
......@@ -12,16 +12,13 @@ C_SRCS = \
blob.c \
bytecodewriter.c \
compiler.c \
preproc.c \
reflection.c \
utils.c
LEX_SRCS = \
asmshader.l \
ppl.l
asmshader.l
BISON_SRCS = \
asmshader.y \
ppy.y
asmshader.y
RC_SRCS = version.rc
......@@ -259,7 +259,7 @@ static void assembleshader_test(void)
messages = NULL;
hr = D3DXAssembleShader(testshader2, strlen(testshader2), NULL, &include.ID3DXInclude_iface,
D3DXSHADER_SKIPVALIDATION, &shader, &messages);
ok(hr == D3D_OK, "D3DXAssembleShader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
todo_wine ok(hr == D3D_OK, "D3DXAssembleShader test failed with error 0x%x - %d\n", hr, hr & 0x0000FFFF);
if(messages) {
trace("recursive D3DXAssembleShader messages:\n%s", (char *)ID3DXBuffer_GetBufferPointer(messages));
ID3DXBuffer_Release(messages);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment