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
e26e3ee5
Commit
e26e3ee5
authored
Jan 02, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 03, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Remove d3ddevice_set_ortho.
parent
82bd0790
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
64 deletions
+58
-64
device.c
dlls/wined3d/device.c
+1
-2
drawprim.c
dlls/wined3d/drawprim.c
+0
-16
state.c
dlls/wined3d/state.c
+52
-40
surface.c
dlls/wined3d/surface.c
+5
-3
wined3d_private.h
dlls/wined3d/wined3d_private.h
+0
-3
No files found.
dlls/wined3d/device.c
View file @
e26e3ee5
...
...
@@ -1936,7 +1936,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
}
/* Initialize the current view state */
This
->
proj_valid
=
0
;
This
->
view_ident
=
1
;
This
->
last_was_rhw
=
0
;
glGetIntegerv
(
GL_MAX_LIGHTS
,
&
This
->
maxConcurrentLights
);
...
...
@@ -5877,7 +5876,7 @@ static void device_render_to_texture(IWineD3DDeviceImpl* This, BOOL isTexture) {
This
->
depth_copy_state
=
WINED3D_DCS_COPY
;
}
This
->
last_was_rhw
=
FALSE
;
This
->
proj_valid
=
FALSE
;
/* Viewport state will reapply the projection matrix for now */
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
WINED3DRS_CULLMODE
);
/* Restore recording */
...
...
dlls/wined3d/drawprim.c
View file @
e26e3ee5
...
...
@@ -155,22 +155,6 @@ static const GLfloat invymat[16] = {
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
};
void
d3ddevice_set_ortho
(
IWineD3DDeviceImpl
*
This
)
{
/* If the last draw was transformed as well, no need to reapply all the matrixes */
if
(
(
!
This
->
last_was_rhw
)
||
(
This
->
viewport_changed
)
)
{
This
->
last_was_rhw
=
TRUE
;
This
->
viewport_changed
=
FALSE
;
/* Transformed already into viewport coordinates, so we do not need transform
matrices. Reset all matrices to identity and leave the default matrix in world
mode. */
glMatrixMode
(
GL_MODELVIEW
);
checkGLcall
(
"glMatrixMode(GL_MODELVIEW)"
);
glLoadIdentity
();
checkGLcall
(
"glLoadIdentity"
);
}
}
static
BOOL
fixed_get_input
(
BYTE
usage
,
BYTE
usage_idx
,
unsigned
int
*
regnum
)
{
...
...
dlls/wined3d/state.c
View file @
e26e3ee5
...
...
@@ -1821,25 +1821,30 @@ static void pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
static
void
transform_world
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
)
{
/* Do not bother applying when we're in rhw mode. vertexdeclaration() will call
* transform_world if it switches out of rhw mode. This function is also called
* by transform_view below if the view matrix was changed
/* This function is called by transform_view below if the view matrix was changed too
*
* Deliberately no check if the vertex declaration is dirty because the vdecl state
* does not always update the world matrix, only on a switch between transformed
* and untrannsformed draws. It *may* happen that the world matrix is set 2 times during one
* draw, but that should be rather rare and cheaper in total.
*/
if
(
stateblock
->
wineD3DDevice
->
last_was_rhw
)
{
return
;
}
glMatrixMode
(
GL_MODELVIEW
);
checkGLcall
(
"glMatrixMode"
);
/* In the general case, the view matrix is the identity matrix */
if
(
stateblock
->
wineD3DDevice
->
view_ident
)
{
glLoadMatrixf
((
float
*
)
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
if
(
stateblock
->
wineD3DDevice
->
last_was_rhw
)
{
glLoadIdentity
();
checkGLcall
(
"glLoadIdentity()"
);
}
else
{
glLoadMatrixf
((
float
*
)
&
stateblock
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
glMultMatrixf
((
float
*
)
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glMultMatrixf"
);
/* In the general case, the view matrix is the identity matrix */
if
(
stateblock
->
wineD3DDevice
->
view_ident
)
{
glLoadMatrixf
((
float
*
)
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
}
else
{
glLoadMatrixf
((
float
*
)
&
stateblock
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
glMultMatrixf
((
float
*
)
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glMultMatrixf"
);
}
}
}
...
...
@@ -2037,8 +2042,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
if
(
!
useVertexShaderFunction
&&
transformed
)
{
d3ddevice_set_ortho
(
device
);
stateblock
->
wineD3DDevice
->
last_was_rhw
=
TRUE
;
}
else
{
/* Untransformed, so relies on the view and projection matrices */
...
...
@@ -2046,42 +2050,50 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
/* This turns off the Z scale trick to 'disable' viewport frustum clipping in rhw mode*/
device
->
untransformed
=
TRUE
;
/* Don't bother checking for !useVertexShaderFunction here. If shaders are always on wasrhw will never
* be true. If they are switched on and off then knowing that the fixed function matrices are ok makes
* those switches cheaper
/* Todo for sw shaders: Vertex Shader output is already transformed, so set up identity matrices
* Not needed as long as only hw shaders are supported
*/
if
(
wasrhw
)
{
/* switching out of orthogonal mode? have to reapply the modelview matrix.
* Only do that when it is not dirty though
*/
if
(
!
isStateDirty
(
device
,
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
))))
{
transform_world
(
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
)),
stateblock
);
}
}
if
(
!
useVertexShaderFunction
)
{
device
->
proj_valid
=
TRUE
;
}
/* Vertex Shader output is already transformed, so set up identity matrices */
/* This sets the shader output position correction constants.
* TODO: Move to the viewport state
*/
if
(
useVertexShaderFunction
)
{
device
->
posFixup
[
1
]
=
device
->
render_offscreen
?
-
1
.
0
:
1
.
0
;
device
->
posFixup
[
2
]
=
0
.
9
/
stateblock
->
viewport
.
Width
;
device
->
posFixup
[
3
]
=
-
0
.
9
/
stateblock
->
viewport
.
Height
;
}
device
->
last_was_rhw
=
FALSE
;
}
/*
TODO: Move this mainly to the viewport state and only apply when the vp has chang
ed
* o
r transformed / untransformed was switched
/*
Don't have to apply the matrices when vertex shaders are used. When vshaders are turn
ed
* o
ff this function will be called again anyway to make sure they're properly set
*/
if
(
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
)))
{
transform_projection
(
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
),
stateblock
);
}
if
(
!
useVertexShaderFunction
)
{
/* TODO: Move this mainly to the viewport state and only apply when the vp has changed
* or transformed / untransformed was switched
*/
if
(
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
)))
{
transform_projection
(
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
),
stateblock
);
}
/* World matrix needs reapplication here only if we're switching between rhw and non-rhw
* mode.
*
* If a vertex shader is used, the world matrix changed and then vertex shader unbound
* this check will fail and the matrix not applied again. This is OK because a simple
* world matrix change reapplies the matrix - These checks here are only to satisfy the
* needs of the vertex declaration.
*
* World and view matrix go into the same gl matrix, so only apply them when neither is
* dirty
*/
if
(
transformed
!=
wasrhw
&&
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
)))
&&
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_TRANSFORM
(
WINED3DTS_VIEW
)))
{
transform_world
(
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
)),
stateblock
);
}
}
/* Setup fogging */
if
(
updateFog
)
{
state_fog
(
STATE_RENDER
(
WINED3DRS_FOGENABLE
),
stateblock
);
state_fog
(
STATE_RENDER
(
WINED3DRS_FOGENABLE
),
stateblock
);
}
}
...
...
dlls/wined3d/surface.c
View file @
e26e3ee5
...
...
@@ -1149,9 +1149,10 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
/* glDrawPixels transforms the raster position as though it was a vertex -
we want to draw at screen position 0,0 - Set up ortho (rhw) mode as
per drawprim (and leave set - it will sort itself out due to last_was_rhw */
d3ddevice_set_ortho
(
This
->
resource
.
wineD3DDevice
)
;
/* Apply the projection
matrix
, it sets up orthogonal projection due to last_was_rhw */
myDevice
->
last_was_rhw
=
TRUE
;
/* Apply the projection
and world matrices
, it sets up orthogonal projection due to last_was_rhw */
StateTable
[
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
)].
apply
(
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
),
myDevice
->
stateBlock
);
StateTable
[
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
))].
apply
(
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
)),
myDevice
->
stateBlock
);
/* Will reapply the projection matrix too */
IWineD3DDeviceImpl_MarkStateDirty
(
myDevice
,
STATE_VDECL
);
...
...
@@ -2476,9 +2477,10 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
/* Draw a textured quad
*/
d3ddevice_set_ortho
(
This
->
resource
.
wineD3DDevice
)
;
myDevice
->
last_was_rhw
=
TRUE
;
/* Apply the projection matrix, it sets up orthogonal projection due to last_was_rhw */
StateTable
[
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
)].
apply
(
STATE_TRANSFORM
(
WINED3DTS_PROJECTION
),
myDevice
->
stateBlock
);
StateTable
[
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
))].
apply
(
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
)),
myDevice
->
stateBlock
);
/* That will reapply the projection matrix too */
IWineD3DDeviceImpl_MarkStateDirty
(
myDevice
,
STATE_VDECL
);
...
...
dlls/wined3d/wined3d_private.h
View file @
e26e3ee5
...
...
@@ -563,7 +563,6 @@ typedef struct IWineD3DDeviceImpl
const
shader_backend_t
*
shader_backend
;
/* Optimization */
BOOL
proj_valid
;
BOOL
view_ident
;
/* true iff view matrix is identity */
BOOL
last_was_rhw
;
/* true iff last draw_primitive was in xyzrhw mode */
BOOL
viewport_changed
;
/* Was the viewport changed since the last draw? */
...
...
@@ -704,8 +703,6 @@ typedef struct PrivateData
DWORD
size
;
}
PrivateData
;
void
d3ddevice_set_ortho
(
IWineD3DDeviceImpl
*
This
);
/*****************************************************************************
* IWineD3DResource implementation structure
*/
...
...
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