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
409103f8
Commit
409103f8
authored
Oct 28, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Nov 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Install a varying map.
parent
c390b604
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
22 deletions
+42
-22
glsl_shader.c
dlls/wined3d/glsl_shader.c
+36
-22
pixelshader.c
dlls/wined3d/pixelshader.c
+5
-0
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-0
No files found.
dlls/wined3d/glsl_shader.c
View file @
409103f8
...
@@ -802,9 +802,11 @@ static void shader_glsl_get_register_name(
...
@@ -802,9 +802,11 @@ static void shader_glsl_get_register_name(
glsl_src_param_t
rel_param
;
glsl_src_param_t
rel_param
;
shader_glsl_add_src_param
(
arg
,
addr_token
,
0
,
WINED3DSP_WRITEMASK_0
,
&
rel_param
);
shader_glsl_add_src_param
(
arg
,
addr_token
,
0
,
WINED3DSP_WRITEMASK_0
,
&
rel_param
);
sprintf
(
tmpStr
,
"IN[%s + %u]"
,
rel_param
.
param_str
,
reg
);
sprintf
(
tmpStr
,
"IN[%s + %u]"
,
rel_param
.
param_str
,
((
IWineD3DPixelShaderImpl
*
)
This
)
->
input_reg_map
[
reg
]);
}
else
{
}
else
{
sprintf
(
tmpStr
,
"IN[%u]"
,
reg
);
sprintf
(
tmpStr
,
"IN[%u]"
,
((
IWineD3DPixelShaderImpl
*
)
This
)
->
input_reg_map
[
reg
]);
}
}
}
else
{
}
else
{
if
(
reg
==
0
)
if
(
reg
==
0
)
...
@@ -2584,28 +2586,28 @@ void pshader_glsl_input_pack(
...
@@ -2584,28 +2586,28 @@ void pshader_glsl_input_pack(
case
WINED3DDECLUSAGE_TEXCOORD
:
case
WINED3DDECLUSAGE_TEXCOORD
:
if
(
usage_idx
<
8
&&
This
->
vertexprocessing
==
pretransformed
)
{
if
(
usage_idx
<
8
&&
This
->
vertexprocessing
==
pretransformed
)
{
shader_addline
(
buffer
,
"IN[%u]%s = gl_TexCoord[%u]%s;
\n
"
,
shader_addline
(
buffer
,
"IN[%u]%s = gl_TexCoord[%u]%s;
\n
"
,
i
,
reg_mask
,
usage_idx
,
reg_mask
);
This
->
input_reg_map
[
i
]
,
reg_mask
,
usage_idx
,
reg_mask
);
}
else
{
}
else
{
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
This
->
input_reg_map
[
i
]
,
reg_mask
,
reg_mask
);
}
}
break
;
break
;
case
WINED3DDECLUSAGE_COLOR
:
case
WINED3DDECLUSAGE_COLOR
:
if
(
usage_idx
==
0
)
if
(
usage_idx
==
0
)
shader_addline
(
buffer
,
"IN[%u]%s = vec4(gl_Color)%s;
\n
"
,
shader_addline
(
buffer
,
"IN[%u]%s = vec4(gl_Color)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
This
->
input_reg_map
[
i
]
,
reg_mask
,
reg_mask
);
else
if
(
usage_idx
==
1
)
else
if
(
usage_idx
==
1
)
shader_addline
(
buffer
,
"IN[%u]%s = vec4(gl_SecondaryColor)%s;
\n
"
,
shader_addline
(
buffer
,
"IN[%u]%s = vec4(gl_SecondaryColor)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
This
->
input_reg_map
[
i
]
,
reg_mask
,
reg_mask
);
else
else
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
This
->
input_reg_map
[
i
]
,
reg_mask
,
reg_mask
);
break
;
break
;
default:
default:
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
This
->
input_reg_map
[
i
]
,
reg_mask
,
reg_mask
);
}
}
}
}
}
}
...
@@ -2652,7 +2654,7 @@ void delete_glsl_program_entry(IWineD3DDevice *iface, struct glsl_shader_prog_li
...
@@ -2652,7 +2654,7 @@ void delete_glsl_program_entry(IWineD3DDevice *iface, struct glsl_shader_prog_li
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
HeapFree
(
GetProcessHeap
(),
0
,
entry
);
}
}
static
void
handle_ps3_input
(
SHADER_BUFFER
*
buffer
,
semantic
*
semantics_in
,
semantic
*
semantics_out
,
WineD3D_GL_Info
*
gl_info
)
{
static
void
handle_ps3_input
(
SHADER_BUFFER
*
buffer
,
semantic
*
semantics_in
,
semantic
*
semantics_out
,
WineD3D_GL_Info
*
gl_info
,
DWORD
*
map
)
{
unsigned
int
i
,
j
;
unsigned
int
i
,
j
;
DWORD
usage_token
,
usage_token_out
;
DWORD
usage_token
,
usage_token_out
;
DWORD
register_token
,
register_token_out
;
DWORD
register_token
,
register_token_out
;
...
@@ -2662,41 +2664,51 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, semantic *semantics_in, sema
...
@@ -2662,41 +2664,51 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, semantic *semantics_in, sema
set
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
set
)
*
(
GL_LIMITS
(
glsl_varyings
)
/
4
));
set
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
set
)
*
(
GL_LIMITS
(
glsl_varyings
)
/
4
));
for
(
i
=
0
;
i
<
min
(
MAX_REG_INPUT
,
GL_LIMITS
(
glsl_varyings
)
/
4
)
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_REG_INPUT
;
i
++
)
{
usage_token
=
semantics_in
[
i
].
usage
;
usage_token
=
semantics_in
[
i
].
usage
;
if
(
!
usage_token
)
continue
;
if
(
!
usage_token
)
continue
;
if
(
map
[
i
]
>=
(
GL_LIMITS
(
glsl_varyings
)
/
4
))
{
FIXME
(
"More input varyings declared than supported, expect issues
\n
"
);
continue
;
}
register_token
=
semantics_in
[
i
].
reg
;
register_token
=
semantics_in
[
i
].
reg
;
usage
=
(
usage_token
&
WINED3DSP_DCL_USAGE_MASK
)
>>
WINED3DSP_DCL_USAGE_SHIFT
;
usage
=
(
usage_token
&
WINED3DSP_DCL_USAGE_MASK
)
>>
WINED3DSP_DCL_USAGE_SHIFT
;
usage_idx
=
(
usage_token
&
WINED3DSP_DCL_USAGEINDEX_MASK
)
>>
WINED3DSP_DCL_USAGEINDEX_SHIFT
;
usage_idx
=
(
usage_token
&
WINED3DSP_DCL_USAGEINDEX_MASK
)
>>
WINED3DSP_DCL_USAGEINDEX_SHIFT
;
set
[
i
]
=
shader_glsl_get_write_mask
(
register_token
,
reg_mask
);
set
[
map
[
i
]
]
=
shader_glsl_get_write_mask
(
register_token
,
reg_mask
);
if
(
!
semantics_out
)
{
if
(
!
semantics_out
)
{
switch
(
usage
)
{
switch
(
usage
)
{
case
WINED3DDECLUSAGE_COLOR
:
case
WINED3DDECLUSAGE_COLOR
:
if
(
usage_idx
==
0
)
if
(
usage_idx
==
0
)
shader_addline
(
buffer
,
"IN[%u]%s = gl_FrontColor%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = gl_FrontColor%s;
\n
"
,
map
[
i
],
reg_mask
,
reg_mask
);
else
if
(
usage_idx
==
1
)
else
if
(
usage_idx
==
1
)
shader_addline
(
buffer
,
"IN[%u]%s = gl_FrontSecondaryColor%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = gl_FrontSecondaryColor%s;
\n
"
,
map
[
i
],
reg_mask
,
reg_mask
);
else
else
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
map
[
i
],
reg_mask
,
reg_mask
);
break
;
break
;
case
WINED3DDECLUSAGE_TEXCOORD
:
case
WINED3DDECLUSAGE_TEXCOORD
:
if
(
usage_idx
<
8
)
{
if
(
usage_idx
<
8
)
{
shader_addline
(
buffer
,
"IN[%u]%s = gl_TexCoord[%u]%s;
\n
"
,
shader_addline
(
buffer
,
"IN[%u]%s = gl_TexCoord[%u]%s;
\n
"
,
i
,
reg_mask
,
usage_idx
,
reg_mask
);
map
[
i
]
,
reg_mask
,
usage_idx
,
reg_mask
);
}
else
{
}
else
{
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
map
[
i
],
reg_mask
,
reg_mask
);
}
}
break
;
break
;
case
WINED3DDECLUSAGE_FOG
:
case
WINED3DDECLUSAGE_FOG
:
shader_addline
(
buffer
,
"IN[%u] = vec4(gl_FogFragCoord, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = vec4(gl_FogFragCoord, 0.0, 0.0, 0.0)%s;
\n
"
,
map
[
i
],
reg_mask
,
reg_mask
);
break
;
break
;
default:
default:
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
map
[
i
],
reg_mask
,
reg_mask
);
}
}
}
else
{
}
else
{
BOOL
found
=
FALSE
;
BOOL
found
=
FALSE
;
...
@@ -2711,12 +2723,14 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, semantic *semantics_in, sema
...
@@ -2711,12 +2723,14 @@ static void handle_ps3_input(SHADER_BUFFER *buffer, semantic *semantics_in, sema
if
(
usage
==
usage_out
&&
if
(
usage
==
usage_out
&&
usage_idx
==
usage_idx_out
)
{
usage_idx
==
usage_idx_out
)
{
shader_addline
(
buffer
,
"IN[%u]%s = OUT[%u]%s;
\n
"
,
i
,
reg_mask
,
j
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = OUT[%u]%s;
\n
"
,
map
[
i
],
reg_mask
,
j
,
reg_mask
);
found
=
TRUE
;
found
=
TRUE
;
}
}
}
}
if
(
!
found
)
{
if
(
!
found
)
{
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
i
,
reg_mask
,
reg_mask
);
shader_addline
(
buffer
,
"IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;
\n
"
,
map
[
i
],
reg_mask
,
reg_mask
);
}
}
}
}
}
}
...
@@ -2869,7 +2883,7 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
...
@@ -2869,7 +2883,7 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
}
}
/* Then, fix the pixel shader input */
/* Then, fix the pixel shader input */
handle_ps3_input
(
&
buffer
,
semantics_in
,
semantics_out
,
gl_info
);
handle_ps3_input
(
&
buffer
,
semantics_in
,
semantics_out
,
gl_info
,
ps
->
input_reg_map
);
shader_addline
(
&
buffer
,
"}
\n
"
);
shader_addline
(
&
buffer
,
"}
\n
"
);
}
else
if
(
ps_major
>=
3
&&
vs_major
<
3
)
{
}
else
if
(
ps_major
>=
3
&&
vs_major
<
3
)
{
...
@@ -2881,7 +2895,7 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
...
@@ -2881,7 +2895,7 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs
* point size, but we depend on the optimizers kindness to find out that the pixel shader doesn't
* point size, but we depend on the optimizers kindness to find out that the pixel shader doesn't
* read gl_TexCoord and gl_ColorX, otherwise we'll run out of varyings
* read gl_TexCoord and gl_ColorX, otherwise we'll run out of varyings
*/
*/
handle_ps3_input
(
&
buffer
,
semantics_in
,
NULL
,
gl_info
);
handle_ps3_input
(
&
buffer
,
semantics_in
,
NULL
,
gl_info
,
ps
->
input_reg_map
);
shader_addline
(
&
buffer
,
"}
\n
"
);
shader_addline
(
&
buffer
,
"}
\n
"
);
}
else
{
}
else
{
ERR
(
"Unexpected vertex and pixel shader version condition: vs: %d, ps: %d
\n
"
,
vs_major
,
ps_major
);
ERR
(
"Unexpected vertex and pixel shader version condition: vs: %d, ps: %d
\n
"
,
vs_major
,
ps_major
);
...
...
dlls/wined3d/pixelshader.c
View file @
409103f8
...
@@ -543,6 +543,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
...
@@ -543,6 +543,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
if
(
WINED3DSHADER_VERSION_MAJOR
(
This
->
baseShader
.
hex_version
)
>
1
)
{
if
(
WINED3DSHADER_VERSION_MAJOR
(
This
->
baseShader
.
hex_version
)
>
1
)
{
shader_reg_maps
*
reg_maps
=
&
This
->
baseShader
.
reg_maps
;
shader_reg_maps
*
reg_maps
=
&
This
->
baseShader
.
reg_maps
;
HRESULT
hr
;
HRESULT
hr
;
unsigned
int
i
;
/* Second pass: figure out which registers are used, what the semantics are, etc.. */
/* Second pass: figure out which registers are used, what the semantics are, etc.. */
memset
(
reg_maps
,
0
,
sizeof
(
shader_reg_maps
));
memset
(
reg_maps
,
0
,
sizeof
(
shader_reg_maps
));
...
@@ -550,6 +551,10 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
...
@@ -550,6 +551,10 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
This
->
semantics_in
,
NULL
,
pFunction
,
NULL
);
This
->
semantics_in
,
NULL
,
pFunction
,
NULL
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
FAILED
(
hr
))
return
hr
;
/* FIXME: validate reg_maps against OpenGL */
/* FIXME: validate reg_maps against OpenGL */
for
(
i
=
0
;
i
<
MAX_REG_INPUT
;
i
++
)
{
This
->
input_reg_map
[
i
]
=
i
;
}
}
}
This
->
baseShader
.
shader_mode
=
deviceImpl
->
ps_selected_mode
;
This
->
baseShader
.
shader_mode
=
deviceImpl
->
ps_selected_mode
;
...
...
dlls/wined3d/wined3d_private.h
View file @
409103f8
...
@@ -2083,6 +2083,7 @@ typedef struct IWineD3DPixelShaderImpl {
...
@@ -2083,6 +2083,7 @@ typedef struct IWineD3DPixelShaderImpl {
/* Pixel shader input semantics */
/* Pixel shader input semantics */
semantic
semantics_in
[
MAX_REG_INPUT
];
semantic
semantics_in
[
MAX_REG_INPUT
];
DWORD
input_reg_map
[
MAX_REG_INPUT
];
/* run time data */
/* run time data */
PSHADERDATA
*
data
;
PSHADERDATA
*
data
;
...
...
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