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
4673b1c6
Commit
4673b1c6
authored
Aug 03, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Aug 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Optimize bool and int vs constants.
parent
274f77d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
31 deletions
+58
-31
device.c
dlls/wined3d/device.c
+28
-3
stateblock.c
dlls/wined3d/stateblock.c
+26
-28
wined3d_private.h
dlls/wined3d/wined3d_private.h
+4
-0
No files found.
dlls/wined3d/device.c
View file @
4673b1c6
...
...
@@ -474,6 +474,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
object
->
contained_transform_states
[
j
-
1
]
=
j
;
}
object
->
num_contained_transform_states
=
HIGHEST_TRANSFORMSTATE
;
for
(
j
=
0
;
j
<
MAX_CONST_I
;
j
++
)
{
object
->
contained_vs_consts_i
[
j
]
=
j
;
}
object
->
num_contained_vs_consts_i
=
MAX_CONST_I
;
for
(
j
=
0
;
j
<
MAX_CONST_B
;
j
++
)
{
object
->
contained_vs_consts_b
[
j
]
=
j
;
}
object
->
num_contained_vs_consts_b
=
MAX_CONST_B
;
}
else
if
(
Type
==
WINED3DSBT_PIXELSTATE
)
{
...
...
@@ -517,11 +525,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
/* Vertex Shader Constants */
for
(
i
=
0
;
i
<
GL_LIMITS
(
vshader_constantsF
);
++
i
)
object
->
changed
.
vertexShaderConstantsF
[
i
]
=
TRUE
;
for
(
i
=
0
;
i
<
MAX_CONST_B
;
++
i
)
for
(
i
=
0
;
i
<
MAX_CONST_B
;
++
i
)
{
object
->
changed
.
vertexShaderConstantsB
[
i
]
=
TRUE
;
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
object
->
contained_vs_consts_b
[
i
]
=
i
;
}
object
->
num_contained_vs_consts_b
=
MAX_CONST_B
;
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
object
->
changed
.
vertexShaderConstantsI
[
i
]
=
TRUE
;
object
->
contained_vs_consts_i
[
i
]
=
i
;
}
object
->
num_contained_vs_consts_i
=
MAX_CONST_I
;
for
(
i
=
0
;
i
<
NUM_SAVEDVERTEXSTATES_R
;
i
++
)
{
object
->
changed
.
renderState
[
SavedVertexStates_R
[
i
]]
=
TRUE
;
object
->
contained_render_states
[
i
]
=
SavedVertexStates_R
[
i
];
...
...
@@ -4334,6 +4347,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW
object
->
num_contained_transform_states
++
;
}
}
for
(
i
=
0
;
i
<
MAX_CONST_I
;
i
++
)
{
if
(
object
->
changed
.
vertexShaderConstantsI
[
i
])
{
object
->
contained_vs_consts_i
[
object
->
num_contained_vs_consts_i
]
=
i
;
object
->
num_contained_vs_consts_i
++
;
}
}
for
(
i
=
0
;
i
<
MAX_CONST_B
;
i
++
)
{
if
(
object
->
changed
.
vertexShaderConstantsB
[
i
])
{
object
->
contained_vs_consts_b
[
object
->
num_contained_vs_consts_b
]
=
i
;
object
->
num_contained_vs_consts_b
++
;
}
}
*
ppStateBlock
=
(
IWineD3DStateBlock
*
)
object
;
This
->
isRecordingState
=
FALSE
;
...
...
dlls/wined3d/stateblock.c
View file @
4673b1c6
...
...
@@ -363,29 +363,27 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
}
/* Vertex Shader Integer Constants */
for
(
i
=
0
;
i
<
MAX_CONST_I
;
++
i
)
{
if
(
This
->
changed
.
vertexShaderConstantsI
[
i
])
{
TRACE
(
"Setting %p from %p %d to { %d, %d, %d, %d }
\n
"
,
This
,
targetStateBlock
,
i
,
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
],
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
1
],
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
2
],
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
3
]);
This
->
vertexShaderConstantI
[
i
*
4
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
];
This
->
vertexShaderConstantI
[
i
*
4
+
1
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
1
];
This
->
vertexShaderConstantI
[
i
*
4
+
2
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
2
];
This
->
vertexShaderConstantI
[
i
*
4
+
3
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
3
];
}
for
(
j
=
0
;
j
<
This
->
num_contained_vs_consts_i
;
++
j
)
{
i
=
This
->
contained_vs_consts_i
[
j
];
TRACE
(
"Setting %p from %p %d to { %d, %d, %d, %d }
\n
"
,
This
,
targetStateBlock
,
i
,
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
],
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
1
],
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
2
],
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
3
]);
This
->
vertexShaderConstantI
[
i
*
4
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
];
This
->
vertexShaderConstantI
[
i
*
4
+
1
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
1
];
This
->
vertexShaderConstantI
[
i
*
4
+
2
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
2
];
This
->
vertexShaderConstantI
[
i
*
4
+
3
]
=
targetStateBlock
->
vertexShaderConstantI
[
i
*
4
+
3
];
}
/* Vertex Shader Boolean Constants */
for
(
i
=
0
;
i
<
MAX_CONST_B
;
++
i
)
{
i
f
(
This
->
changed
.
vertexShaderConstantsB
[
i
])
{
TRACE
(
"Setting %p from %p %d to %s
\n
"
,
This
,
targetStateBlock
,
i
,
targetStateBlock
->
vertexShaderConstantB
[
i
]
?
"TRUE"
:
"FALSE"
);
for
(
j
=
0
;
j
<
This
->
num_contained_vs_consts_b
;
++
j
)
{
i
=
This
->
contained_vs_consts_b
[
j
];
TRACE
(
"Setting %p from %p %d to %s
\n
"
,
This
,
targetStateBlock
,
i
,
targetStateBlock
->
vertexShaderConstantB
[
i
]
?
"TRUE"
:
"FALSE"
);
This
->
vertexShaderConstantB
[
i
]
=
targetStateBlock
->
vertexShaderConstantB
[
i
];
}
This
->
vertexShaderConstantB
[
i
]
=
targetStateBlock
->
vertexShaderConstantB
[
i
];
}
/* Lights... For a recorded state block, we just had a chain of actions to perform,
...
...
@@ -647,15 +645,15 @@ should really perform a delta so that only the changes get updated*/
if
(
This
->
changed
.
vertexShaderConstantsF
[
i
])
IWineD3DDevice_SetVertexShaderConstantF
(
pDevice
,
i
,
This
->
vertexShaderConstantF
+
i
*
4
,
1
);
}
for
(
i
=
0
;
i
<
MAX_CONST_I
;
i
++
)
{
if
(
This
->
changed
.
vertexShaderConstantsI
[
i
])
IWineD3DDevice_SetVertexShaderConstantI
(
pDevice
,
i
,
This
->
vertexShaderConstantI
+
i
*
4
,
1
);
for
(
i
=
0
;
i
<
This
->
num_contained_vs_consts_i
;
i
++
)
{
IWineD3DDevice_SetVertexShaderConstantI
(
pDevice
,
This
->
contained_vs_consts_i
[
i
],
This
->
vertexShaderConstantI
+
This
->
contained_vs_consts_i
[
i
]
*
4
,
1
);
}
for
(
i
=
0
;
i
<
MAX_CONST_B
;
i
++
)
{
if
(
This
->
changed
.
vertexShaderConstantsB
[
i
])
IWineD3DDevice_SetVertexShaderConstantB
(
pDevice
,
i
,
This
->
vertexShaderConstantB
+
i
,
1
);
for
(
i
=
0
;
i
<
This
->
num_contained_vs_consts_b
;
i
++
)
{
IWineD3DDevice_SetVertexShaderConstantB
(
pDevice
,
This
->
contained_vs_consts_b
[
i
],
This
->
vertexShaderConstantB
+
This
->
contained_vs_consts_b
[
i
]
,
1
);
}
}
...
...
dlls/wined3d/wined3d_private.h
View file @
4673b1c6
...
...
@@ -1371,6 +1371,10 @@ struct IWineD3DStateBlockImpl
unsigned
int
num_contained_render_states
;
DWORD
contained_transform_states
[
WINEHIGHEST_RENDER_STATE
+
1
];
unsigned
int
num_contained_transform_states
;
DWORD
contained_vs_consts_i
[
MAX_CONST_I
];
unsigned
int
num_contained_vs_consts_i
;
DWORD
contained_vs_consts_b
[
MAX_CONST_B
];
unsigned
int
num_contained_vs_consts_b
;
};
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