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
03ffb734
Commit
03ffb734
authored
Aug 09, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Optimize texture stage state applying.
parent
865b82af
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
38 deletions
+48
-38
device.c
dlls/wined3d/device.c
+24
-2
stateblock.c
dlls/wined3d/stateblock.c
+17
-36
wined3d_private.h
dlls/wined3d/wined3d_private.h
+7
-0
No files found.
dlls/wined3d/device.c
View file @
03ffb734
...
...
@@ -490,6 +490,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
object
->
contained_ps_consts_b
[
j
]
=
j
;
}
object
->
num_contained_ps_consts_b
=
MAX_CONST_B
;
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
i
++
)
{
for
(
j
=
1
;
j
<=
WINED3D_HIGHEST_TEXTURE_STATE
;
j
++
)
{
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
stage
=
i
;
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
state
=
j
;
object
->
num_contained_tss_states
++
;
}
}
}
else
if
(
Type
==
WINED3DSBT_PIXELSTATE
)
{
...
...
@@ -520,6 +527,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
for
(
j
=
0
;
j
<
MAX_TEXTURES
;
j
++
)
{
for
(
i
=
0
;
i
<
NUM_SAVEDPIXELSTATES_T
;
i
++
)
{
object
->
changed
.
textureState
[
j
][
SavedPixelStates_T
[
i
]]
=
TRUE
;
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
stage
=
j
;
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
state
=
SavedPixelStates_T
[
i
];
object
->
num_contained_tss_states
++
;
}
}
for
(
j
=
0
;
j
<
16
;
j
++
)
{
...
...
@@ -557,6 +567,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
for
(
j
=
0
;
j
<
MAX_TEXTURES
;
j
++
)
{
for
(
i
=
0
;
i
<
NUM_SAVEDVERTEXSTATES_T
;
i
++
)
{
object
->
changed
.
textureState
[
j
][
SavedVertexStates_T
[
i
]]
=
TRUE
;
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
stage
=
j
;
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
state
=
SavedVertexStates_T
[
i
];
object
->
num_contained_tss_states
++
;
}
}
for
(
j
=
0
;
j
<
16
;
j
++
){
...
...
@@ -4303,7 +4316,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_BeginStateBlock(IWineD3DDevice *iface)
HRESULT
temp_result
;
int
i
;
TRACE
(
"(%p)
\n
"
,
This
);
ERR
(
"(%p)
\n
"
,
This
);
if
(
This
->
isRecordingState
)
{
return
WINED3DERR_INVALIDCALL
;
...
...
@@ -4340,7 +4353,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_BeginStateBlock(IWineD3DDevice *iface)
static
HRESULT
WINAPI
IWineD3DDeviceImpl_EndStateBlock
(
IWineD3DDevice
*
iface
,
IWineD3DStateBlock
**
ppStateBlock
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
unsigned
int
i
;
unsigned
int
i
,
j
;
IWineD3DStateBlockImpl
*
object
=
This
->
updateStateBlock
;
if
(
!
This
->
isRecordingState
)
{
...
...
@@ -4385,6 +4398,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW
object
->
num_contained_ps_consts_b
++
;
}
}
for
(
i
=
0
;
i
<
MAX_TEXTURES
;
i
++
)
{
for
(
j
=
1
;
j
<=
WINED3D_HIGHEST_TEXTURE_STATE
;
j
++
)
{
if
(
object
->
changed
.
textureState
[
i
][
j
])
{
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
stage
=
i
;
object
->
contained_tss_states
[
object
->
num_contained_tss_states
].
state
=
j
;
object
->
num_contained_tss_states
++
;
}
}
}
*
ppStateBlock
=
(
IWineD3DStateBlock
*
)
object
;
This
->
isRecordingState
=
FALSE
;
...
...
dlls/wined3d/stateblock.c
View file @
03ffb734
...
...
@@ -567,15 +567,13 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
}
/* Texture states */
for
(
j
=
0
;
j
<
MAX_TEXTURES
;
j
++
)
{
/* TODO: move over to using memcpy */
for
(
i
=
1
;
i
<=
WINED3D_HIGHEST_TEXTURE_STATE
;
i
++
)
{
if
(
This
->
changed
.
textureState
[
j
][
i
])
{
TRACE
(
"Updating texturestagestate %d,%d to %d (was %d)
\n
"
,
j
,
i
,
targetStateBlock
->
textureState
[
j
][
i
],
This
->
textureState
[
j
][
i
]);
This
->
textureState
[
j
][
i
]
=
targetStateBlock
->
textureState
[
j
][
i
];
}
}
for
(
j
=
0
;
j
<
This
->
num_contained_tss_states
;
j
++
)
{
DWORD
stage
=
This
->
contained_tss_states
[
j
].
stage
;
DWORD
state
=
This
->
contained_tss_states
[
j
].
state
;
TRACE
(
"Updating texturestagestate %d,%d to %d (was %d)
\n
"
,
stage
,
state
,
targetStateBlock
->
textureState
[
stage
][
state
],
This
->
textureState
[
stage
][
state
]);
This
->
textureState
[
stage
][
state
]
=
targetStateBlock
->
textureState
[
stage
][
state
];
}
/* Samplers */
...
...
@@ -614,6 +612,7 @@ should really perform a delta so that only the changes get updated*/
TRACE
(
"(%p) : Applying state block %p ------------------v
\n
"
,
This
,
pDevice
);
TRACE
(
"Blocktype: %d
\n
"
,
This
->
blockType
);
/* FIXME: Only apply applicable states not all states */
if
(
/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED || */
This
->
blockType
==
WINED3DSBT_INIT
||
This
->
blockType
==
WINED3DSBT_ALL
||
This
->
blockType
==
WINED3DSBT_VERTEXSTATE
)
{
...
...
@@ -729,19 +728,6 @@ should really perform a delta so that only the changes get updated*/
}
}
/* Texture states */
for
(
j
=
0
;
j
<
MAX_TEXTURES
;
j
++
)
{
/* Set The texture first, just in case it resets the states? */
/* TODO: move over to memcpy */
for
(
i
=
1
;
i
<=
WINED3D_HIGHEST_TEXTURE_STATE
;
i
++
)
{
if
(
This
->
changed
.
textureState
[
j
][
i
])
{
/* tb_dx9_10 failes without this test */
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
textureState
[
j
][
i
]
=
This
->
textureState
[
j
][
i
];
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
changed
.
textureState
[
j
][
i
]
=
TRUE
;
/* TODO: Record a display list to apply all gl states. For now apply by brute force */
IWineD3DDeviceImpl_MarkStateDirty
((
IWineD3DDeviceImpl
*
)
pDevice
,
STATE_TEXTURESTAGE
(
j
,
i
));
}
}
}
/* Samplers */
/* TODO: move over to memcpy */
for
(
j
=
0
;
j
<
MAX_COMBINED_SAMPLERS
;
j
++
){
...
...
@@ -764,13 +750,6 @@ should really perform a delta so that only the changes get updated*/
}
else
if
(
This
->
blockType
==
WINED3DSBT_PIXELSTATE
)
{
for
(
j
=
0
;
j
<
MAX_TEXTURES
;
j
++
)
{
for
(
i
=
0
;
i
<
NUM_SAVEDPIXELSTATES_T
;
i
++
)
{
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
textureState
[
j
][
SavedPixelStates_T
[
i
]]
=
This
->
textureState
[
j
][
SavedPixelStates_T
[
i
]];
IWineD3DDeviceImpl_MarkStateDirty
((
IWineD3DDeviceImpl
*
)
pDevice
,
STATE_TEXTURESTAGE
(
j
,
SavedPixelStates_T
[
i
]));
}
}
for
(
j
=
0
;
j
<
MAX_COMBINED_SAMPLERS
;
j
++
)
{
for
(
i
=
0
;
i
<
NUM_SAVEDPIXELSTATES_S
;
i
++
)
{
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
samplerState
[
j
][
SavedPixelStates_S
[
i
]]
=
This
->
samplerState
[
j
][
SavedPixelStates_S
[
i
]];
...
...
@@ -779,13 +758,6 @@ should really perform a delta so that only the changes get updated*/
}
else
if
(
This
->
blockType
==
WINED3DSBT_VERTEXSTATE
)
{
for
(
j
=
0
;
j
<
MAX_TEXTURES
;
j
++
)
{
for
(
i
=
0
;
i
<
NUM_SAVEDVERTEXSTATES_T
;
i
++
)
{
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
textureState
[
j
][
SavedVertexStates_T
[
i
]]
=
This
->
textureState
[
j
][
SavedVertexStates_T
[
i
]];
IWineD3DDeviceImpl_MarkStateDirty
((
IWineD3DDeviceImpl
*
)
pDevice
,
STATE_TEXTURESTAGE
(
j
,
SavedVertexStates_T
[
i
]));
}
}
for
(
j
=
0
;
j
<
MAX_COMBINED_SAMPLERS
;
j
++
)
{
for
(
i
=
0
;
i
<
NUM_SAVEDVERTEXSTATES_S
;
i
++
)
{
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
samplerState
[
j
][
SavedVertexStates_S
[
i
]]
=
This
->
samplerState
[
j
][
SavedVertexStates_S
[
i
]];
...
...
@@ -802,6 +774,15 @@ should really perform a delta so that only the changes get updated*/
IWineD3DDevice_SetRenderState
(
pDevice
,
This
->
contained_render_states
[
i
],
This
->
renderState
[
This
->
contained_render_states
[
i
]]);
}
/* Texture states */
for
(
i
=
0
;
i
<
This
->
num_contained_tss_states
;
i
++
)
{
DWORD
stage
=
This
->
contained_tss_states
[
i
].
stage
;
DWORD
state
=
This
->
contained_tss_states
[
i
].
state
;
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
textureState
[
stage
][
state
]
=
This
->
textureState
[
stage
][
state
];
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
changed
.
textureState
[
stage
][
state
]
=
TRUE
;
/* TODO: Record a display list to apply all gl states. For now apply by brute force */
IWineD3DDeviceImpl_MarkStateDirty
((
IWineD3DDeviceImpl
*
)
pDevice
,
STATE_TEXTURESTAGE
(
stage
,
state
));
}
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
lowest_disabled_stage
=
MAX_TEXTURES
-
1
;
for
(
j
=
0
;
j
<
MAX_TEXTURES
-
1
;
j
++
)
{
...
...
dlls/wined3d/wined3d_private.h
View file @
03ffb734
...
...
@@ -1279,6 +1279,11 @@ typedef struct {
DWORD
idx
[
13
];
}
constants_entry
;
struct
StageState
{
DWORD
stage
;
DWORD
state
;
};
struct
IWineD3DStateBlockImpl
{
/* IUnknown fields */
...
...
@@ -1379,6 +1384,8 @@ struct IWineD3DStateBlockImpl
unsigned
int
num_contained_ps_consts_i
;
DWORD
contained_ps_consts_b
[
MAX_CONST_B
];
unsigned
int
num_contained_ps_consts_b
;
struct
StageState
contained_tss_states
[
MAX_TEXTURES
*
(
WINED3D_HIGHEST_TEXTURE_STATE
)];
unsigned
int
num_contained_tss_states
;
};
extern
void
stateblock_savedstates_set
(
...
...
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