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
4546a13d
Commit
4546a13d
authored
Sep 21, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 22, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move light state to wined3d_state.
parent
f4df53c4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
28 deletions
+30
-28
device.c
dlls/wined3d/device.c
+9
-9
state.c
dlls/wined3d/state.c
+2
-2
stateblock.c
dlls/wined3d/stateblock.c
+13
-11
wined3d_private.h
dlls/wined3d/wined3d_private.h
+6
-6
No files found.
dlls/wined3d/device.c
View file @
4546a13d
...
...
@@ -2546,7 +2546,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
return
WINED3DERR_INVALIDCALL
;
}
LIST_FOR_EACH
(
e
,
&
This
->
updateStateBlock
->
lightM
ap
[
Hi
])
LIST_FOR_EACH
(
e
,
&
This
->
updateStateBlock
->
state
.
light_m
ap
[
Hi
])
{
object
=
LIST_ENTRY
(
e
,
struct
wined3d_light_info
,
entry
);
if
(
object
->
OriginalIndex
==
Index
)
break
;
...
...
@@ -2560,7 +2560,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD I
ERR
(
"Out of memory error when allocating a light
\n
"
);
return
E_OUTOFMEMORY
;
}
list_add_head
(
&
This
->
updateStateBlock
->
lightM
ap
[
Hi
],
&
object
->
entry
);
list_add_head
(
&
This
->
updateStateBlock
->
state
.
light_m
ap
[
Hi
],
&
object
->
entry
);
object
->
glIndex
=
-
1
;
object
->
OriginalIndex
=
Index
;
}
...
...
@@ -2659,7 +2659,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD I
struct
list
*
e
;
TRACE
(
"(%p) : Idx(%d), pLight(%p)
\n
"
,
This
,
Index
,
pLight
);
LIST_FOR_EACH
(
e
,
&
This
->
stateBlock
->
lightM
ap
[
Hi
])
LIST_FOR_EACH
(
e
,
&
This
->
stateBlock
->
state
.
light_m
ap
[
Hi
])
{
lightInfo
=
LIST_ENTRY
(
e
,
struct
wined3d_light_info
,
entry
);
if
(
lightInfo
->
OriginalIndex
==
Index
)
break
;
...
...
@@ -2688,7 +2688,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D
struct
list
*
e
;
TRACE
(
"(%p) : Idx(%d), enable? %d
\n
"
,
This
,
Index
,
Enable
);
LIST_FOR_EACH
(
e
,
&
This
->
updateStateBlock
->
lightM
ap
[
Hi
])
LIST_FOR_EACH
(
e
,
&
This
->
updateStateBlock
->
state
.
light_m
ap
[
Hi
])
{
lightInfo
=
LIST_ENTRY
(
e
,
struct
wined3d_light_info
,
entry
);
if
(
lightInfo
->
OriginalIndex
==
Index
)
break
;
...
...
@@ -2703,7 +2703,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D
IWineD3DDeviceImpl_SetLight
(
iface
,
Index
,
&
WINED3D_default_light
);
/* Search for it again! Should be fairly quick as near head of list */
LIST_FOR_EACH
(
e
,
&
This
->
updateStateBlock
->
lightM
ap
[
Hi
])
LIST_FOR_EACH
(
e
,
&
This
->
updateStateBlock
->
state
.
light_m
ap
[
Hi
])
{
lightInfo
=
LIST_ENTRY
(
e
,
struct
wined3d_light_info
,
entry
);
if
(
lightInfo
->
OriginalIndex
==
Index
)
break
;
...
...
@@ -2722,7 +2722,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D
IWineD3DDeviceImpl_MarkStateDirty
(
This
,
STATE_ACTIVELIGHT
(
lightInfo
->
glIndex
));
}
This
->
updateStateBlock
->
activeL
ights
[
lightInfo
->
glIndex
]
=
NULL
;
This
->
updateStateBlock
->
state
.
l
ights
[
lightInfo
->
glIndex
]
=
NULL
;
lightInfo
->
glIndex
=
-
1
;
}
else
{
TRACE
(
"Light already disabled, nothing to do
\n
"
);
...
...
@@ -2738,9 +2738,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, D
/* Find a free gl light */
for
(
i
=
0
;
i
<
This
->
maxConcurrentLights
;
++
i
)
{
if
(
!
This
->
updateStateBlock
->
activeL
ights
[
i
])
if
(
!
This
->
updateStateBlock
->
state
.
l
ights
[
i
])
{
This
->
updateStateBlock
->
activeL
ights
[
i
]
=
lightInfo
;
This
->
updateStateBlock
->
state
.
l
ights
[
i
]
=
lightInfo
;
lightInfo
->
glIndex
=
i
;
break
;
}
...
...
@@ -2775,7 +2775,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetLightEnable(IWineD3DDevice *iface, D
UINT
Hi
=
LIGHTMAP_HASHFUNC
(
Index
);
TRACE
(
"(%p) : for idx(%d)
\n
"
,
This
,
Index
);
LIST_FOR_EACH
(
e
,
&
This
->
stateBlock
->
lightM
ap
[
Hi
])
LIST_FOR_EACH
(
e
,
&
This
->
stateBlock
->
state
.
light_m
ap
[
Hi
])
{
lightInfo
=
LIST_ENTRY
(
e
,
struct
wined3d_light_info
,
entry
);
if
(
lightInfo
->
OriginalIndex
==
Index
)
break
;
...
...
dlls/wined3d/state.c
View file @
4546a13d
...
...
@@ -3938,7 +3938,7 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
/* Reset lights. TODO: Call light apply func */
for
(
k
=
0
;
k
<
stateblock
->
device
->
maxConcurrentLights
;
++
k
)
{
light
=
stateblock
->
activeL
ights
[
k
];
light
=
stateblock
->
state
.
l
ights
[
k
];
if
(
!
light
)
continue
;
glLightfv
(
GL_LIGHT0
+
light
->
glIndex
,
GL_POSITION
,
light
->
lightPosn
);
checkGLcall
(
"glLightfv posn"
);
...
...
@@ -4812,7 +4812,7 @@ static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock,
static
void
light
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
struct
wined3d_context
*
context
)
{
UINT
Index
=
state
-
STATE_ACTIVELIGHT
(
0
);
const
struct
wined3d_light_info
*
lightInfo
=
stateblock
->
activeL
ights
[
Index
];
const
struct
wined3d_light_info
*
lightInfo
=
stateblock
->
state
.
l
ights
[
Index
];
if
(
!
lightInfo
)
{
glDisable
(
GL_LIGHT0
+
Index
);
...
...
dlls/wined3d/stateblock.c
View file @
4546a13d
...
...
@@ -452,7 +452,7 @@ static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct li
struct
wined3d_light_info
*
dst_light
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
dst_light
));
*
dst_light
=
*
src_light
;
list_add_tail
(
&
stateblock
->
lightM
ap
[
i
],
&
dst_light
->
entry
);
list_add_tail
(
&
stateblock
->
state
.
light_m
ap
[
i
],
&
dst_light
->
entry
);
}
}
}
...
...
@@ -518,7 +518,7 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
for
(
counter
=
0
;
counter
<
LIGHTMAP_SIZE
;
counter
++
)
{
struct
list
*
e1
,
*
e2
;
LIST_FOR_EACH_SAFE
(
e1
,
e2
,
&
This
->
lightM
ap
[
counter
])
LIST_FOR_EACH_SAFE
(
e1
,
e2
,
&
This
->
state
.
light_m
ap
[
counter
])
{
struct
wined3d_light_info
*
light
=
LIST_ENTRY
(
e1
,
struct
wined3d_light_info
,
entry
);
list_remove
(
&
light
->
entry
);
...
...
@@ -549,12 +549,14 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock
*/
for
(
i
=
0
;
i
<
LIGHTMAP_SIZE
;
i
++
)
{
struct
list
*
e
,
*
f
;
LIST_FOR_EACH
(
e
,
&
This
->
lightMap
[
i
])
{
LIST_FOR_EACH
(
e
,
&
This
->
state
.
light_map
[
i
])
{
BOOL
updated
=
FALSE
;
struct
wined3d_light_info
*
src
=
LIST_ENTRY
(
e
,
struct
wined3d_light_info
,
entry
),
*
realLight
;
/* Look up the light in the destination */
LIST_FOR_EACH
(
f
,
&
targetStateBlock
->
lightMap
[
i
])
{
LIST_FOR_EACH
(
f
,
&
targetStateBlock
->
state
.
light_map
[
i
])
{
realLight
=
LIST_ENTRY
(
f
,
struct
wined3d_light_info
,
entry
);
if
(
realLight
->
OriginalIndex
==
src
->
OriginalIndex
)
{
...
...
@@ -563,12 +565,12 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock
if
(
realLight
->
glIndex
==
-
1
&&
src
->
glIndex
!=
-
1
)
{
/* Light disabled */
This
->
activeL
ights
[
src
->
glIndex
]
=
NULL
;
This
->
state
.
l
ights
[
src
->
glIndex
]
=
NULL
;
}
else
if
(
realLight
->
glIndex
!=
-
1
&&
src
->
glIndex
==
-
1
)
{
/* Light enabled */
This
->
activeL
ights
[
realLight
->
glIndex
]
=
src
;
This
->
state
.
l
ights
[
realLight
->
glIndex
]
=
src
;
}
src
->
glIndex
=
realLight
->
glIndex
;
updated
=
TRUE
;
...
...
@@ -586,7 +588,7 @@ static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlock
src
->
OriginalParms
=
WINED3D_default_light
;
if
(
src
->
glIndex
!=
-
1
)
{
This
->
activeL
ights
[
src
->
glIndex
]
=
NULL
;
This
->
state
.
l
ights
[
src
->
glIndex
]
=
NULL
;
src
->
glIndex
=
-
1
;
}
}
...
...
@@ -896,7 +898,7 @@ static void apply_lights(IWineD3DDevice *device, const IWineD3DStateBlockImpl *T
for
(
i
=
0
;
i
<
LIGHTMAP_SIZE
;
i
++
)
{
struct
list
*
e
;
LIST_FOR_EACH
(
e
,
&
This
->
lightM
ap
[
i
])
LIST_FOR_EACH
(
e
,
&
This
->
state
.
light_m
ap
[
i
])
{
const
struct
wined3d_light_info
*
light
=
LIST_ENTRY
(
e
,
struct
wined3d_light_info
,
entry
);
...
...
@@ -1371,7 +1373,7 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *
for
(
i
=
0
;
i
<
LIGHTMAP_SIZE
;
i
++
)
{
list_init
(
&
stateblock
->
lightM
ap
[
i
]);
list_init
(
&
stateblock
->
state
.
light_m
ap
[
i
]);
}
hr
=
stateblock_allocate_shader_constants
(
stateblock
);
...
...
@@ -1387,7 +1389,7 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *
switch
(
type
)
{
case
WINED3DSBT_ALL
:
stateblock_init_lights
(
stateblock
,
device
->
stateBlock
->
lightM
ap
);
stateblock_init_lights
(
stateblock
,
device
->
stateBlock
->
state
.
light_m
ap
);
stateblock_savedstates_set_all
(
&
stateblock
->
changed
,
device
->
d3d_vshader_constantF
,
device
->
d3d_pshader_constantF
);
break
;
...
...
@@ -1397,7 +1399,7 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *
break
;
case
WINED3DSBT_VERTEXSTATE
:
stateblock_init_lights
(
stateblock
,
device
->
stateBlock
->
lightM
ap
);
stateblock_init_lights
(
stateblock
,
device
->
stateBlock
->
state
.
light_m
ap
);
stateblock_savedstates_set_vertex
(
&
stateblock
->
changed
,
device
->
d3d_vshader_constantF
);
break
;
...
...
dlls/wined3d/wined3d_private.h
View file @
4546a13d
...
...
@@ -2378,6 +2378,12 @@ struct wined3d_state
WINED3DVIEWPORT
viewport
;
RECT
scissor_rect
;
/* 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 */
struct
list
light_map
[
LIGHTMAP_SIZE
];
/* Hash map containing the lights */
const
struct
wined3d_light_info
*
lights
[
MAX_ACTIVE_LIGHTS
];
/* Map of opengl lights to d3d lights */
DWORD
render_states
[
WINEHIGHEST_RENDER_STATE
+
1
];
};
...
...
@@ -2395,12 +2401,6 @@ struct IWineD3DStateBlockImpl
SAVEDSTATES
changed
;
struct
wined3d_state
state
;
/* 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 */
struct
list
lightMap
[
LIGHTMAP_SIZE
];
/* Hash map containing the lights */
const
struct
wined3d_light_info
*
activeLights
[
MAX_ACTIVE_LIGHTS
];
/* Map of opengl lights to d3d lights */
/* Clipping */
double
clipplane
[
MAX_CLIPPLANES
][
4
];
WINED3DCLIPSTATUS
clip_status
;
...
...
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