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
9b492099
Commit
9b492099
authored
Jan 10, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jan 10, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Move material applying to the state table.
parent
dfeb40cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
45 deletions
+24
-45
drawprim.c
dlls/wined3d/drawprim.c
+0
-34
state.c
dlls/wined3d/state.c
+24
-11
No files found.
dlls/wined3d/drawprim.c
View file @
9b492099
...
...
@@ -90,37 +90,6 @@ static DWORD primitiveToGl(WINED3DPRIMITIVETYPE PrimitiveType,
return
NumVertexes
;
}
/* Ensure the appropriate material states are set up - only change
state if really required */
static
void
init_materials
(
IWineD3DDevice
*
iface
,
BOOL
isDiffuseSupplied
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
if
(
This
->
tracking_color
==
NEEDS_TRACKING
&&
isDiffuseSupplied
)
{
/* If we have not set up the material color tracking, do it now as required */
glDisable
(
GL_COLOR_MATERIAL
);
/* Note: Man pages state must enable AFTER calling glColorMaterial! Required?*/
checkGLcall
(
"glDisable GL_COLOR_MATERIAL"
);
TRACE
(
"glColorMaterial Parm=%x
\n
"
,
This
->
tracking_parm
);
glColorMaterial
(
GL_FRONT_AND_BACK
,
This
->
tracking_parm
);
checkGLcall
(
"glColorMaterial(GL_FRONT_AND_BACK, Parm)"
);
glEnable
(
GL_COLOR_MATERIAL
);
checkGLcall
(
"glEnable GL_COLOR_MATERIAL"
);
This
->
tracking_color
=
IS_TRACKING
;
}
else
if
((
This
->
tracking_color
==
IS_TRACKING
&&
!
isDiffuseSupplied
)
||
(
This
->
tracking_color
==
NEEDS_TRACKING
&&
!
isDiffuseSupplied
))
{
/* If we are tracking the current color but one isn't supplied, don't! */
glDisable
(
GL_COLOR_MATERIAL
);
checkGLcall
(
"glDisable GL_COLOR_MATERIAL"
);
This
->
tracking_color
=
NEEDS_TRACKING
;
}
else
if
(
This
->
tracking_color
==
IS_TRACKING
&&
isDiffuseSupplied
)
{
/* No need to reset material colors since no change to gl_color_material */
}
else
if
(
This
->
tracking_color
==
NEEDS_DISABLE
)
{
glDisable
(
GL_COLOR_MATERIAL
);
checkGLcall
(
"glDisable GL_COLOR_MATERIAL"
);
This
->
tracking_color
=
DISABLED_TRACKING
;
}
}
static
BOOL
fixed_get_input
(
BYTE
usage
,
BYTE
usage_idx
,
unsigned
int
*
regnum
)
{
...
...
@@ -1248,9 +1217,6 @@ void drawPrimitive(IWineD3DDevice *iface,
}
This
->
depth_copy_state
=
WINED3D_DCS_INITIAL
;
/* Now initialize the materials state */
init_materials
(
iface
,
(
This
->
strided_streams
.
u
.
s
.
diffuse
.
lpData
!=
NULL
||
This
->
strided_streams
.
u
.
s
.
diffuse
.
VBO
!=
0
));
{
GLenum
glPrimType
;
/* Ok, Work out which primitive is requested and how many vertexes that
...
...
dlls/wined3d/state.c
View file @
9b492099
...
...
@@ -806,7 +806,18 @@ static void state_fogdensity(DWORD state, IWineD3DStateBlockImpl *stateblock) {
/* TODO: Merge with primitive type + init_materials()!! */
static
void
state_colormat
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
)
{
GLenum
Parm
=
GL_AMBIENT_AND_DIFFUSE
;
GLenum
Parm
=
-
1
;
WineDirect3DStridedData
*
diffuse
=
&
stateblock
->
wineD3DDevice
->
strided_streams
.
u
.
s
.
diffuse
;
BOOL
isDiffuseSupplied
;
/* Depends on the decoded vertex declaration to read the existance of diffuse data.
* The vertex declaration will call this function if the fixed function pipeline is used.
*/
if
(
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_VDECL
))
{
return
;
}
isDiffuseSupplied
=
diffuse
->
lpData
||
diffuse
->
VBO
;
if
(
stateblock
->
renderState
[
WINED3DRS_COLORVERTEX
])
{
TRACE
(
"diff %d, amb %d, emis %d, spec %d
\n
"
,
...
...
@@ -827,19 +838,17 @@ static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock) {
Parm
=
GL_EMISSION
;
}
else
if
(
stateblock
->
renderState
[
WINED3DRS_SPECULARMATERIALSOURCE
]
==
D3DMCS_COLOR1
)
{
Parm
=
GL_SPECULAR
;
}
else
{
Parm
=
-
1
;
}
if
(
Parm
==
-
1
)
{
if
(
stateblock
->
wineD3DDevice
->
tracking_color
!=
DISABLED_TRACKING
)
stateblock
->
wineD3DDevice
->
tracking_color
=
NEEDS_DISABLE
;
}
else
{
stateblock
->
wineD3DDevice
->
tracking_color
=
NEEDS_TRACKING
;
stateblock
->
wineD3DDevice
->
tracking_parm
=
Parm
;
}
}
if
(
Parm
==
-
1
||
!
isDiffuseSupplied
)
{
glDisable
(
GL_COLOR_MATERIAL
);
checkGLcall
(
"glDisable GL_COLOR_MATERIAL"
);
}
else
{
if
(
stateblock
->
wineD3DDevice
->
tracking_color
!=
DISABLED_TRACKING
)
stateblock
->
wineD3DDevice
->
tracking_color
=
NEEDS_DISABLE
;
glColorMaterial
(
GL_FRONT_AND_BACK
,
Parm
);
checkGLcall
(
"glColorMaterial(GL_FRONT_AND_BACK, Parm)"
);
glEnable
(
GL_COLOR_MATERIAL
);
checkGLcall
(
"glEnable(GL_COLOR_MATERIAL)"
);
}
}
...
...
@@ -2678,6 +2687,10 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock) {
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_TRANSFORM
(
WINED3DTS_VIEW
)))
{
transform_world
(
STATE_TRANSFORM
(
WINED3DTS_WORLDMATRIX
(
0
)),
stateblock
);
}
if
(
!
isStateDirty
(
stateblock
->
wineD3DDevice
,
STATE_RENDER
(
WINED3DRS_COLORVERTEX
)))
{
state_colormat
(
STATE_RENDER
(
WINED3DRS_COLORVERTEX
),
stateblock
);
}
}
else
{
/* We compile the shader here because we need the vertex declaration
* in order to determine if we need to do any swizzling for D3DCOLOR
...
...
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