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"
8 # include "gfxWindowsPlatform.h"
11 bool DxgiAdapterDesc::operator==(const DxgiAdapterDesc
& aOther
) const {
12 return memcmp(&aOther
, this, sizeof(*this)) == 0;
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);
30 void ParamTraits
<DxgiAdapterDesc
>::Write(MessageWriter
* aWriter
,
31 const paramType
& aParam
) {
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
);
46 bool ParamTraits
<DxgiAdapterDesc
>::Read(MessageReader
* aReader
,
49 if (!aReader
->ReadBytesInto(aResult
->Description
,
50 sizeof(aResult
->Description
))) {
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
)) {