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
7ffd10da
Commit
7ffd10da
authored
Jun 22, 2009
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jun 23, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Find the clip texcoord before compiling.
The best is to put this together with the rest of the shader_arb_priv initialization.
parent
e64d4837
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
46 deletions
+47
-46
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+47
-46
No files found.
dlls/wined3d/arb_program_shader.c
View file @
7ffd10da
...
...
@@ -3592,6 +3592,42 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This,
return
ret
;
}
static
void
find_clip_texcoord
(
IWineD3DPixelShaderImpl
*
ps
)
{
struct
arb_pshader_private
*
shader_priv
=
ps
->
backend_priv
;
int
i
;
const
WineD3D_GL_Info
*
gl_info
=
&
((
IWineD3DDeviceImpl
*
)
ps
->
baseShader
.
device
)
->
adapter
->
gl_info
;
/* See if we can use fragment.texcoord[7] for clipplane emulation
*
* Don't do this if it is not supported, or fragment.texcoord[7] is used
*/
if
(
ps
->
baseShader
.
reg_maps
.
shader_version
.
major
<
3
)
{
for
(
i
=
GL_LIMITS
(
texture_stages
);
i
>
0
;
i
--
)
{
if
(
!
ps
->
baseShader
.
reg_maps
.
texcoord
[
i
-
1
])
{
shader_priv
->
clipplane_emulation
=
i
;
return
;
}
}
WARN
(
"Did not find a free clip reg(2.0)
\n
"
);
}
else
{
for
(
i
=
GL_LIMITS
(
texture_stages
);
i
>
0
;
i
--
)
{
if
(
!
(
ps
->
baseShader
.
reg_maps
.
input_registers
&
(
1
<<
(
i
-
1
))))
{
shader_priv
->
clipplane_emulation
=
i
;
return
;
}
}
WARN
(
"Did not find a free clip reg(3.0)
\n
"
);
}
}
/* GL locking is done by the caller */
static
struct
arb_ps_compiled_shader
*
find_arb_pshader
(
IWineD3DPixelShaderImpl
*
shader
,
const
struct
arb_ps_compile_args
*
args
)
{
...
...
@@ -3603,9 +3639,20 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *
GLuint
ret
;
if
(
!
shader
->
backend_priv
)
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
shader
->
baseShader
.
device
;
struct
shader_arb_priv
*
priv
=
device
->
shader_priv
;
shader
->
backend_priv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
shader_data
));
shader_data
=
shader
->
backend_priv
;
shader_data
->
clamp_consts
=
shader
->
baseShader
.
reg_maps
.
shader_version
.
major
==
1
;
if
(
shader
->
baseShader
.
reg_maps
.
shader_version
.
major
<
3
)
shader_data
->
input_signature_idx
=
~
0
;
else
shader_data
->
input_signature_idx
=
find_input_signature
(
priv
,
shader
->
input_signature
);
shader_data
->
has_signature_idx
=
TRUE
;
TRACE
(
"Shader got assigned input signature index %u
\n
"
,
shader_data
->
input_signature_idx
);
if
(
!
device
->
vs_clipping
)
find_clip_texcoord
(
shader
);
}
shader_data
=
shader
->
backend_priv
;
...
...
@@ -3845,39 +3892,6 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
}
}
static
void
find_clip_texcoord
(
IWineD3DPixelShaderImpl
*
ps
,
const
WineD3D_GL_Info
*
gl_info
)
{
struct
arb_pshader_private
*
shader_priv
=
ps
->
backend_priv
;
int
i
;
/* See if we can use fragment.texcoord[7] for clipplane emulation
*
* Don't do this if it is not supported, or fragment.texcoord[7] is used
*/
if
(
ps
->
baseShader
.
reg_maps
.
shader_version
.
major
<
3
)
{
for
(
i
=
GL_LIMITS
(
texture_stages
);
i
>
0
;
i
--
)
{
if
(
!
ps
->
baseShader
.
reg_maps
.
texcoord
[
i
-
1
])
{
shader_priv
->
clipplane_emulation
=
i
;
break
;
}
}
}
else
{
for
(
i
=
GL_LIMITS
(
texture_stages
);
i
>
0
;
i
--
)
{
if
(
!
(
ps
->
baseShader
.
reg_maps
.
input_registers
&
(
1
<<
(
i
-
1
))))
{
shader_priv
->
clipplane_emulation
=
i
;
break
;
}
}
}
}
/* GL locking is done by the caller */
static
void
shader_arb_select
(
IWineD3DDevice
*
iface
,
BOOL
usePS
,
BOOL
useVS
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
...
...
@@ -3889,7 +3903,6 @@ static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
if
(
usePS
)
{
struct
arb_ps_compile_args
compile_args
;
struct
arb_ps_compiled_shader
*
compiled
;
struct
arb_pshader_private
*
shader_priv
;
IWineD3DPixelShaderImpl
*
ps
=
(
IWineD3DPixelShaderImpl
*
)
This
->
stateBlock
->
pixelShader
;
TRACE
(
"Using pixel shader %p
\n
"
,
This
->
stateBlock
->
pixelShader
);
...
...
@@ -3898,18 +3911,6 @@ static void shader_arb_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {
priv
->
current_fprogram_id
=
compiled
->
prgId
;
priv
->
compiled_fprog
=
compiled
;
shader_priv
=
ps
->
backend_priv
;
if
(
!
shader_priv
->
has_signature_idx
)
{
if
(
ps
->
baseShader
.
reg_maps
.
shader_version
.
major
<
3
)
shader_priv
->
input_signature_idx
=
~
0
;
else
shader_priv
->
input_signature_idx
=
find_input_signature
(
priv
,
ps
->
input_signature
);
shader_priv
->
has_signature_idx
=
TRUE
;
TRACE
(
"Shader got assigned input signature index %u
\n
"
,
shader_priv
->
input_signature_idx
);
if
(
!
This
->
vs_clipping
)
find_clip_texcoord
(
ps
,
gl_info
);
}
/* Bind the fragment program */
GL_EXTCALL
(
glBindProgramARB
(
GL_FRAGMENT_PROGRAM_ARB
,
priv
->
current_fprogram_id
));
checkGLcall
(
"glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, priv->current_fprogram_id);"
);
...
...
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