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
40b09a23
Commit
40b09a23
authored
Sep 19, 2003
by
Jason Edmeades
Committed by
Alexandre Julliard
Sep 19, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vertex shader output is lit and transformed, so stop GL doing it all
again.
parent
74c3281b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
22 deletions
+43
-22
drawprim.c
dlls/d3d8/drawprim.c
+32
-13
vshaderdeclaration.c
dlls/d3d8/vshaderdeclaration.c
+11
-9
No files found.
dlls/d3d8/drawprim.c
View file @
40b09a23
...
...
@@ -214,21 +214,21 @@ void init_materials(LPDIRECT3DDEVICE8 iface, BOOL isDiffuseSupplied) {
/* Setup views - Transformed & lit if RHW, else untransformed.
Only unlit if Normals are supplied
Returns: Whether to restore lighting afterwards */
BOOL
primitiveInitState
(
LPDIRECT3DDEVICE8
iface
,
BOOL
vtx_transformed
,
BOOL
vtx_lit
)
{
BOOL
primitiveInitState
(
LPDIRECT3DDEVICE8
iface
,
BOOL
vtx_transformed
,
BOOL
vtx_lit
,
BOOL
useVS
)
{
BOOL
isLightingOn
=
FALSE
;
ICOM_THIS
(
IDirect3DDevice8Impl
,
iface
);
/* If no normals, DISABLE lighting otherwise, dont touch lighing as it is
set by the appropriate render state
*/
if
(
vtx_lit
)
{
set by the appropriate render state
. Note Vertex Shader output is already lit
*/
if
(
vtx_lit
||
useVS
)
{
isLightingOn
=
glIsEnabled
(
GL_LIGHTING
);
glDisable
(
GL_LIGHTING
);
checkGLcall
(
"glDisable(GL_LIGHTING);"
);
TRACE
(
"Disabled lighting as no normals supplied, old state = %d
\n
"
,
isLightingOn
);
}
if
(
vtx_transformed
)
{
if
(
!
useVS
&&
vtx_transformed
)
{
/* If the last draw was transformed as well, no need to reapply all the matrixes */
if
(
!
This
->
last_was_rhw
)
{
...
...
@@ -270,7 +270,7 @@ BOOL primitiveInitState(LPDIRECT3DDEVICE8 iface, BOOL vtx_transformed, BOOL vtx_
/* Untransformed, so relies on the view and projection matrices */
if
(
This
->
last_was_rhw
||
!
This
->
modelview_valid
)
{
if
(
!
useVS
&&
(
This
->
last_was_rhw
||
!
This
->
modelview_valid
)
)
{
/* Only reapply when have to */
This
->
modelview_valid
=
TRUE
;
glMatrixMode
(
GL_MODELVIEW
);
...
...
@@ -288,7 +288,7 @@ BOOL primitiveInitState(LPDIRECT3DDEVICE8 iface, BOOL vtx_transformed, BOOL vtx_
}
}
if
(
This
->
last_was_rhw
||
!
This
->
proj_valid
)
{
if
(
!
useVS
&&
(
This
->
last_was_rhw
||
!
This
->
proj_valid
)
)
{
/* Only reapply when have to */
This
->
proj_valid
=
TRUE
;
glMatrixMode
(
GL_PROJECTION
);
...
...
@@ -308,6 +308,24 @@ BOOL primitiveInitState(LPDIRECT3DDEVICE8 iface, BOOL vtx_transformed, BOOL vtx_
checkGLcall
(
"glLoadMatrixf"
);
}
/* Vertex Shader output is already transformed, so set up identity matrices */
/* FIXME: Actually, only true for software emulated ones, so when h/w ones
come along this needs to take into account whether s/w ones were
requested or not */
if
(
useVS
)
{
glMatrixMode
(
GL_MODELVIEW
);
checkGLcall
(
"glMatrixMode"
);
glLoadIdentity
();
glMatrixMode
(
GL_PROJECTION
);
checkGLcall
(
"glMatrixMode"
);
glLoadIdentity
();
/* Window Coord 0 is the middle of the first pixel, so translate by half
a pixel (See comment above glTranslate above) */
glTranslatef
(
1
.
0
/
This
->
StateBlock
->
viewport
.
Width
,
-
1
.
0
/
This
->
StateBlock
->
viewport
.
Height
,
0
);
checkGLcall
(
"glTranslatef (1.0/width, -1.0/height, 0)"
);
This
->
modelview_valid
=
FALSE
;
This
->
proj_valid
=
FALSE
;
}
This
->
last_was_rhw
=
FALSE
;
}
return
isLightingOn
;
...
...
@@ -601,7 +619,7 @@ void draw_vertex(LPDIRECT3DDEVICE8 iface, /* interf
/* Position -------------------------------- */
if
(
isXYZ
==
TRUE
)
{
if
(
1
.
0
f
==
rhw
||
rhw
<
0
.
01
f
)
{
if
(
1
.
0
f
==
rhw
||
rhw
<
0
.
0
000
1
f
)
{
VTRACE
((
"Vertex: glVertex:x,y,z=%f,%f,%f
\n
"
,
x
,
y
,
z
));
glVertex3f
(
x
,
y
,
z
);
}
else
{
...
...
@@ -1166,7 +1184,7 @@ void drawStridedSlow(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *sd,
/* Position -------------------------------- */
if
(
sd
->
u
.
s
.
position
.
lpData
!=
NULL
)
{
if
(
1
.
0
f
==
rhw
||
rhw
<
0
.
01
f
)
{
if
(
1
.
0
f
==
rhw
||
rhw
<
0
.
0
00
1
f
)
{
VTRACE
((
"Vertex: glVertex:x,y,z=%f,%f,%f
\n
"
,
x
,
y
,
z
));
glVertex3f
(
x
,
y
,
z
);
}
else
{
...
...
@@ -1302,7 +1320,7 @@ void drawStridedSoftwareVS(LPDIRECT3DDEVICE8 iface, Direct3DVertexStridedData *s
/* Draw using this information */
draw_vertex
(
iface
,
TRUE
,
x
,
y
,
z
,
rhw
,
FALSE
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
TRUE
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
,
TRUE
,
(
float
*
)
&
vertex_shader
->
output
.
oD
[
0
],
TRUE
,
(
float
*
)
&
vertex_shader
->
output
.
oD
[
1
],
FALSE
,
ptSize
,
/* FIXME: Change back when supported */
...
...
@@ -1350,7 +1368,7 @@ void drawPrimitive(LPDIRECT3DDEVICE8 iface,
/** init Constants */
if
(
TRUE
==
This
->
UpdateStateBlock
->
Changed
.
vertexShaderConstant
)
{
TRACE_
(
d3d_shader
)(
"vertex shader init
Constant
\n
"
);
TRACE_
(
d3d_shader
)(
"vertex shader init
ializing constants
\n
"
);
IDirect3DVertexShaderImpl_SetConstantF
(
vertex_shader
,
0
,
(
CONST
FLOAT
*
)
&
This
->
UpdateStateBlock
->
vertexShaderConstant
[
0
],
96
);
}
}
...
...
@@ -1361,7 +1379,8 @@ void drawPrimitive(LPDIRECT3DDEVICE8 iface,
/* Setup transform matrices and sort out */
isLightingOn
=
primitiveInitState
(
iface
,
fvf
&
D3DFVF_XYZRHW
,
!
(
fvf
&
D3DFVF_NORMAL
));
!
(
fvf
&
D3DFVF_NORMAL
),
useVertexShaderFunction
);
/* Initialize all values to null */
if
(
useVertexShaderFunction
==
FALSE
)
{
...
...
@@ -1422,8 +1441,8 @@ void drawPrimitive(LPDIRECT3DDEVICE8 iface,
idxData
,
idxSize
,
minIndex
,
StartIdx
);
}
/* If no normals, restore previous lighting state */
if
(
!
(
fvf
&
D3DFVF_NORMAL
))
{
/* If
vertex shaders or
no normals, restore previous lighting state */
if
(
useVertexShaderFunction
||
!
(
fvf
&
D3DFVF_NORMAL
))
{
if
(
isLightingOn
)
glEnable
(
GL_LIGHTING
);
else
glDisable
(
GL_LIGHTING
);
TRACE
(
"Restored lighting to original state
\n
"
);
...
...
dlls/d3d8/vshaderdeclaration.c
View file @
40b09a23
...
...
@@ -245,7 +245,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
case
D3DVSDT_FLOAT3
:
fvf
|=
D3DFVF_XYZ
;
break
;
case
D3DVSDT_FLOAT4
:
fvf
|=
D3DFVF_XYZRHW
;
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
if
(
type
>=
MAX_VSHADER_DECL_TYPES
)
{
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_POSITION register: unsupported and unrecognized type %08lx
\n
"
,
type
);
...
...
@@ -262,7 +262,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
case
D3DVSDT_FLOAT3
:
fvf
|=
D3DFVF_XYZB3
;
break
;
case
D3DVSDT_FLOAT4
:
fvf
|=
D3DFVF_XYZB4
;
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_BLENDWEIGHT register: unsupported type %s
\n
"
,
VertexShaderDeclDataTypes
[
type
]);
}
...
...
@@ -272,7 +272,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
switch
(
type
)
{
case
D3DVSDT_UBYTE4
:
fvf
|=
D3DFVF_LASTBETA_UBYTE4
;
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_BLENDINDINCES register: unsupported type %s
\n
"
,
VertexShaderDeclDataTypes
[
type
]);
}
...
...
@@ -282,7 +282,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
switch
(
type
)
{
case
D3DVSDT_FLOAT3
:
fvf
|=
D3DFVF_NORMAL
;
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_NORMAL register: unsupported type %s
\n
"
,
VertexShaderDeclDataTypes
[
type
]);
}
...
...
@@ -292,7 +292,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
switch
(
type
)
{
case
D3DVSDT_FLOAT1
:
fvf
|=
D3DFVF_PSIZE
;
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_PSIZE register: unsupported type %s
\n
"
,
VertexShaderDeclDataTypes
[
type
]);
}
...
...
@@ -302,7 +302,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
switch
(
type
)
{
case
D3DVSDT_D3DCOLOR
:
fvf
|=
D3DFVF_DIFFUSE
;
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_DIFFUSE register: unsupported type %s
\n
"
,
VertexShaderDeclDataTypes
[
type
]);
}
...
...
@@ -312,7 +312,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
switch
(
type
)
{
case
D3DVSDT_D3DCOLOR
:
fvf
|=
D3DFVF_SPECULAR
;
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_SPECULAR register: unsupported type %s
\n
"
,
VertexShaderDeclDataTypes
[
type
]);
}
...
...
@@ -336,7 +336,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
case
D3DVSDT_FLOAT3
:
fvf
|=
D3DFVF_TEXCOORDSIZE3
(
texNo
);
break
;
case
D3DVSDT_FLOAT4
:
fvf
|=
D3DFVF_TEXCOORDSIZE4
(
texNo
);
break
;
default:
/**
errooooorr mismatched use of a register, invalid fvf computing
*/
/**
Mismatched use of a register, invalid for fixed function fvf computing (ok for VS)
*/
invalid_fvf
=
TRUE
;
TRACE
(
"Mismatched use in VertexShader declaration of D3DVSDE_TEXCOORD? register: unsupported type %s
\n
"
,
VertexShaderDeclDataTypes
[
type
]);
}
...
...
@@ -345,7 +345,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_CreateVertexShaderDeclaration8(IDirect3DDevic
case
D3DVSDE_POSITION2
:
/* maybe D3DFVF_XYZRHW instead D3DFVF_XYZ (of D3DVDE_POSITION) ... to see */
case
D3DVSDE_NORMAL2
:
/* FIXME i don't know what to do here ;( */
TRAC
E
(
"[%lu] registers in VertexShader declaration not supported yet (token:0x%08lx)
\n
"
,
reg
,
token
);
FIXM
E
(
"[%lu] registers in VertexShader declaration not supported yet (token:0x%08lx)
\n
"
,
reg
,
token
);
break
;
}
TRACE
(
"VertexShader declaration define %lx as current FVF
\n
"
,
fvf
);
...
...
@@ -442,6 +442,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInput(IDirect3DDevice8Impl* T
}
else
if
(
D3DVSD_TOKEN_STREAMDATA
==
tokentype
&&
0
!=
(
0x10000000
&
tokentype
))
{
/** skip datas */
DWORD
skipCount
=
((
token
&
D3DVSD_SKIPCOUNTMASK
)
>>
D3DVSD_SKIPCOUNTSHIFT
);
TRACE
(
" skipping %ld dwords
\n
"
,
skipCount
);
curPos
=
curPos
+
skipCount
*
sizeof
(
DWORD
);
++
pToken
;
...
...
@@ -450,6 +451,7 @@ HRESULT WINAPI IDirect3DDeviceImpl_FillVertexShaderInput(IDirect3DDevice8Impl* T
DWORD
reg
=
((
token
&
D3DVSD_VERTEXREGMASK
)
>>
D3DVSD_VERTEXREGSHIFT
);
++
pToken
;
TRACE
(
" type : %ld, reg = %ld
\n
"
,
type
,
reg
);
switch
(
type
)
{
case
D3DVSDT_FLOAT1
:
x
=
*
(
float
*
)
curPos
;
...
...
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