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
27880abb
Commit
27880abb
authored
Jul 16, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
Jul 17, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Implement basic expressions parsing.
parent
604a91eb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
0 deletions
+102
-0
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+88
-0
hlsl.y
dlls/d3dcompiler_43/hlsl.y
+14
-0
utils.c
dlls/d3dcompiler_43/utils.c
+0
-0
No files found.
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
27880abb
...
...
@@ -703,6 +703,7 @@ enum hlsl_ir_node_type
HLSL_IR_CONSTANT
,
HLSL_IR_CONSTRUCTOR
,
HLSL_IR_DEREF
,
HLSL_IR_EXPR
,
HLSL_IR_FUNCTION_DECL
,
};
...
...
@@ -749,6 +750,81 @@ struct hlsl_ir_function_decl
struct
list
*
body
;
};
enum
hlsl_ir_expr_op
{
HLSL_IR_UNOP_BIT_NOT
=
0
,
HLSL_IR_UNOP_LOGIC_NOT
,
HLSL_IR_UNOP_NEG
,
HLSL_IR_UNOP_ABS
,
HLSL_IR_UNOP_SIGN
,
HLSL_IR_UNOP_RCP
,
HLSL_IR_UNOP_RSQ
,
HLSL_IR_UNOP_SQRT
,
HLSL_IR_UNOP_NRM
,
HLSL_IR_UNOP_EXP2
,
HLSL_IR_UNOP_LOG2
,
HLSL_IR_UNOP_CAST
,
HLSL_IR_UNOP_FRACT
,
HLSL_IR_UNOP_SIN
,
HLSL_IR_UNOP_COS
,
HLSL_IR_UNOP_SIN_REDUCED
,
/* Reduced range [-pi, pi] */
HLSL_IR_UNOP_COS_REDUCED
,
/* Reduced range [-pi, pi] */
HLSL_IR_UNOP_DSX
,
HLSL_IR_UNOP_DSY
,
HLSL_IR_UNOP_SAT
,
HLSL_IR_BINOP_ADD
,
HLSL_IR_BINOP_SUB
,
HLSL_IR_BINOP_MUL
,
HLSL_IR_BINOP_DIV
,
HLSL_IR_BINOP_MOD
,
HLSL_IR_BINOP_LESS
,
HLSL_IR_BINOP_GREATER
,
HLSL_IR_BINOP_LEQUAL
,
HLSL_IR_BINOP_GEQUAL
,
HLSL_IR_BINOP_EQUAL
,
HLSL_IR_BINOP_NEQUAL
,
HLSL_IR_BINOP_LOGIC_AND
,
HLSL_IR_BINOP_LOGIC_OR
,
HLSL_IR_BINOP_LSHIFT
,
HLSL_IR_BINOP_RSHIFT
,
HLSL_IR_BINOP_BIT_AND
,
HLSL_IR_BINOP_BIT_OR
,
HLSL_IR_BINOP_BIT_XOR
,
HLSL_IR_BINOP_DOT
,
HLSL_IR_BINOP_CRS
,
HLSL_IR_BINOP_MIN
,
HLSL_IR_BINOP_MAX
,
HLSL_IR_BINOP_POW
,
HLSL_IR_BINOP_PREINC
,
HLSL_IR_BINOP_PREDEC
,
HLSL_IR_BINOP_POSTINC
,
HLSL_IR_BINOP_POSTDEC
,
HLSL_IR_TEROP_LERP
,
HLSL_IR_SEQUENCE
,
};
struct
hlsl_ir_expr
{
struct
hlsl_ir_node
node
;
enum
hlsl_ir_expr_op
op
;
struct
hlsl_ir_node
*
operands
[
3
];
struct
list
*
subexpressions
;
};
enum
hlsl_ir_deref_type
{
HLSL_IR_DEREF_VAR
,
...
...
@@ -861,6 +937,12 @@ void hlsl_message(const char *fmt, ...) PRINTF_ATTR(1,2) DECLSPEC_HIDDEN;
void
hlsl_report_message
(
const
char
*
filename
,
DWORD
line
,
DWORD
column
,
enum
hlsl_error_level
level
,
const
char
*
fmt
,
...)
PRINTF_ATTR
(
5
,
6
)
DECLSPEC_HIDDEN
;
static
inline
struct
hlsl_ir_expr
*
expr_from_node
(
const
struct
hlsl_ir_node
*
node
)
{
assert
(
node
->
type
==
HLSL_IR_EXPR
);
return
CONTAINING_RECORD
(
node
,
struct
hlsl_ir_expr
,
node
);
}
static
inline
struct
hlsl_ir_deref
*
deref_from_node
(
const
struct
hlsl_ir_node
*
node
)
{
assert
(
node
->
type
==
HLSL_IR_DEREF
);
...
...
@@ -890,6 +972,12 @@ 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
)
DECLSPEC_HIDDEN
;
BOOL
find_function
(
const
char
*
name
)
DECLSPEC_HIDDEN
;
unsigned
int
components_count_type
(
struct
hlsl_type
*
type
)
DECLSPEC_HIDDEN
;
struct
hlsl_ir_expr
*
new_expr
(
enum
hlsl_ir_expr_op
op
,
struct
hlsl_ir_node
**
operands
,
struct
source_location
*
loc
)
DECLSPEC_HIDDEN
;
struct
hlsl_ir_expr
*
hlsl_add
(
struct
hlsl_ir_node
*
op1
,
struct
hlsl_ir_node
*
op2
,
struct
source_location
*
loc
)
DECLSPEC_HIDDEN
;
struct
hlsl_ir_expr
*
hlsl_sub
(
struct
hlsl_ir_node
*
op1
,
struct
hlsl_ir_node
*
op2
,
struct
source_location
*
loc
)
DECLSPEC_HIDDEN
;
struct
hlsl_ir_deref
*
new_var_deref
(
struct
hlsl_ir_var
*
var
)
DECLSPEC_HIDDEN
;
void
push_scope
(
struct
hlsl_parse_ctx
*
ctx
)
DECLSPEC_HIDDEN
;
BOOL
pop_scope
(
struct
hlsl_parse_ctx
*
ctx
)
DECLSPEC_HIDDEN
;
...
...
dlls/d3dcompiler_43/hlsl.y
View file @
27880abb
...
...
@@ -944,6 +944,20 @@ add_expr: mul_expr
{
$$ = $1;
}
| add_expr '+' mul_expr
{
struct source_location loc;
set_location(&loc, &@2);
$$ = &hlsl_add($1, $3, &loc)->node;
}
| add_expr '-' mul_expr
{
struct source_location loc;
set_location(&loc, &@2);
$$ = &hlsl_sub($1, $3, &loc)->node;
}
shift_expr: add_expr
{
...
...
dlls/d3dcompiler_43/utils.c
View file @
27880abb
This diff is collapsed.
Click to expand it.
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