2 // Copyright (c) 2002-2014 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.
7 // renderer9_utils.h: Conversion functions and other utility routines
8 // specific to the D3D9 renderer
10 #ifndef LIBGLESV2_RENDERER_RENDERER9_UTILS_H
11 #define LIBGLESV2_RENDERER_RENDERER9_UTILS_H
13 #include "libGLESv2/angletypes.h"
14 #include "libGLESv2/Caps.h"
18 class FramebufferAttachment;
28 D3DCMPFUNC ConvertComparison(GLenum comparison);
29 D3DCOLOR ConvertColor(gl::ColorF color);
30 D3DBLEND ConvertBlendFunc(GLenum blend);
31 D3DBLENDOP ConvertBlendOp(GLenum blendOp);
32 D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
33 D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap);
34 D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace);
35 D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace);
36 DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
37 D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy);
38 void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy);
40 D3DMULTISAMPLE_TYPE GetMultisampleType(GLuint samples);
47 GLsizei GetSamplesCount(D3DMULTISAMPLE_TYPE type);
49 bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
51 void GenerateCaps(IDirect3D9 *d3d9, IDirect3DDevice9 *device, D3DDEVTYPE deviceType, UINT adapter, gl::Caps *caps,
52 gl::TextureCapsMap *textureCapsMap, gl::Extensions *extensions);
59 GLuint ComputeBlockSize(D3DFORMAT format, GLuint width, GLuint height);
61 void MakeValidSize(bool isImage, D3DFORMAT format, GLsizei *requestWidth, GLsizei *requestHeight, int *levelOffset);
63 inline bool isDeviceLostError(HRESULT errorCode)
67 case D3DERR_DRIVERINTERNALERROR:
68 case D3DERR_DEVICELOST:
69 case D3DERR_DEVICEHUNG:
70 case D3DERR_DEVICEREMOVED:
77 RenderTarget9 *GetAttachmentRenderTarget(gl::FramebufferAttachment *attachment);
83 #endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H