Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/sun/java2d/d3d/D3DPipeline.h
32288 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
/* Use THIS_FILE when it is available. */
32
#ifndef THIS_FILE
33
#define THIS_FILE THIS_FILE
34
#endif
35
36
#ifdef D3D_PPL_DLL
37
38
39
#ifndef WIN32_LEAN_AND_MEAN
40
#define WIN32_LEAN_AND_MEAN
41
#endif
42
43
#ifdef D3DPIPELINE_EXPORTS
44
#define D3DPIPELINE_API __declspec(dllexport)
45
#else
46
#define D3DPIPELINE_API __declspec(dllimport)
47
#endif
48
49
#include <windows.h>
50
#include <d3d9.h>
51
#include <DDErr.h>
52
#include "..\Import\Trace.h"
53
54
#define DebugPrintD3DError(res, msg) \
55
DXTRACE_ERR(msg, res)
56
57
#else
58
59
#define D3DPIPELINE_API __declspec(dllexport)
60
61
// this include ensures that with debug build we get
62
// awt's overridden debug "new" and "delete" operators
63
#include "awt.h"
64
65
#include <windows.h>
66
#include <d3d9.h>
67
#include "Trace.h"
68
69
#define DebugPrintD3DError(res, msg) \
70
J2dTraceLn1(J2D_TRACE_ERROR, "D3D Error: " ## msg ## " res=%d", res)
71
72
#endif /*D3D_PPL_DLL*/
73
74
// some helper macros
75
#define SAFE_RELEASE(RES) \
76
do { \
77
if ((RES)!= NULL) { \
78
(RES)->Release(); \
79
(RES) = NULL; \
80
} \
81
} while (0);
82
83
#define SAFE_DELETE(RES) \
84
do { \
85
if ((RES)!= NULL) { \
86
delete (RES); \
87
(RES) = NULL; \
88
} \
89
} while (0);
90
91
#ifdef DEBUG
92
#define SAFE_PRINTLN(RES) \
93
do { \
94
if ((RES)!= NULL) { \
95
J2dTraceLn1(J2D_TRACE_VERBOSE, " " ## #RES ## "=0x%x", (RES)); \
96
} else { \
97
J2dTraceLn(J2D_TRACE_VERBOSE, " " ## #RES ## "=NULL"); \
98
} \
99
} while (0);
100
#else // DEBUG
101
#define SAFE_PRINTLN(RES)
102
#endif // DEBUG
103
104
/*
105
* The following macros allow the caller to return (or continue) if the
106
* provided value is NULL. (The strange else clause is included below to
107
* allow for a trailing ';' after RETURN/CONTINUE_IF_NULL() invocations.)
108
*/
109
#define ACT_IF_NULL(ACTION, value) \
110
if ((value) == NULL) { \
111
J2dTraceLn3(J2D_TRACE_ERROR, \
112
"%s is null in %s:%d", #value, THIS_FILE, __LINE__); \
113
ACTION; \
114
} else do { } while (0)
115
#define RETURN_IF_NULL(value) ACT_IF_NULL(return, value)
116
#define CONTINUE_IF_NULL(value) ACT_IF_NULL(continue, value)
117
#define RETURN_STATUS_IF_NULL(value, status) \
118
ACT_IF_NULL(return (status), value)
119
120
#define RETURN_STATUS_IF_EXP_FAILED(EXPR) \
121
if (FAILED(res = (EXPR))) { \
122
DebugPrintD3DError(res, " " ## #EXPR ## " failed in " ## THIS_FILE); \
123
return res; \
124
} else do { } while (0)
125
126
#define RETURN_STATUS_IF_FAILED(status) \
127
if (FAILED((status))) { \
128
DebugPrintD3DError((status), " failed in " ## THIS_FILE ## ", return;");\
129
return (status); \
130
} else do { } while (0)
131
132