OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 19 matching lines...) Expand all Loading... |
30 */ | 30 */ |
31 | 31 |
32 | 32 |
33 // This file contains definitions of handy methods and macros used by the | 33 // This file contains definitions of handy methods and macros used by the |
34 // O3D DirectX code. | 34 // O3D DirectX code. |
35 | 35 |
36 #ifndef O3D_CORE_WIN_D3D9_UTILS_D3D9_H_ | 36 #ifndef O3D_CORE_WIN_D3D9_UTILS_D3D9_H_ |
37 #define O3D_CORE_WIN_D3D9_UTILS_D3D9_H_ | 37 #define O3D_CORE_WIN_D3D9_UTILS_D3D9_H_ |
38 | 38 |
39 #include <d3d9.h> | 39 #include <d3d9.h> |
40 #include <dxerr9.h> | 40 #include <dxerr.h> |
41 #include "base/logging.h" | 41 #include "base/logging.h" |
42 #include "core/cross/stream.h" | 42 #include "core/cross/stream.h" |
43 | 43 |
44 #define HR(x) ::o3d::VerifyHResult((x), __FILE__, __LINE__, #x) | 44 #define HR(x) ::o3d::VerifyHResult((x), __FILE__, __LINE__, #x) |
45 | 45 |
46 namespace o3d { | 46 namespace o3d { |
47 | 47 |
48 class Field; | 48 class Field; |
49 | 49 |
50 inline bool VerifyHResult(HRESULT hr, const char* file, int line, | 50 inline bool VerifyHResult(HRESULT hr, const char* file, int line, |
51 const char* call) { | 51 const char* call) { |
52 if (FAILED(hr)) { | 52 if (FAILED(hr)) { |
53 DLOG(ERROR) << "DX Error in file " << file | 53 DLOG(ERROR) << "DX Error in file " << file |
54 << " line " << line << L": " | 54 << " line " << line << L": " |
55 << DXGetErrorString9(hr) << L": " << call; | 55 << DXGetErrorString(hr) << L": " << call; |
56 return false; | 56 return false; |
57 } | 57 } |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 union Float2DWord { | 61 union Float2DWord { |
62 float my_float; | 62 float my_float; |
63 DWORD my_dword; | 63 DWORD my_dword; |
64 }; | 64 }; |
65 | 65 |
66 D3DDECLTYPE DX9DataType(const Field& stream); | 66 D3DDECLTYPE DX9DataType(const Field& stream); |
67 D3DDECLUSAGE DX9UsageType(Stream::Semantic semantic); | 67 D3DDECLUSAGE DX9UsageType(Stream::Semantic semantic); |
68 Stream::Semantic SemanticFromDX9UsageType(D3DDECLUSAGE usage); | 68 Stream::Semantic SemanticFromDX9UsageType(D3DDECLUSAGE usage); |
69 | 69 |
70 } // namespace o3d | 70 } // namespace o3d |
71 | 71 |
72 #endif // O3D_CORE_WIN_D3D9_UTILS_D3D9_H_ | 72 #endif // O3D_CORE_WIN_D3D9_UTILS_D3D9_H_ |
OLD | NEW |