Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
40cbcabc
Commit
40cbcabc
authored
Jul 12, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
Jul 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Track the location of each lexer token.
parent
632703d8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
7 deletions
+39
-7
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+5
-2
hlsl.l
dlls/d3dcompiler_43/hlsl.l
+9
-0
hlsl.y
dlls/d3dcompiler_43/hlsl.y
+25
-5
No files found.
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
40cbcabc
...
...
@@ -705,7 +705,7 @@ struct hlsl_ir_node
enum
hlsl_ir_node_type
type
;
struct
hlsl_type
*
data_type
;
char
*
source_file
;
c
onst
c
har
*
source_file
;
unsigned
int
line
;
unsigned
int
column
;
};
...
...
@@ -823,8 +823,11 @@ struct parse_variable_def
struct
hlsl_parse_ctx
{
char
*
source_file
;
const
char
**
source_files
;
unsigned
int
source_files_count
;
const
char
*
source_file
;
unsigned
int
line_no
;
unsigned
int
column
;
enum
parse_status
status
;
struct
compilation_messages
messages
;
...
...
dlls/d3dcompiler_43/hlsl.l
View file @
40cbcabc
...
...
@@ -29,6 +29,14 @@
#include "hlsl.tab.h"
WINE_DEFAULT_DEBUG_CHANNEL(hlsl_parser);
#define YY_USER_ACTION \
do { \
hlsl_lloc.first_column = hlsl_ctx.column; \
hlsl_lloc.first_line = hlsl_ctx.line_no; \
hlsl_ctx.column += yyleng; \
} while(0);
%}
%option noyywrap nounput noinput
...
...
@@ -206,6 +214,7 @@ row_major {return KW_ROW_MAJOR; }
{WS}+ {}
{NEWLINE} {
hlsl_ctx.line_no++;
hlsl_ctx.column = 1;
}
^# {
...
...
dlls/d3dcompiler_43/hlsl.y
View file @
40cbcabc
...
...
@@ -95,7 +95,7 @@ void hlsl_report_message(const char *filename, DWORD line, DWORD column,
static void hlsl_error(const char *s)
{
hlsl_report_message(hlsl_ctx.source_file, hlsl_ctx.line_no,
1
, HLSL_LEVEL_ERROR, "%s", s);
hlsl_report_message(hlsl_ctx.source_file, hlsl_ctx.line_no,
hlsl_ctx.column
, HLSL_LEVEL_ERROR, "%s", s);
}
static void debug_dump_decl(struct hlsl_type *type, DWORD modifiers, const char *declname, unsigned int line_no)
...
...
@@ -177,6 +177,7 @@ static unsigned int components_count_expr_list(struct list *list)
%}
%locations
%error-verbose
%union
...
...
@@ -360,8 +361,19 @@ preproc_directive: PRE_LINE STRING
{
TRACE("Updating line information to file %s, line %u\n", debugstr_a($2), $1);
hlsl_ctx.line_no = $1;
d3dcompiler_free(hlsl_ctx.source_file);
hlsl_ctx.source_file = $2;
if (strcmp($2, hlsl_ctx.source_file))
{
const char **new_array;
hlsl_ctx.source_file = $2;
new_array = d3dcompiler_realloc(hlsl_ctx.source_files,
sizeof(*hlsl_ctx.source_files) * hlsl_ctx.source_files_count + 1);
if (new_array)
{
hlsl_ctx.source_files = new_array;
hlsl_ctx.source_files[hlsl_ctx.source_files_count++] = $2;
}
}
}
any_identifier: VAR_IDENTIFIER
...
...
@@ -978,11 +990,16 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino
struct hlsl_scope *scope, *next_scope;
struct hlsl_type *hlsl_type, *next_type;
struct hlsl_ir_var *var, *next_var;
unsigned int i;
hlsl_ctx.status = PARSE_SUCCESS;
hlsl_ctx.messages.size = hlsl_ctx.messages.capacity = 0;
hlsl_ctx.line_no = 1;
hlsl_ctx.line_no =
hlsl_ctx.column =
1;
hlsl_ctx.source_file = d3dcompiler_strdup("");
hlsl_ctx.source_files = d3dcompiler_alloc(sizeof(*hlsl_ctx.source_files));
if (hlsl_ctx.source_files)
hlsl_ctx.source_files[0] = hlsl_ctx.source_file;
hlsl_ctx.source_files_count = 1;
hlsl_ctx.cur_scope = NULL;
hlsl_ctx.matrix_majority = HLSL_COLUMN_MAJOR;
list_init(&hlsl_ctx.scopes);
...
...
@@ -1020,7 +1037,10 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino
d3dcompiler_free(hlsl_ctx.messages.string);
}
d3dcompiler_free(hlsl_ctx.source_file);
for (i = 0; i < hlsl_ctx.source_files_count; ++i)
d3dcompiler_free((void *)hlsl_ctx.source_files[i]);
d3dcompiler_free(hlsl_ctx.source_files);
TRACE("Freeing functions IR.\n");
LIST_FOR_EACH_ENTRY(function, &hlsl_ctx.functions, struct hlsl_ir_function_decl, node.entry)
free_function(function);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment