2016-11-16 16:54:51 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef WR_h
|
|
|
|
#define WR_h
|
2017-01-06 22:50:53 +03:00
|
|
|
|
2017-01-13 13:25:07 +03:00
|
|
|
#include "mozilla/gfx/Types.h"
|
2017-02-22 21:19:57 +03:00
|
|
|
#include "nsTArray.h"
|
2017-02-14 21:34:15 +03:00
|
|
|
|
2016-11-16 16:54:51 +03:00
|
|
|
extern "C" {
|
2017-01-20 22:44:26 +03:00
|
|
|
|
|
|
|
// ----
|
|
|
|
// Functions invoked from Rust code
|
|
|
|
// ----
|
|
|
|
|
2016-12-02 01:10:10 +03:00
|
|
|
bool is_in_compositor_thread();
|
2017-03-02 04:36:27 +03:00
|
|
|
bool is_in_main_thread();
|
2017-01-06 21:10:15 +03:00
|
|
|
bool is_in_render_thread();
|
2019-07-03 16:38:00 +03:00
|
|
|
bool is_glcontext_gles(void* glcontext_ptr);
|
2017-12-06 23:06:40 +03:00
|
|
|
bool is_glcontext_angle(void* glcontext_ptr);
|
2017-07-17 08:38:22 +03:00
|
|
|
bool gfx_use_wrench();
|
2017-10-06 21:38:56 +03:00
|
|
|
const char* gfx_wr_resource_path_override();
|
2020-04-21 13:32:15 +03:00
|
|
|
bool gfx_wr_use_optimized_shaders();
|
2017-03-27 21:32:39 +03:00
|
|
|
void gfx_critical_note(const char* msg);
|
2017-10-30 06:31:38 +03:00
|
|
|
void gfx_critical_error(const char* msg);
|
|
|
|
void gecko_printf_stderr_output(const char* msg);
|
2016-12-21 07:22:04 +03:00
|
|
|
void* get_proc_address_from_glcontext(void* glcontext_ptr,
|
|
|
|
const char* procname);
|
2017-11-11 13:57:31 +03:00
|
|
|
void gecko_profiler_register_thread(const char* threadname);
|
|
|
|
void gecko_profiler_unregister_thread();
|
2016-12-02 01:10:10 +03:00
|
|
|
|
2018-11-15 02:21:23 +03:00
|
|
|
void gecko_profiler_start_marker(const char* name);
|
|
|
|
void gecko_profiler_end_marker(const char* name);
|
2020-03-14 09:56:36 +03:00
|
|
|
void gecko_profiler_event_marker(const char* name);
|
2019-03-05 22:31:49 +03:00
|
|
|
void gecko_profiler_add_text_marker(const char* name, const char* text_ptr,
|
|
|
|
size_t text_len, uint64_t microseconds);
|
|
|
|
bool gecko_profiler_thread_is_being_profiled();
|
2018-11-15 02:21:23 +03:00
|
|
|
|
2019-01-11 22:19:59 +03:00
|
|
|
// IMPORTANT: Keep this synchronized with enumerate_interners in
|
|
|
|
// gfx/wr/webrender_api
|
|
|
|
#define WEBRENDER_FOR_EACH_INTERNER(macro) \
|
|
|
|
macro(clip); \
|
|
|
|
macro(prim); \
|
|
|
|
macro(normal_border); \
|
|
|
|
macro(image_border); \
|
|
|
|
macro(image); \
|
|
|
|
macro(yuv_image); \
|
|
|
|
macro(line_decoration); \
|
|
|
|
macro(linear_grad); \
|
|
|
|
macro(radial_grad); \
|
2020-02-12 21:08:32 +03:00
|
|
|
macro(conic_grad); \
|
2019-01-11 22:19:59 +03:00
|
|
|
macro(picture); \
|
2019-02-26 09:16:36 +03:00
|
|
|
macro(text_run); \
|
2019-08-14 01:02:44 +03:00
|
|
|
macro(filterdata); \
|
|
|
|
macro(backdrop);
|
2019-02-26 09:16:36 +03:00
|
|
|
|
2017-11-28 18:25:27 +03:00
|
|
|
// Prelude of types necessary before including webrender_ffi_generated.h
|
|
|
|
namespace mozilla {
|
|
|
|
namespace wr {
|
|
|
|
|
2019-01-11 22:19:59 +03:00
|
|
|
// Because this struct is macro-generated on the Rust side, cbindgen can't see
|
2019-01-18 03:45:13 +03:00
|
|
|
// it. Work around that by re-declaring it here.
|
|
|
|
#define DECLARE_MEMBER(id) uintptr_t id;
|
|
|
|
struct InternerSubReport {
|
|
|
|
WEBRENDER_FOR_EACH_INTERNER(DECLARE_MEMBER)
|
2019-01-11 22:19:59 +03:00
|
|
|
};
|
|
|
|
|
2019-01-18 03:45:13 +03:00
|
|
|
#undef DECLARE_MEMBER
|
2019-01-11 22:19:59 +03:00
|
|
|
|
2018-04-17 00:39:14 +03:00
|
|
|
struct Transaction;
|
2018-04-10 19:29:55 +03:00
|
|
|
struct WrWindowId;
|
2019-03-22 21:28:42 +03:00
|
|
|
struct DocumentId;
|
2018-04-10 19:29:55 +03:00
|
|
|
struct WrPipelineInfo;
|
|
|
|
|
2020-03-12 20:39:59 +03:00
|
|
|
struct WrPipelineIdAndEpoch;
|
|
|
|
using WrPipelineIdEpochs = nsTArray<WrPipelineIdAndEpoch>;
|
|
|
|
|
2019-01-09 06:27:48 +03:00
|
|
|
const uint64_t ROOT_CLIP_CHAIN = ~0;
|
|
|
|
|
2017-11-28 18:25:27 +03:00
|
|
|
} // namespace wr
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2018-04-10 19:29:55 +03:00
|
|
|
void apz_register_updater(mozilla::wr::WrWindowId aWindowId);
|
|
|
|
void apz_pre_scene_swap(mozilla::wr::WrWindowId aWindowId);
|
2018-04-11 00:26:54 +03:00
|
|
|
void apz_post_scene_swap(mozilla::wr::WrWindowId aWindowId,
|
2020-02-19 21:34:51 +03:00
|
|
|
const mozilla::wr::WrPipelineInfo* aInfo);
|
2018-04-10 19:29:55 +03:00
|
|
|
void apz_run_updater(mozilla::wr::WrWindowId aWindowId);
|
|
|
|
void apz_deregister_updater(mozilla::wr::WrWindowId aWindowId);
|
|
|
|
|
2018-04-17 00:39:14 +03:00
|
|
|
void apz_register_sampler(mozilla::wr::WrWindowId aWindowId);
|
|
|
|
void apz_sample_transforms(
|
2019-03-22 21:28:42 +03:00
|
|
|
mozilla::wr::WrWindowId aWindowId, mozilla::wr::Transaction* aTransaction,
|
2020-03-12 20:39:59 +03:00
|
|
|
const mozilla::wr::WrPipelineIdEpochs* aPipelineEpochs);
|
2018-04-17 00:39:14 +03:00
|
|
|
void apz_deregister_sampler(mozilla::wr::WrWindowId aWindowId);
|
2020-06-18 02:47:20 +03:00
|
|
|
|
|
|
|
void omta_register_sampler(mozilla::wr::WrWindowId aWindowId);
|
|
|
|
void omta_sample(mozilla::wr::WrWindowId aWindowId,
|
|
|
|
mozilla::wr::Transaction* aTransaction);
|
|
|
|
void omta_deregister_sampler(mozilla::wr::WrWindowId aWindowId);
|
2017-05-08 08:31:20 +03:00
|
|
|
} // extern "C"
|
|
|
|
|
2019-12-09 15:14:16 +03:00
|
|
|
// Work-around wingdi.h define which conflcits with WR color constant
|
|
|
|
#pragma push_macro("TRANSPARENT")
|
|
|
|
#undef TRANSPARENT
|
|
|
|
|
2017-04-12 05:17:18 +03:00
|
|
|
#include "webrender_ffi_generated.h"
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2019-12-09 15:14:16 +03:00
|
|
|
#pragma pop_macro("TRANSPARENT")
|
|
|
|
|
2018-07-04 14:52:22 +03:00
|
|
|
// More functions invoked from Rust code. These are down here because they
|
|
|
|
// refer to data structures from webrender_ffi_generated.h
|
|
|
|
extern "C" {
|
|
|
|
void record_telemetry_time(mozilla::wr::TelemetryProbe aProbe,
|
|
|
|
uint64_t aTimeNs);
|
|
|
|
}
|
|
|
|
|
2018-11-24 02:33:49 +03:00
|
|
|
namespace mozilla {
|
|
|
|
namespace wr {
|
|
|
|
|
|
|
|
// Cast a blob image key into a regular image for use in
|
|
|
|
// a display item.
|
|
|
|
inline ImageKey AsImageKey(BlobImageKey aKey) { return aKey._0; }
|
|
|
|
|
|
|
|
} // namespace wr
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2017-01-20 22:44:26 +03:00
|
|
|
#endif // WR_h
|