Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
d06f8ef7
Commit
d06f8ef7
authored
Apr 10, 2020
by
Juan Linietsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Shows proper scene render time in editor info
Also fixed GPU profiler, which was not working on nvidia hardware.
parent
ae42cb7b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
209 additions
and
27 deletions
+209
-27
rendering_device_vulkan.cpp
drivers/vulkan/rendering_device_vulkan.cpp
+34
-1
node_3d_editor_plugin.cpp
editor/plugins/node_3d_editor_plugin.cpp
+49
-15
node_3d_editor_plugin.h
editor/plugins/node_3d_editor_plugin.h
+9
-2
rendering_server_raster.cpp
servers/rendering/rendering_server_raster.cpp
+17
-6
rendering_server_raster.h
servers/rendering/rendering_server_raster.h
+4
-0
rendering_server_viewport.cpp
servers/rendering/rendering_server_viewport.cpp
+61
-0
rendering_server_viewport.h
servers/rendering/rendering_server_viewport.h
+23
-3
rendering_server_wrap_mt.h
servers/rendering/rendering_server_wrap_mt.h
+8
-0
rendering_server.h
servers/rendering_server.h
+4
-0
No files found.
drivers/vulkan/rendering_device_vulkan.cpp
View file @
d06f8ef7
...
...
@@ -6935,9 +6935,42 @@ uint64_t RenderingDeviceVulkan::get_captured_timestamps_frame() const {
return
frames
[
frame
].
index
;
}
static
void
mult64to128
(
uint64_t
u
,
uint64_t
v
,
uint64_t
&
h
,
uint64_t
&
l
)
{
uint64_t
u1
=
(
u
&
0xffffffff
);
uint64_t
v1
=
(
v
&
0xffffffff
);
uint64_t
t
=
(
u1
*
v1
);
uint64_t
w3
=
(
t
&
0xffffffff
);
uint64_t
k
=
(
t
>>
32
);
u
>>=
32
;
t
=
(
u
*
v1
)
+
k
;
k
=
(
t
&
0xffffffff
);
uint64_t
w1
=
(
t
>>
32
);
v
>>=
32
;
t
=
(
u1
*
v
)
+
k
;
k
=
(
t
>>
32
);
h
=
(
u
*
v
)
+
w1
+
k
;
l
=
(
t
<<
32
)
+
w3
;
}
uint64_t
RenderingDeviceVulkan
::
get_captured_timestamp_gpu_time
(
uint32_t
p_index
)
const
{
ERR_FAIL_UNSIGNED_INDEX_V
(
p_index
,
frames
[
frame
].
timestamp_result_count
,
0
);
return
frames
[
frame
].
timestamp_result_values
[
p_index
]
*
limits
.
timestampPeriod
;
// this sucks because timestampPeriod multiplier is a float, while the timestamp is 64 bits nanosecs.
// so, in cases like nvidia which give you enormous numbers and 1 as multiplier, multiplying is next to impossible
// need to do 128 bits fixed point multiplication to get the rigth value
uint64_t
shift_bits
=
16
;
uint64_t
h
,
l
;
mult64to128
(
frames
[
frame
].
timestamp_result_values
[
p_index
],
uint64_t
(
double
(
limits
.
timestampPeriod
)
*
double
(
1
<<
shift_bits
)),
h
,
l
);
l
>>=
shift_bits
;
l
|=
h
<<
(
64
-
shift_bits
);
return
l
;
}
uint64_t
RenderingDeviceVulkan
::
get_captured_timestamp_cpu_time
(
uint32_t
p_index
)
const
{
ERR_FAIL_UNSIGNED_INDEX_V
(
p_index
,
frames
[
frame
].
timestamp_result_count
,
0
);
...
...
editor/plugins/node_3d_editor_plugin.cpp
View file @
d06f8ef7
...
...
@@ -2482,7 +2482,9 @@ void Node3DEditorViewport::_notification(int p_what) {
viewport
->
set_msaa
(
Viewport
::
MSAA
(
msaa_mode
));
bool
show_info
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_INFORMATION
));
info_label
->
set_visible
(
show_info
);
if
(
show_info
!=
info_label
->
is_visible
())
{
info_label
->
set_visible
(
show_info
);
}
Camera3D
*
current_camera
;
...
...
@@ -2509,17 +2511,46 @@ void Node3DEditorViewport::_notification(int p_what) {
text
+=
TTR
(
"Surface Changes"
)
+
": "
+
itos
(
viewport
->
get_render_info
(
Viewport
::
RENDER_INFO_SURFACE_CHANGES_IN_FRAME
))
+
"
\n
"
;
text
+=
TTR
(
"Draw Calls"
)
+
": "
+
itos
(
viewport
->
get_render_info
(
Viewport
::
RENDER_INFO_DRAW_CALLS_IN_FRAME
))
+
"
\n
"
;
text
+=
TTR
(
"Vertices"
)
+
": "
+
itos
(
viewport
->
get_render_info
(
Viewport
::
RENDER_INFO_VERTICES_IN_FRAME
));
info_label
->
set_text
(
text
);
}
// FPS Counter.
bool
show_fps
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_FPS
));
fps_label
->
set_visible
(
show_fps
);
bool
show_fps
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_FRAME_TIME
));
if
(
show_fps
!=
fps_label
->
is_visible
())
{
fps_label
->
set_visible
(
show_fps
);
RS
::
get_singleton
()
->
viewport_set_measure_render_time
(
viewport
->
get_viewport_rid
(),
show_fps
);
for
(
int
i
=
0
;
i
<
FRAME_TIME_HISTORY
;
i
++
)
{
cpu_time_history
[
i
]
=
0
;
gpu_time_history
[
i
]
=
0
;
}
cpu_time_history_index
=
0
;
cpu_time_history_index
=
0
;
}
if
(
show_fps
)
{
cpu_time_history
[
cpu_time_history_index
]
=
RS
::
get_singleton
()
->
viewport_get_measured_render_time_cpu
(
viewport
->
get_viewport_rid
());
cpu_time_history_index
=
(
cpu_time_history_index
+
1
)
%
FRAME_TIME_HISTORY
;
float
cpu_time
=
0.0
;
for
(
int
i
=
0
;
i
<
FRAME_TIME_HISTORY
;
i
++
)
{
cpu_time
+=
cpu_time_history
[
i
];
}
cpu_time
/=
FRAME_TIME_HISTORY
;
gpu_time_history
[
gpu_time_history_index
]
=
RS
::
get_singleton
()
->
viewport_get_measured_render_time_gpu
(
viewport
->
get_viewport_rid
());
gpu_time_history_index
=
(
gpu_time_history_index
+
1
)
%
FRAME_TIME_HISTORY
;
float
gpu_time
=
0.0
;
for
(
int
i
=
0
;
i
<
FRAME_TIME_HISTORY
;
i
++
)
{
gpu_time
+=
gpu_time_history
[
i
];
}
gpu_time
/=
FRAME_TIME_HISTORY
;
String
text
;
const
float
temp_fps
=
Engine
::
get_singleton
()
->
get_frames_per_second
();
text
+=
TTR
(
vformat
(
"FPS: %d (%s ms)"
,
temp_fps
,
String
::
num
(
1000.0
f
/
temp_fps
,
2
)));
text
+=
TTR
(
"CPU Time"
)
+
": "
+
String
::
num
(
cpu_time
,
1
)
+
" ms
\n
"
;
text
+=
TTR
(
"GPU Time"
)
+
": "
+
String
::
num
(
gpu_time
,
1
)
+
" ms
\n
"
;
text
+=
TTR
(
"FPS"
)
+
": "
+
itos
(
1000.0
/
gpu_time
);
fps_label
->
set_text
(
text
);
}
...
...
@@ -2980,9 +3011,9 @@ void Node3DEditorViewport::_menu_option(int p_option) {
view_menu
->
get_popup
()
->
set_item_checked
(
idx
,
!
current
);
}
break
;
case
VIEW_F
PS
:
{
case
VIEW_F
RAME_TIME
:
{
int
idx
=
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_F
PS
);
int
idx
=
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_F
RAME_TIME
);
bool
current
=
view_menu
->
get_popup
()
->
is_item_checked
(
idx
);
view_menu
->
get_popup
()
->
set_item_checked
(
idx
,
!
current
);
...
...
@@ -3338,12 +3369,12 @@ void Node3DEditorViewport::set_state(const Dictionary &p_state) {
if
(
view_menu
->
get_popup
()
->
is_item_checked
(
idx
)
!=
information
)
_menu_option
(
VIEW_INFORMATION
);
}
if
(
p_state
.
has
(
"f
ps
"
))
{
bool
fps
=
p_state
[
"f
ps
"
];
if
(
p_state
.
has
(
"f
rame_time
"
))
{
bool
fps
=
p_state
[
"f
rame_time
"
];
int
idx
=
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_F
PS
);
int
idx
=
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_F
RAME_TIME
);
if
(
view_menu
->
get_popup
()
->
is_item_checked
(
idx
)
!=
fps
)
_menu_option
(
VIEW_F
PS
);
_menu_option
(
VIEW_F
RAME_TIME
);
}
if
(
p_state
.
has
(
"half_res"
))
{
bool
half_res
=
p_state
[
"half_res"
];
...
...
@@ -3400,7 +3431,7 @@ Dictionary Node3DEditorViewport::get_state() const {
d
[
"doppler"
]
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_AUDIO_DOPPLER
));
d
[
"gizmos"
]
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_GIZMOS
));
d
[
"information"
]
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_INFORMATION
));
d
[
"f
ps"
]
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_FPS
));
d
[
"f
rame_time"
]
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_FRAME_TIME
));
d
[
"half_res"
]
=
subviewport_container
->
get_stretch_shrink
()
>
1
;
d
[
"cinematic_preview"
]
=
view_menu
->
get_popup
()
->
is_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_CINEMATIC_PREVIEW
));
if
(
previewing
)
...
...
@@ -3812,6 +3843,9 @@ void Node3DEditorViewport::drop_data_fw(const Point2 &p_point, const Variant &p_
Node3DEditorViewport
::
Node3DEditorViewport
(
Node3DEditor
*
p_spatial_editor
,
EditorNode
*
p_editor
,
int
p_index
)
{
cpu_time_history_index
=
0
;
cpu_time_history_index
=
0
;
_edit
.
mode
=
TRANSFORM_NONE
;
_edit
.
plane
=
TRANSFORM_VIEW
;
_edit
.
edited_gizmo
=
0
;
...
...
@@ -3912,7 +3946,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
view_menu
->
get_popup
()
->
add_check_shortcut
(
ED_SHORTCUT
(
"spatial_editor/view_environment"
,
TTR
(
"View Environment"
)),
VIEW_ENVIRONMENT
);
view_menu
->
get_popup
()
->
add_check_shortcut
(
ED_SHORTCUT
(
"spatial_editor/view_gizmos"
,
TTR
(
"View Gizmos"
)),
VIEW_GIZMOS
);
view_menu
->
get_popup
()
->
add_check_shortcut
(
ED_SHORTCUT
(
"spatial_editor/view_information"
,
TTR
(
"View Information"
)),
VIEW_INFORMATION
);
view_menu
->
get_popup
()
->
add_check_shortcut
(
ED_SHORTCUT
(
"spatial_editor/view_fps"
,
TTR
(
"View F
PS"
)),
VIEW_FPS
);
view_menu
->
get_popup
()
->
add_check_shortcut
(
ED_SHORTCUT
(
"spatial_editor/view_fps"
,
TTR
(
"View F
rame Time"
)),
VIEW_FRAME_TIME
);
view_menu
->
get_popup
()
->
set_item_checked
(
view_menu
->
get_popup
()
->
get_item_index
(
VIEW_ENVIRONMENT
),
true
);
view_menu
->
get_popup
()
->
add_separator
();
view_menu
->
get_popup
()
->
add_check_shortcut
(
ED_SHORTCUT
(
"spatial_editor/view_half_resolution"
,
TTR
(
"Half Resolution"
)),
VIEW_HALF_RESOLUTION
);
...
...
@@ -3989,7 +4023,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, Edito
fps_label
->
set_anchor_and_margin
(
MARGIN_TOP
,
ANCHOR_BEGIN
,
10
*
EDSCALE
);
fps_label
->
set_anchor_and_margin
(
MARGIN_RIGHT
,
ANCHOR_END
,
-
10
*
EDSCALE
);
fps_label
->
set_h_grow_direction
(
GROW_DIRECTION_BEGIN
);
fps_label
->
set_tooltip
(
TTR
(
"Note: The FPS
value displayed is the editor's framerate.
\n
It cannot be used as a reliable indication of in-game performanc
e."
));
fps_label
->
set_tooltip
(
TTR
(
"Note: The FPS
is estimated on a 60hz refresh rat
e."
));
fps_label
->
set_mouse_filter
(
MOUSE_FILTER_PASS
);
// Otherwise tooltip doesn't show.
surface
->
add_child
(
fps_label
);
fps_label
->
hide
();
...
...
editor/plugins/node_3d_editor_plugin.h
View file @
d06f8ef7
...
...
@@ -202,7 +202,7 @@ class Node3DEditorViewport : public Control {
VIEW_AUDIO_DOPPLER
,
VIEW_GIZMOS
,
VIEW_INFORMATION
,
VIEW_F
PS
,
VIEW_F
RAME_TIME
,
VIEW_DISPLAY_NORMAL
,
VIEW_DISPLAY_WIREFRAME
,
VIEW_DISPLAY_OVERDRAW
,
...
...
@@ -229,7 +229,9 @@ public:
enum
{
GIZMO_BASE_LAYER
=
27
,
GIZMO_EDIT_LAYER
=
26
,
GIZMO_GRID_LAYER
=
25
GIZMO_GRID_LAYER
=
25
,
FRAME_TIME_HISTORY
=
20
,
};
enum
NavigationScheme
{
...
...
@@ -239,6 +241,11 @@ public:
};
private
:
float
cpu_time_history
[
FRAME_TIME_HISTORY
];
int
cpu_time_history_index
;
float
gpu_time_history
[
FRAME_TIME_HISTORY
];
int
gpu_time_history_index
;
int
index
;
String
name
;
void
_menu_option
(
int
p_option
);
...
...
servers/rendering/rendering_server_raster.cpp
View file @
d06f8ef7
...
...
@@ -135,16 +135,27 @@ void RenderingServerRaster::draw(bool p_swap_buffers, double frame_step) {
if
(
RSG
::
storage
->
get_captured_timestamps_count
())
{
Vector
<
FrameProfileArea
>
new_profile
;
new_profile
.
resize
(
RSG
::
storage
->
get_captured_timestamps_count
());
if
(
RSG
::
storage
->
capturing_timestamps
)
{
new_profile
.
resize
(
RSG
::
storage
->
get_captured_timestamps_count
());
}
uint64_t
base_cpu
=
RSG
::
storage
->
get_captured_timestamp_cpu_time
(
0
);
uint64_t
base_gpu
=
RSG
::
storage
->
get_captured_timestamp_gpu_time
(
0
);
for
(
uint32_t
i
=
0
;
i
<
RSG
::
storage
->
get_captured_timestamps_count
();
i
++
)
{
uint64_t
time_cpu
=
RSG
::
storage
->
get_captured_timestamp_cpu_time
(
i
)
-
base_cpu
;
uint64_t
time_gpu
=
RSG
::
storage
->
get_captured_timestamp_gpu_time
(
i
)
-
base_gpu
;
new_profile
.
write
[
i
].
gpu_msec
=
float
(
time_gpu
/
1000
)
/
1000.0
;
new_profile
.
write
[
i
].
cpu_msec
=
float
(
time_cpu
)
/
1000.0
;
new_profile
.
write
[
i
].
name
=
RSG
::
storage
->
get_captured_timestamp_name
(
i
);
uint64_t
time_cpu
=
RSG
::
storage
->
get_captured_timestamp_cpu_time
(
i
);
uint64_t
time_gpu
=
RSG
::
storage
->
get_captured_timestamp_gpu_time
(
i
);
String
name
=
RSG
::
storage
->
get_captured_timestamp_name
(
i
);
if
(
name
.
begins_with
(
"vp_"
))
{
RSG
::
viewport
->
handle_timestamp
(
name
,
time_cpu
,
time_gpu
);
}
if
(
RSG
::
storage
->
capturing_timestamps
)
{
new_profile
.
write
[
i
].
gpu_msec
=
float
((
time_gpu
-
base_gpu
)
/
1000
)
/
1000.0
;
new_profile
.
write
[
i
].
cpu_msec
=
float
(
time_cpu
-
base_cpu
)
/
1000.0
;
new_profile
.
write
[
i
].
name
=
RSG
::
storage
->
get_captured_timestamp_name
(
i
);
}
}
frame_profile
=
new_profile
;
...
...
servers/rendering/rendering_server_raster.h
View file @
d06f8ef7
...
...
@@ -493,6 +493,10 @@ public:
BIND2R
(
int
,
viewport_get_render_info
,
RID
,
ViewportRenderInfo
)
BIND2
(
viewport_set_debug_draw
,
RID
,
ViewportDebugDraw
)
BIND2
(
viewport_set_measure_render_time
,
RID
,
bool
)
BIND1RC
(
float
,
viewport_get_measured_render_time_cpu
,
RID
)
BIND1RC
(
float
,
viewport_get_measured_render_time_gpu
,
RID
)
/* ENVIRONMENT API */
#undef BINDBASE
...
...
servers/rendering/rendering_server_viewport.cpp
View file @
d06f8ef7
...
...
@@ -81,6 +81,12 @@ void RenderingServerViewport::_draw_3d(Viewport *p_viewport, XRInterface::Eyes p
void
RenderingServerViewport
::
_draw_viewport
(
Viewport
*
p_viewport
,
XRInterface
::
Eyes
p_eye
)
{
if
(
p_viewport
->
measure_render_time
)
{
String
rt_id
=
"vp_begin_"
+
itos
(
p_viewport
->
self
.
get_id
());
RSG
::
storage
->
capture_timestamp
(
rt_id
);
timestamp_vp_map
[
rt_id
]
=
p_viewport
->
self
;
}
/* Camera should always be BEFORE any other 3D */
bool
scenario_draw_canvas_bg
=
false
;
//draw canvas, or some layer of it, as BG for 3D instead of in front
...
...
@@ -289,10 +295,18 @@ void RenderingServerViewport::_draw_viewport(Viewport *p_viewport, XRInterface::
//was never cleared in the end, force clear it
RSG
::
storage
->
render_target_do_clear_request
(
p_viewport
->
render_target
);
}
if
(
p_viewport
->
measure_render_time
)
{
String
rt_id
=
"vp_end_"
+
itos
(
p_viewport
->
self
.
get_id
());
RSG
::
storage
->
capture_timestamp
(
rt_id
);
timestamp_vp_map
[
rt_id
]
=
p_viewport
->
self
;
}
}
void
RenderingServerViewport
::
draw_viewports
()
{
timestamp_vp_map
.
clear
();
// get our xr interface in case we need it
Ref
<
XRInterface
>
xr_interface
;
...
...
@@ -745,6 +759,30 @@ void RenderingServerViewport::viewport_set_debug_draw(RID p_viewport, RS::Viewpo
viewport
->
debug_draw
=
p_draw
;
}
void
RenderingServerViewport
::
viewport_set_measure_render_time
(
RID
p_viewport
,
bool
p_enable
)
{
Viewport
*
viewport
=
viewport_owner
.
getornull
(
p_viewport
);
ERR_FAIL_COND
(
!
viewport
);
viewport
->
measure_render_time
=
p_enable
;
}
float
RenderingServerViewport
::
viewport_get_measured_render_time_cpu
(
RID
p_viewport
)
const
{
Viewport
*
viewport
=
viewport_owner
.
getornull
(
p_viewport
);
ERR_FAIL_COND_V
(
!
viewport
,
0
);
return
double
(
viewport
->
time_cpu_end
-
viewport
->
time_cpu_begin
)
/
1000.0
;
}
float
RenderingServerViewport
::
viewport_get_measured_render_time_gpu
(
RID
p_viewport
)
const
{
Viewport
*
viewport
=
viewport_owner
.
getornull
(
p_viewport
);
ERR_FAIL_COND_V
(
!
viewport
,
0
);
return
double
((
viewport
->
time_gpu_end
-
viewport
->
time_gpu_begin
)
/
1000
)
/
1000.0
;
}
bool
RenderingServerViewport
::
free
(
RID
p_rid
)
{
if
(
viewport_owner
.
owns
(
p_rid
))
{
...
...
@@ -773,6 +811,29 @@ bool RenderingServerViewport::free(RID p_rid) {
return
false
;
}
void
RenderingServerViewport
::
handle_timestamp
(
String
p_timestamp
,
uint64_t
p_cpu_time
,
uint64_t
p_gpu_time
)
{
RID
*
vp
=
timestamp_vp_map
.
getptr
(
p_timestamp
);
if
(
!
vp
)
{
return
;
}
Viewport
*
viewport
=
viewport_owner
.
getornull
(
*
vp
);
if
(
!
viewport
)
{
return
;
}
if
(
p_timestamp
.
begins_with
(
"vp_begin"
))
{
viewport
->
time_cpu_begin
=
p_cpu_time
;
viewport
->
time_gpu_begin
=
p_gpu_time
;
}
if
(
p_timestamp
.
begins_with
(
"vp_end"
))
{
viewport
->
time_cpu_end
=
p_cpu_time
;
viewport
->
time_gpu_end
=
p_gpu_time
;
}
}
void
RenderingServerViewport
::
set_default_clear_color
(
const
Color
&
p_color
)
{
RSG
::
storage
->
set_default_clear_color
(
p_color
);
}
...
...
servers/rendering/rendering_server_viewport.h
View file @
d06f8ef7
...
...
@@ -67,8 +67,13 @@ public:
bool
hide_scenario
;
bool
hide_canvas
;
bool
disable_environment
;
bool
disable_3d_by_usage
;
bool
keep_3d_linear
;
bool
measure_render_time
;
uint64_t
time_cpu_begin
;
uint64_t
time_cpu_end
;
uint64_t
time_gpu_begin
;
uint64_t
time_gpu_end
;
RID
shadow_atlas
;
int
shadow_atlas_size
;
...
...
@@ -121,16 +126,25 @@ public:
disable_environment
=
false
;
viewport_to_screen
=
DisplayServer
::
INVALID_WINDOW_ID
;
shadow_atlas_size
=
0
;
keep_3d_linear
=
false
;
measure_render_time
=
false
;
debug_draw
=
RS
::
VIEWPORT_DEBUG_DRAW_DISABLED
;
msaa
=
RS
::
VIEWPORT_MSAA_DISABLED
;
for
(
int
i
=
0
;
i
<
RS
::
VIEWPORT_RENDER_INFO_MAX
;
i
++
)
{
render_info
[
i
]
=
0
;
}
use_xr
=
false
;
time_cpu_begin
=
0
;
time_cpu_end
=
0
;
time_gpu_begin
=
0
;
time_gpu_end
=
0
;
}
};
HashMap
<
String
,
RID
>
timestamp_vp_map
;
uint64_t
draw_viewports_pass
=
0
;
mutable
RID_PtrOwner
<
Viewport
>
viewport_owner
;
...
...
@@ -196,6 +210,12 @@ public:
virtual
int
viewport_get_render_info
(
RID
p_viewport
,
RS
::
ViewportRenderInfo
p_info
);
virtual
void
viewport_set_debug_draw
(
RID
p_viewport
,
RS
::
ViewportDebugDraw
p_draw
);
void
viewport_set_measure_render_time
(
RID
p_viewport
,
bool
p_enable
);
float
viewport_get_measured_render_time_cpu
(
RID
p_viewport
)
const
;
float
viewport_get_measured_render_time_gpu
(
RID
p_viewport
)
const
;
void
handle_timestamp
(
String
p_timestamp
,
uint64_t
p_cpu_time
,
uint64_t
p_gpu_time
);
void
set_default_clear_color
(
const
Color
&
p_color
);
void
draw_viewports
();
...
...
servers/rendering/rendering_server_wrap_mt.h
View file @
d06f8ef7
...
...
@@ -411,6 +411,14 @@ public:
FUNC2
(
viewport_set_debug_draw
,
RID
,
ViewportDebugDraw
)
FUNC2
(
viewport_set_measure_render_time
,
RID
,
bool
)
virtual
float
viewport_get_measured_render_time_cpu
(
RID
p_viewport
)
const
{
return
rendering_server
->
viewport_get_measured_render_time_cpu
(
p_viewport
);
}
virtual
float
viewport_get_measured_render_time_gpu
(
RID
p_viewport
)
const
{
return
rendering_server
->
viewport_get_measured_render_time_gpu
(
p_viewport
);
}
FUNC1
(
directional_shadow_atlas_set_size
,
int
)
/* SKY API */
...
...
servers/rendering_server.h
View file @
d06f8ef7
...
...
@@ -673,6 +673,10 @@ public:
virtual
void
viewport_set_debug_draw
(
RID
p_viewport
,
ViewportDebugDraw
p_draw
)
=
0
;
virtual
void
viewport_set_measure_render_time
(
RID
p_viewport
,
bool
p_enable
)
=
0
;
virtual
float
viewport_get_measured_render_time_cpu
(
RID
p_viewport
)
const
=
0
;
virtual
float
viewport_get_measured_render_time_gpu
(
RID
p_viewport
)
const
=
0
;
virtual
void
directional_shadow_atlas_set_size
(
int
p_size
)
=
0
;
/* SKY API */
...
...
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