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
e7a9218e
Commit
e7a9218e
authored
Sep 18, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
Sep 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Declare predefined data types.
parent
05896328
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
1 deletion
+80
-1
hlsl.y
dlls/d3dcompiler_43/hlsl.y
+71
-0
utils.c
dlls/d3dcompiler_43/utils.c
+9
-1
No files found.
dlls/d3dcompiler_43/hlsl.y
View file @
e7a9218e
...
...
@@ -175,6 +175,76 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
static DWORD add_modifier(DWORD modifiers, DWORD mod, const struct YYLTYPE *loc);
BOOL add_type_to_scope(struct hlsl_scope *scope, struct hlsl_type *def)
{
if (get_type(scope, def->name, FALSE))
return FALSE;
list_add_tail(&scope->types, &def->scope_entry);
return TRUE;
}
static void declare_predefined_types(struct hlsl_scope *scope)
{
struct hlsl_type *type;
unsigned int x, y, bt;
static const char *names[] =
{
"float",
"half",
"double",
"int",
"uint",
"bool",
};
char name[10];
for (bt = 0; bt <= HLSL_TYPE_LAST_SCALAR; ++bt)
{
for (y = 1; y <= 4; ++y)
{
for (x = 1; x <= 4; ++x)
{
sprintf(name, "%s%ux%u", names[bt], x, y);
type = new_hlsl_type(d3dcompiler_strdup(name), HLSL_CLASS_MATRIX, bt, x, y);
add_type_to_scope(scope, type);
if (y == 1)
{
sprintf(name, "%s%u", names[bt], x);
type = new_hlsl_type(d3dcompiler_strdup(name), HLSL_CLASS_VECTOR, bt, x, y);
add_type_to_scope(scope, type);
if (x == 1)
{
sprintf(name, "%s", names[bt]);
type = new_hlsl_type(d3dcompiler_strdup(name), HLSL_CLASS_SCALAR, bt, x, y);
add_type_to_scope(scope, type);
}
}
}
}
}
/* DX8 effects predefined types */
type = new_hlsl_type(d3dcompiler_strdup("DWORD"), HLSL_CLASS_SCALAR, HLSL_TYPE_INT, 1, 1);
add_type_to_scope(scope, type);
type = new_hlsl_type(d3dcompiler_strdup("FLOAT"), HLSL_CLASS_SCALAR, HLSL_TYPE_FLOAT, 1, 1);
add_type_to_scope(scope, type);
type = new_hlsl_type(d3dcompiler_strdup("VECTOR"), HLSL_CLASS_VECTOR, HLSL_TYPE_FLOAT, 4, 1);
add_type_to_scope(scope, type);
type = new_hlsl_type(d3dcompiler_strdup("MATRIX"), HLSL_CLASS_MATRIX, HLSL_TYPE_FLOAT, 4, 4);
add_type_to_scope(scope, type);
type = new_hlsl_type(d3dcompiler_strdup("STRING"), HLSL_CLASS_OBJECT, HLSL_TYPE_STRING, 1, 1);
add_type_to_scope(scope, type);
type = new_hlsl_type(d3dcompiler_strdup("TEXTURE"), HLSL_CLASS_OBJECT, HLSL_TYPE_TEXTURE, 1, 1);
add_type_to_scope(scope, type);
type = new_hlsl_type(d3dcompiler_strdup("PIXELSHADER"), HLSL_CLASS_OBJECT, HLSL_TYPE_PIXELSHADER, 1, 1);
add_type_to_scope(scope, type);
type = new_hlsl_type(d3dcompiler_strdup("VERTEXSHADER"), HLSL_CLASS_OBJECT, HLSL_TYPE_VERTEXSHADER, 1, 1);
add_type_to_scope(scope, type);
}
static unsigned int components_count_expr_list(struct list *list)
{
struct hlsl_ir_node *node;
...
...
@@ -1486,6 +1556,7 @@ struct bwriter_shader *parse_hlsl(enum shader_type type, DWORD major, DWORD mino
push_scope(&hlsl_ctx);
hlsl_ctx.globals = hlsl_ctx.cur_scope;
declare_predefined_types(hlsl_ctx.globals);
hlsl_parse();
...
...
dlls/d3dcompiler_43/utils.c
View file @
e7a9218e
...
...
@@ -860,7 +860,15 @@ 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
)
{
FIXME
(
"stub.
\n
"
);
struct
hlsl_type
*
type
;
LIST_FOR_EACH_ENTRY
(
type
,
&
scope
->
types
,
struct
hlsl_type
,
scope_entry
)
{
if
(
strcmp
(
type
->
name
,
name
)
==
0
)
return
type
;
}
if
(
recursive
&&
scope
->
upper
)
return
get_type
(
scope
->
upper
,
name
,
recursive
);
return
NULL
;
}
...
...
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