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
597da990
Commit
597da990
authored
Sep 16, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 16, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move transforms to wined3d_state.
parent
5f6ced27
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
33 deletions
+46
-33
device.c
dlls/wined3d/device.c
+21
-10
state.c
dlls/wined3d/state.c
+14
-12
stateblock.c
dlls/wined3d/stateblock.c
+10
-8
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-3
No files found.
dlls/wined3d/device.c
View file @
597da990
...
...
@@ -2413,7 +2413,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, W
if
(
This
->
isRecordingState
)
{
TRACE
(
"Recording... not performing anything
\n
"
);
This
->
updateStateBlock
->
changed
.
transform
[
d3dts
>>
5
]
|=
1
<<
(
d3dts
&
0x1f
);
This
->
updateStateBlock
->
transforms
[
d3dts
]
=
*
lpmatrix
;
This
->
updateStateBlock
->
state
.
transforms
[
d3dts
]
=
*
lpmatrix
;
return
WINED3D_OK
;
}
...
...
@@ -2425,11 +2425,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, W
*
* From here on we assume that the new matrix is different, wherever it matters.
*/
if
(
!
memcmp
(
&
This
->
stateBlock
->
transforms
[
d3dts
].
u
.
m
[
0
][
0
],
lpmatrix
,
sizeof
(
WINED3DMATRIX
)))
{
if
(
!
memcmp
(
&
This
->
stateBlock
->
state
.
transforms
[
d3dts
].
u
.
m
[
0
][
0
],
lpmatrix
,
sizeof
(
*
lpmatrix
)))
{
TRACE
(
"The app is setting the same matrix over again
\n
"
);
return
WINED3D_OK
;
}
else
{
conv_mat
(
lpmatrix
,
&
This
->
stateBlock
->
transforms
[
d3dts
].
u
.
m
[
0
][
0
]);
}
else
{
conv_mat
(
lpmatrix
,
&
This
->
stateBlock
->
state
.
transforms
[
d3dts
].
u
.
m
[
0
][
0
]);
}
/*
...
...
@@ -2452,10 +2455,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, W
return
WINED3D_OK
;
}
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetTransform
(
IWineD3DDevice
*
iface
,
WINED3DTRANSFORMSTATETYPE
State
,
WINED3DMATRIX
*
pMatrix
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"(%p) : for Transform State %s
\n
"
,
This
,
debug_d3dtstype
(
State
));
*
pMatrix
=
This
->
stateBlock
->
transforms
[
State
];
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetTransform
(
IWineD3DDevice
*
iface
,
WINED3DTRANSFORMSTATETYPE
state
,
WINED3DMATRIX
*
matrix
)
{
IWineD3DDeviceImpl
*
device
=
(
IWineD3DDeviceImpl
*
)
iface
;
TRACE
(
"iface %p, state %s, matrix %p.
\n
"
,
iface
,
debug_d3dtstype
(
state
),
matrix
);
*
matrix
=
device
->
stateBlock
->
state
.
transforms
[
state
];
return
WINED3D_OK
;
}
...
...
@@ -2473,8 +2482,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface
if
(
State
<=
HIGHEST_TRANSFORMSTATE
)
{
mat
=
&
This
->
updateStateBlock
->
transforms
[
State
];
}
else
{
mat
=
&
This
->
updateStateBlock
->
state
.
transforms
[
State
];
}
else
{
FIXME
(
"Unhandled transform state!!
\n
"
);
}
...
...
dlls/wined3d/state.c
View file @
597da990
...
...
@@ -3246,7 +3246,7 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, s
generated
=
(
stateblock
->
textureState
[
texUnit
][
WINED3DTSS_TEXCOORDINDEX
]
&
0xFFFF0000
)
!=
WINED3DTSS_TCI_PASSTHRU
;
coordIdx
=
min
(
stateblock
->
textureState
[
texUnit
][
WINED3DTSS_TEXCOORDINDEX
&
0x0000FFFF
],
MAX_TEXTURES
-
1
);
set_texture_matrix
(
&
stateblock
->
transforms
[
WINED3DTS_TEXTURE0
+
texUnit
].
u
.
m
[
0
][
0
],
set_texture_matrix
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_TEXTURE0
+
texUnit
].
u
.
m
[
0
][
0
],
stateblock
->
textureState
[
texUnit
][
WINED3DTSS_TEXTURETRANSFORMFLAGS
],
generated
,
context
->
last_was_rhw
,
stateblock
->
device
->
strided_streams
.
use_map
&
(
1
<<
(
WINED3D_FFP_TEXCOORD0
+
coordIdx
))
?
stateblock
->
device
->
strided_streams
.
elements
[
WINED3D_FFP_TEXCOORD0
+
coordIdx
].
format
->
id
...
...
@@ -3727,14 +3727,14 @@ static void transform_world(DWORD state, IWineD3DStateBlockImpl *stateblock, str
/* In the general case, the view matrix is the identity matrix */
if
(
stateblock
->
device
->
view_ident
)
{
glLoadMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
glLoadMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
}
else
{
glLoadMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
glLoadMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
glMultMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
glMultMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_WORLDMATRIX
(
0
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glMultMatrixf"
);
}
}
...
...
@@ -3753,8 +3753,10 @@ static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
if
(
!
use_vs
(
stateblock
))
{
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
glLoadMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
}
else
{
glLoadMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
}
else
{
/* with vertex shaders, clip planes are not transformed in direct3d,
* in OpenGL they are still transformed by the model view.
* Use this to swap the y coordinate if necessary
...
...
@@ -3808,14 +3810,14 @@ static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, s
*/
if
(
stateblock
->
device
->
view_ident
)
{
glLoadMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
matrix
)].
u
.
m
[
0
][
0
]);
glLoadMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_WORLDMATRIX
(
matrix
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
}
else
{
glLoadMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
glLoadMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
glMultMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_WORLDMATRIX
(
matrix
)].
u
.
m
[
0
][
0
]);
glMultMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_WORLDMATRIX
(
matrix
)].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glMultMatrixf"
);
}
}
...
...
@@ -3889,7 +3891,7 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
glMatrixMode
(
GL_MODELVIEW
);
checkGLcall
(
"glMatrixMode(GL_MODELVIEW)"
);
glLoadMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
glLoadMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf(...)"
);
/* Reset lights. TODO: Call light apply func */
...
...
@@ -4030,7 +4032,7 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
}
checkGLcall
(
"glScalef"
);
glMultMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_PROJECTION
].
u
.
m
[
0
][
0
]);
glMultMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_PROJECTION
].
u
.
m
[
0
][
0
]);
checkGLcall
(
"glLoadMatrixf"
);
}
}
...
...
@@ -4781,7 +4783,7 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3
/* Light settings are affected by the model view in OpenGL, the View transform in direct3d*/
glMatrixMode
(
GL_MODELVIEW
);
glPushMatrix
();
glLoadMatrixf
(
&
stateblock
->
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
glLoadMatrixf
(
&
stateblock
->
state
.
transforms
[
WINED3DTS_VIEW
].
u
.
m
[
0
][
0
]);
/* Diffuse: */
colRGBA
[
0
]
=
lightInfo
->
OriginalParms
.
Diffuse
.
r
;
...
...
dlls/wined3d/stateblock.c
View file @
597da990
...
...
@@ -710,7 +710,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
TRACE
(
"Updating transform %#x.
\n
"
,
transform
);
This
->
transforms
[
transform
]
=
targetStateBlock
->
transforms
[
transform
];
This
->
state
.
transforms
[
transform
]
=
targetStateBlock
->
state
.
transforms
[
transform
];
}
if
(
This
->
changed
.
primitive_type
)
This
->
gl_primitive_type
=
targetStateBlock
->
gl_primitive_type
;
...
...
@@ -968,7 +968,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
for
(
i
=
0
;
i
<
This
->
num_contained_transform_states
;
++
i
)
{
IWineD3DDevice_SetTransform
(
device
,
This
->
contained_transform_states
[
i
],
&
This
->
transforms
[
This
->
contained_transform_states
[
i
]]);
&
This
->
state
.
transforms
[
This
->
contained_transform_states
[
i
]]);
}
if
(
This
->
changed
.
primitive_type
)
...
...
@@ -1084,10 +1084,11 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
This
->
blockType
=
WINED3DSBT_INIT
;
/* Set some of the defaults for lights, transforms etc */
memcpy
(
&
This
->
transforms
[
WINED3DTS_PROJECTION
],
identity
,
sizeof
(
identity
));
memcpy
(
&
This
->
transforms
[
WINED3DTS_VIEW
],
identity
,
sizeof
(
identity
));
for
(
i
=
0
;
i
<
256
;
++
i
)
{
memcpy
(
&
This
->
transforms
[
WINED3DTS_WORLDMATRIX
(
i
)],
identity
,
sizeof
(
identity
));
memcpy
(
&
This
->
state
.
transforms
[
WINED3DTS_PROJECTION
],
identity
,
sizeof
(
identity
));
memcpy
(
&
This
->
state
.
transforms
[
WINED3DTS_VIEW
],
identity
,
sizeof
(
identity
));
for
(
i
=
0
;
i
<
256
;
++
i
)
{
memcpy
(
&
This
->
state
.
transforms
[
WINED3DTS_WORLDMATRIX
(
i
)],
identity
,
sizeof
(
identity
));
}
TRACE
(
"Render states
\n
"
);
...
...
@@ -1228,9 +1229,10 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
This
->
clip_status
.
ClipIntersection
=
0xFFFFFFFF
;
/* Texture Stage States - Put directly into state block, we will call function below */
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
i
++
)
{
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
++
i
)
{
TRACE
(
"Setting up default texture states for texture Stage %d
\n
"
,
i
);
memcpy
(
&
This
->
transforms
[
WINED3DTS_TEXTURE0
+
i
],
identity
,
sizeof
(
identity
));
memcpy
(
&
This
->
state
.
transforms
[
WINED3DTS_TEXTURE0
+
i
],
identity
,
sizeof
(
identity
));
This
->
textureState
[
i
][
WINED3DTSS_COLOROP
]
=
i
?
WINED3DTOP_DISABLE
:
WINED3DTOP_MODULATE
;
This
->
textureState
[
i
][
WINED3DTSS_COLORARG1
]
=
WINED3DTA_TEXTURE
;
This
->
textureState
[
i
][
WINED3DTSS_COLORARG2
]
=
WINED3DTA_CURRENT
;
...
...
dlls/wined3d/wined3d_private.h
View file @
597da990
...
...
@@ -2349,6 +2349,7 @@ struct wined3d_stream_state
struct
wined3d_state
{
WINED3DMATRIX
transforms
[
HIGHEST_TRANSFORMSTATE
+
1
];
WINED3DMATERIAL
material
;
WINED3DVIEWPORT
viewport
;
RECT
scissor_rect
;
...
...
@@ -2393,9 +2394,6 @@ struct IWineD3DStateBlockImpl
INT
baseVertexIndex
;
INT
loadBaseVertexIndex
;
/* non-indexed drawing needs 0 here, indexed baseVertexIndex */
/* Transform */
WINED3DMATRIX
transforms
[
HIGHEST_TRANSFORMSTATE
+
1
];
/* Light hashmap . Collisions are handled using standard wine double linked lists */
#define LIGHTMAP_SIZE 43
/* Use of a prime number recommended. Set to 1 for a linked list! */
#define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE)
/* Primitive and simple function */
...
...
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