зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1799258 - Share all-of-dcomp.h preamble, and deal with outdated mingw dcomp.h. r=gfx-reviewers,sotaro
Mingw's dcomp.h is not the official one, but rather a by-hand reproduction. While this newly-updated version has e.g. IDCompositionFilterEffect, it is still missing e.g. IDCompositionColorMatrixEffect. Differential Revision: https://phabricator.services.mozilla.com/D168839
This commit is contained in:
Родитель
c1b083b181
Коммит
754f4a89af
|
@ -0,0 +1,39 @@
|
|||
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
* 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 mozilla_gfx_AllOfDcomp_h
|
||||
#define mozilla_gfx_AllOfDcomp_h
|
||||
|
||||
// Getting everything that we need in dcomp.h defined means messing with some defines.
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_WIN10)
|
||||
|
||||
# define XSTR(x) STR(x)
|
||||
# define STR(x) #x
|
||||
// clang-format off
|
||||
|
||||
# pragma message "IDCompositionFilterEffect in dcomp.h requires _WIN32_WINNT >= _WIN32_WINNT_WIN10."
|
||||
// Pedantically, it actually requires _WIN32_WINNT_WINTHRESHOLD, but that's the
|
||||
// same as _WIN32_WINNT_WIN10.
|
||||
|
||||
# pragma message "Forcing NTDDI_VERSION " XSTR(NTDDI_VERSION) " -> " XSTR(NTDDI_WIN10)
|
||||
# undef NTDDI_VERSION
|
||||
# define NTDDI_VERSION NTDDI_WIN10
|
||||
|
||||
# pragma message "Forcing _WIN32_WINNT " XSTR(_WIN32_WINNT) " -> " XSTR(_WIN32_WINNT_WIN10)
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT _WIN32_WINNT_WIN10
|
||||
|
||||
// clang-format on
|
||||
# undef STR
|
||||
# undef XSTR
|
||||
|
||||
#endif
|
||||
|
||||
// -
|
||||
|
||||
#include <dcomp.h>
|
||||
|
||||
#endif // mozilla_gfx_AllOfDcomp_h
|
|
@ -25,17 +25,10 @@
|
|||
#include "nsPrintfCString.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT _WIN32_WINNT_WINBLUE
|
||||
#undef NTDDI_VERSION
|
||||
#define NTDDI_VERSION NTDDI_WINBLUE
|
||||
|
||||
// We also need this, or dcomp.h won't give us e.g. IDCompositionDevice3:
|
||||
#undef _WIN32_WINNT_WINTHRESHOLD
|
||||
#define _WIN32_WINNT_WINTHRESHOLD _WIN32_WINNT
|
||||
// -
|
||||
|
||||
#include "mozilla/gfx/AllOfDcomp.h"
|
||||
#include <d3d11.h>
|
||||
#include <dcomp.h>
|
||||
#include <ddraw.h>
|
||||
#include <dxgi.h>
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ EXPORTS += [
|
|||
]
|
||||
|
||||
EXPORTS.mozilla.gfx += [
|
||||
"AllOfDcomp.h",
|
||||
"D3D11Checks.h",
|
||||
"DeviceManagerDx.h",
|
||||
"DisplayConfigWindows.h",
|
||||
|
|
|
@ -8,33 +8,9 @@
|
|||
|
||||
// -
|
||||
|
||||
#if (_WIN32_WINNT < _WIN32_WINNT_WIN10)
|
||||
|
||||
# define XSTR(x) STR(x)
|
||||
# define STR(x) #x
|
||||
// clang-format off
|
||||
|
||||
# pragma message "IDCompositionFilterEffect in dcomp.h requires _WIN32_WINNT >= _WIN32_WINNT_WIN10."
|
||||
// Pedantically, it actually requires _WIN32_WINNT_WINTHRESHOLD, but that's the
|
||||
// same as _WIN32_WINNT_WIN10.
|
||||
|
||||
# pragma message "Forcing NTDDI_VERSION " XSTR(NTDDI_VERSION) " -> " XSTR(NTDDI_WIN10)
|
||||
# undef NTDDI_VERSION
|
||||
# define NTDDI_VERSION NTDDI_WIN10
|
||||
|
||||
# pragma message "Forcing _WIN32_WINNT " XSTR(_WIN32_WINNT) " -> " XSTR(_WIN32_WINNT_WIN10)
|
||||
# undef _WIN32_WINNT
|
||||
# define _WIN32_WINNT _WIN32_WINNT_WIN10
|
||||
|
||||
// clang-format on
|
||||
# undef STR
|
||||
# undef XSTR
|
||||
|
||||
#endif
|
||||
|
||||
#include "mozilla/gfx/AllOfDcomp.h"
|
||||
#include <d3d11.h>
|
||||
#include <d3d11_1.h>
|
||||
#include <dcomp.h>
|
||||
#include <dxgi1_2.h>
|
||||
|
||||
// -
|
||||
|
@ -57,6 +33,16 @@
|
|||
#include "nsPrintfCString.h"
|
||||
#include "WinUtils.h"
|
||||
|
||||
// -
|
||||
|
||||
#if defined(__MINGW32__) // 64 defines both 32 and 64
|
||||
// We need to fake some things, while we wait on updates to mingw's dcomp.h
|
||||
// header. Just enough that we can successfully fail to work there.
|
||||
#define MOZ_MINGW_DCOMP_H_INCOMPLETE
|
||||
struct IDCompositionColorMatrixEffect : public IDCompositionFilterEffect {};
|
||||
struct IDCompositionTableTransferEffect : public IDCompositionFilterEffect {};
|
||||
#endif // defined(__MINGW32__)
|
||||
|
||||
namespace mozilla {
|
||||
namespace wr {
|
||||
|
||||
|
@ -1820,6 +1806,8 @@ ColorManagementChain ColorManagementChain::From(
|
|||
const color::ColorProfileConversionDesc& conv) {
|
||||
auto ret = ColorManagementChain{};
|
||||
|
||||
#if !defined(MOZ_MINGW_DCOMP_H_INCOMPLETE)
|
||||
|
||||
const auto Append = [&](const RefPtr<IDCompositionFilterEffect>& afterLast) {
|
||||
if (ret.last) {
|
||||
afterLast->SetInput(0, ret.last, 0);
|
||||
|
@ -1855,6 +1843,9 @@ ColorManagementChain ColorManagementChain::From(
|
|||
ret.dstLinearFromSrcLinear =
|
||||
MaybeAppendColorMatrix(color::mat4(conv.dstLinearFromSrcLinear));
|
||||
ret.dstTfFromDstLinear = MaybeAppendTableTransfer(conv.dstTfFromDstLinear);
|
||||
|
||||
#endif // !defined(MOZ_MINGW_DCOMP_H_INCOMPLETE)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче