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
8f60f8f3
Commit
8f60f8f3
authored
Sep 19, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
Sep 19, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Store data types in a RB tree for faster search.
parent
79c6ce0a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
10 deletions
+51
-10
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+2
-2
hlsl.y
dlls/d3dcompiler_43/hlsl.y
+2
-1
utils.c
dlls/d3dcompiler_43/utils.c
+47
-7
No files found.
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
8f60f8f3
...
@@ -662,7 +662,7 @@ enum hlsl_matrix_majority
...
@@ -662,7 +662,7 @@ enum hlsl_matrix_majority
struct
hlsl_type
struct
hlsl_type
{
{
struct
list
entry
;
struct
list
entry
;
struct
list
scope_entry
;
struct
wine_rb_entry
scope_entry
;
enum
hlsl_type_class
type
;
enum
hlsl_type_class
type
;
enum
hlsl_base_type
base_type
;
enum
hlsl_base_type
base_type
;
enum
hlsl_sampler_dim
sampler_dim
;
enum
hlsl_sampler_dim
sampler_dim
;
...
@@ -924,7 +924,7 @@ struct hlsl_scope
...
@@ -924,7 +924,7 @@ struct hlsl_scope
{
{
struct
list
entry
;
struct
list
entry
;
struct
list
vars
;
struct
list
vars
;
struct
list
types
;
struct
wine_rb_tree
types
;
struct
hlsl_scope
*
upper
;
struct
hlsl_scope
*
upper
;
};
};
...
...
dlls/d3dcompiler_43/hlsl.y
View file @
8f60f8f3
...
@@ -180,7 +180,7 @@ BOOL add_type_to_scope(struct hlsl_scope *scope, struct hlsl_type *def)
...
@@ -180,7 +180,7 @@ BOOL add_type_to_scope(struct hlsl_scope *scope, struct hlsl_type *def)
if (get_type(scope, def->name, FALSE))
if (get_type(scope, def->name, FALSE))
return FALSE;
return FALSE;
list_add_tail(&scope->types
, &def->scope_entry);
wine_rb_put(&scope->types, def->name
, &def->scope_entry);
return TRUE;
return TRUE;
}
}
...
@@ -1658,6 +1658,7 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino
...
@@ -1658,6 +1658,7 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino
{
{
free_declaration(var);
free_declaration(var);
}
}
wine_rb_destroy(&scope->types, NULL, NULL);
d3dcompiler_free(scope);
d3dcompiler_free(scope);
}
}
...
...
dlls/d3dcompiler_43/utils.c
View file @
8f60f8f3
...
@@ -860,13 +860,10 @@ struct hlsl_type *new_array_type(struct hlsl_type *basic_type, unsigned int arra
...
@@ -860,13 +860,10 @@ struct hlsl_type *new_array_type(struct hlsl_type *basic_type, unsigned int arra
struct
hlsl_type
*
get_type
(
struct
hlsl_scope
*
scope
,
const
char
*
name
,
BOOL
recursive
)
struct
hlsl_type
*
get_type
(
struct
hlsl_scope
*
scope
,
const
char
*
name
,
BOOL
recursive
)
{
{
struct
hlsl_type
*
type
;
struct
wine_rb_entry
*
entry
=
wine_rb_get
(
&
scope
->
types
,
name
);
if
(
entry
)
return
WINE_RB_ENTRY_VALUE
(
entry
,
struct
hlsl_type
,
scope_entry
);
LIST_FOR_EACH_ENTRY
(
type
,
&
scope
->
types
,
struct
hlsl_type
,
scope_entry
)
{
if
(
strcmp
(
type
->
name
,
name
)
==
0
)
return
type
;
}
if
(
recursive
&&
scope
->
upper
)
if
(
recursive
&&
scope
->
upper
)
return
get_type
(
scope
->
upper
,
name
,
recursive
);
return
get_type
(
scope
->
upper
,
name
,
recursive
);
return
NULL
;
return
NULL
;
...
@@ -1599,6 +1596,44 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig
...
@@ -1599,6 +1596,44 @@ struct hlsl_ir_node *make_assignment(struct hlsl_ir_node *left, enum parse_assig
return
&
assign
->
node
;
return
&
assign
->
node
;
}
}
int
compare_hlsl_types_rb
(
const
void
*
key
,
const
struct
wine_rb_entry
*
entry
)
{
const
char
*
name
=
(
const
char
*
)
key
;
const
struct
hlsl_type
*
type
=
WINE_RB_ENTRY_VALUE
(
entry
,
const
struct
hlsl_type
,
scope_entry
);
if
(
name
==
type
->
name
)
return
0
;
if
(
!
name
||
!
type
->
name
)
{
ERR
(
"hlsl_type without a name in a scope?
\n
"
);
return
-
1
;
}
return
strcmp
(
name
,
type
->
name
);
}
static
inline
void
*
d3dcompiler_alloc_rb
(
size_t
size
)
{
return
d3dcompiler_alloc
(
size
);
}
static
inline
void
*
d3dcompiler_realloc_rb
(
void
*
ptr
,
size_t
size
)
{
return
d3dcompiler_realloc
(
ptr
,
size
);
}
static
inline
void
d3dcompiler_free_rb
(
void
*
ptr
)
{
d3dcompiler_free
(
ptr
);
}
static
const
struct
wine_rb_functions
hlsl_type_rb_funcs
=
{
d3dcompiler_alloc_rb
,
d3dcompiler_realloc_rb
,
d3dcompiler_free_rb
,
compare_hlsl_types_rb
,
};
void
push_scope
(
struct
hlsl_parse_ctx
*
ctx
)
void
push_scope
(
struct
hlsl_parse_ctx
*
ctx
)
{
{
struct
hlsl_scope
*
new_scope
=
d3dcompiler_alloc
(
sizeof
(
*
new_scope
));
struct
hlsl_scope
*
new_scope
=
d3dcompiler_alloc
(
sizeof
(
*
new_scope
));
...
@@ -1610,7 +1645,12 @@ void push_scope(struct hlsl_parse_ctx *ctx)
...
@@ -1610,7 +1645,12 @@ void push_scope(struct hlsl_parse_ctx *ctx)
}
}
TRACE
(
"Pushing a new scope
\n
"
);
TRACE
(
"Pushing a new scope
\n
"
);
list_init
(
&
new_scope
->
vars
);
list_init
(
&
new_scope
->
vars
);
list_init
(
&
new_scope
->
types
);
if
(
wine_rb_init
(
&
new_scope
->
types
,
&
hlsl_type_rb_funcs
)
==
-
1
)
{
ERR
(
"Failed to initialize types rbtree.
\n
"
);
d3dcompiler_free
(
new_scope
);
return
;
}
new_scope
->
upper
=
ctx
->
cur_scope
;
new_scope
->
upper
=
ctx
->
cur_scope
;
ctx
->
cur_scope
=
new_scope
;
ctx
->
cur_scope
=
new_scope
;
list_add_tail
(
&
ctx
->
scopes
,
&
new_scope
->
entry
);
list_add_tail
(
&
ctx
->
scopes
,
&
new_scope
->
entry
);
...
...
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