Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.desktop/windows/native/libawt/java2d/d3d/D3DPipeline.h
41159 views
1
/*
2
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
#pragma once
26
27
#ifdef DEBUG
28
#define D3D_DEBUG_INFO
29
#endif // DEBUG
30
31
#ifdef D3D_PPL_DLL
32
33
34
#ifndef WIN32_LEAN_AND_MEAN
35
#define WIN32_LEAN_AND_MEAN
36
#endif
37
38
#ifdef D3DPIPELINE_EXPORTS
39
#define D3DPIPELINE_API __declspec(dllexport)
40
#else
41
#define D3DPIPELINE_API __declspec(dllimport)
42
#endif
43
44
#include <windows.h>
45
#include <d3d9.h>
46
#include <DDErr.h>
47
#include "..\Import\Trace.h"
48
49
#define DebugPrintD3DError(res, msg) \
50
DXTRACE_ERR(msg, res)
51
52
#else
53
54
#define D3DPIPELINE_API __declspec(dllexport)
55
56
// this include ensures that with debug build we get
57
// awt's overridden debug "new" and "delete" operators
58
#include "awt.h"
59
60
#include <windows.h>
61
#include <d3d9.h>
62
#include "Trace.h"
63
64
#define DebugPrintD3DError(res, msg) \
65
J2dTraceLn1(J2D_TRACE_ERROR, "D3D Error: " ## msg ## " res=%d", res)
66
67
#endif /*D3D_PPL_DLL*/
68
69
// some helper macros
70
#define SAFE_RELEASE(RES) \
71
do { \
72
if ((RES)!= NULL) { \
73
(RES)->Release(); \
74
(RES) = NULL; \
75
} \
76
} while (0);
77
78
#define SAFE_DELETE(RES) \
79
do { \
80
if ((RES)!= NULL) { \
81
delete (RES); \
82
(RES) = NULL; \
83
} \
84
} while (0);
85
86
#ifdef DEBUG
87
#define SAFE_PRINTLN(RES) \
88
do { \
89
if ((RES)!= NULL) { \
90
J2dTraceLn1(J2D_TRACE_VERBOSE, " " ## #RES ## "=0x%x", (RES)); \
91
} else { \
92
J2dTraceLn(J2D_TRACE_VERBOSE, " " ## #RES ## "=NULL"); \
93
} \
94
} while (0);
95
#else // DEBUG
96
#define SAFE_PRINTLN(RES)
97
#endif // DEBUG
98
99
/*
100
* The following macros allow the caller to return (or continue) if the
101
* provided value is NULL. (The strange else clause is included below to
102
* allow for a trailing ';' after RETURN/CONTINUE_IF_NULL() invocations.)
103
*/
104
#define ACT_IF_NULL(ACTION, value) \
105
if ((value) == NULL) { \
106
J2dTraceLn3(J2D_TRACE_ERROR, \
107
"%s is null in %s:%d", #value, __FILE__, __LINE__); \
108
ACTION; \
109
} else do { } while (0)
110
#define RETURN_IF_NULL(value) ACT_IF_NULL(return, value)
111
#define CONTINUE_IF_NULL(value) ACT_IF_NULL(continue, value)
112
#define RETURN_STATUS_IF_NULL(value, status) \
113
ACT_IF_NULL(return (status), value)
114
115
#define RETURN_STATUS_IF_EXP_FAILED(EXPR) \
116
if (FAILED(res = (EXPR))) { \
117
DebugPrintD3DError(res, " " ## #EXPR ## " failed in " ## __FILE__); \
118
return res; \
119
} else do { } while (0)
120
121
#define RETURN_STATUS_IF_FAILED(status) \
122
if (FAILED((status))) { \
123
DebugPrintD3DError((status), " failed in " ## __FILE__ ## ", return;");\
124
return (status); \
125
} else do { } while (0)
126
127