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
59fb2928
Commit
59fb2928
authored
Aug 03, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Optimize sampler states in stateblocks.
parent
6e7a10f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
32 deletions
+43
-32
device.c
dlls/wined3d/device.c
+24
-3
stateblock.c
dlls/wined3d/stateblock.c
+17
-29
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-0
No files found.
dlls/wined3d/device.c
View file @
59fb2928
...
...
@@ -497,6 +497,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
object
->
num_contained_tss_states
++
;
}
}
for
(
i
=
0
;
i
<
MAX_COMBINED_SAMPLERS
;
i
++
)
{
for
(
j
=
1
;
j
<=
WINED3D_HIGHEST_SAMPLER_STATE
;
j
++
)
{
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
stage
=
i
;
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
state
=
j
;
object
->
num_contained_sampler_states
++
;
}
}
}
else
if
(
Type
==
WINED3DSBT_PIXELSTATE
)
{
...
...
@@ -532,10 +539,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
object
->
num_contained_tss_states
++
;
}
}
for
(
j
=
0
;
j
<
16
;
j
++
)
{
for
(
j
=
0
;
j
<
MAX_COMBINED_SAMPLERS
;
j
++
)
{
for
(
i
=
0
;
i
<
NUM_SAVEDPIXELSTATES_S
;
i
++
)
{
object
->
changed
.
samplerState
[
j
][
SavedPixelStates_S
[
i
]]
=
TRUE
;
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
stage
=
j
;
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
state
=
SavedPixelStates_S
[
i
];
object
->
num_contained_sampler_states
++
;
}
}
...
...
@@ -572,9 +581,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
object
->
num_contained_tss_states
++
;
}
}
for
(
j
=
0
;
j
<
16
;
j
++
){
for
(
j
=
0
;
j
<
MAX_COMBINED_SAMPLERS
;
j
++
){
for
(
i
=
0
;
i
<
NUM_SAVEDVERTEXSTATES_S
;
i
++
)
{
object
->
changed
.
samplerState
[
j
][
SavedVertexStates_S
[
i
]]
=
TRUE
;
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
stage
=
j
;
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
state
=
SavedVertexStates_S
[
i
];
object
->
num_contained_sampler_states
++
;
}
}
...
...
@@ -4407,6 +4419,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW
}
}
}
for
(
i
=
0
;
i
<
MAX_COMBINED_SAMPLERS
;
i
++
){
for
(
j
=
1
;
j
<
WINED3D_HIGHEST_SAMPLER_STATE
;
j
++
)
{
if
(
object
->
changed
.
samplerState
[
i
][
j
])
{
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
stage
=
i
;
object
->
contained_sampler_states
[
object
->
num_contained_sampler_states
].
state
=
j
;
object
->
num_contained_sampler_states
++
;
}
}
}
*
ppStateBlock
=
(
IWineD3DStateBlock
*
)
object
;
This
->
isRecordingState
=
FALSE
;
...
...
dlls/wined3d/stateblock.c
View file @
59fb2928
...
...
@@ -583,14 +583,15 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
TRACE
(
"Updating texture %d to %p (was %p)
\n
"
,
j
,
targetStateBlock
->
textures
[
j
],
This
->
textures
[
j
]);
This
->
textures
[
j
]
=
targetStateBlock
->
textures
[
j
];
}
for
(
i
=
1
;
i
<=
WINED3D_HIGHEST_SAMPLER_STATE
;
i
++
){
/* States are 1 based */
if
(
This
->
changed
.
samplerState
[
j
][
i
])
{
TRACE
(
"Updating sampler state %d,%d to %d (was %d)
\n
"
,
j
,
i
,
targetStateBlock
->
samplerState
[
j
][
i
],
This
->
samplerState
[
j
][
i
]);
This
->
samplerState
[
j
][
i
]
=
targetStateBlock
->
samplerState
[
j
][
i
];
}
}
}
for
(
j
=
0
;
j
<
This
->
num_contained_sampler_states
;
j
++
)
{
DWORD
stage
=
This
->
contained_sampler_states
[
j
].
stage
;
DWORD
state
=
This
->
contained_sampler_states
[
j
].
state
;
TRACE
(
"Updating sampler state %d,%d to %d (was %d)
\n
"
,
stage
,
state
,
targetStateBlock
->
samplerState
[
stage
][
state
],
This
->
samplerState
[
stage
][
state
]);
This
->
samplerState
[
stage
][
state
]
=
targetStateBlock
->
samplerState
[
stage
][
state
];
}
}
...
...
@@ -738,33 +739,12 @@ should really perform a delta so that only the changes get updated*/
IWineD3DDevice_SetTexture
(
pDevice
,
WINED3DVERTEXTEXTURESAMPLER0
+
j
-
MAX_FRAGMENT_SAMPLERS
,
This
->
textures
[
j
]);
}
}
for
(
i
=
1
;
i
<=
WINED3D_HIGHEST_SAMPLER_STATE
;
i
++
){
if
(
This
->
changed
.
samplerState
[
j
][
i
])
{
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
samplerState
[
j
][
i
]
=
This
->
samplerState
[
j
][
i
];
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
changed
.
samplerState
[
j
][
i
]
=
TRUE
;
}
}
/* SetTexture catches nop changes, so the above call does not assure that the sampler is updated */
IWineD3DDeviceImpl_MarkStateDirty
((
IWineD3DDeviceImpl
*
)
pDevice
,
STATE_SAMPLER
(
j
));
}
}
else
if
(
This
->
blockType
==
WINED3DSBT_PIXELSTATE
)
{
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
]];
}
}
}
else
if
(
This
->
blockType
==
WINED3DSBT_VERTEXSTATE
)
{
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
]];
}
}
}
else
{
FIXME
(
"Unrecognized state block type %d
\n
"
,
This
->
blockType
);
}
...
...
@@ -783,6 +763,14 @@ should really perform a delta so that only the changes get updated*/
/* TODO: Record a display list to apply all gl states. For now apply by brute force */
IWineD3DDeviceImpl_MarkStateDirty
((
IWineD3DDeviceImpl
*
)
pDevice
,
STATE_TEXTURESTAGE
(
stage
,
state
));
}
/* Sampler states */
for
(
i
=
0
;
i
<
This
->
num_contained_sampler_states
;
i
++
)
{
DWORD
stage
=
This
->
contained_sampler_states
[
i
].
stage
;
DWORD
state
=
This
->
contained_sampler_states
[
i
].
state
;
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
samplerState
[
stage
][
state
]
=
This
->
samplerState
[
stage
][
state
];
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
changed
.
samplerState
[
stage
][
state
]
=
TRUE
;
IWineD3DDeviceImpl_MarkStateDirty
((
IWineD3DDeviceImpl
*
)
pDevice
,
STATE_SAMPLER
(
stage
));
}
((
IWineD3DDeviceImpl
*
)
pDevice
)
->
stateBlock
->
lowest_disabled_stage
=
MAX_TEXTURES
-
1
;
for
(
j
=
0
;
j
<
MAX_TEXTURES
-
1
;
j
++
)
{
...
...
dlls/wined3d/wined3d_private.h
View file @
59fb2928
...
...
@@ -1386,6 +1386,8 @@ struct IWineD3DStateBlockImpl
unsigned
int
num_contained_ps_consts_b
;
struct
StageState
contained_tss_states
[
MAX_TEXTURES
*
(
WINED3D_HIGHEST_TEXTURE_STATE
)];
unsigned
int
num_contained_tss_states
;
struct
StageState
contained_sampler_states
[
MAX_COMBINED_SAMPLERS
*
WINED3D_HIGHEST_SAMPLER_STATE
];
unsigned
int
num_contained_sampler_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