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
5f6ced27
Commit
5f6ced27
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 the material to wined3d_state.
parent
cde699b2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
31 deletions
+32
-31
device.c
dlls/wined3d/device.c
+2
-2
state.c
dlls/wined3d/state.c
+25
-22
stateblock.c
dlls/wined3d/stateblock.c
+4
-4
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-3
No files found.
dlls/wined3d/device.c
View file @
5f6ced27
...
...
@@ -2873,7 +2873,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONS
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
This
->
updateStateBlock
->
changed
.
material
=
TRUE
;
This
->
updateStateBlock
->
material
=
*
pMaterial
;
This
->
updateStateBlock
->
state
.
material
=
*
pMaterial
;
/* Handle recording of state blocks */
if
(
This
->
isRecordingState
)
{
...
...
@@ -2887,7 +2887,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONS
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetMaterial
(
IWineD3DDevice
*
iface
,
WINED3DMATERIAL
*
pMaterial
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
*
pMaterial
=
This
->
updateStateBlock
->
material
;
*
pMaterial
=
This
->
updateStateBlock
->
state
.
material
;
TRACE
(
"(%p) : Diffuse (%f,%f,%f,%f)
\n
"
,
This
,
pMaterial
->
Diffuse
.
r
,
pMaterial
->
Diffuse
.
g
,
pMaterial
->
Diffuse
.
b
,
pMaterial
->
Diffuse
.
a
);
TRACE
(
"(%p) : Ambient (%f,%f,%f,%f)
\n
"
,
This
,
pMaterial
->
Ambient
.
r
,
pMaterial
->
Ambient
.
g
,
...
...
dlls/wined3d/state.c
View file @
5f6ced27
...
...
@@ -716,10 +716,10 @@ static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock
TRACE
(
"Setting specular enable state and materials
\n
"
);
if
(
stateblock
->
state
.
render_states
[
WINED3DRS_SPECULARENABLE
])
{
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
(
float
*
)
&
stateblock
->
material
.
Specular
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
(
float
*
)
&
stateblock
->
state
.
material
.
Specular
);
checkGLcall
(
"glMaterialfv"
);
if
(
stateblock
->
material
.
Power
>
gl_info
->
limits
.
shininess
)
if
(
stateblock
->
state
.
material
.
Power
>
gl_info
->
limits
.
shininess
)
{
/* glMaterialf man page says that the material says that GL_SHININESS must be between 0.0
* and 128.0, although in d3d neither -1 nor 129 produce an error. GL_NV_max_light_exponent
...
...
@@ -727,10 +727,12 @@ static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock
* value reported by the extension, otherwise 128. For values > gl_info->limits.shininess clamp
* them, it should be safe to do so without major visual distortions.
*/
WARN
(
"Material power = %f, limit %f
\n
"
,
stateblock
->
material
.
Power
,
gl_info
->
limits
.
shininess
);
WARN
(
"Material power = %f, limit %f
\n
"
,
stateblock
->
state
.
material
.
Power
,
gl_info
->
limits
.
shininess
);
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
gl_info
->
limits
.
shininess
);
}
else
{
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
stateblock
->
material
.
Power
);
}
else
{
glMaterialf
(
GL_FRONT_AND_BACK
,
GL_SHININESS
,
stateblock
->
state
.
material
.
Power
);
}
checkGLcall
(
"glMaterialf(GL_SHININESS)"
);
...
...
@@ -775,23 +777,23 @@ static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock
}
TRACE
(
"(%p) : Diffuse {%.8e, %.8e, %.8e, %.8e}
\n
"
,
stateblock
->
device
,
stateblock
->
material
.
Diffuse
.
r
,
stateblock
->
material
.
Diffuse
.
g
,
stateblock
->
material
.
Diffuse
.
b
,
stateblock
->
material
.
Diffuse
.
a
);
stateblock
->
state
.
material
.
Diffuse
.
r
,
stateblock
->
state
.
material
.
Diffuse
.
g
,
stateblock
->
state
.
material
.
Diffuse
.
b
,
stateblock
->
state
.
material
.
Diffuse
.
a
);
TRACE
(
"(%p) : Ambient {%.8e, %.8e, %.8e, %.8e}
\n
"
,
stateblock
->
device
,
stateblock
->
material
.
Ambient
.
r
,
stateblock
->
material
.
Ambient
.
g
,
stateblock
->
material
.
Ambient
.
b
,
stateblock
->
material
.
Ambient
.
a
);
stateblock
->
state
.
material
.
Ambient
.
r
,
stateblock
->
state
.
material
.
Ambient
.
g
,
stateblock
->
state
.
material
.
Ambient
.
b
,
stateblock
->
state
.
material
.
Ambient
.
a
);
TRACE
(
"(%p) : Specular {%.8e, %.8e, %.8e, %.8e}
\n
"
,
stateblock
->
device
,
stateblock
->
material
.
Specular
.
r
,
stateblock
->
material
.
Specular
.
g
,
stateblock
->
material
.
Specular
.
b
,
stateblock
->
material
.
Specular
.
a
);
stateblock
->
state
.
material
.
Specular
.
r
,
stateblock
->
state
.
material
.
Specular
.
g
,
stateblock
->
state
.
material
.
Specular
.
b
,
stateblock
->
state
.
material
.
Specular
.
a
);
TRACE
(
"(%p) : Emissive {%.8e, %.8e, %.8e, %.8e}
\n
"
,
stateblock
->
device
,
stateblock
->
material
.
Emissive
.
r
,
stateblock
->
material
.
Emissive
.
g
,
stateblock
->
material
.
Emissive
.
b
,
stateblock
->
material
.
Emissive
.
a
);
stateblock
->
state
.
material
.
Emissive
.
r
,
stateblock
->
state
.
material
.
Emissive
.
g
,
stateblock
->
state
.
material
.
Emissive
.
b
,
stateblock
->
state
.
material
.
Emissive
.
a
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
(
float
*
)
&
stateblock
->
material
.
Ambient
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
(
float
*
)
&
stateblock
->
state
.
material
.
Ambient
);
checkGLcall
(
"glMaterialfv(GL_AMBIENT)"
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
,
(
float
*
)
&
stateblock
->
material
.
Diffuse
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
,
(
float
*
)
&
stateblock
->
state
.
material
.
Diffuse
);
checkGLcall
(
"glMaterialfv(GL_DIFFUSE)"
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
(
float
*
)
&
stateblock
->
material
.
Emissive
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
(
float
*
)
&
stateblock
->
state
.
material
.
Emissive
);
checkGLcall
(
"glMaterialfv(GL_EMISSION)"
);
}
...
...
@@ -1317,23 +1319,23 @@ static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
* tracking with glColorMaterial, so apply those here. */
switch
(
context
->
tracking_parm
)
{
case
GL_AMBIENT_AND_DIFFUSE
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
(
float
*
)
&
device
->
updateStateBlock
->
material
.
Ambient
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
,
(
float
*
)
&
device
->
updateStateBlock
->
material
.
Diffuse
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
(
float
*
)
&
device
->
updateStateBlock
->
state
.
material
.
Ambient
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
,
(
float
*
)
&
device
->
updateStateBlock
->
state
.
material
.
Diffuse
);
checkGLcall
(
"glMaterialfv"
);
break
;
case
GL_DIFFUSE
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
,
(
float
*
)
&
device
->
updateStateBlock
->
material
.
Diffuse
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_DIFFUSE
,
(
float
*
)
&
device
->
updateStateBlock
->
state
.
material
.
Diffuse
);
checkGLcall
(
"glMaterialfv"
);
break
;
case
GL_AMBIENT
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
(
float
*
)
&
device
->
updateStateBlock
->
material
.
Ambient
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_AMBIENT
,
(
float
*
)
&
device
->
updateStateBlock
->
state
.
material
.
Ambient
);
checkGLcall
(
"glMaterialfv"
);
break
;
case
GL_EMISSION
:
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
(
float
*
)
&
device
->
updateStateBlock
->
material
.
Emissive
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_EMISSION
,
(
float
*
)
&
device
->
updateStateBlock
->
state
.
material
.
Emissive
);
checkGLcall
(
"glMaterialfv"
);
break
;
...
...
@@ -1341,7 +1343,8 @@ static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
/* Only change material color if specular is enabled, otherwise it is set to black */
if
(
device
->
stateBlock
->
state
.
render_states
[
WINED3DRS_SPECULARENABLE
])
{
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
(
float
*
)
&
device
->
updateStateBlock
->
material
.
Specular
);
glMaterialfv
(
GL_FRONT_AND_BACK
,
GL_SPECULAR
,
(
float
*
)
&
device
->
updateStateBlock
->
state
.
material
.
Specular
);
checkGLcall
(
"glMaterialfv"
);
}
else
{
static
const
GLfloat
black
[]
=
{
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
};
...
...
dlls/wined3d/stateblock.c
View file @
5f6ced27
...
...
@@ -739,12 +739,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
This
->
vertexDecl
=
targetStateBlock
->
vertexDecl
;
}
if
(
This
->
changed
.
material
&
&
memcmp
(
&
targetStateBlock
->
material
,
&
This
->
material
,
sizeof
(
This
->
material
)))
if
(
This
->
changed
.
material
&&
memcmp
(
&
targetStateBlock
->
state
.
material
,
&
This
->
state
.
material
,
sizeof
(
This
->
state
.
material
)))
{
TRACE
(
"Updating material.
\n
"
);
This
->
material
=
targetStateBlock
->
material
;
This
->
state
.
material
=
targetStateBlock
->
state
.
material
;
}
if
(
This
->
changed
.
viewport
&&
memcmp
(
&
targetStateBlock
->
state
.
viewport
,
...
...
@@ -990,7 +990,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
if
(
This
->
changed
.
material
)
{
IWineD3DDevice_SetMaterial
(
device
,
&
This
->
material
);
IWineD3DDevice_SetMaterial
(
device
,
&
This
->
state
.
material
);
}
if
(
This
->
changed
.
viewport
)
...
...
dlls/wined3d/wined3d_private.h
View file @
5f6ced27
...
...
@@ -2349,6 +2349,7 @@ struct wined3d_stream_state
struct
wined3d_state
{
WINED3DMATERIAL
material
;
WINED3DVIEWPORT
viewport
;
RECT
scissor_rect
;
...
...
@@ -2405,9 +2406,6 @@ struct IWineD3DStateBlockImpl
double
clipplane
[
MAX_CLIPPLANES
][
4
];
WINED3DCLIPSTATUS
clip_status
;
/* Material */
WINED3DMATERIAL
material
;
/* Pixel Shader */
IWineD3DPixelShader
*
pixelShader
;
...
...
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