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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 //
     2 // Copyright (c) 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 //
     7 // renderer11_utils.h: Conversion functions and other utility routines
     8 // specific to the D3D11 renderer.
    10 #ifndef LIBGLESV2_RENDERER_RENDERER11_UTILS_H
    11 #define LIBGLESV2_RENDERER_RENDERER11_UTILS_H
    13 #include "libGLESv2/angletypes.h"
    15 namespace gl_d3d11
    16 {
    18 D3D11_BLEND ConvertBlendFunc(GLenum glBlend, bool isAlpha);
    19 D3D11_BLEND_OP ConvertBlendOp(GLenum glBlendOp);
    20 UINT8 ConvertColorMask(bool maskRed, bool maskGreen, bool maskBlue, bool maskAlpha);
    22 D3D11_CULL_MODE ConvertCullMode(bool cullEnabled, GLenum cullMode);
    24 D3D11_COMPARISON_FUNC ConvertComparison(GLenum comparison);
    25 D3D11_DEPTH_WRITE_MASK ConvertDepthMask(bool depthWriteEnabled);
    26 UINT8 ConvertStencilMask(GLuint stencilmask);
    27 D3D11_STENCIL_OP ConvertStencilOp(GLenum stencilOp);
    29 D3D11_FILTER ConvertFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy);
    30 D3D11_TEXTURE_ADDRESS_MODE ConvertTextureWrap(GLenum wrap);
    31 FLOAT ConvertMinLOD(GLenum minFilter, unsigned int lodOffset);
    32 FLOAT ConvertMaxLOD(GLenum minFilter, unsigned int lodOffset);
    34 DXGI_FORMAT ConvertRenderbufferFormat(GLenum format);
    35 DXGI_FORMAT ConvertTextureFormat(GLenum format);
    36 }
    38 namespace d3d11_gl
    39 {
    41 GLenum ConvertBackBufferFormat(DXGI_FORMAT format);
    42 GLenum ConvertDepthStencilFormat(DXGI_FORMAT format);
    43 GLenum ConvertRenderbufferFormat(DXGI_FORMAT format);
    44 GLenum ConvertTextureInternalFormat(DXGI_FORMAT format);
    46 }
    48 namespace d3d11
    49 {
    51 struct PositionTexCoordVertex
    52 {
    53     float x, y;
    54     float u, v;
    55 };
    56 void SetPositionTexCoordVertex(PositionTexCoordVertex* vertex, float x, float y, float u, float v);
    58 struct PositionDepthColorVertex
    59 {
    60     float x, y, z;
    61     float r, g, b, a;
    62 };
    63 void SetPositionDepthColorVertex(PositionDepthColorVertex* vertex, float x, float y, float z,
    64                                  const gl::Color &color);
    66 size_t ComputePixelSizeBits(DXGI_FORMAT format);
    67 size_t ComputeBlockSizeBits(DXGI_FORMAT format);
    69 bool IsCompressed(DXGI_FORMAT format);
    70 unsigned int GetTextureFormatDimensionAlignment(DXGI_FORMAT format);
    72 bool IsDepthStencilFormat(DXGI_FORMAT format);
    73 DXGI_FORMAT GetDepthTextureFormat(DXGI_FORMAT format);
    74 DXGI_FORMAT GetDepthShaderResourceFormat(DXGI_FORMAT format);
    76 HRESULT SetDebugName(ID3D11DeviceChild *resource, const char *name);
    78 inline bool isDeviceLostError(HRESULT errorCode)
    79 {
    80     switch (errorCode)
    81     {
    82       case DXGI_ERROR_DEVICE_HUNG:
    83       case DXGI_ERROR_DEVICE_REMOVED:
    84       case DXGI_ERROR_DEVICE_RESET:
    85       case DXGI_ERROR_DRIVER_INTERNAL_ERROR:
    86       case DXGI_ERROR_NOT_CURRENTLY_AVAILABLE:
    87         return true;
    88       default:
    89         return false;
    90     }
    91 }
    93 }
    95 #endif // LIBGLESV2_RENDERER_RENDERER11_UTILS_H

mercurial