4 * Copyright 2008 Stefan Dösinger
5 * Copyright 2012 Matteo Bruni for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/debug.h"
27 #include "d3dcompiler_private.h"
29 WINE_DEFAULT_DEBUG_CHANNEL
(hlsl_parser
);
33 struct hlsl_parse_ctx hlsl_ctx
;
35 void hlsl_message
(const char *fmt
, ...
)
40 compilation_message
(&hlsl_ctx.messages
, fmt
, args
);
44 static void hlsl_error
(const char *s
)
46 hlsl_message
("Line %u: %s\n", hlsl_ctx.line_no
, s
);
47 set_parse_status
(&hlsl_ctx.status
, PARSE_ERR
);
60 %token
<intval
> PRE_LINE
65 hlsl_prog: /* empty */
68 | hlsl_prog preproc_directive
72 preproc_directive: PRE_LINE STRING
74 TRACE
("Updating line information to file %s, line %u\n", debugstr_a
($2), $1);
75 hlsl_ctx.line_no
= $1 - 1;
76 d3dcompiler_free
(hlsl_ctx.source_file
);
77 hlsl_ctx.source_file
= $2;
82 struct bwriter_shader
*parse_hlsl
(enum shader_type type
, DWORD version
, const char *entrypoint
, char **messages
)
85 hlsl_ctx.source_file
= d3dcompiler_strdup
("");
86 hlsl_ctx.matrix_majority
= HLSL_COLUMN_MAJOR
;
90 d3dcompiler_free
(hlsl_ctx.source_file
);