blob: 7002191faa237bd4449b743190877251c56a09e0 [file] [log] [blame]
daniel@transgaming.comd8e36562012-10-31 19:52:19 +00001//
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
20const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
21const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
22
daniel@transgaming.com682a37c2012-11-28 19:34:44 +000023namespace gl_d3d9
daniel@transgaming.comd8e36562012-10-31 19:52:19 +000024{
25
26D3DCMPFUNC ConvertComparison(GLenum comparison);
27D3DCOLOR ConvertColor(gl::Color color);
28D3DBLEND ConvertBlendFunc(GLenum blend);
29D3DBLENDOP ConvertBlendOp(GLenum blendOp);
30D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
31D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap);
32D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace);
33D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace);
34DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
35D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy);
36void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy);
37bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount,
38 D3DPRIMITIVETYPE *d3dPrimitiveType, int *d3dPrimitiveCount);
39D3DFORMAT ConvertRenderbufferFormat(GLenum format);
40D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples);
41
42}
43
daniel@transgaming.com682a37c2012-11-28 19:34:44 +000044namespace d3d9_gl
daniel@transgaming.comd8e36562012-10-31 19:52:19 +000045{
46
47GLuint GetAlphaSize(D3DFORMAT colorFormat);
48GLuint GetStencilSize(D3DFORMAT stencilFormat);
49
50GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type);
51
52bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
53GLenum ConvertBackBufferFormat(D3DFORMAT format);
54GLenum ConvertDepthStencilFormat(D3DFORMAT format);
daniel@transgaming.com4df38ce2012-11-28 19:37:03 +000055GLenum ConvertRenderTargetFormat(D3DFORMAT format);
daniel@transgaming.comd8e36562012-10-31 19:52:19 +000056GLenum GetEquivalentFormat(D3DFORMAT format);
57
58}
59
60namespace dx
61{
62bool IsCompressedFormat(D3DFORMAT format);
63size_t ComputeRowSize(D3DFORMAT format, unsigned int width);
64}
65
66#endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H