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
2912e293
Commit
2912e293
authored
Jan 19, 2015
by
Henri Verbeet
Committed by
Alexandre Julliard
Jan 19, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Handle the SM4 SV_POSITION pixel shader input semantic in the GLSL shader backend.
This is (mostly) equivalent to the vPos register in SM3.
parent
2e5abc15
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
glsl_shader.c
dlls/wined3d/glsl_shader.c
+16
-13
shader.c
dlls/wined3d/shader.c
+3
-0
No files found.
dlls/wined3d/glsl_shader.c
View file @
2912e293
...
@@ -1191,14 +1191,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
...
@@ -1191,14 +1191,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
UINT
in_count
=
min
(
vec4_varyings
(
version
->
major
,
gl_info
),
shader
->
limits
->
packed_input
);
UINT
in_count
=
min
(
vec4_varyings
(
version
->
major
,
gl_info
),
shader
->
limits
->
packed_input
);
if
(
use_vs
(
state
))
if
(
use_vs
(
state
))
shader_addline
(
buffer
,
"varying vec4 %s_in[%u];
\n
"
,
prefix
,
in_count
);
shader_addline
(
buffer
,
"varying vec4 %s_link[%u];
\n
"
,
prefix
,
in_count
);
else
shader_addline
(
buffer
,
"vec4 %s_in[%u];
\n
"
,
prefix
,
in_count
);
/* TODO: Write a replacement shader for the fixed function
* vertex pipeline, so this isn't needed. For fixed function
* vertex processing + 3.0 pixel shader we need a separate
* function in the pixel shader that reads the fixed function
* color into the packed input registers. */
shader_addline
(
buffer
,
"vec4 %s_in[%u];
\n
"
,
prefix
,
in_count
);
}
}
for
(
i
=
0
,
map
=
reg_maps
->
bumpmat
;
map
;
map
>>=
1
,
++
i
)
for
(
i
=
0
,
map
=
reg_maps
->
bumpmat
;
map
;
map
>>=
1
,
++
i
)
...
@@ -4154,7 +4148,16 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
...
@@ -4154,7 +4148,16 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
semantic_idx
=
input_signature
[
i
].
semantic_idx
;
semantic_idx
=
input_signature
[
i
].
semantic_idx
;
shader_glsl_write_mask_to_str
(
input_signature
[
i
].
mask
,
reg_mask
);
shader_glsl_write_mask_to_str
(
input_signature
[
i
].
mask
,
reg_mask
);
if
(
shader_match_semantic
(
semantic_name
,
WINED3D_DECL_USAGE_TEXCOORD
))
if
(
vertexprocessing
==
vertexshader
)
{
if
(
!
strcmp
(
semantic_name
,
"SV_POSITION"
))
shader_addline
(
buffer
,
"ps_in[%u]%s = vpos%s;
\n
"
,
shader
->
u
.
ps
.
input_reg_map
[
i
],
reg_mask
,
reg_mask
);
else
shader_addline
(
buffer
,
"ps_in[%u]%s = ps_link[%u]%s;
\n
"
,
shader
->
u
.
ps
.
input_reg_map
[
i
],
reg_mask
,
shader
->
u
.
ps
.
input_reg_map
[
i
],
reg_mask
);
}
else
if
(
shader_match_semantic
(
semantic_name
,
WINED3D_DECL_USAGE_TEXCOORD
))
{
{
if
(
semantic_idx
<
8
&&
vertexprocessing
==
pretransformed
)
if
(
semantic_idx
<
8
&&
vertexprocessing
==
pretransformed
)
shader_addline
(
buffer
,
"ps_in[%u]%s = gl_TexCoord[%u]%s;
\n
"
,
shader_addline
(
buffer
,
"ps_in[%u]%s = gl_TexCoord[%u]%s;
\n
"
,
...
@@ -4276,7 +4279,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer,
...
@@ -4276,7 +4279,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer,
else
if
(
in_idx
==
in_count
+
1
)
else
if
(
in_idx
==
in_count
+
1
)
sprintf
(
destination
,
"gl_FrontSecondaryColor"
);
sprintf
(
destination
,
"gl_FrontSecondaryColor"
);
else
else
sprintf
(
destination
,
"ps_
in
[%u]"
,
in_idx
);
sprintf
(
destination
,
"ps_
link
[%u]"
,
in_idx
);
semantic_name_in
=
input_signature
[
i
].
semantic_name
;
semantic_name_in
=
input_signature
[
i
].
semantic_name
;
semantic_idx_in
=
input_signature
[
i
].
semantic_idx
;
semantic_idx_in
=
input_signature
[
i
].
semantic_idx
;
...
@@ -4322,7 +4325,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer,
...
@@ -4322,7 +4325,7 @@ static void handle_ps3_input(struct wined3d_shader_buffer *buffer,
else
if
(
i
==
in_count
+
1
)
else
if
(
i
==
in_count
+
1
)
sprintf
(
destination
,
"gl_FrontSecondaryColor"
);
sprintf
(
destination
,
"gl_FrontSecondaryColor"
);
else
else
sprintf
(
destination
,
"ps_
in
[%u]"
,
i
);
sprintf
(
destination
,
"ps_
link
[%u]"
,
i
);
if
(
size
==
1
)
shader_addline
(
buffer
,
"%s.%s = 0.0;
\n
"
,
destination
,
reg_mask
);
if
(
size
==
1
)
shader_addline
(
buffer
,
"%s.%s = 0.0;
\n
"
,
destination
,
reg_mask
);
else
shader_addline
(
buffer
,
"%s.%s = vec%u(0.0);
\n
"
,
destination
,
reg_mask
,
size
);
else
shader_addline
(
buffer
,
"%s.%s = vec%u(0.0);
\n
"
,
destination
,
reg_mask
,
size
);
...
@@ -4406,7 +4409,7 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
...
@@ -4406,7 +4409,7 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
{
{
UINT
in_count
=
min
(
vec4_varyings
(
ps_major
,
gl_info
),
ps
->
limits
->
packed_input
);
UINT
in_count
=
min
(
vec4_varyings
(
ps_major
,
gl_info
),
ps
->
limits
->
packed_input
);
/* This one is tricky: a 3.0 pixel shader reads from a 3.0 vertex shader */
/* This one is tricky: a 3.0 pixel shader reads from a 3.0 vertex shader */
shader_addline
(
buffer
,
"varying vec4 ps_
in
[%u];
\n
"
,
in_count
);
shader_addline
(
buffer
,
"varying vec4 ps_
link
[%u];
\n
"
,
in_count
);
shader_addline
(
buffer
,
"void order_ps_input(in vec4 vs_out[%u])
\n
{
\n
"
,
vs
->
limits
->
packed_output
);
shader_addline
(
buffer
,
"void order_ps_input(in vec4 vs_out[%u])
\n
{
\n
"
,
vs
->
limits
->
packed_output
);
/* First, sort out position and point size. Those are not passed to the pixel shader */
/* First, sort out position and point size. Those are not passed to the pixel shader */
...
@@ -4517,7 +4520,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
...
@@ -4517,7 +4520,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
shader_generate_glsl_declarations
(
context
,
buffer
,
shader
,
reg_maps
,
&
priv_ctx
);
shader_generate_glsl_declarations
(
context
,
buffer
,
shader
,
reg_maps
,
&
priv_ctx
);
/* Pack 3.0 inputs */
/* Pack 3.0 inputs */
if
(
reg_maps
->
shader_version
.
major
>=
3
&&
args
->
vp_mode
!=
vertexshader
)
if
(
reg_maps
->
shader_version
.
major
>=
3
)
shader_glsl_input_pack
(
shader
,
buffer
,
shader
->
input_signature
,
reg_maps
,
args
->
vp_mode
);
shader_glsl_input_pack
(
shader
,
buffer
,
shader
->
input_signature
,
reg_maps
,
args
->
vp_mode
);
/* Base Shader Body */
/* Base Shader Body */
...
...
dlls/wined3d/shader.c
View file @
2912e293
...
@@ -2506,6 +2506,9 @@ static HRESULT pixelshader_init(struct wined3d_shader *shader, struct wined3d_de
...
@@ -2506,6 +2506,9 @@ static HRESULT pixelshader_init(struct wined3d_shader *shader, struct wined3d_de
memcpy
(
ptr
,
e
->
semantic_name
,
len
+
1
);
memcpy
(
ptr
,
e
->
semantic_name
,
len
+
1
);
shader
->
input_signature
[
e
->
register_idx
].
semantic_name
=
ptr
;
shader
->
input_signature
[
e
->
register_idx
].
semantic_name
=
ptr
;
ptr
+=
len
+
1
;
ptr
+=
len
+
1
;
if
(
!
strcmp
(
e
->
semantic_name
,
"SV_POSITION"
))
shader
->
reg_maps
.
vpos
=
1
;
}
}
}
}
...
...
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