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
5c3d5246
Commit
5c3d5246
authored
Dec 03, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Dec 03, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Take the resource data type into account in shader_glsl_gen_sample_code().
parent
3aa9fe6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
15 deletions
+19
-15
glsl_shader.c
dlls/wined3d/glsl_shader.c
+19
-15
No files found.
dlls/wined3d/glsl_shader.c
View file @
5c3d5246
...
...
@@ -65,6 +65,7 @@ struct glsl_sample_function
{
const
char
*
name
;
DWORD
coord_mask
;
enum
wined3d_data_type
data_type
;
};
enum
heap_node_op
...
...
@@ -1800,14 +1801,15 @@ static DWORD shader_glsl_add_dst_param(const struct wined3d_shader_instruction *
/* Append the destination part of the instruction to the buffer, return the effective write mask */
static
DWORD
shader_glsl_append_dst_ext
(
struct
wined3d_shader_buffer
*
buffer
,
const
struct
wined3d_shader_instruction
*
ins
,
const
struct
wined3d_shader_dst_param
*
dst
)
const
struct
wined3d_shader_instruction
*
ins
,
const
struct
wined3d_shader_dst_param
*
dst
,
enum
wined3d_data_type
data_type
)
{
struct
glsl_dst_param
glsl_dst
;
DWORD
mask
;
if
((
mask
=
shader_glsl_add_dst_param
(
ins
,
dst
,
&
glsl_dst
)))
{
switch
(
d
st
->
reg
.
d
ata_type
)
switch
(
data_type
)
{
case
WINED3D_DATA_FLOAT
:
shader_addline
(
buffer
,
"%s%s = %s("
,
...
...
@@ -1824,7 +1826,7 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_shader_buffer *buffer,
glsl_dst
.
reg_name
,
glsl_dst
.
mask_str
,
shift_glsl_tab
[
dst
->
shift
]);
break
;
default:
FIXME
(
"Unhandled data type %#x.
\n
"
,
d
st
->
reg
.
d
ata_type
);
FIXME
(
"Unhandled data type %#x.
\n
"
,
data_type
);
shader_addline
(
buffer
,
"%s%s = %s("
,
glsl_dst
.
reg_name
,
glsl_dst
.
mask_str
,
shift_glsl_tab
[
dst
->
shift
]);
break
;
...
...
@@ -1837,7 +1839,7 @@ static DWORD shader_glsl_append_dst_ext(struct wined3d_shader_buffer *buffer,
/* Append the destination part of the instruction to the buffer, return the effective write mask */
static
DWORD
shader_glsl_append_dst
(
struct
wined3d_shader_buffer
*
buffer
,
const
struct
wined3d_shader_instruction
*
ins
)
{
return
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]);
return
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]
,
ins
->
dst
[
0
].
reg
.
data_type
);
}
/** Process GLSL instruction modifiers */
...
...
@@ -1899,6 +1901,8 @@ static void shader_glsl_get_sample_function(const struct wined3d_shader_context
BOOL
lod
=
flags
&
WINED3D_GLSL_SAMPLE_LOD
;
BOOL
grad
=
flags
&
WINED3D_GLSL_SAMPLE_GRAD
;
sample_function
->
data_type
=
ctx
->
reg_maps
->
resource_info
[
resource_idx
].
data_type
;
/* Note that there's no such thing as a projected cube texture. */
switch
(
resource_type
)
{
...
...
@@ -2265,7 +2269,7 @@ static void PRINTF_ATTR(8, 9) shader_glsl_gen_sample_code(const struct wined3d_s
fixup
=
COLOR_FIXUP_IDENTITY
;
/* FIXME: Vshader color fixup */
}
shader_glsl_append_dst
(
ins
->
ctx
->
buffer
,
ins
);
shader_glsl_append_dst
_ext
(
ins
->
ctx
->
buffer
,
ins
,
&
ins
->
dst
[
0
],
sample_function
->
data_type
);
shader_addline
(
ins
->
ctx
->
buffer
,
"%s(%s_sampler%u, "
,
sample_function
->
name
,
shader_glsl_get_prefix
(
version
->
type
),
sampler
);
...
...
@@ -2397,7 +2401,7 @@ static void shader_glsl_imul(const struct wined3d_shader_instruction *ins)
if
(
ins
->
dst
[
1
].
reg
.
type
!=
WINED3DSPR_NULL
)
{
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]
,
ins
->
dst
[
1
].
reg
.
data_type
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
1
],
write_mask
,
&
src1_param
);
...
...
@@ -2425,17 +2429,17 @@ static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins)
shader_addline
(
buffer
,
"tmp0%s = %s / %s;
\n
"
,
dst_mask
,
src0_param
.
param_str
,
src1_param
.
param_str
);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]
,
ins
->
dst
[
1
].
reg
.
data_type
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
1
],
write_mask
,
&
src1_param
);
shader_addline
(
buffer
,
"%s %% %s));
\n
"
,
src0_param
.
param_str
,
src1_param
.
param_str
);
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]);
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]
,
ins
->
dst
[
0
].
reg
.
data_type
);
shader_addline
(
buffer
,
"tmp0%s);
\n
"
,
dst_mask
);
}
else
{
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]
,
ins
->
dst
[
0
].
reg
.
data_type
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
1
],
write_mask
,
&
src1_param
);
shader_addline
(
buffer
,
"%s / %s);
\n
"
,
src0_param
.
param_str
,
src1_param
.
param_str
);
...
...
@@ -2443,7 +2447,7 @@ static void shader_glsl_udiv(const struct wined3d_shader_instruction *ins)
}
else
if
(
ins
->
dst
[
1
].
reg
.
type
!=
WINED3DSPR_NULL
)
{
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]
,
ins
->
dst
[
1
].
reg
.
data_type
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
1
],
write_mask
,
&
src1_param
);
shader_addline
(
buffer
,
"%s %% %s);
\n
"
,
src0_param
.
param_str
,
src1_param
.
param_str
);
...
...
@@ -2907,7 +2911,7 @@ static void shader_glsl_conditional_move(const struct wined3d_shader_instruction
continue
;
shader_addline
(
ins
->
ctx
->
buffer
,
"tmp0%s = ("
,
mask_char
);
}
else
if
(
!
(
write_mask
=
shader_glsl_append_dst_ext
(
ins
->
ctx
->
buffer
,
ins
,
&
dst
)))
else
if
(
!
(
write_mask
=
shader_glsl_append_dst_ext
(
ins
->
ctx
->
buffer
,
ins
,
&
dst
,
dst
.
reg
.
data_type
)))
continue
;
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
cmp_channel
,
&
src0_param
);
...
...
@@ -3185,23 +3189,23 @@ static void shader_glsl_sincos(const struct wined3d_shader_instruction *ins)
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_addline
(
buffer
,
"tmp0%s = sin(%s);
\n
"
,
dst_mask
,
src0_param
.
param_str
);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]
,
ins
->
dst
[
1
].
reg
.
data_type
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_addline
(
buffer
,
"cos(%s));
\n
"
,
src0_param
.
param_str
);
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]);
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]
,
ins
->
dst
[
0
].
reg
.
data_type
);
shader_addline
(
buffer
,
"tmp0%s);
\n
"
,
dst_mask
);
}
else
{
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
0
]
,
ins
->
dst
[
0
].
reg
.
data_type
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_addline
(
buffer
,
"sin(%s));
\n
"
,
src0_param
.
param_str
);
}
}
else
if
(
ins
->
dst
[
1
].
reg
.
type
!=
WINED3DSPR_NULL
)
{
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]);
write_mask
=
shader_glsl_append_dst_ext
(
buffer
,
ins
,
&
ins
->
dst
[
1
]
,
ins
->
dst
[
1
].
reg
.
data_type
);
shader_glsl_add_src_param
(
ins
,
&
ins
->
src
[
0
],
write_mask
,
&
src0_param
);
shader_addline
(
buffer
,
"cos(%s));
\n
"
,
src0_param
.
param_str
);
}
...
...
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