Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / ipc / D3DMessageUtils.cpp
blob0d18d2ed00a514602d12a2fd73af5df307c57a45
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "D3DMessageUtils.h"
7 #if defined(XP_WIN)
8 # include "gfxWindowsPlatform.h"
9 #endif
11 bool DxgiAdapterDesc::operator==(const DxgiAdapterDesc& aOther) const {
12 return memcmp(&aOther, this, sizeof(*this)) == 0;
15 #if defined(XP_WIN)
16 static_assert(sizeof(DxgiAdapterDesc) == sizeof(DXGI_ADAPTER_DESC),
17 "DXGI_ADAPTER_DESC doe snot match DxgiAdapterDesc");
19 const DxgiAdapterDesc& DxgiAdapterDesc::From(const DXGI_ADAPTER_DESC& aDesc) {
20 return reinterpret_cast<const DxgiAdapterDesc&>(aDesc);
23 const DXGI_ADAPTER_DESC& DxgiAdapterDesc::ToDesc() const {
24 return reinterpret_cast<const DXGI_ADAPTER_DESC&>(*this);
26 #endif
28 namespace IPC {
30 void ParamTraits<DxgiAdapterDesc>::Write(MessageWriter* aWriter,
31 const paramType& aParam) {
32 #if defined(XP_WIN)
33 aWriter->WriteBytes(aParam.Description, sizeof(aParam.Description));
34 WriteParam(aWriter, aParam.VendorId);
35 WriteParam(aWriter, aParam.DeviceId);
36 WriteParam(aWriter, aParam.SubSysId);
37 WriteParam(aWriter, aParam.Revision);
38 WriteParam(aWriter, aParam.DedicatedVideoMemory);
39 WriteParam(aWriter, aParam.DedicatedSystemMemory);
40 WriteParam(aWriter, aParam.SharedSystemMemory);
41 WriteParam(aWriter, aParam.AdapterLuid.LowPart);
42 WriteParam(aWriter, aParam.AdapterLuid.HighPart);
43 #endif
46 bool ParamTraits<DxgiAdapterDesc>::Read(MessageReader* aReader,
47 paramType* aResult) {
48 #if defined(XP_WIN)
49 if (!aReader->ReadBytesInto(aResult->Description,
50 sizeof(aResult->Description))) {
51 return false;
54 if (ReadParam(aReader, &aResult->VendorId) &&
55 ReadParam(aReader, &aResult->DeviceId) &&
56 ReadParam(aReader, &aResult->SubSysId) &&
57 ReadParam(aReader, &aResult->Revision) &&
58 ReadParam(aReader, &aResult->DedicatedVideoMemory) &&
59 ReadParam(aReader, &aResult->DedicatedSystemMemory) &&
60 ReadParam(aReader, &aResult->SharedSystemMemory) &&
61 ReadParam(aReader, &aResult->AdapterLuid.LowPart) &&
62 ReadParam(aReader, &aResult->AdapterLuid.HighPart)) {
63 return true;
65 return false;
66 #else
67 return true;
68 #endif
71 } // namespace IPC