Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a7ded9a6
Commit
a7ded9a6
authored
Sep 28, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Pass a wined3d_state structure to use_ps().
parent
9224751a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
73 deletions
+90
-73
arb_program_shader.c
dlls/wined3d/arb_program_shader.c
+35
-27
ati_fragment_shader.c
dlls/wined3d/ati_fragment_shader.c
+1
-1
device.c
dlls/wined3d/device.c
+4
-3
drawprim.c
dlls/wined3d/drawprim.c
+13
-12
nvidia_texture_shader.c
dlls/wined3d/nvidia_texture_shader.c
+5
-4
state.c
dlls/wined3d/state.c
+30
-24
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-2
No files found.
dlls/wined3d/arb_program_shader.c
View file @
a7ded9a6
...
...
@@ -4457,7 +4457,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
find_vs_compile_args
(
shader
,
stateblock
,
&
args
->
super
);
args
->
clip
.
boolclip_compare
=
0
;
if
(
use_ps
(
stateblock
))
if
(
use_ps
(
state
))
{
IWineD3DPixelShaderImpl
*
ps
=
state
->
pixel_shader
;
struct
arb_pshader_private
*
shader_priv
=
ps
->
baseShader
.
backend_data
;
...
...
@@ -5533,45 +5533,50 @@ static void arbfp_get_caps(const struct wined3d_gl_info *gl_info, struct fragmen
caps
->
MaxSimultaneousTextures
=
min
(
gl_info
->
limits
.
fragment_samplers
,
8
);
}
static
void
state_texfactor_arbfp
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
state_texfactor_arbfp
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
float
col
[
4
];
/* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite
* application provided constants
*/
if
(
device
->
shader_backend
==
&
arb_program_shader_backend
)
{
if
(
use_ps
(
stateblock
))
return
;
if
(
device
->
shader_backend
==
&
arb_program_shader_backend
)
{
if
(
use_ps
(
state
))
return
;
context
->
pshader_const_dirty
[
ARB_FFP_CONST_TFACTOR
]
=
1
;
device
->
highest_dirty_ps_const
=
max
(
device
->
highest_dirty_ps_const
,
ARB_FFP_CONST_TFACTOR
+
1
);
}
D3DCOLORTOGLFLOAT4
(
state
block
->
state
.
render_states
[
WINED3DRS_TEXTUREFACTOR
],
col
);
D3DCOLORTOGLFLOAT4
(
state
->
render_states
[
WINED3DRS_TEXTUREFACTOR
],
col
);
GL_EXTCALL
(
glProgramEnvParameter4fvARB
(
GL_FRAGMENT_PROGRAM_ARB
,
ARB_FFP_CONST_TFACTOR
,
col
));
checkGLcall
(
"glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_TFACTOR, col)"
);
}
static
void
state_arb_specularenable
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
state_arb_specularenable
(
DWORD
state_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
float
col
[
4
];
/* Don't load the parameter if we're using an arbfp pixel shader, otherwise we'll overwrite
* application provided constants
*/
if
(
device
->
shader_backend
==
&
arb_program_shader_backend
)
{
if
(
use_ps
(
stateblock
))
return
;
if
(
device
->
shader_backend
==
&
arb_program_shader_backend
)
{
if
(
use_ps
(
state
))
return
;
context
->
pshader_const_dirty
[
ARB_FFP_CONST_SPECULAR_ENABLE
]
=
1
;
device
->
highest_dirty_ps_const
=
max
(
device
->
highest_dirty_ps_const
,
ARB_FFP_CONST_SPECULAR_ENABLE
+
1
);
}
if
(
state
block
->
state
.
render_states
[
WINED3DRS_SPECULARENABLE
])
if
(
state
->
render_states
[
WINED3DRS_SPECULARENABLE
])
{
/* The specular color has no alpha */
col
[
0
]
=
1
.
0
f
;
col
[
1
]
=
1
.
0
f
;
...
...
@@ -5584,16 +5589,17 @@ static void state_arb_specularenable(DWORD state, IWineD3DStateBlockImpl *stateb
checkGLcall
(
"glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_SPECULAR_ENABLE, col)"
);
}
static
void
set_bumpmat_arbfp
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
set_bumpmat_arbfp
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
DWORD
stage
=
(
state
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
DWORD
stage
=
(
state
_id
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
float
mat
[
2
][
2
];
if
(
use_ps
(
state
block
))
if
(
use_ps
(
state
))
{
IWineD3DPixelShaderImpl
*
ps
=
state
block
->
state
.
pixel_shader
;
IWineD3DPixelShaderImpl
*
ps
=
state
->
pixel_shader
;
if
(
stage
&&
(
ps
->
baseShader
.
reg_maps
.
bumpmat
&
(
1
<<
stage
)))
{
/* The pixel shader has to know the bump env matrix. Do a constants update if it isn't scheduled
...
...
@@ -5612,25 +5618,26 @@ static void set_bumpmat_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, s
device
->
highest_dirty_ps_const
=
max
(
device
->
highest_dirty_ps_const
,
ARB_FFP_CONST_BUMPMAT
(
stage
)
+
1
);
}
mat
[
0
][
0
]
=
*
((
float
*
)
&
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT00
]);
mat
[
0
][
1
]
=
*
((
float
*
)
&
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT01
]);
mat
[
1
][
0
]
=
*
((
float
*
)
&
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT10
]);
mat
[
1
][
1
]
=
*
((
float
*
)
&
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT11
]);
mat
[
0
][
0
]
=
*
((
float
*
)
&
state
->
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT00
]);
mat
[
0
][
1
]
=
*
((
float
*
)
&
state
->
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT01
]);
mat
[
1
][
0
]
=
*
((
float
*
)
&
state
->
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT10
]);
mat
[
1
][
1
]
=
*
((
float
*
)
&
state
->
texture_states
[
stage
][
WINED3DTSS_BUMPENVMAT11
]);
GL_EXTCALL
(
glProgramEnvParameter4fvARB
(
GL_FRAGMENT_PROGRAM_ARB
,
ARB_FFP_CONST_BUMPMAT
(
stage
),
&
mat
[
0
][
0
]));
checkGLcall
(
"glProgramEnvParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, ARB_FFP_CONST_BUMPMAT(stage), &mat[0][0])"
);
}
static
void
tex_bumpenvlum_arbfp
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
tex_bumpenvlum_arbfp
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
DWORD
stage
=
(
state
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
DWORD
stage
=
(
state
_id
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
float
param
[
4
];
if
(
use_ps
(
state
block
))
if
(
use_ps
(
state
))
{
IWineD3DPixelShaderImpl
*
ps
=
state
block
->
state
.
pixel_shader
;
IWineD3DPixelShaderImpl
*
ps
=
state
->
pixel_shader
;
if
(
stage
&&
(
ps
->
baseShader
.
reg_maps
.
luminanceparams
&
(
1
<<
stage
)))
{
/* The pixel shader has to know the luminance offset. Do a constants update if it
...
...
@@ -5649,8 +5656,8 @@ static void tex_bumpenvlum_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock
device
->
highest_dirty_ps_const
=
max
(
device
->
highest_dirty_ps_const
,
ARB_FFP_CONST_LUMINANCE
(
stage
)
+
1
);
}
param
[
0
]
=
*
((
float
*
)
&
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_BUMPENVLSCALE
]);
param
[
1
]
=
*
((
float
*
)
&
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_BUMPENVLOFFSET
]);
param
[
0
]
=
*
((
float
*
)
&
state
->
texture_states
[
stage
][
WINED3DTSS_BUMPENVLSCALE
]);
param
[
1
]
=
*
((
float
*
)
&
state
->
texture_states
[
stage
][
WINED3DTSS_BUMPENVLOFFSET
]);
param
[
2
]
=
0
.
0
f
;
param
[
3
]
=
0
.
0
f
;
...
...
@@ -6149,18 +6156,19 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, IWi
return
ret
;
}
static
void
fragment_prog_arbfp
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
fragment_prog_arbfp
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
struct
shader_arb_priv
*
priv
=
device
->
fragment_priv
;
BOOL
use_vshader
=
use_vs
(
&
stateblock
->
state
);
BOOL
use_pshader
=
use_ps
(
state
block
);
BOOL
use_vshader
=
use_vs
(
state
);
BOOL
use_pshader
=
use_ps
(
state
);
struct
ffp_frag_settings
settings
;
const
struct
arbfp_ffp_desc
*
desc
;
unsigned
int
i
;
TRACE
(
"state
%#x, stateblock %p, context %p
\n
"
,
state
,
stateblock
,
context
);
TRACE
(
"state
_id %#x, stateblock %p, context %p
\n
"
,
state_id
,
stateblock
,
context
);
if
(
isStateDirty
(
context
,
STATE_RENDER
(
WINED3DRS_FOGENABLE
)))
{
if
(
!
use_pshader
&&
device
->
shader_backend
==
&
arb_program_shader_backend
&&
context
->
last_was_pshader
)
{
...
...
dlls/wined3d/ati_fragment_shader.c
View file @
a7ded9a6
...
...
@@ -893,7 +893,7 @@ static void atifs_apply_pixelshader(DWORD state_id, IWineD3DStateBlockImpl *stat
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
BOOL
use_vshader
=
use_vs
(
state
);
context
->
last_was_pshader
=
use_ps
(
state
block
);
context
->
last_was_pshader
=
use_ps
(
state
);
/* The ATIFS code does not support pixel shaders currently, but we have to provide a state handler
* to call shader_select to select a vertex shader if one is applied because the vertex shader state
* may defer calling the shader backend if the pshader state is dirty.
...
...
dlls/wined3d/device.c
View file @
a7ded9a6
...
...
@@ -478,7 +478,7 @@ void device_preload_textures(IWineD3DDeviceImpl *device)
}
}
if
(
use_ps
(
state
block
))
if
(
use_ps
(
state
))
{
for
(
i
=
0
;
i
<
MAX_FRAGMENT_SAMPLERS
;
++
i
)
{
...
...
@@ -3586,8 +3586,9 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps, const struct
void
IWineD3DDeviceImpl_FindTexUnitMap
(
IWineD3DDeviceImpl
*
This
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
This
->
adapter
->
gl_info
;
BOOL
vs
=
use_vs
(
&
This
->
stateBlock
->
state
);
BOOL
ps
=
use_ps
(
This
->
stateBlock
);
const
struct
wined3d_state
*
state
=
&
This
->
stateBlock
->
state
;
BOOL
vs
=
use_vs
(
state
);
BOOL
ps
=
use_ps
(
state
);
/*
* Rules are:
* -> Pixel shaders need a 1:1 map. In theory the shader input could be mapped too, but
...
...
dlls/wined3d/drawprim.c
View file @
a7ded9a6
...
...
@@ -69,9 +69,10 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
const
DWORD
*
pIdxBufL
=
NULL
;
UINT
vx_index
;
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
const
struct
wined3d_stream_state
*
streams
=
This
->
stateBlock
->
state
.
streams
;
LONG
SkipnStrides
=
startIdx
+
This
->
stateBlock
->
state
.
load_base_vertex_index
;
BOOL
pixelShader
=
use_ps
(
This
->
stateBlock
);
const
struct
wined3d_state
*
state
=
&
This
->
stateBlock
->
state
;
const
struct
wined3d_stream_state
*
streams
=
state
->
streams
;
LONG
SkipnStrides
=
startIdx
+
state
->
load_base_vertex_index
;
BOOL
pixelShader
=
use_ps
(
state
);
BOOL
specular_fog
=
FALSE
;
const
BYTE
*
texCoords
[
WINED3DDP_MAXTEXCOORD
];
const
BYTE
*
diffuse
=
NULL
,
*
specular
=
NULL
,
*
normal
=
NULL
,
*
position
=
NULL
;
...
...
@@ -91,7 +92,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
* supported or other reason), or with user pointer drawing idxData
* will be non-NULL. */
if
(
!
idxData
)
idxData
=
buffer_get_sysmem
(
This
->
stateBlock
->
state
.
index_buffer
,
gl_info
);
idxData
=
buffer_get_sysmem
(
state
->
index_buffer
,
gl_info
);
if
(
idxSize
==
2
)
pIdxBufS
=
idxData
;
else
pIdxBufL
=
idxData
;
...
...
@@ -139,10 +140,10 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
specular
=
element
->
data
+
streams
[
element
->
stream_idx
].
offset
;
/* special case where the fog density is stored in the specular alpha channel */
if
(
This
->
stateBlock
->
state
.
render_states
[
WINED3DRS_FOGENABLE
]
&&
(
This
->
stateBlock
->
state
.
render_states
[
WINED3DRS_FOGVERTEXMODE
]
==
WINED3DFOG_NONE
if
(
state
->
render_states
[
WINED3DRS_FOGENABLE
]
&&
(
state
->
render_states
[
WINED3DRS_FOGVERTEXMODE
]
==
WINED3DFOG_NONE
||
si
->
elements
[
WINED3D_FFP_POSITION
].
format
->
id
==
WINED3DFMT_R32G32B32A32_FLOAT
)
&&
This
->
stateBlock
->
state
.
render_states
[
WINED3DRS_FOGTABLEMODE
]
==
WINED3DFOG_NONE
)
&&
state
->
render_states
[
WINED3DRS_FOGTABLEMODE
]
==
WINED3DFOG_NONE
)
{
if
(
gl_info
->
supported
[
EXT_FOG_COORD
])
{
...
...
@@ -169,7 +170,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
for
(
textureNo
=
0
;
textureNo
<
texture_stages
;
++
textureNo
)
{
int
coordIdx
=
This
->
stateBlock
->
state
.
texture_states
[
textureNo
][
WINED3DTSS_TEXCOORDINDEX
];
int
coordIdx
=
state
->
texture_states
[
textureNo
][
WINED3DTSS_TEXCOORDINDEX
];
DWORD
texture_idx
=
This
->
texUnitMap
[
textureNo
];
if
(
!
gl_info
->
supported
[
ARB_MULTITEXTURE
]
&&
textureNo
>
0
)
...
...
@@ -178,7 +179,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
continue
;
}
if
(
!
pixelShader
&&
!
This
->
stateBlock
->
state
.
textures
[
textureNo
])
continue
;
if
(
!
pixelShader
&&
!
state
->
textures
[
textureNo
])
continue
;
if
(
texture_idx
==
WINED3D_UNMAPPED_STAGE
)
continue
;
...
...
@@ -225,9 +226,9 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
{
/* Indexed so work out the number of strides to skip */
if
(
idxSize
==
2
)
SkipnStrides
=
pIdxBufS
[
startIdx
+
vx_index
]
+
This
->
stateBlock
->
state
.
load_base_vertex_index
;
SkipnStrides
=
pIdxBufS
[
startIdx
+
vx_index
]
+
state
->
load_base_vertex_index
;
else
SkipnStrides
=
pIdxBufL
[
startIdx
+
vx_index
]
+
This
->
stateBlock
->
state
.
load_base_vertex_index
;
SkipnStrides
=
pIdxBufL
[
startIdx
+
vx_index
]
+
state
->
load_base_vertex_index
;
}
tmp_tex_mask
=
tex_mask
;
...
...
@@ -239,7 +240,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
if
(
!
(
tmp_tex_mask
&
1
))
continue
;
coord_idx
=
This
->
stateBlock
->
state
.
texture_states
[
texture
][
WINED3DTSS_TEXCOORDINDEX
];
coord_idx
=
state
->
texture_states
[
texture
][
WINED3DTSS_TEXCOORDINDEX
];
ptr
=
texCoords
[
coord_idx
]
+
(
SkipnStrides
*
si
->
elements
[
WINED3D_FFP_TEXCOORD0
+
coord_idx
].
stride
);
texture_idx
=
This
->
texUnitMap
[
texture
];
...
...
dlls/wined3d/nvidia_texture_shader.c
View file @
a7ded9a6
...
...
@@ -456,17 +456,18 @@ void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d
}
static
void
nvrc_colorop
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
nvrc_colorop
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
DWORD
stage
=
(
state
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
DWORD
stage
=
(
state
_id
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
BOOL
tex_used
=
stateblock
->
device
->
fixed_function_usage_map
&
(
1
<<
stage
);
DWORD
mapped_stage
=
stateblock
->
device
->
texUnitMap
[
stage
];
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
TRACE
(
"Setting color op for stage %
d
\n
"
,
stage
);
TRACE
(
"Setting color op for stage %
u.
\n
"
,
stage
);
/* Using a pixel shader? Don't care for anything here, the shader applying does it */
if
(
use_ps
(
state
block
))
return
;
if
(
use_ps
(
state
))
return
;
if
(
stage
!=
mapped_stage
)
WARN
(
"Using non 1:1 mapping: %d -> %d!
\n
"
,
stage
,
mapped_stage
);
...
...
dlls/wined3d/state.c
View file @
a7ded9a6
...
...
@@ -1681,17 +1681,18 @@ static void state_pointsprite_w(DWORD state, IWineD3DStateBlockImpl *stateblock,
}
}
static
void
state_pointsprite
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
state_pointsprite
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
if
(
state
block
->
state
.
render_states
[
WINED3DRS_POINTSPRITEENABLE
])
if
(
state
->
render_states
[
WINED3DRS_POINTSPRITEENABLE
])
{
static
BOOL
warned
;
if
(
gl_info
->
limits
.
point_sprite_units
<
gl_info
->
limits
.
textures
&&
!
warned
)
{
if
(
use_ps
(
state
block
)
||
stateblock
->
state
.
lowest_disabled_stage
>
gl_info
->
limits
.
point_sprite_units
)
if
(
use_ps
(
state
)
||
state
->
lowest_disabled_stage
>
gl_info
->
limits
.
point_sprite_units
)
{
FIXME
(
"The app uses point sprite texture coordinates on more units than supported by the driver
\n
"
);
warned
=
TRUE
;
...
...
@@ -3099,17 +3100,18 @@ static void set_tex_op(const struct wined3d_gl_info *gl_info, const struct wined
}
static
void
tex_colorop
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
tex_colorop
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
DWORD
stage
=
(
state
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
DWORD
stage
=
(
state
_id
-
STATE_TEXTURESTAGE
(
0
,
0
))
/
(
WINED3D_HIGHEST_TEXTURE_STATE
+
1
);
BOOL
tex_used
=
stateblock
->
device
->
fixed_function_usage_map
&
(
1
<<
stage
);
DWORD
mapped_stage
=
stateblock
->
device
->
texUnitMap
[
stage
];
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
TRACE
(
"Setting color op for stage %d
\n
"
,
stage
);
/* Using a pixel shader? Don't care for anything here, the shader applying does it */
if
(
use_ps
(
state
block
))
return
;
if
(
use_ps
(
state
))
return
;
if
(
stage
!=
mapped_stage
)
WARN
(
"Using non 1:1 mapping: %d -> %d!
\n
"
,
stage
,
mapped_stage
);
...
...
@@ -3124,7 +3126,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
checkGLcall
(
"glActiveTextureARB"
);
}
if
(
stage
>=
state
block
->
state
.
lowest_disabled_stage
)
if
(
stage
>=
state
->
lowest_disabled_stage
)
{
TRACE
(
"Stage disabled
\n
"
);
if
(
mapped_stage
!=
WINED3D_UNMAPPED_STAGE
)
...
...
@@ -3152,13 +3154,13 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
/* The sampler will also activate the correct texture dimensions, so no
* need to do it here if the sampler for this stage is dirty. */
if
(
!
isStateDirty
(
context
,
STATE_SAMPLER
(
stage
))
&&
tex_used
)
texture_activate_dimensions
(
state
block
->
state
.
textures
[
stage
],
gl_info
);
texture_activate_dimensions
(
state
->
textures
[
stage
],
gl_info
);
set_tex_op
(
gl_info
,
&
stateblock
->
state
,
FALSE
,
stage
,
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_COLOROP
],
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_COLORARG1
],
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_COLORARG2
],
state
block
->
state
.
texture_states
[
stage
][
WINED3DTSS_COLORARG0
]);
set_tex_op
(
gl_info
,
state
,
FALSE
,
stage
,
state
->
texture_states
[
stage
][
WINED3DTSS_COLOROP
],
state
->
texture_states
[
stage
][
WINED3DTSS_COLORARG1
],
state
->
texture_states
[
stage
][
WINED3DTSS_COLORARG2
],
state
->
texture_states
[
stage
][
WINED3DTSS_COLORARG0
]);
}
void
tex_alphaop
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
...
...
@@ -3302,7 +3304,8 @@ static void transform_texture(DWORD state_id, IWineD3DStateBlockImpl *stateblock
}
/* NP2 texcoord fixup is implemented for pixelshaders so only enable the
fixed-function-pipeline fixup via pow2Matrix when no PS is used. */
if
(
!
use_ps
(
stateblock
))
{
if
(
!
use_ps
(
state
))
{
TRACE
(
"Non power two matrix multiply fixup
\n
"
);
glMultMatrixf
(
state
->
textures
[
texUnit
]
->
baseTexture
.
pow2Matrix
);
}
...
...
@@ -3547,8 +3550,9 @@ static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
}
}
static
void
shaderconstant
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
shaderconstant
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
/* Vertex and pixel shader states will call a shader upload, don't do anything as long one of them
...
...
@@ -3559,7 +3563,7 @@ static void shaderconstant(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
return
;
}
device
->
shader_backend
->
shader_load_constants
(
context
,
use_ps
(
state
block
),
use_vs
(
&
stateblock
->
state
));
device
->
shader_backend
->
shader_load_constants
(
context
,
use_ps
(
state
),
use_vs
(
state
));
}
static
void
tex_bumpenvlscale
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
...
...
@@ -3655,7 +3659,7 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w
checkGLcall
(
"glTexEnvi(GL_TEXTURE_LOD_BIAS_EXT, ...)"
);
}
if
(
!
use_ps
(
state
block
)
&&
sampler
<
state
->
lowest_disabled_stage
)
if
(
!
use_ps
(
state
)
&&
sampler
<
state
->
lowest_disabled_stage
)
{
if
(
state
->
render_states
[
WINED3DRS_COLORKEYENABLE
]
&&
!
sampler
)
{
...
...
@@ -3671,7 +3675,7 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w
{
IWineD3DDeviceImpl
*
d3ddevice
=
stateblock
->
device
;
d3ddevice
->
shader_backend
->
shader_load_np2fixup_constants
(
(
IWineD3DDevice
*
)
d3ddevice
,
use_ps
(
state
block
),
use_vs
(
state
));
(
IWineD3DDevice
*
)
d3ddevice
,
use_ps
(
state
),
use_vs
(
state
));
}
}
else
if
(
mapped_stage
<
gl_info
->
limits
.
textures
)
...
...
@@ -3692,11 +3696,12 @@ static void sampler(DWORD state_id, IWineD3DStateBlockImpl *stateblock, struct w
}
}
void
apply_pixelshader
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
void
apply_pixelshader
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
BOOL
use_vshader
=
use_vs
(
&
stateblock
->
state
);
BOOL
use_pshader
=
use_ps
(
state
block
);
BOOL
use_vshader
=
use_vs
(
state
);
BOOL
use_pshader
=
use_ps
(
state
);
unsigned
int
i
;
if
(
use_pshader
)
{
...
...
@@ -4610,12 +4615,13 @@ static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
}
}
static
void
vertexdeclaration
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
static
void
vertexdeclaration
(
DWORD
state
_id
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
const
struct
wined3d_gl_info
*
gl_info
=
context
->
gl_info
;
const
struct
wined3d_state
*
state
=
&
stateblock
->
state
;
BOOL
useVertexShaderFunction
=
use_vs
(
state
);
BOOL
usePixelShaderFunction
=
use_ps
(
state
);
BOOL
updateFog
=
FALSE
;
BOOL
useVertexShaderFunction
=
use_vs
(
&
stateblock
->
state
);
BOOL
usePixelShaderFunction
=
use_ps
(
stateblock
);
IWineD3DDeviceImpl
*
device
=
stateblock
->
device
;
BOOL
transformed
;
BOOL
wasrhw
=
context
->
last_was_rhw
;
...
...
dlls/wined3d/wined3d_private.h
View file @
a7ded9a6
...
...
@@ -3026,9 +3026,9 @@ static inline BOOL use_vs(const struct wined3d_state *state)
return
state
->
vertex_shader
&&
!
state
->
vertex_declaration
->
position_transformed
;
}
static
inline
BOOL
use_ps
(
IWineD3DStateBlockImpl
*
stateblock
)
static
inline
BOOL
use_ps
(
const
struct
wined3d_state
*
state
)
{
return
!!
state
block
->
state
.
pixel_shader
;
return
!!
state
->
pixel_shader
;
}
/* The WNDCLASS-Name for the fake window which we use to retrieve the GL capabilities */
...
...
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