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
5114507f
Commit
5114507f
authored
Mar 27, 2014
by
Stefan Dösinger
Committed by
Alexandre Julliard
Mar 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Handle LOG and LOGP in shader_hw_scalar_op.
parent
f20173e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
61 deletions
+45
-61
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+45
-61
No files found.
dlls/wined3d/arb_program_shader.c
View file @
5114507f
...
...
@@ -2497,11 +2497,36 @@ static void shader_hw_rcp(const struct wined3d_shader_instruction *ins)
shader_addline
(
buffer
,
"RCP%s %s, %s;
\n
"
,
shader_arb_get_modifier
(
ins
),
dst
,
src
);
}
static
DWORD
abs_modifier
(
DWORD
mod
,
BOOL
*
need_abs
)
{
*
need_abs
=
FALSE
;
switch
(
mod
)
{
case
WINED3DSPSM_NONE
:
return
WINED3DSPSM_ABS
;
case
WINED3DSPSM_NEG
:
return
WINED3DSPSM_ABS
;
case
WINED3DSPSM_BIAS
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_BIAS
;
case
WINED3DSPSM_BIASNEG
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_BIASNEG
;
case
WINED3DSPSM_SIGN
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_SIGN
;
case
WINED3DSPSM_SIGNNEG
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_SIGNNEG
;
case
WINED3DSPSM_COMP
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_COMP
;
case
WINED3DSPSM_X2
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_X2
;
case
WINED3DSPSM_X2NEG
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_X2NEG
;
case
WINED3DSPSM_DZ
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_DZ
;
case
WINED3DSPSM_DW
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_DW
;
case
WINED3DSPSM_ABS
:
return
WINED3DSPSM_ABS
;
case
WINED3DSPSM_ABSNEG
:
return
WINED3DSPSM_ABS
;
}
FIXME
(
"Unknown modifier %u
\n
"
,
mod
);
return
mod
;
}
static
void
shader_hw_scalar_op
(
const
struct
wined3d_shader_instruction
*
ins
)
{
struct
wined3d_shader_buffer
*
buffer
=
ins
->
ctx
->
buffer
;
const
char
*
instruction
;
struct
wined3d_shader_src_param
src0_copy
=
ins
->
src
[
0
];
BOOL
need_abs
=
FALSE
;
char
dst
[
50
];
char
src
[
50
];
...
...
@@ -2512,6 +2537,14 @@ static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins)
case
WINED3DSIH_RCP
:
instruction
=
"RCP"
;
break
;
case
WINED3DSIH_EXP
:
instruction
=
"EX2"
;
break
;
case
WINED3DSIH_EXPP
:
instruction
=
"EXP"
;
break
;
case
WINED3DSIH_LOG
:
src0_copy
.
modifiers
=
abs_modifier
(
src0_copy
.
modifiers
,
&
need_abs
);
instruction
=
"LG2"
;
break
;
case
WINED3DSIH_LOGP
:
src0_copy
.
modifiers
=
abs_modifier
(
src0_copy
.
modifiers
,
&
need_abs
);
instruction
=
"LOG"
;
break
;
default:
instruction
=
""
;
FIXME
(
"Unhandled opcode %#x
\n
"
,
ins
->
handler_idx
);
break
;
...
...
@@ -2524,7 +2557,16 @@ static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins)
shader_arb_get_dst_param
(
ins
,
&
ins
->
dst
[
0
],
dst
);
/* Destination */
shader_arb_get_src_param
(
ins
,
&
src0_copy
,
0
,
src
);
shader_addline
(
buffer
,
"%s%s %s, %s;
\n
"
,
instruction
,
shader_arb_get_modifier
(
ins
),
dst
,
src
);
if
(
need_abs
)
{
shader_addline
(
buffer
,
"ABS TA.w, %s;
\n
"
,
src
);
shader_addline
(
buffer
,
"%s%s %s, TA.w;
\n
"
,
instruction
,
shader_arb_get_modifier
(
ins
),
dst
);
}
else
{
shader_addline
(
buffer
,
"%s%s %s, %s;
\n
"
,
instruction
,
shader_arb_get_modifier
(
ins
),
dst
,
src
);
}
}
static
void
shader_hw_nrm
(
const
struct
wined3d_shader_instruction
*
ins
)
...
...
@@ -2764,64 +2806,6 @@ static void shader_hw_dsy(const struct wined3d_shader_instruction *ins)
shader_addline
(
buffer
,
"MUL%s %s, %s, ycorrection.y;
\n
"
,
shader_arb_get_modifier
(
ins
),
dst
,
dst_name
);
}
static
DWORD
abs_modifier
(
DWORD
mod
,
BOOL
*
need_abs
)
{
*
need_abs
=
FALSE
;
switch
(
mod
)
{
case
WINED3DSPSM_NONE
:
return
WINED3DSPSM_ABS
;
case
WINED3DSPSM_NEG
:
return
WINED3DSPSM_ABS
;
case
WINED3DSPSM_BIAS
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_BIAS
;
case
WINED3DSPSM_BIASNEG
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_BIASNEG
;
case
WINED3DSPSM_SIGN
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_SIGN
;
case
WINED3DSPSM_SIGNNEG
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_SIGNNEG
;
case
WINED3DSPSM_COMP
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_COMP
;
case
WINED3DSPSM_X2
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_X2
;
case
WINED3DSPSM_X2NEG
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_X2NEG
;
case
WINED3DSPSM_DZ
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_DZ
;
case
WINED3DSPSM_DW
:
*
need_abs
=
TRUE
;
return
WINED3DSPSM_DW
;
case
WINED3DSPSM_ABS
:
return
WINED3DSPSM_ABS
;
case
WINED3DSPSM_ABSNEG
:
return
WINED3DSPSM_ABS
;
}
FIXME
(
"Unknown modifier %u
\n
"
,
mod
);
return
mod
;
}
static
void
shader_hw_log
(
const
struct
wined3d_shader_instruction
*
ins
)
{
struct
wined3d_shader_buffer
*
buffer
=
ins
->
ctx
->
buffer
;
char
src0
[
50
],
dst
[
50
];
struct
wined3d_shader_src_param
src0_copy
=
ins
->
src
[
0
];
BOOL
need_abs
=
FALSE
;
const
char
*
instr
;
switch
(
ins
->
handler_idx
)
{
case
WINED3DSIH_LOG
:
instr
=
"LG2"
;
break
;
case
WINED3DSIH_LOGP
:
instr
=
"LOG"
;
break
;
default:
ERR
(
"Unexpected instruction %d
\n
"
,
ins
->
handler_idx
);
return
;
}
/* LOG and LOGP operate on the absolute value of the input */
src0_copy
.
modifiers
=
abs_modifier
(
src0_copy
.
modifiers
,
&
need_abs
);
shader_arb_get_dst_param
(
ins
,
&
ins
->
dst
[
0
],
dst
);
shader_arb_get_src_param
(
ins
,
&
src0_copy
,
0
,
src0
);
if
(
need_abs
)
{
shader_addline
(
buffer
,
"ABS TA, %s;
\n
"
,
src0
);
shader_addline
(
buffer
,
"%s%s %s, TA;
\n
"
,
instr
,
shader_arb_get_modifier
(
ins
),
dst
);
}
else
{
shader_addline
(
buffer
,
"%s%s %s, %s;
\n
"
,
instr
,
shader_arb_get_modifier
(
ins
),
dst
,
src0
);
}
}
static
void
shader_hw_pow
(
const
struct
wined3d_shader_instruction
*
ins
)
{
struct
wined3d_shader_buffer
*
buffer
=
ins
->
ctx
->
buffer
;
...
...
@@ -5246,8 +5230,8 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
/* WINED3DSIH_LABEL */
shader_hw_label
,
/* WINED3DSIH_LD */
NULL
,
/* WINED3DSIH_LIT */
shader_hw_map2gl
,
/* WINED3DSIH_LOG */
shader_hw_
log
,
/* WINED3DSIH_LOGP */
shader_hw_
log
,
/* WINED3DSIH_LOG */
shader_hw_
scalar_op
,
/* WINED3DSIH_LOGP */
shader_hw_
scalar_op
,
/* WINED3DSIH_LOOP */
shader_hw_loop
,
/* WINED3DSIH_LRP */
shader_hw_lrp
,
/* WINED3DSIH_LT */
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