daniel@transgaming.com | d8e3656 | 2012-10-31 19:52:19 +0000 | [diff] [blame] | 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 | #define GL_APICALL |
| 14 | #include <GLES2/gl2.h> |
| 15 | #include <GLES2/gl2ext.h> |
| 16 | #include <d3d9.h> |
| 17 | |
| 18 | #include "libGLESv2/utilities.h" |
| 19 | |
| 20 | const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z'))); |
| 21 | const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L'))); |
| 22 | |
daniel@transgaming.com | 682a37c | 2012-11-28 19:34:44 +0000 | [diff] [blame] | 23 | namespace gl_d3d9 |
daniel@transgaming.com | d8e3656 | 2012-10-31 19:52:19 +0000 | [diff] [blame] | 24 | { |
| 25 | |
| 26 | D3DCMPFUNC ConvertComparison(GLenum comparison); |
| 27 | D3DCOLOR ConvertColor(gl::Color color); |
| 28 | D3DBLEND ConvertBlendFunc(GLenum blend); |
| 29 | D3DBLENDOP ConvertBlendOp(GLenum blendOp); |
| 30 | D3DSTENCILOP ConvertStencilOp(GLenum stencilOp); |
| 31 | D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap); |
| 32 | D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace); |
| 33 | D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace); |
| 34 | DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha); |
| 35 | D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy); |
| 36 | void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy); |
| 37 | bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, |
| 38 | D3DPRIMITIVETYPE *d3dPrimitiveType, int *d3dPrimitiveCount); |
| 39 | D3DFORMAT ConvertRenderbufferFormat(GLenum format); |
| 40 | D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples); |
| 41 | |
| 42 | } |
| 43 | |
daniel@transgaming.com | 682a37c | 2012-11-28 19:34:44 +0000 | [diff] [blame] | 44 | namespace d3d9_gl |
daniel@transgaming.com | d8e3656 | 2012-10-31 19:52:19 +0000 | [diff] [blame] | 45 | { |
| 46 | |
| 47 | GLuint GetAlphaSize(D3DFORMAT colorFormat); |
| 48 | GLuint GetStencilSize(D3DFORMAT stencilFormat); |
| 49 | |
| 50 | GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type); |
| 51 | |
| 52 | bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format); |
| 53 | GLenum ConvertBackBufferFormat(D3DFORMAT format); |
| 54 | GLenum ConvertDepthStencilFormat(D3DFORMAT format); |
daniel@transgaming.com | 4df38ce | 2012-11-28 19:37:03 +0000 | [diff] [blame^] | 55 | GLenum ConvertRenderTargetFormat(D3DFORMAT format); |
daniel@transgaming.com | d8e3656 | 2012-10-31 19:52:19 +0000 | [diff] [blame] | 56 | GLenum GetEquivalentFormat(D3DFORMAT format); |
| 57 | |
| 58 | } |
| 59 | |
| 60 | namespace dx |
| 61 | { |
| 62 | bool IsCompressedFormat(D3DFORMAT format); |
| 63 | size_t ComputeRowSize(D3DFORMAT format, unsigned int width); |
| 64 | } |
| 65 | |
| 66 | #endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H |