Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/sun/java2d/d3d/D3DPipeline.h
32288 views
/*1* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/24#pragma once2526#ifdef DEBUG27#define D3D_DEBUG_INFO28#endif // DEBUG2930/* Use THIS_FILE when it is available. */31#ifndef THIS_FILE32#define THIS_FILE THIS_FILE33#endif3435#ifdef D3D_PPL_DLL363738#ifndef WIN32_LEAN_AND_MEAN39#define WIN32_LEAN_AND_MEAN40#endif4142#ifdef D3DPIPELINE_EXPORTS43#define D3DPIPELINE_API __declspec(dllexport)44#else45#define D3DPIPELINE_API __declspec(dllimport)46#endif4748#include <windows.h>49#include <d3d9.h>50#include <DDErr.h>51#include "..\Import\Trace.h"5253#define DebugPrintD3DError(res, msg) \54DXTRACE_ERR(msg, res)5556#else5758#define D3DPIPELINE_API __declspec(dllexport)5960// this include ensures that with debug build we get61// awt's overridden debug "new" and "delete" operators62#include "awt.h"6364#include <windows.h>65#include <d3d9.h>66#include "Trace.h"6768#define DebugPrintD3DError(res, msg) \69J2dTraceLn1(J2D_TRACE_ERROR, "D3D Error: " ## msg ## " res=%d", res)7071#endif /*D3D_PPL_DLL*/7273// some helper macros74#define SAFE_RELEASE(RES) \75do { \76if ((RES)!= NULL) { \77(RES)->Release(); \78(RES) = NULL; \79} \80} while (0);8182#define SAFE_DELETE(RES) \83do { \84if ((RES)!= NULL) { \85delete (RES); \86(RES) = NULL; \87} \88} while (0);8990#ifdef DEBUG91#define SAFE_PRINTLN(RES) \92do { \93if ((RES)!= NULL) { \94J2dTraceLn1(J2D_TRACE_VERBOSE, " " ## #RES ## "=0x%x", (RES)); \95} else { \96J2dTraceLn(J2D_TRACE_VERBOSE, " " ## #RES ## "=NULL"); \97} \98} while (0);99#else // DEBUG100#define SAFE_PRINTLN(RES)101#endif // DEBUG102103/*104* The following macros allow the caller to return (or continue) if the105* provided value is NULL. (The strange else clause is included below to106* allow for a trailing ';' after RETURN/CONTINUE_IF_NULL() invocations.)107*/108#define ACT_IF_NULL(ACTION, value) \109if ((value) == NULL) { \110J2dTraceLn3(J2D_TRACE_ERROR, \111"%s is null in %s:%d", #value, THIS_FILE, __LINE__); \112ACTION; \113} else do { } while (0)114#define RETURN_IF_NULL(value) ACT_IF_NULL(return, value)115#define CONTINUE_IF_NULL(value) ACT_IF_NULL(continue, value)116#define RETURN_STATUS_IF_NULL(value, status) \117ACT_IF_NULL(return (status), value)118119#define RETURN_STATUS_IF_EXP_FAILED(EXPR) \120if (FAILED(res = (EXPR))) { \121DebugPrintD3DError(res, " " ## #EXPR ## " failed in " ## THIS_FILE); \122return res; \123} else do { } while (0)124125#define RETURN_STATUS_IF_FAILED(status) \126if (FAILED((status))) { \127DebugPrintD3DError((status), " failed in " ## THIS_FILE ## ", return;");\128return (status); \129} else do { } while (0)130131132