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
875a1eb0
Commit
875a1eb0
authored
Oct 31, 2006
by
Ivan Gyurdiev
Committed by
Alexandre Julliard
Oct 31, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Add D3DFVF codes to the WINED3D namespace.
parent
dd6c4c68
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
39 deletions
+78
-39
device.c
dlls/wined3d/device.c
+13
-13
drawprim.c
dlls/wined3d/drawprim.c
+17
-17
utils.c
dlls/wined3d/utils.c
+9
-9
wined3d_types.h
include/wine/wined3d_types.h
+39
-0
No files found.
dlls/wined3d/device.c
View file @
875a1eb0
...
...
@@ -666,7 +666,7 @@ static void CreateVBO(IWineD3DVertexBufferImpl *object) {
* usage assume DYNAMIC usage and print a warning. The app will have to update
* the vertices regularily for them to be useful
*/
if
(((
object
->
fvf
&
D3DFVF_POSITION_MASK
)
==
D3DFVF_XYZRHW
)
&&
if
(((
object
->
fvf
&
WINED3DFVF_POSITION_MASK
)
==
WINE
D3DFVF_XYZRHW
)
&&
!
(
vboUsage
&
WINED3DUSAGE_DYNAMIC
))
{
WARN
(
"Application creates a vertex buffer holding transformed vertices which doesn't specify dynamic usage
\n
"
);
vboUsage
|=
WINED3DUSAGE_DYNAMIC
;
...
...
@@ -753,7 +753,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
* There is a IDirect3DVertexBuffer7::Optimize call after which the buffer can't be locked any
* more. In this call we can convert dx7 buffers too.
*/
conv
=
((
FVF
&
D3DFVF_POSITION_MASK
)
==
D3DFVF_XYZRHW
)
||
(
FVF
&
(
D3DFVF_DIFFUSE
|
D3DFVF_SPECULAR
));
conv
=
((
FVF
&
WINED3DFVF_POSITION_MASK
)
==
WINED3DFVF_XYZRHW
)
||
(
FVF
&
(
WINED3DFVF_DIFFUSE
|
WINE
D3DFVF_SPECULAR
));
if
(
GL_SUPPORT
(
ARB_VERTEX_BUFFER_OBJECT
)
&&
Pool
!=
WINED3DPOOL_SYSTEMMEM
&&
!
(
Usage
&
WINED3DUSAGE_DYNAMIC
)
&&
(
dxVersion
>
7
||
!
conv
)
)
{
CreateVBO
(
object
);
...
...
@@ -5092,11 +5092,11 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
BOOL
doClip
;
int
numTextures
;
if
(
SrcFVF
&
D3DFVF_NORMAL
)
{
if
(
SrcFVF
&
WINE
D3DFVF_NORMAL
)
{
WARN
(
" lighting state not saved yet... Some strange stuff may happen !
\n
"
);
}
if
(
(
SrcFVF
&
D3DFVF_POSITION_MASK
)
!=
D3DFVF_XYZ
)
{
if
(
(
SrcFVF
&
WINED3DFVF_POSITION_MASK
)
!=
WINE
D3DFVF_XYZ
)
{
ERR
(
"Source has no position mask
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
...
...
@@ -5204,13 +5204,13 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
multiply_matrix
(
&
mat
,
&
view_mat
,
&
world_mat
);
multiply_matrix
(
&
mat
,
&
proj_mat
,
&
mat
);
numTextures
=
(
DestFVF
&
D3DFVF_TEXCOUNT_MASK
)
>>
D3DFVF_TEXCOUNT_SHIFT
;
numTextures
=
(
DestFVF
&
WINED3DFVF_TEXCOUNT_MASK
)
>>
WINE
D3DFVF_TEXCOUNT_SHIFT
;
for
(
i
=
0
;
i
<
dwCount
;
i
+=
1
)
{
unsigned
int
tex_index
;
if
(
((
DestFVF
&
D3DFVF_POSITION_MASK
)
==
D3DFVF_XYZ
)
||
((
DestFVF
&
D3DFVF_POSITION_MASK
)
==
D3DFVF_XYZRHW
)
)
{
if
(
((
DestFVF
&
WINED3DFVF_POSITION_MASK
)
==
WINE
D3DFVF_XYZ
)
||
((
DestFVF
&
WINED3DFVF_POSITION_MASK
)
==
WINE
D3DFVF_XYZRHW
)
)
{
/* The position first */
float
*
p
=
(
float
*
)
(((
char
*
)
lpStrideData
->
u
.
s
.
position
.
lpData
)
+
i
*
lpStrideData
->
u
.
s
.
position
.
dwStride
);
...
...
@@ -5306,7 +5306,7 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
dest_ptr
+=
3
*
sizeof
(
float
);
if
((
DestFVF
&
D3DFVF_POSITION_MASK
)
==
D3DFVF_XYZRHW
)
{
if
((
DestFVF
&
WINED3DFVF_POSITION_MASK
)
==
WINE
D3DFVF_XYZRHW
)
{
dest_ptr
+=
sizeof
(
float
);
}
...
...
@@ -5319,16 +5319,16 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
dest_conv
+=
3
*
sizeof
(
float
);
if
((
DestFVF
&
D3DFVF_POSITION_MASK
)
==
D3DFVF_XYZRHW
)
{
if
((
DestFVF
&
WINED3DFVF_POSITION_MASK
)
==
WINE
D3DFVF_XYZRHW
)
{
dest_conv
+=
sizeof
(
float
);
}
}
}
if
(
DestFVF
&
D3DFVF_PSIZE
)
{
if
(
DestFVF
&
WINE
D3DFVF_PSIZE
)
{
dest_ptr
+=
sizeof
(
DWORD
);
if
(
dest_conv
)
dest_conv
+=
sizeof
(
DWORD
);
}
if
(
DestFVF
&
D3DFVF_NORMAL
)
{
if
(
DestFVF
&
WINE
D3DFVF_NORMAL
)
{
float
*
normal
=
(
float
*
)
(((
float
*
)
lpStrideData
->
u
.
s
.
normal
.
lpData
)
+
i
*
lpStrideData
->
u
.
s
.
normal
.
dwStride
);
/* AFAIK this should go into the lighting information */
...
...
@@ -5339,7 +5339,7 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
}
}
if
(
DestFVF
&
D3DFVF_DIFFUSE
)
{
if
(
DestFVF
&
WINE
D3DFVF_DIFFUSE
)
{
DWORD
*
color_d
=
(
DWORD
*
)
(((
char
*
)
lpStrideData
->
u
.
s
.
diffuse
.
lpData
)
+
i
*
lpStrideData
->
u
.
s
.
diffuse
.
dwStride
);
if
(
!
color_d
)
{
...
...
@@ -5369,7 +5369,7 @@ process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIndex, DWORD dwCo
}
}
if
(
DestFVF
&
D3DFVF_SPECULAR
)
{
if
(
DestFVF
&
WINE
D3DFVF_SPECULAR
)
{
/* What's the color value in the feedback buffer? */
DWORD
*
color_s
=
(
DWORD
*
)
(((
char
*
)
lpStrideData
->
u
.
s
.
specular
.
lpData
)
+
i
*
lpStrideData
->
u
.
s
.
specular
.
dwStride
);
...
...
dlls/wined3d/drawprim.c
View file @
875a1eb0
...
...
@@ -487,18 +487,18 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
int
numTextures
;
int
textureNo
;
int
coordIdxInfo
=
0x00
;
/* Information on number of coords supplied */
int
numCoords
[
8
];
/* Holding place for D3DFVF_TEXTUREFORMATx */
int
numCoords
[
8
];
/* Holding place for
WINE
D3DFVF_TEXTUREFORMATx */
/* Either 3 or 4 floats depending on the FVF */
/* FIXME: Can blending data be in a different stream to the position data?
and if so using the fixed pipeline how do we handle it */
if
(
thisFVF
&
D3DFVF_POSITION_MASK
)
{
if
(
thisFVF
&
WINE
D3DFVF_POSITION_MASK
)
{
strided
->
u
.
s
.
position
.
lpData
=
data
;
strided
->
u
.
s
.
position
.
dwType
=
WINED3DDECLTYPE_FLOAT3
;
strided
->
u
.
s
.
position
.
dwStride
=
stride
;
strided
->
u
.
s
.
position
.
VBO
=
streamVBO
;
data
+=
3
*
sizeof
(
float
);
if
(
thisFVF
&
D3DFVF_XYZRHW
)
{
if
(
thisFVF
&
WINE
D3DFVF_XYZRHW
)
{
strided
->
u
.
s
.
position
.
dwType
=
WINED3DDECLTYPE_FLOAT4
;
strided
->
u
.
s
.
position_transformed
=
TRUE
;
data
+=
sizeof
(
float
);
...
...
@@ -508,10 +508,10 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
/* Blending is numBlends * FLOATs followed by a DWORD for UBYTE4 */
/** do we have to Check This->stateBlock->renderState[D3DRS_INDEXEDVERTEXBLENDENABLE] ? */
numBlends
=
1
+
(((
thisFVF
&
D3DFVF_XYZB5
)
-
D3DFVF_XYZB1
)
>>
1
);
if
(
thisFVF
&
D3DFVF_LASTBETA_UBYTE4
)
numBlends
--
;
numBlends
=
1
+
(((
thisFVF
&
WINED3DFVF_XYZB5
)
-
WINE
D3DFVF_XYZB1
)
>>
1
);
if
(
thisFVF
&
WINE
D3DFVF_LASTBETA_UBYTE4
)
numBlends
--
;
if
((
thisFVF
&
D3DFVF_XYZB5
)
>
D3DFVF_XYZRHW
)
{
if
((
thisFVF
&
WINED3DFVF_XYZB5
)
>
WINE
D3DFVF_XYZRHW
)
{
TRACE
(
"Setting blend Weights to %p
\n
"
,
data
);
strided
->
u
.
s
.
blendWeights
.
lpData
=
data
;
strided
->
u
.
s
.
blendWeights
.
dwType
=
WINED3DDECLTYPE_FLOAT1
+
numBlends
-
1
;
...
...
@@ -519,7 +519,7 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
strided
->
u
.
s
.
blendWeights
.
VBO
=
streamVBO
;
data
+=
numBlends
*
sizeof
(
FLOAT
);
if
(
thisFVF
&
D3DFVF_LASTBETA_UBYTE4
)
{
if
(
thisFVF
&
WINE
D3DFVF_LASTBETA_UBYTE4
)
{
strided
->
u
.
s
.
blendMatrixIndices
.
lpData
=
data
;
strided
->
u
.
s
.
blendMatrixIndices
.
dwType
=
WINED3DDECLTYPE_UBYTE4
;
strided
->
u
.
s
.
blendMatrixIndices
.
dwStride
=
stride
;
...
...
@@ -529,7 +529,7 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
}
/* Normal is always 3 floats */
if
(
thisFVF
&
D3DFVF_NORMAL
)
{
if
(
thisFVF
&
WINE
D3DFVF_NORMAL
)
{
strided
->
u
.
s
.
normal
.
lpData
=
data
;
strided
->
u
.
s
.
normal
.
dwType
=
WINED3DDECLTYPE_FLOAT3
;
strided
->
u
.
s
.
normal
.
dwStride
=
stride
;
...
...
@@ -538,7 +538,7 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
}
/* Pointsize is a single float */
if
(
thisFVF
&
D3DFVF_PSIZE
)
{
if
(
thisFVF
&
WINE
D3DFVF_PSIZE
)
{
strided
->
u
.
s
.
pSize
.
lpData
=
data
;
strided
->
u
.
s
.
pSize
.
dwType
=
WINED3DDECLTYPE_FLOAT1
;
strided
->
u
.
s
.
pSize
.
dwStride
=
stride
;
...
...
@@ -547,7 +547,7 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
}
/* Diffuse is 4 unsigned bytes */
if
(
thisFVF
&
D3DFVF_DIFFUSE
)
{
if
(
thisFVF
&
WINE
D3DFVF_DIFFUSE
)
{
strided
->
u
.
s
.
diffuse
.
lpData
=
data
;
strided
->
u
.
s
.
diffuse
.
dwType
=
WINED3DDECLTYPE_SHORT4
;
strided
->
u
.
s
.
diffuse
.
dwStride
=
stride
;
...
...
@@ -556,7 +556,7 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
}
/* Specular is 4 unsigned bytes */
if
(
thisFVF
&
D3DFVF_SPECULAR
)
{
if
(
thisFVF
&
WINE
D3DFVF_SPECULAR
)
{
strided
->
u
.
s
.
specular
.
lpData
=
data
;
strided
->
u
.
s
.
specular
.
dwType
=
WINED3DDECLTYPE_SHORT4
;
strided
->
u
.
s
.
specular
.
dwStride
=
stride
;
...
...
@@ -565,14 +565,14 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
}
/* Texture coords */
numTextures
=
(
thisFVF
&
D3DFVF_TEXCOUNT_MASK
)
>>
D3DFVF_TEXCOUNT_SHIFT
;
coordIdxInfo
=
(
thisFVF
&
0x00FF0000
)
>>
16
;
/* 16 is from definition of D3DFVF_TEXCOORDSIZE1, and is 8 (0-7 stages) * 2bits long */
numTextures
=
(
thisFVF
&
WINED3DFVF_TEXCOUNT_MASK
)
>>
WINE
D3DFVF_TEXCOUNT_SHIFT
;
coordIdxInfo
=
(
thisFVF
&
0x00FF0000
)
>>
16
;
/* 16 is from definition of
WINE
D3DFVF_TEXCOORDSIZE1, and is 8 (0-7 stages) * 2bits long */
/* numTextures indicates the number of texture coordinates supplied */
/* However, the first set may not be for stage 0 texture - it all */
/* depends on WINED3DTSS_TEXCOORDINDEX. */
/* The number of bytes for each coordinate set is based off */
/* D3DFVF_TEXCOORDSIZEn, which are the bottom 2 bits */
/*
WINE
D3DFVF_TEXCOORDSIZEn, which are the bottom 2 bits */
/* So, for each supplied texture extract the coords */
for
(
textureNo
=
0
;
textureNo
<
numTextures
;
++
textureNo
)
{
...
...
@@ -585,13 +585,13 @@ void primitiveConvertFVFtoOffset(DWORD thisFVF, DWORD stride, BYTE *data, WineDi
/* Always one set */
data
+=
sizeof
(
float
);
if
(
numCoords
[
textureNo
]
!=
D3DFVF_TEXTUREFORMAT1
)
{
if
(
numCoords
[
textureNo
]
!=
WINE
D3DFVF_TEXTUREFORMAT1
)
{
strided
->
u
.
s
.
texCoords
[
textureNo
].
dwType
=
WINED3DDECLTYPE_FLOAT2
;
data
+=
sizeof
(
float
);
if
(
numCoords
[
textureNo
]
!=
D3DFVF_TEXTUREFORMAT2
)
{
if
(
numCoords
[
textureNo
]
!=
WINE
D3DFVF_TEXTUREFORMAT2
)
{
strided
->
u
.
s
.
texCoords
[
textureNo
].
dwType
=
WINED3DDECLTYPE_FLOAT3
;
data
+=
sizeof
(
float
);
if
(
numCoords
[
textureNo
]
!=
D3DFVF_TEXTUREFORMAT3
)
{
if
(
numCoords
[
textureNo
]
!=
WINE
D3DFVF_TEXTUREFORMAT3
)
{
strided
->
u
.
s
.
texCoords
[
textureNo
].
dwType
=
WINED3DDECLTYPE_FLOAT4
;
data
+=
sizeof
(
float
);
}
...
...
dlls/wined3d/utils.c
View file @
875a1eb0
...
...
@@ -2482,15 +2482,15 @@ void multiply_matrix(WINED3DMATRIX *dest, WINED3DMATRIX *src1, WINED3DMATRIX *sr
DWORD
get_flexible_vertex_size
(
DWORD
d3dvtVertexType
)
{
DWORD
size
=
0
;
int
i
;
int
numTextures
=
(
d3dvtVertexType
&
D3DFVF_TEXCOUNT_MASK
)
>>
D3DFVF_TEXCOUNT_SHIFT
;
if
(
d3dvtVertexType
&
D3DFVF_NORMAL
)
size
+=
3
*
sizeof
(
float
);
if
(
d3dvtVertexType
&
D3DFVF_DIFFUSE
)
size
+=
sizeof
(
DWORD
);
if
(
d3dvtVertexType
&
D3DFVF_SPECULAR
)
size
+=
sizeof
(
DWORD
);
if
(
d3dvtVertexType
&
D3DFVF_PSIZE
)
size
+=
sizeof
(
DWORD
);
switch
(
d3dvtVertexType
&
D3DFVF_POSITION_MASK
)
{
case
D3DFVF_XYZ
:
size
+=
3
*
sizeof
(
float
);
break
;
case
D3DFVF_XYZRHW
:
size
+=
4
*
sizeof
(
float
);
break
;
int
numTextures
=
(
d3dvtVertexType
&
WINED3DFVF_TEXCOUNT_MASK
)
>>
WINE
D3DFVF_TEXCOUNT_SHIFT
;
if
(
d3dvtVertexType
&
WINE
D3DFVF_NORMAL
)
size
+=
3
*
sizeof
(
float
);
if
(
d3dvtVertexType
&
WINE
D3DFVF_DIFFUSE
)
size
+=
sizeof
(
DWORD
);
if
(
d3dvtVertexType
&
WINE
D3DFVF_SPECULAR
)
size
+=
sizeof
(
DWORD
);
if
(
d3dvtVertexType
&
WINE
D3DFVF_PSIZE
)
size
+=
sizeof
(
DWORD
);
switch
(
d3dvtVertexType
&
WINE
D3DFVF_POSITION_MASK
)
{
case
WINE
D3DFVF_XYZ
:
size
+=
3
*
sizeof
(
float
);
break
;
case
WINE
D3DFVF_XYZRHW
:
size
+=
4
*
sizeof
(
float
);
break
;
default
:
TRACE
(
" matrix weighting not handled yet...
\n
"
);
}
for
(
i
=
0
;
i
<
numTextures
;
i
++
)
{
...
...
include/wine/wined3d_types.h
View file @
875a1eb0
...
...
@@ -1478,4 +1478,43 @@ typedef enum _WINED3DSURFTYPE {
#define WINED3DCLIPPLANE4 (1 << 4)
#define WINED3DCLIPPLANE5 (1 << 5)
/* FVF (Flexible Vertex Format) codes */
#define WINED3DFVF_RESERVED0 0x0001
#define WINED3DFVF_POSITION_MASK 0x000E
#define WINED3DFVF_XYZ 0x0002
#define WINED3DFVF_XYZRHW 0x0004
#define WINED3DFVF_XYZB1 0x0006
#define WINED3DFVF_XYZB2 0x0008
#define WINED3DFVF_XYZB3 0x000a
#define WINED3DFVF_XYZB4 0x000c
#define WINED3DFVF_XYZB5 0x000e
#define WINED3DFVF_XYZW 0x4002
#define WINED3DFVF_NORMAL 0x0010
#define WINED3DFVF_PSIZE 0x0020
#define WINED3DFVF_DIFFUSE 0x0040
#define WINED3DFVF_SPECULAR 0x0080
#define WINED3DFVF_TEXCOUNT_MASK 0x0f00
#define WINED3DFVF_TEXCOUNT_SHIFT 8
#define WINED3DFVF_TEX0 0x0000
#define WINED3DFVF_TEX1 0x0100
#define WINED3DFVF_TEX2 0x0200
#define WINED3DFVF_TEX3 0x0300
#define WINED3DFVF_TEX4 0x0400
#define WINED3DFVF_TEX5 0x0500
#define WINED3DFVF_TEX6 0x0600
#define WINED3DFVF_TEX7 0x0700
#define WINED3DFVF_TEX8 0x0800
#define WINED3DFVF_LASTBETA_UBYTE4 0x1000
#define WINED3DFVF_LASTBETA_D3DCOLOR 0x8000
#define WINED3DFVF_RESERVED2 0x6000
#define WINED3DFVF_TEXTUREFORMAT1 3
#define WINED3DFVF_TEXTUREFORMAT2 0
#define WINED3DFVF_TEXTUREFORMAT3 1
#define WINED3DFVF_TEXTUREFORMAT4 2
#define WINED3DFVF_TEXCOORDSIZE1(CoordIndex) (WINED3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
#define WINED3DFVF_TEXCOORDSIZE2(CoordIndex) (WINED3DFVF_TEXTUREFORMAT2)
#define WINED3DFVF_TEXCOORDSIZE3(CoordIndex) (WINED3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
#define WINED3DFVF_TEXCOORDSIZE4(CoordIndex) (WINED3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
#endif
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