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
1eaee423
Commit
1eaee423
authored
Nov 25, 2003
by
Lionel Ulmer
Committed by
Alexandre Julliard
Nov 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use vertex arrays when possible.
parent
2d6a3fcc
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
22 deletions
+96
-22
mesa.c
dlls/ddraw/d3ddevice/mesa.c
+79
-22
gl_api.h
dlls/ddraw/gl_api.h
+8
-0
gl_private.h
dlls/ddraw/gl_private.h
+8
-0
mesa_private.h
dlls/ddraw/mesa_private.h
+1
-0
No files found.
dlls/ddraw/d3ddevice/mesa.c
View file @
1eaee423
...
@@ -836,42 +836,36 @@ GL_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
...
@@ -836,42 +836,36 @@ GL_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface,
return
DD_OK
;
return
DD_OK
;
}
}
static
void
draw_primitive_start
_GL
(
D3DPRIMITIVETYPE
d3dpt
)
static
GLenum
convert_D3D_ptype_to
_GL
(
D3DPRIMITIVETYPE
d3dpt
)
{
{
switch
(
d3dpt
)
{
switch
(
d3dpt
)
{
case
D3DPT_POINTLIST
:
case
D3DPT_POINTLIST
:
TRACE
(
"Start POINTS
\n
"
);
TRACE
(
" primitive type is POINTS
\n
"
);
glBegin
(
GL_POINTS
);
return
GL_POINTS
;
break
;
case
D3DPT_LINELIST
:
case
D3DPT_LINELIST
:
TRACE
(
"Start LINES
\n
"
);
TRACE
(
" primitive type is LINES
\n
"
);
glBegin
(
GL_LINES
);
return
GL_LINES
;
break
;
case
D3DPT_LINESTRIP
:
case
D3DPT_LINESTRIP
:
TRACE
(
"Start LINE_STRIP
\n
"
);
TRACE
(
" primitive type is LINE_STRIP
\n
"
);
glBegin
(
GL_LINE_STRIP
);
return
GL_LINE_STRIP
;
break
;
case
D3DPT_TRIANGLELIST
:
case
D3DPT_TRIANGLELIST
:
TRACE
(
"Start TRIANGLES
\n
"
);
TRACE
(
" primitive type is TRIANGLES
\n
"
);
glBegin
(
GL_TRIANGLES
);
return
GL_TRIANGLES
;
break
;
case
D3DPT_TRIANGLESTRIP
:
case
D3DPT_TRIANGLESTRIP
:
TRACE
(
"Start TRIANGLE_STRIP
\n
"
);
TRACE
(
" primitive type is TRIANGLE_STRIP
\n
"
);
glBegin
(
GL_TRIANGLE_STRIP
);
return
GL_TRIANGLE_STRIP
;
break
;
case
D3DPT_TRIANGLEFAN
:
case
D3DPT_TRIANGLEFAN
:
TRACE
(
"Start TRIANGLE_FAN
\n
"
);
TRACE
(
" primitive type is TRIANGLE_FAN
\n
"
);
glBegin
(
GL_TRIANGLE_FAN
);
return
GL_TRIANGLE_FAN
;
break
;
default:
default:
FIXME
(
"Unhandled primitive %08x
\n
"
,
d3dpt
);
FIXME
(
"Unhandled primitive %08x
\n
"
,
d3dpt
);
break
;
return
GL_POINTS
;
}
}
}
}
...
@@ -1305,6 +1299,7 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
...
@@ -1305,6 +1299,7 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
BOOLEAN
vertex_lighted
=
FALSE
;
BOOLEAN
vertex_lighted
=
FALSE
;
IDirect3DDeviceGLImpl
*
glThis
=
(
IDirect3DDeviceGLImpl
*
)
This
;
IDirect3DDeviceGLImpl
*
glThis
=
(
IDirect3DDeviceGLImpl
*
)
This
;
int
num_active_stages
=
0
;
int
num_active_stages
=
0
;
int
num_tex_index
=
((
d3dvtVertexType
&
D3DFVF_TEXCOUNT_MASK
)
>>
D3DFVF_TEXCOUNT_SHIFT
);
/* I put the trace before the various locks... So as to better understand where locks occur :-) */
/* I put the trace before the various locks... So as to better understand where locks occur :-) */
if
(
TRACE_ON
(
ddraw
))
{
if
(
TRACE_ON
(
ddraw
))
{
...
@@ -1356,7 +1351,68 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
...
@@ -1356,7 +1351,68 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
draw_primitive_handle_GL_state
(
This
,
draw_primitive_handle_GL_state
(
This
,
(
d3dvtVertexType
&
D3DFVF_POSITION_MASK
)
!=
D3DFVF_XYZ
,
(
d3dvtVertexType
&
D3DFVF_POSITION_MASK
)
!=
D3DFVF_XYZ
,
vertex_lighted
);
vertex_lighted
);
draw_primitive_start_GL
(
d3dptPrimitiveType
);
/* First, see if we can use the OpenGL vertex arrays... This is very limited
for now to some 'special' cases where we can do a direct mapping between D3D
types and GL types.
Note that in the future all calls will go through vertex arrays but the arrays
will be generated by this function. */
if
(((
d3dvtVertexType
&
D3DFVF_POSITION_MASK
)
==
D3DFVF_XYZ
)
&&
/* Standard XYZ vertices */
(((
d3dvtVertexType
&
(
D3DFVF_DIFFUSE
|
D3DFVF_SPECULAR
))
==
0
)
||
/* Either no colours */
(((
d3dvtVertexType
&
D3DFVF_DIFFUSE
)
!=
0
)
&&
/* Or diffuse only but the Alpha component is not used */
(
This
->
state_block
.
render_state
[
D3DRENDERSTATE_ALPHATESTENABLE
-
1
]
==
FALSE
)
&&
(
This
->
state_block
.
render_state
[
D3DRENDERSTATE_ALPHABLENDENABLE
-
1
]
==
FALSE
))))
{
int
tex_stage
;
TRACE
(
" using GL vertex arrays for performance !
\n
"
);
/* First, the vertices (we are sure we have some :-) */
glEnableClientState
(
GL_VERTEX_ARRAY
);
glVertexPointer
(
3
,
GL_FLOAT
,
lpD3DDrawPrimStrideData
->
position
.
dwStride
,
lpD3DDrawPrimStrideData
->
position
.
lpvData
);
/* Then the normals */
if
(
d3dvtVertexType
&
D3DFVF_NORMAL
)
{
glEnableClientState
(
GL_NORMAL_ARRAY
);
glNormalPointer
(
GL_FLOAT
,
lpD3DDrawPrimStrideData
->
normal
.
dwStride
,
lpD3DDrawPrimStrideData
->
normal
.
lpvData
);
}
/* Then the diffuse colour */
if
(
d3dvtVertexType
&
D3DFVF_DIFFUSE
)
{
glEnableClientState
(
GL_COLOR_ARRAY
);
glColorPointer
(
3
,
GL_UNSIGNED_BYTE
,
lpD3DDrawPrimStrideData
->
normal
.
dwStride
,
((
char
*
)
lpD3DDrawPrimStrideData
->
diffuse
.
lpvData
));
}
/* Then the various textures */
for
(
tex_stage
=
0
;
tex_stage
<
num_active_stages
;
tex_stage
++
)
{
int
tex_index
=
This
->
state_block
.
texture_stage_state
[
tex_stage
][
D3DTSS_TEXCOORDINDEX
-
1
]
&
0x0000FFFF
;
if
(
tex_index
>=
num_tex_index
)
{
WARN
(
"Default texture coordinate not handled in the vertex array path !!!
\n
"
);
tex_index
=
num_tex_index
-
1
;
}
if
(
GL_extensions
.
glClientActiveTexture
)
{
GL_extensions
.
glClientActiveTexture
(
GL_TEXTURE0_WINE
+
tex_stage
);
}
glEnableClientState
(
GL_TEXTURE_COORD_ARRAY
);
glTexCoordPointer
(
2
,
GL_FLOAT
,
lpD3DDrawPrimStrideData
->
textureCoords
[
tex_index
].
dwStride
,
lpD3DDrawPrimStrideData
->
textureCoords
[
tex_index
].
lpvData
);
}
if
(
dwIndices
!=
NULL
)
{
glDrawElements
(
convert_D3D_ptype_to_GL
(
d3dptPrimitiveType
),
dwIndexCount
,
GL_UNSIGNED_SHORT
,
dwIndices
);
}
else
{
glDrawArrays
(
convert_D3D_ptype_to_GL
(
d3dptPrimitiveType
),
0
,
dwIndexCount
);
}
glDisableClientState
(
GL_VERTEX_ARRAY
);
if
(
d3dvtVertexType
&
D3DFVF_NORMAL
)
{
glDisableClientState
(
GL_NORMAL_ARRAY
);
}
if
(
d3dvtVertexType
&
D3DFVF_DIFFUSE
)
{
glDisableClientState
(
GL_COLOR_ARRAY
);
}
for
(
tex_stage
=
0
;
tex_stage
<
num_active_stages
;
tex_stage
++
)
{
if
(
GL_extensions
.
glClientActiveTexture
)
{
GL_extensions
.
glClientActiveTexture
(
GL_TEXTURE0_WINE
+
tex_stage
);
}
glDisableClientState
(
GL_TEXTURE_COORD_ARRAY
);
}
}
else
{
glBegin
(
convert_D3D_ptype_to_GL
(
d3dptPrimitiveType
));
/* Some fast paths first before the generic case.... */
/* Some fast paths first before the generic case.... */
if
((
d3dvtVertexType
==
D3DFVF_VERTEX
)
&&
(
num_active_stages
<=
1
))
{
if
((
d3dvtVertexType
==
D3DFVF_VERTEX
)
&&
(
num_active_stages
<=
1
))
{
...
@@ -1416,7 +1472,6 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
...
@@ -1416,7 +1472,6 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
Note that people should write a fast path for all vertex formats out there...
Note that people should write a fast path for all vertex formats out there...
*/
*/
int
index
;
int
index
;
int
num_tex_index
=
((
d3dvtVertexType
&
D3DFVF_TEXCOUNT_MASK
)
>>
D3DFVF_TEXCOUNT_SHIFT
);
static
const
D3DVALUE
no_index
[]
=
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
};
static
const
D3DVALUE
no_index
[]
=
{
0
.
0
,
0
.
0
,
0
.
0
,
0
.
0
};
for
(
index
=
0
;
index
<
dwIndexCount
;
index
++
)
{
for
(
index
=
0
;
index
<
dwIndexCount
;
index
++
)
{
...
@@ -1517,6 +1572,7 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
...
@@ -1517,6 +1572,7 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This,
}
}
glEnd
();
glEnd
();
}
/* Whatever the case, disable the color material stuff */
/* Whatever the case, disable the color material stuff */
glDisable
(
GL_COLOR_MATERIAL
);
glDisable
(
GL_COLOR_MATERIAL
);
...
@@ -4203,6 +4259,7 @@ d3ddevice_init_at_startup(void *gl_handle)
...
@@ -4203,6 +4259,7 @@ d3ddevice_init_at_startup(void *gl_handle)
/* We query the ARB version to be the most portable we can... */
/* We query the ARB version to be the most portable we can... */
GL_extensions
.
glActiveTexture
=
pglXGetProcAddressARB
(
"glActiveTextureARB"
);
GL_extensions
.
glActiveTexture
=
pglXGetProcAddressARB
(
"glActiveTextureARB"
);
GL_extensions
.
glMultiTexCoord2fv
=
pglXGetProcAddressARB
(
"glMultiTexCoord2fv"
);
GL_extensions
.
glMultiTexCoord2fv
=
pglXGetProcAddressARB
(
"glMultiTexCoord2fv"
);
GL_extensions
.
glClientActiveTexture
=
pglXGetProcAddressARB
(
"glClientActiveTextureARB"
);
}
}
}
}
...
...
dlls/ddraw/gl_api.h
View file @
1eaee423
...
@@ -40,6 +40,7 @@ GL_API_FUNCTION(glColor3ub)
...
@@ -40,6 +40,7 @@ GL_API_FUNCTION(glColor3ub)
GL_API_FUNCTION
(
glColor4ub
)
GL_API_FUNCTION
(
glColor4ub
)
GL_API_FUNCTION
(
glColorMask
)
GL_API_FUNCTION
(
glColorMask
)
GL_API_FUNCTION
(
glColorMaterial
)
GL_API_FUNCTION
(
glColorMaterial
)
GL_API_FUNCTION
(
glColorPointer
)
GL_API_FUNCTION
(
glCopyPixels
)
GL_API_FUNCTION
(
glCopyPixels
)
GL_API_FUNCTION
(
glCopyTexSubImage2D
)
GL_API_FUNCTION
(
glCopyTexSubImage2D
)
GL_API_FUNCTION
(
glCullFace
)
GL_API_FUNCTION
(
glCullFace
)
...
@@ -48,9 +49,13 @@ GL_API_FUNCTION(glDepthFunc)
...
@@ -48,9 +49,13 @@ GL_API_FUNCTION(glDepthFunc)
GL_API_FUNCTION
(
glDepthMask
)
GL_API_FUNCTION
(
glDepthMask
)
GL_API_FUNCTION
(
glDepthRange
)
GL_API_FUNCTION
(
glDepthRange
)
GL_API_FUNCTION
(
glDisable
)
GL_API_FUNCTION
(
glDisable
)
GL_API_FUNCTION
(
glDisableClientState
)
GL_API_FUNCTION
(
glDrawArrays
)
GL_API_FUNCTION
(
glDrawBuffer
)
GL_API_FUNCTION
(
glDrawBuffer
)
GL_API_FUNCTION
(
glDrawElements
)
GL_API_FUNCTION
(
glDrawPixels
)
GL_API_FUNCTION
(
glDrawPixels
)
GL_API_FUNCTION
(
glEnable
)
GL_API_FUNCTION
(
glEnable
)
GL_API_FUNCTION
(
glEnableClientState
)
GL_API_FUNCTION
(
glEnd
)
GL_API_FUNCTION
(
glEnd
)
GL_API_FUNCTION
(
glFlush
)
GL_API_FUNCTION
(
glFlush
)
GL_API_FUNCTION
(
glFogf
)
GL_API_FUNCTION
(
glFogf
)
...
@@ -77,6 +82,7 @@ GL_API_FUNCTION(glMatrixMode)
...
@@ -77,6 +82,7 @@ GL_API_FUNCTION(glMatrixMode)
GL_API_FUNCTION
(
glMultMatrixf
)
GL_API_FUNCTION
(
glMultMatrixf
)
GL_API_FUNCTION
(
glNormal3f
)
GL_API_FUNCTION
(
glNormal3f
)
GL_API_FUNCTION
(
glNormal3fv
)
GL_API_FUNCTION
(
glNormal3fv
)
GL_API_FUNCTION
(
glNormalPointer
)
GL_API_FUNCTION
(
glOrtho
)
GL_API_FUNCTION
(
glOrtho
)
GL_API_FUNCTION
(
glPixelStorei
)
GL_API_FUNCTION
(
glPixelStorei
)
GL_API_FUNCTION
(
glPolygonMode
)
GL_API_FUNCTION
(
glPolygonMode
)
...
@@ -94,6 +100,7 @@ GL_API_FUNCTION(glStencilMask)
...
@@ -94,6 +100,7 @@ GL_API_FUNCTION(glStencilMask)
GL_API_FUNCTION
(
glStencilOp
)
GL_API_FUNCTION
(
glStencilOp
)
GL_API_FUNCTION
(
glTexCoord2f
)
GL_API_FUNCTION
(
glTexCoord2f
)
GL_API_FUNCTION
(
glTexCoord2fv
)
GL_API_FUNCTION
(
glTexCoord2fv
)
GL_API_FUNCTION
(
glTexCoordPointer
)
GL_API_FUNCTION
(
glTexEnvf
)
GL_API_FUNCTION
(
glTexEnvf
)
GL_API_FUNCTION
(
glTexEnvfv
)
GL_API_FUNCTION
(
glTexEnvfv
)
GL_API_FUNCTION
(
glTexEnvi
)
GL_API_FUNCTION
(
glTexEnvi
)
...
@@ -106,6 +113,7 @@ GL_API_FUNCTION(glVertex3d)
...
@@ -106,6 +113,7 @@ GL_API_FUNCTION(glVertex3d)
GL_API_FUNCTION
(
glVertex3f
)
GL_API_FUNCTION
(
glVertex3f
)
GL_API_FUNCTION
(
glVertex3fv
)
GL_API_FUNCTION
(
glVertex3fv
)
GL_API_FUNCTION
(
glVertex4f
)
GL_API_FUNCTION
(
glVertex4f
)
GL_API_FUNCTION
(
glVertexPointer
)
GL_API_FUNCTION
(
glViewport
)
GL_API_FUNCTION
(
glViewport
)
GL_API_FUNCTION
(
glXCreateContext
)
GL_API_FUNCTION
(
glXCreateContext
)
GL_API_FUNCTION
(
glXDestroyContext
)
GL_API_FUNCTION
(
glXDestroyContext
)
...
...
dlls/ddraw/gl_private.h
View file @
1eaee423
...
@@ -82,6 +82,7 @@
...
@@ -82,6 +82,7 @@
#define glColor3ub pglColor3ub
#define glColor3ub pglColor3ub
#define glColor4ub pglColor4ub
#define glColor4ub pglColor4ub
#define glColorMask pglColorMask
#define glColorMask pglColorMask
#define glColorPointer pglColorPointer
#define glCopyPixels pglCopyPixels
#define glCopyPixels pglCopyPixels
#define glCopyTexSubImage2D pglCopyTexSubImage2D
#define glCopyTexSubImage2D pglCopyTexSubImage2D
#define glColorMaterial pglColorMaterial
#define glColorMaterial pglColorMaterial
...
@@ -91,9 +92,13 @@
...
@@ -91,9 +92,13 @@
#define glDepthMask pglDepthMask
#define glDepthMask pglDepthMask
#define glDepthRange pglDepthRange
#define glDepthRange pglDepthRange
#define glDisable pglDisable
#define glDisable pglDisable
#define glDisableClientState pglDisableClientState
#define glDrawArrays pglDrawArrays
#define glDrawBuffer pglDrawBuffer
#define glDrawBuffer pglDrawBuffer
#define glDrawElements pglDrawElements
#define glDrawPixels pglDrawPixels
#define glDrawPixels pglDrawPixels
#define glEnable pglEnable
#define glEnable pglEnable
#define glEnableClientState pglEnableClientState
#define glEnd pglEnd
#define glEnd pglEnd
#define glFlush pglFlush
#define glFlush pglFlush
#define glFogf pglFogf
#define glFogf pglFogf
...
@@ -120,6 +125,7 @@
...
@@ -120,6 +125,7 @@
#define glMultMatrixf pglMultMatrixf
#define glMultMatrixf pglMultMatrixf
#define glNormal3f pglNormal3f
#define glNormal3f pglNormal3f
#define glNormal3fv pglNormal3fv
#define glNormal3fv pglNormal3fv
#define glNormalPointer pglNormalPointer
#define glOrtho pglOrtho
#define glOrtho pglOrtho
#define glPixelStorei pglPixelStorei
#define glPixelStorei pglPixelStorei
#define glPolygonMode pglPolygonMode
#define glPolygonMode pglPolygonMode
...
@@ -137,6 +143,7 @@
...
@@ -137,6 +143,7 @@
#define glStencilOp pglStencilOp
#define glStencilOp pglStencilOp
#define glTexCoord2f pglTexCoord2f
#define glTexCoord2f pglTexCoord2f
#define glTexCoord2fv pglTexCoord2fv
#define glTexCoord2fv pglTexCoord2fv
#define glTexCoordPointer pglTexCoordPointer
#define glTexEnvf pglTexEnvf
#define glTexEnvf pglTexEnvf
#define glTexEnvfv pglTexEnvfv
#define glTexEnvfv pglTexEnvfv
#define glTexEnvi pglTexEnvi
#define glTexEnvi pglTexEnvi
...
@@ -149,6 +156,7 @@
...
@@ -149,6 +156,7 @@
#define glVertex3f pglVertex3f
#define glVertex3f pglVertex3f
#define glVertex3fv pglVertex3fv
#define glVertex3fv pglVertex3fv
#define glVertex4f pglVertex4f
#define glVertex4f pglVertex4f
#define glVertexPointer pglVertexPointer
#define glViewport pglViewport
#define glViewport pglViewport
#define glXCreateContext pglXCreateContext
#define glXCreateContext pglXCreateContext
#define glXDestroyContext pglXDestroyContext
#define glXDestroyContext pglXDestroyContext
...
...
dlls/ddraw/mesa_private.h
View file @
1eaee423
...
@@ -174,6 +174,7 @@ typedef struct {
...
@@ -174,6 +174,7 @@ typedef struct {
GLint
max_texture_units
;
GLint
max_texture_units
;
void
(
*
glActiveTexture
)(
GLenum
texture
);
void
(
*
glActiveTexture
)(
GLenum
texture
);
void
(
*
glMultiTexCoord2fv
)(
GLenum
target
,
const
GLfloat
*
v
);
void
(
*
glMultiTexCoord2fv
)(
GLenum
target
,
const
GLfloat
*
v
);
void
(
*
glClientActiveTexture
)(
GLenum
texture
);
}
GL_EXTENSIONS_LIST
;
}
GL_EXTENSIONS_LIST
;
extern
GL_EXTENSIONS_LIST
GL_extensions
;
extern
GL_EXTENSIONS_LIST
GL_extensions
;
...
...
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