1 // 2 // Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved. 3 // Use of this source code is governed by a BSD-style license that can be 4 // found in the LICENSE file. 5 // 6 7 // renderer9_utils.h: Conversion functions and other utility routines 8 // specific to the D3D9 renderer 9 10 #ifndef LIBGLESV2_RENDERER_RENDERER9_UTILS_H 11 #define LIBGLESV2_RENDERER_RENDERER9_UTILS_H 12 13 #include "libGLESv2/angletypes.h" 14 15 namespace rx 16 { 17 18 namespace gl_d3d9 19 { 20 21 D3DCMPFUNC ConvertComparison(GLenum comparison); 22 D3DCOLOR ConvertColor(gl::ColorF color); 23 D3DBLEND ConvertBlendFunc(GLenum blend); 24 D3DBLENDOP ConvertBlendOp(GLenum blendOp); 25 D3DSTENCILOP ConvertStencilOp(GLenum stencilOp); 26 D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap); 27 D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace); 28 D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace); 29 DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha); 30 D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy); 31 void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy); 32 33 } 34 35 namespace d3d9 36 { 37 38 inline bool isDeviceLostError(HRESULT errorCode) 39 { 40 switch (errorCode) 41 { 42 case D3DERR_DRIVERINTERNALERROR: 43 case D3DERR_DEVICELOST: 44 case D3DERR_DEVICEHUNG: 45 case D3DERR_DEVICEREMOVED: 46 return true; 47 default: 48 return false; 49 } 50 } 51 52 } 53 54 } 55 56 #endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H 57