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();
|
2017-03-20 19:10:40 +03:00
|
|
|
bool is_glcontext_egl(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();
|
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);
|
|
|
|
|
2017-11-28 18:25:27 +03:00
|
|
|
// Prelude of types necessary before including webrender_ffi_generated.h
|
|
|
|
namespace mozilla {
|
|
|
|
namespace wr {
|
|
|
|
|
|
|
|
struct FontInstanceFlags {
|
|
|
|
uint32_t bits;
|
|
|
|
|
|
|
|
bool operator==(const FontInstanceFlags& aOther) const {
|
|
|
|
return bits == aOther.bits;
|
|
|
|
}
|
|
|
|
|
|
|
|
FontInstanceFlags& operator=(uint32_t aBits) {
|
|
|
|
bits = aBits;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
FontInstanceFlags& operator|=(uint32_t aBits) {
|
|
|
|
bits |= aBits;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2018-09-06 04:55:53 +03:00
|
|
|
FontInstanceFlags operator|(uint32_t aBits) const {
|
2018-01-17 15:51:20 +03:00
|
|
|
FontInstanceFlags flags = {bits | aBits};
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
|
|
|
FontInstanceFlags& operator&=(uint32_t aBits) {
|
|
|
|
bits &= aBits;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2018-09-06 04:55:53 +03:00
|
|
|
FontInstanceFlags operator&(uint32_t aBits) const {
|
2018-01-17 15:51:20 +03:00
|
|
|
FontInstanceFlags flags = {bits & aBits};
|
|
|
|
return flags;
|
|
|
|
}
|
|
|
|
|
2018-09-06 04:55:53 +03:00
|
|
|
MOZ_IMPLICIT operator bool() const { return bits != 0; }
|
|
|
|
|
2017-11-28 18:25:27 +03:00
|
|
|
enum : uint32_t {
|
|
|
|
SYNTHETIC_BOLD = 1 << 1,
|
|
|
|
EMBEDDED_BITMAPS = 1 << 2,
|
|
|
|
SUBPIXEL_BGR = 1 << 3,
|
2018-01-17 15:51:20 +03:00
|
|
|
TRANSPOSE = 1 << 4,
|
|
|
|
FLIP_X = 1 << 5,
|
|
|
|
FLIP_Y = 1 << 6,
|
2018-05-26 18:09:21 +03:00
|
|
|
SUBPIXEL_POSITION = 1 << 7,
|
2017-11-28 18:25:27 +03:00
|
|
|
|
|
|
|
FORCE_GDI = 1 << 16,
|
|
|
|
|
|
|
|
FONT_SMOOTHING = 1 << 16,
|
|
|
|
|
|
|
|
FORCE_AUTOHINT = 1 << 16,
|
|
|
|
NO_AUTOHINT = 1 << 17,
|
2018-05-26 18:09:21 +03:00
|
|
|
VERTICAL_LAYOUT = 1 << 18,
|
|
|
|
LCD_VERTICAL = 1 << 19
|
2017-11-28 18:25:27 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-04-17 00:39:14 +03:00
|
|
|
struct Transaction;
|
2018-04-10 19:29:55 +03:00
|
|
|
struct WrWindowId;
|
|
|
|
struct WrPipelineInfo;
|
|
|
|
|
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,
|
|
|
|
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(mozilla::wr::WrWindowId aWindowId,
|
|
|
|
mozilla::wr::Transaction* aTransaction);
|
|
|
|
void apz_deregister_sampler(mozilla::wr::WrWindowId aWindowId);
|
2017-05-08 08:31:20 +03:00
|
|
|
} // extern "C"
|
|
|
|
|
2017-01-20 22:46:58 +03:00
|
|
|
// Some useful defines to stub out webrender binding functions for when we
|
|
|
|
// build gecko without webrender. We try to tell the compiler these functions
|
|
|
|
// are unreachable in that case, but VC++ emits a warning if it finds any
|
|
|
|
// unreachable functions invoked from destructors. That warning gets turned into
|
|
|
|
// an error and causes the build to fail. So for wr_* functions called by
|
|
|
|
// destructors in C++ classes, use WR_DESTRUCTOR_SAFE_FUNC instead, which omits
|
|
|
|
// the unreachable annotation.
|
2017-03-23 00:36:25 +03:00
|
|
|
#ifdef MOZ_BUILD_WEBRENDER
|
2016-11-16 16:54:51 +03:00
|
|
|
#define WR_INLINE
|
|
|
|
#define WR_FUNC
|
2017-01-20 22:46:58 +03:00
|
|
|
#define WR_DESTRUCTOR_SAFE_FUNC
|
2016-11-16 16:54:51 +03:00
|
|
|
#else
|
|
|
|
#define WR_INLINE inline
|
|
|
|
#define WR_FUNC \
|
|
|
|
{ MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("WebRender disabled"); }
|
2017-01-20 22:46:58 +03:00
|
|
|
#define WR_DESTRUCTOR_SAFE_FUNC \
|
|
|
|
{}
|
2016-11-16 16:54:51 +03:00
|
|
|
#endif
|
|
|
|
|
2017-04-12 05:17:18 +03:00
|
|
|
#include "webrender_ffi_generated.h"
|
2017-01-10 12:17:30 +03:00
|
|
|
|
2017-04-12 05:17:18 +03:00
|
|
|
#undef WR_FUNC
|
|
|
|
#undef WR_DESTRUCTOR_SAFE_FUNC
|
2017-02-16 21:23:22 +03:00
|
|
|
|
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
|