gfx/angle/src/libGLESv2/renderer/renderer9_utils.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/libGLESv2/renderer/renderer9_utils.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,74 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-2012 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +// renderer9_utils.h: Conversion functions and other utility routines 
    1.11 +// specific to the D3D9 renderer
    1.12 +
    1.13 +#ifndef LIBGLESV2_RENDERER_RENDERER9_UTILS_H
    1.14 +#define LIBGLESV2_RENDERER_RENDERER9_UTILS_H
    1.15 +
    1.16 +#include "libGLESv2/utilities.h"
    1.17 +
    1.18 +const D3DFORMAT D3DFMT_INTZ = ((D3DFORMAT)(MAKEFOURCC('I','N','T','Z')));
    1.19 +const D3DFORMAT D3DFMT_NULL = ((D3DFORMAT)(MAKEFOURCC('N','U','L','L')));
    1.20 +
    1.21 +namespace gl_d3d9
    1.22 +{
    1.23 +
    1.24 +D3DCMPFUNC ConvertComparison(GLenum comparison);
    1.25 +D3DCOLOR ConvertColor(gl::Color color);
    1.26 +D3DBLEND ConvertBlendFunc(GLenum blend);
    1.27 +D3DBLENDOP ConvertBlendOp(GLenum blendOp);
    1.28 +D3DSTENCILOP ConvertStencilOp(GLenum stencilOp);
    1.29 +D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap);
    1.30 +D3DCULL ConvertCullMode(GLenum cullFace, GLenum frontFace);
    1.31 +D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace);
    1.32 +DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha);
    1.33 +D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy);
    1.34 +void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, float maxAnisotropy);
    1.35 +D3DFORMAT ConvertRenderbufferFormat(GLenum format);
    1.36 +D3DMULTISAMPLE_TYPE GetMultisampleTypeFromSamples(GLsizei samples);
    1.37 +
    1.38 +}
    1.39 +
    1.40 +namespace d3d9_gl
    1.41 +{
    1.42 +
    1.43 +GLuint GetAlphaSize(D3DFORMAT colorFormat);
    1.44 +GLuint GetStencilSize(D3DFORMAT stencilFormat);
    1.45 +
    1.46 +GLsizei GetSamplesFromMultisampleType(D3DMULTISAMPLE_TYPE type);
    1.47 +
    1.48 +bool IsFormatChannelEquivalent(D3DFORMAT d3dformat, GLenum format);
    1.49 +GLenum ConvertBackBufferFormat(D3DFORMAT format);
    1.50 +GLenum ConvertDepthStencilFormat(D3DFORMAT format);
    1.51 +GLenum ConvertRenderTargetFormat(D3DFORMAT format);
    1.52 +GLenum GetEquivalentFormat(D3DFORMAT format);
    1.53 +
    1.54 +}
    1.55 +
    1.56 +namespace d3d9
    1.57 +{
    1.58 +bool IsCompressedFormat(D3DFORMAT format);
    1.59 +size_t ComputeRowSize(D3DFORMAT format, unsigned int width);
    1.60 +
    1.61 +inline bool isDeviceLostError(HRESULT errorCode)
    1.62 +{
    1.63 +    switch (errorCode)
    1.64 +    {
    1.65 +      case D3DERR_DRIVERINTERNALERROR:
    1.66 +      case D3DERR_DEVICELOST:
    1.67 +      case D3DERR_DEVICEHUNG:
    1.68 +      case D3DERR_DEVICEREMOVED:
    1.69 +        return true;
    1.70 +      default:
    1.71 +        return false;
    1.72 +    }
    1.73 +}
    1.74 +
    1.75 +}
    1.76 +
    1.77 +#endif // LIBGLESV2_RENDERER_RENDERER9_UTILS_H

mercurial