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
112c426c
Commit
112c426c
authored
Jun 04, 2004
by
Lionel Ulmer
Committed by
Alexandre Julliard
Jun 04, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the FPS computation from the D3D code to the common code.
parent
92c62e23
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
63 deletions
+63
-63
mesa.c
dlls/ddraw/d3ddevice/mesa.c
+0
-63
main.c
dlls/ddraw/dsurface/main.c
+63
-0
No files found.
dlls/ddraw/d3ddevice/mesa.c
View file @
112c426c
...
...
@@ -43,7 +43,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ddraw
);
WINE_DECLARE_DEBUG_CHANNEL
(
ddraw_geom
);
WINE_DECLARE_DEBUG_CHANNEL
(
ddraw_fps
);
/* x11drv GDI escapes */
#define X11DRV_ESCAPE 6789
...
...
@@ -243,17 +242,6 @@ inline static Drawable get_drawable( HDC hdc )
return
drawable
;
}
/* This is unnecessarely complicated :-) */
#define MEASUREMENT_WINDOW 5
#define NUMBER_OF_WINDOWS 10
static
LONGLONG
perf_freq
;
static
LONGLONG
perf_storage
[
NUMBER_OF_WINDOWS
];
static
LONGLONG
prev_time
=
0
;
static
unsigned
int
current_window
;
static
unsigned
int
measurements_in_window
;
static
unsigned
int
valid_windows
;
static
BOOL
opengl_flip
(
LPVOID
dev
,
LPVOID
drawable
)
{
IDirect3DDeviceImpl
*
d3d_dev
=
(
IDirect3DDeviceImpl
*
)
dev
;
...
...
@@ -268,57 +256,6 @@ static BOOL opengl_flip( LPVOID dev, LPVOID drawable)
gl_d3d_dev
->
state
[
WINE_GL_BUFFER_FRONT
]
=
SURFACE_GL
;
glXSwapBuffers
(
gl_d3d_dev
->
display
,
(
Drawable
)
drawable
);
LEAVE_GL
();
if
(
TRACE_ON
(
ddraw_fps
))
{
LONGLONG
current_time
;
LONGLONG
frame_duration
;
QueryPerformanceCounter
((
LARGE_INTEGER
*
)
&
current_time
);
if
(
prev_time
!=
0
)
{
LONGLONG
total_time
=
0
;
int
tot_meas
;
frame_duration
=
current_time
-
prev_time
;
prev_time
=
current_time
;
perf_storage
[
current_window
]
+=
frame_duration
;
measurements_in_window
++
;
if
(
measurements_in_window
>=
MEASUREMENT_WINDOW
)
{
current_window
++
;
valid_windows
++
;
if
(
valid_windows
<
NUMBER_OF_WINDOWS
)
{
int
i
;
tot_meas
=
valid_windows
*
MEASUREMENT_WINDOW
;
for
(
i
=
0
;
i
<
valid_windows
;
i
++
)
{
total_time
+=
perf_storage
[
i
];
}
}
else
{
int
i
;
tot_meas
=
NUMBER_OF_WINDOWS
*
MEASUREMENT_WINDOW
;
for
(
i
=
0
;
i
<
NUMBER_OF_WINDOWS
;
i
++
)
{
total_time
+=
perf_storage
[
i
];
}
}
TRACE_
(
ddraw_fps
)(
" %9.5f
\n
"
,
(
double
)
(
perf_freq
*
tot_meas
)
/
(
double
)
total_time
);
if
(
current_window
>=
NUMBER_OF_WINDOWS
)
{
current_window
=
0
;
}
perf_storage
[
current_window
]
=
0
;
measurements_in_window
=
0
;
}
}
else
{
prev_time
=
current_time
;
memset
(
perf_storage
,
0
,
sizeof
(
perf_storage
));
current_window
=
0
;
valid_windows
=
0
;
measurements_in_window
=
0
;
QueryPerformanceFrequency
((
LARGE_INTEGER
*
)
&
perf_freq
);
}
}
return
TRUE
;
}
...
...
dlls/ddraw/dsurface/main.c
View file @
112c426c
...
...
@@ -35,6 +35,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
ddraw
);
WINE_DECLARE_DEBUG_CHANNEL
(
ddraw_flip
);
WINE_DECLARE_DEBUG_CHANNEL
(
ddraw_fps
);
/** Creation/Destruction functions */
...
...
@@ -512,6 +513,17 @@ BOOL Main_DirectDrawSurface_flip_data(IDirectDrawSurfaceImpl* front,
return
TRUE
;
}
/* This is unnecessarely complicated :-) */
#define MEASUREMENT_WINDOW 5
#define NUMBER_OF_WINDOWS 10
static
LONGLONG
perf_freq
;
static
LONGLONG
perf_storage
[
NUMBER_OF_WINDOWS
];
static
LONGLONG
prev_time
=
0
;
static
unsigned
int
current_window
;
static
unsigned
int
measurements_in_window
;
static
unsigned
int
valid_windows
;
HRESULT
WINAPI
Main_DirectDrawSurface_Flip
(
LPDIRECTDRAWSURFACE7
iface
,
LPDIRECTDRAWSURFACE7
override
,
DWORD
dwFlags
)
...
...
@@ -522,6 +534,57 @@ Main_DirectDrawSurface_Flip(LPDIRECTDRAWSURFACE7 iface,
TRACE
(
"(%p)->(%p,%08lx)
\n
"
,
This
,
override
,
dwFlags
);
if
(
TRACE_ON
(
ddraw_fps
))
{
LONGLONG
current_time
;
LONGLONG
frame_duration
;
QueryPerformanceCounter
((
LARGE_INTEGER
*
)
&
current_time
);
if
(
prev_time
!=
0
)
{
LONGLONG
total_time
=
0
;
int
tot_meas
;
frame_duration
=
current_time
-
prev_time
;
prev_time
=
current_time
;
perf_storage
[
current_window
]
+=
frame_duration
;
measurements_in_window
++
;
if
(
measurements_in_window
>=
MEASUREMENT_WINDOW
)
{
current_window
++
;
valid_windows
++
;
if
(
valid_windows
<
NUMBER_OF_WINDOWS
)
{
int
i
;
tot_meas
=
valid_windows
*
MEASUREMENT_WINDOW
;
for
(
i
=
0
;
i
<
valid_windows
;
i
++
)
{
total_time
+=
perf_storage
[
i
];
}
}
else
{
int
i
;
tot_meas
=
NUMBER_OF_WINDOWS
*
MEASUREMENT_WINDOW
;
for
(
i
=
0
;
i
<
NUMBER_OF_WINDOWS
;
i
++
)
{
total_time
+=
perf_storage
[
i
];
}
}
TRACE_
(
ddraw_fps
)(
" %9.5f
\n
"
,
(
double
)
(
perf_freq
*
tot_meas
)
/
(
double
)
total_time
);
if
(
current_window
>=
NUMBER_OF_WINDOWS
)
{
current_window
=
0
;
}
perf_storage
[
current_window
]
=
0
;
measurements_in_window
=
0
;
}
}
else
{
prev_time
=
current_time
;
memset
(
perf_storage
,
0
,
sizeof
(
perf_storage
));
current_window
=
0
;
valid_windows
=
0
;
measurements_in_window
=
0
;
QueryPerformanceFrequency
((
LARGE_INTEGER
*
)
&
perf_freq
);
}
}
/* MSDN: "This method can be called only for a surface that has the
* DDSCAPS_FLIP and DDSCAPS_FRONTBUFFER capabilities." */
if
((
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_FLIP
|
DDSCAPS_FRONTBUFFER
))
...
...
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