d3dcompiler: Add a stub parser.
This commit is contained in:
parent
47a7f7f13d
commit
949de2e520
|
@ -52,6 +52,8 @@ dlls/advapi32/svcctl_c.c
|
|||
dlls/d3dcompiler_43/asmshader.tab.c
|
||||
dlls/d3dcompiler_43/asmshader.tab.h
|
||||
dlls/d3dcompiler_43/asmshader.yy.c
|
||||
dlls/d3dcompiler_43/hlsl.tab.c
|
||||
dlls/d3dcompiler_43/hlsl.tab.h
|
||||
dlls/dispex/disp_ex.h
|
||||
dlls/dispex/disp_ex_p.c
|
||||
dlls/dxdiagn/fil_data.h
|
||||
|
|
|
@ -13,7 +13,9 @@ C_SRCS = \
|
|||
utils.c
|
||||
|
||||
LEX_SRCS = asmshader.l
|
||||
BISON_SRCS = asmshader.y
|
||||
BISON_SRCS = \
|
||||
asmshader.y \
|
||||
hlsl.y
|
||||
|
||||
RC_SRCS = version.rc
|
||||
|
||||
|
|
|
@ -490,13 +490,6 @@ HRESULT WINAPI D3DAssemble(const void *data, SIZE_T datasize, const char *filena
|
|||
return hr;
|
||||
}
|
||||
|
||||
static struct bwriter_shader *parse_hlsl_shader(const char *text, enum shader_type type, DWORD version,
|
||||
const char *entrypoint, char **messages)
|
||||
{
|
||||
FIXME("\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static HRESULT compile_shader(const char *preproc_shader, const char *target, const char *entrypoint,
|
||||
ID3DBlob **shader_blob, ID3DBlob **error_messages)
|
||||
{
|
||||
|
|
|
@ -573,6 +573,35 @@ struct bwriter_shader *SlAssembleShader(const char *text, char **messages) DECLS
|
|||
HRESULT SlWriteBytecode(const struct bwriter_shader *shader, int dxversion, DWORD **result, DWORD *size) DECLSPEC_HIDDEN;
|
||||
void SlDeleteShader(struct bwriter_shader *shader) DECLSPEC_HIDDEN;
|
||||
|
||||
enum hlsl_matrix_majority
|
||||
{
|
||||
HLSL_COLUMN_MAJOR,
|
||||
HLSL_ROW_MAJOR
|
||||
};
|
||||
|
||||
struct hlsl_parse_ctx
|
||||
{
|
||||
char *source_file;
|
||||
unsigned int line_no;
|
||||
enum parse_status status;
|
||||
struct compilation_messages messages;
|
||||
|
||||
struct hlsl_scope *cur_scope;
|
||||
struct hlsl_scope *globals;
|
||||
struct list scopes;
|
||||
|
||||
struct list types;
|
||||
struct list functions;
|
||||
|
||||
enum hlsl_matrix_majority matrix_majority;
|
||||
};
|
||||
|
||||
extern struct hlsl_parse_ctx hlsl_ctx DECLSPEC_HIDDEN;
|
||||
|
||||
void hlsl_message(const char *fmt, ...) PRINTF_ATTR(1,2) DECLSPEC_HIDDEN;
|
||||
struct bwriter_shader *parse_hlsl_shader(const char *text, enum shader_type type, DWORD version,
|
||||
const char *entrypoint, char **messages) DECLSPEC_HIDDEN;
|
||||
|
||||
#define MAKE_TAG(ch0, ch1, ch2, ch3) \
|
||||
((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
|
||||
((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* HLSL parser
|
||||
*
|
||||
* Copyright 2008 Stefan Dösinger
|
||||
* Copyright 2012 Matteo Bruni for CodeWeavers
|
||||
*
|
||||
* 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/debug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "d3dcompiler_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(hlsl_parser);
|
||||
|
||||
int hlsl_lex(void)
|
||||
{
|
||||
FIXME("Lexer.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct hlsl_parse_ctx hlsl_ctx;
|
||||
|
||||
void hlsl_message(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
compilation_message(&hlsl_ctx.messages, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static void hlsl_error(const char *s)
|
||||
{
|
||||
hlsl_message("Line %u: %s\n", hlsl_ctx.line_no, s);
|
||||
set_parse_status(&hlsl_ctx.status, PARSE_ERR);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%error-verbose
|
||||
|
||||
%union
|
||||
{
|
||||
char *name;
|
||||
INT intval;
|
||||
}
|
||||
|
||||
%token <intval> PRE_LINE
|
||||
|
||||
%token <name> STRING
|
||||
%%
|
||||
|
||||
hlsl_prog: /* empty */
|
||||
{
|
||||
}
|
||||
| hlsl_prog preproc_directive
|
||||
{
|
||||
}
|
||||
|
||||
preproc_directive: PRE_LINE STRING
|
||||
{
|
||||
TRACE("Updating line informations to file %s, line %u\n", debugstr_a($2), $1);
|
||||
hlsl_ctx.line_no = $1 - 1;
|
||||
d3dcompiler_free(hlsl_ctx.source_file);
|
||||
hlsl_ctx.source_file = $2;
|
||||
}
|
||||
|
||||
%%
|
||||
|
||||
struct bwriter_shader *parse_hlsl_shader(const char *text, enum shader_type type, DWORD version, const char *entrypoint, char **messages)
|
||||
{
|
||||
hlsl_ctx.line_no = 1;
|
||||
hlsl_ctx.matrix_majority = HLSL_COLUMN_MAJOR;
|
||||
|
||||
hlsl_parse();
|
||||
|
||||
return NULL;
|
||||
}
|
Loading…
Reference in New Issue