Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim: set ts=8 sts=4 et sw=4 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
10 :
11 : bool
12 0 : DxgiAdapterDesc::operator ==(const DxgiAdapterDesc& aOther) const
13 : {
14 0 : return memcmp(&aOther, this, sizeof(*this)) == 0;
15 : }
16 :
17 : #if defined(XP_WIN)
18 : static_assert(sizeof(DxgiAdapterDesc) == sizeof(DXGI_ADAPTER_DESC),
19 : "DXGI_ADAPTER_DESC doe snot match DxgiAdapterDesc");
20 :
21 : const DxgiAdapterDesc&
22 : DxgiAdapterDesc::From(const DXGI_ADAPTER_DESC& aDesc)
23 : {
24 : return reinterpret_cast<const DxgiAdapterDesc&>(aDesc);
25 : }
26 :
27 : const DXGI_ADAPTER_DESC&
28 : DxgiAdapterDesc::ToDesc() const
29 : {
30 : return reinterpret_cast<const DXGI_ADAPTER_DESC&>(*this);
31 : }
32 : #endif
33 :
34 : namespace IPC {
35 :
36 : void
37 2 : ParamTraits<DxgiAdapterDesc>::Write(Message* aMsg, const paramType& aParam)
38 : {
39 : #if defined(XP_WIN)
40 : aMsg->WriteBytes(aParam.Description, sizeof(aParam.Description));
41 : WriteParam(aMsg, aParam.VendorId);
42 : WriteParam(aMsg, aParam.DeviceId);
43 : WriteParam(aMsg, aParam.SubSysId);
44 : WriteParam(aMsg, aParam.Revision);
45 : WriteParam(aMsg, aParam.DedicatedVideoMemory);
46 : WriteParam(aMsg, aParam.DedicatedSystemMemory);
47 : WriteParam(aMsg, aParam.SharedSystemMemory);
48 : WriteParam(aMsg, aParam.AdapterLuid.LowPart);
49 : WriteParam(aMsg, aParam.AdapterLuid.HighPart);
50 : #endif
51 2 : }
52 :
53 : bool
54 2 : ParamTraits<DxgiAdapterDesc>::Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
55 : {
56 : #if defined(XP_WIN)
57 : if (!aMsg->ReadBytesInto(aIter, aResult->Description, sizeof(aResult->Description))) {
58 : return false;
59 : }
60 :
61 : if (ReadParam(aMsg, aIter, &aResult->VendorId) &&
62 : ReadParam(aMsg, aIter, &aResult->DeviceId) &&
63 : ReadParam(aMsg, aIter, &aResult->SubSysId) &&
64 : ReadParam(aMsg, aIter, &aResult->Revision) &&
65 : ReadParam(aMsg, aIter, &aResult->DedicatedVideoMemory) &&
66 : ReadParam(aMsg, aIter, &aResult->DedicatedSystemMemory) &&
67 : ReadParam(aMsg, aIter, &aResult->SharedSystemMemory) &&
68 : ReadParam(aMsg, aIter, &aResult->AdapterLuid.LowPart) &&
69 : ReadParam(aMsg, aIter, &aResult->AdapterLuid.HighPart))
70 : {
71 : return true;
72 : }
73 : return false;
74 : #else
75 2 : return true;
76 : #endif
77 : }
78 :
79 : } // namespace IPC
|