gfxD3D11EnumTranslate.cpp
Engine/source/gfx/D3D11/gfxD3D11EnumTranslate.cpp
Public Variables
D3D11_BLEND
GFXD3D11Blend [GFXBlend_COUNT]
D3D11_BLEND
GFXD3D11BlendAlpha [GFXBlend_COUNT]
D3D11_BLEND_OP
GFXD3D11BlendOp [GFXBlendOp_COUNT]
D3D11_COMPARISON_FUNC
GFXD3D11CmpFunc [GFXCmp_COUNT]
D3D11_CULL_MODE
GFXD3D11CullMode [GFXCull_COUNT]
DXGI_FORMAT
GFXD3D11DeclType [GFXDeclType_COUNT]
D3D11_FILL_MODE
GFXD3D11FillMode [GFXFill_COUNT]
D3D11_PRIMITIVE_TOPOLOGY
GFXD3D11PrimType [GFXPT_COUNT]
D3D11_STENCIL_OP
GFXD3D11StencilOp [GFXStencilOp_COUNT]
D3D11_TEXTURE_ADDRESS_MODE
GFXD3D11TextureAddress [GFXAddress_COUNT]
D3D11_FILTER
GFXD3D11TextureFilter [GFXTextureFilter_COUNT]
DXGI_FORMAT
GFXD3D11TextureFormat [GFXFormat_COUNT]
Detailed Description
Public Variables
D3D11_BLEND GFXD3D11Blend [GFXBlend_COUNT]
D3D11_BLEND GFXD3D11BlendAlpha [GFXBlend_COUNT]
D3D11_BLEND_OP GFXD3D11BlendOp [GFXBlendOp_COUNT]
D3D11_COMPARISON_FUNC GFXD3D11CmpFunc [GFXCmp_COUNT]
D3D11_CULL_MODE GFXD3D11CullMode [GFXCull_COUNT]
DXGI_FORMAT GFXD3D11DeclType [GFXDeclType_COUNT]
D3D11_FILL_MODE GFXD3D11FillMode [GFXFill_COUNT]
D3D11_PRIMITIVE_TOPOLOGY GFXD3D11PrimType [GFXPT_COUNT]
D3D11_STENCIL_OP GFXD3D11StencilOp [GFXStencilOp_COUNT]
D3D11_TEXTURE_ADDRESS_MODE GFXD3D11TextureAddress [GFXAddress_COUNT]
D3D11_FILTER GFXD3D11TextureFilter [GFXTextureFilter_COUNT]
DXGI_FORMAT GFXD3D11TextureFormat [GFXFormat_COUNT]
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2015 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#include "gfx/D3D11/gfxD3D11Device.h" 25#include "gfx/D3D11/gfxD3D11EnumTranslate.h" 26#include "console/console.h" 27 28//------------------------------------------------------------------------------ 29 30DXGI_FORMAT GFXD3D11TextureFormat[GFXFormat_COUNT]; 31D3D11_FILTER GFXD3D11TextureFilter[GFXTextureFilter_COUNT]; 32D3D11_BLEND GFXD3D11Blend[GFXBlend_COUNT]; 33D3D11_BLEND_OP GFXD3D11BlendOp[GFXBlendOp_COUNT]; 34D3D11_STENCIL_OP GFXD3D11StencilOp[GFXStencilOp_COUNT]; 35D3D11_COMPARISON_FUNC GFXD3D11CmpFunc[GFXCmp_COUNT]; 36D3D11_CULL_MODE GFXD3D11CullMode[GFXCull_COUNT]; 37D3D11_FILL_MODE GFXD3D11FillMode[GFXFill_COUNT]; 38D3D11_PRIMITIVE_TOPOLOGY GFXD3D11PrimType[GFXPT_COUNT]; 39D3D11_TEXTURE_ADDRESS_MODE GFXD3D11TextureAddress[GFXAddress_COUNT]; 40DXGI_FORMAT GFXD3D11DeclType[GFXDeclType_COUNT]; 41D3D11_BLEND GFXD3D11BlendAlpha[GFXBlend_COUNT]; 42//------------------------------------------------------------------------------ 43 44void GFXD3D11EnumTranslate::init() 45{ 46 GFXD3D11TextureFormat[GFXFormatR8G8B8] = DXGI_FORMAT_B8G8R8X8_UNORM; 47 GFXD3D11TextureFormat[GFXFormatR8G8B8A8] = DXGI_FORMAT_B8G8R8A8_UNORM; 48 GFXD3D11TextureFormat[GFXFormatR8G8B8X8] = DXGI_FORMAT_B8G8R8X8_UNORM; 49 GFXD3D11TextureFormat[GFXFormatB8G8R8A8] = DXGI_FORMAT_B8G8R8A8_UNORM; 50 GFXD3D11TextureFormat[GFXFormatR5G6B5] = DXGI_FORMAT_B5G6R5_UNORM; 51 GFXD3D11TextureFormat[GFXFormatR5G5B5A1] = DXGI_FORMAT_B5G5R5A1_UNORM; 52 GFXD3D11TextureFormat[GFXFormatR5G5B5X1] = DXGI_FORMAT_UNKNOWN; 53 GFXD3D11TextureFormat[GFXFormatR32F] = DXGI_FORMAT_R32_FLOAT; 54 GFXD3D11TextureFormat[GFXFormatA4L4] = DXGI_FORMAT_UNKNOWN; 55 GFXD3D11TextureFormat[GFXFormatA8L8] = DXGI_FORMAT_R8G8_UNORM; 56 GFXD3D11TextureFormat[GFXFormatA8] = DXGI_FORMAT_A8_UNORM; 57 GFXD3D11TextureFormat[GFXFormatL8] = DXGI_FORMAT_R8_UNORM; 58 GFXD3D11TextureFormat[GFXFormatBC1] = DXGI_FORMAT_BC1_UNORM; 59 GFXD3D11TextureFormat[GFXFormatBC2] = DXGI_FORMAT_BC2_UNORM; 60 GFXD3D11TextureFormat[GFXFormatBC3] = DXGI_FORMAT_BC3_UNORM; 61 GFXD3D11TextureFormat[GFXFormatBC4] = DXGI_FORMAT_BC4_UNORM; 62 GFXD3D11TextureFormat[GFXFormatBC5] = DXGI_FORMAT_BC5_UNORM; 63 GFXD3D11TextureFormat[GFXFormatR32G32B32A32F] = DXGI_FORMAT_R32G32B32A32_FLOAT; 64 GFXD3D11TextureFormat[GFXFormatR16G16B16A16F] = DXGI_FORMAT_R16G16B16A16_FLOAT; 65 GFXD3D11TextureFormat[GFXFormatL16] = DXGI_FORMAT_R16_UNORM; 66 GFXD3D11TextureFormat[GFXFormatR16G16B16A16] = DXGI_FORMAT_R16G16B16A16_UNORM; 67 GFXD3D11TextureFormat[GFXFormatR16G16] = DXGI_FORMAT_R16G16_UNORM; 68 GFXD3D11TextureFormat[GFXFormatR16F] = DXGI_FORMAT_R16_FLOAT; 69 GFXD3D11TextureFormat[GFXFormatR16G16F] = DXGI_FORMAT_R16G16_FLOAT; 70 GFXD3D11TextureFormat[GFXFormatR10G10B10A2] = DXGI_FORMAT_R10G10B10A2_UNORM; 71 GFXD3D11TextureFormat[GFXFormatR11G11B10] = DXGI_FORMAT_R11G11B10_FLOAT; 72 GFXD3D11TextureFormat[GFXFormatD32] = DXGI_FORMAT_UNKNOWN; 73 GFXD3D11TextureFormat[GFXFormatD24X8] = DXGI_FORMAT_UNKNOWN; 74 GFXD3D11TextureFormat[GFXFormatD24S8] = DXGI_FORMAT_D24_UNORM_S8_UINT; 75 GFXD3D11TextureFormat[GFXFormatD24FS8] = DXGI_FORMAT_UNKNOWN; 76 GFXD3D11TextureFormat[GFXFormatD16] = DXGI_FORMAT_D16_UNORM; 77 //sRGB 78 GFXD3D11TextureFormat[GFXFormatR8G8B8A8_SRGB] = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB; 79 GFXD3D11TextureFormat[GFXFormatR8G8B8_SRGB] = DXGI_FORMAT_B8G8R8X8_UNORM_SRGB; 80 GFXD3D11TextureFormat[GFXFormatBC1_SRGB] = DXGI_FORMAT_BC1_UNORM_SRGB; 81 GFXD3D11TextureFormat[GFXFormatBC2_SRGB] = DXGI_FORMAT_BC2_UNORM_SRGB; 82 GFXD3D11TextureFormat[GFXFormatBC3_SRGB] = DXGI_FORMAT_BC3_UNORM_SRGB; 83 84 85//------------------------------------------------------------------------------ 86//------------------------------------------------------------------------------ 87 GFXD3D11TextureFilter[GFXTextureFilterNone] = D3D11_FILTER_MIN_MAG_MIP_POINT; 88 GFXD3D11TextureFilter[GFXTextureFilterPoint] = D3D11_FILTER_MIN_MAG_MIP_POINT; 89 GFXD3D11TextureFilter[GFXTextureFilterLinear] = D3D11_FILTER_MIN_MAG_MIP_LINEAR; 90 GFXD3D11TextureFilter[GFXTextureFilterAnisotropic] = D3D11_FILTER_ANISOTROPIC; 91//------------------------------------------------------------------------------ 92//------------------------------------------------------------------------------ 93 GFXD3D11Blend[GFXBlendZero] = D3D11_BLEND_ZERO; 94 GFXD3D11Blend[GFXBlendOne] = D3D11_BLEND_ONE; 95 GFXD3D11Blend[GFXBlendSrcColor] = D3D11_BLEND_SRC_COLOR; 96 GFXD3D11Blend[GFXBlendInvSrcColor] = D3D11_BLEND_INV_SRC_COLOR; 97 GFXD3D11Blend[GFXBlendSrcAlpha] = D3D11_BLEND_SRC_ALPHA; 98 GFXD3D11Blend[GFXBlendInvSrcAlpha] = D3D11_BLEND_INV_SRC_ALPHA; 99 GFXD3D11Blend[GFXBlendDestAlpha] = D3D11_BLEND_DEST_ALPHA; 100 GFXD3D11Blend[GFXBlendInvDestAlpha] = D3D11_BLEND_INV_DEST_ALPHA; 101 GFXD3D11Blend[GFXBlendDestColor] = D3D11_BLEND_DEST_COLOR; 102 GFXD3D11Blend[GFXBlendInvDestColor] = D3D11_BLEND_INV_DEST_COLOR; 103 GFXD3D11Blend[GFXBlendSrcAlphaSat] = D3D11_BLEND_SRC_ALPHA_SAT; 104 GFXD3D11BlendAlpha[GFXBlendZero] = D3D11_BLEND_ZERO; 105 GFXD3D11BlendAlpha[GFXBlendOne] = D3D11_BLEND_ONE; 106 GFXD3D11BlendAlpha[GFXBlendSrcColor] = D3D11_BLEND_SRC_ALPHA; 107 GFXD3D11BlendAlpha[GFXBlendInvSrcColor] = D3D11_BLEND_INV_SRC_ALPHA; 108 GFXD3D11BlendAlpha[GFXBlendSrcAlpha] = D3D11_BLEND_SRC_ALPHA; 109 GFXD3D11BlendAlpha[GFXBlendInvSrcAlpha] = D3D11_BLEND_INV_SRC_ALPHA; 110 GFXD3D11BlendAlpha[GFXBlendDestAlpha] = D3D11_BLEND_DEST_ALPHA; 111 GFXD3D11BlendAlpha[GFXBlendInvDestAlpha] = D3D11_BLEND_INV_DEST_ALPHA; 112 GFXD3D11BlendAlpha[GFXBlendDestColor] = D3D11_BLEND_DEST_ALPHA; 113 GFXD3D11BlendAlpha[GFXBlendInvDestColor] = D3D11_BLEND_INV_DEST_ALPHA; 114 GFXD3D11BlendAlpha[GFXBlendSrcAlphaSat] = D3D11_BLEND_SRC_ALPHA_SAT; 115//------------------------------------------------------------------------------ 116//------------------------------------------------------------------------------ 117 GFXD3D11BlendOp[GFXBlendOpAdd] = D3D11_BLEND_OP_ADD; 118 GFXD3D11BlendOp[GFXBlendOpSubtract] = D3D11_BLEND_OP_SUBTRACT; 119 GFXD3D11BlendOp[GFXBlendOpRevSubtract] = D3D11_BLEND_OP_REV_SUBTRACT; 120 GFXD3D11BlendOp[GFXBlendOpMin] = D3D11_BLEND_OP_MIN; 121 GFXD3D11BlendOp[GFXBlendOpMax] = D3D11_BLEND_OP_MAX; 122//------------------------------------------------------------------------------ 123//------------------------------------------------------------------------------ 124 GFXD3D11StencilOp[GFXStencilOpKeep] = D3D11_STENCIL_OP_KEEP; 125 GFXD3D11StencilOp[GFXStencilOpZero] = D3D11_STENCIL_OP_ZERO; 126 GFXD3D11StencilOp[GFXStencilOpReplace] = D3D11_STENCIL_OP_REPLACE; 127 GFXD3D11StencilOp[GFXStencilOpIncrSat] = D3D11_STENCIL_OP_INCR_SAT; 128 GFXD3D11StencilOp[GFXStencilOpDecrSat] = D3D11_STENCIL_OP_DECR_SAT; 129 GFXD3D11StencilOp[GFXStencilOpInvert] = D3D11_STENCIL_OP_INVERT; 130 GFXD3D11StencilOp[GFXStencilOpIncr] = D3D11_STENCIL_OP_INCR; 131 GFXD3D11StencilOp[GFXStencilOpDecr] = D3D11_STENCIL_OP_DECR; 132//------------------------------------------------------------------------------ 133//------------------------------------------------------------------------------ 134 GFXD3D11CmpFunc[GFXCmpNever] = D3D11_COMPARISON_NEVER; 135 GFXD3D11CmpFunc[GFXCmpLess] = D3D11_COMPARISON_LESS; 136 GFXD3D11CmpFunc[GFXCmpEqual] = D3D11_COMPARISON_EQUAL; 137 GFXD3D11CmpFunc[GFXCmpLessEqual] = D3D11_COMPARISON_LESS_EQUAL; 138 GFXD3D11CmpFunc[GFXCmpGreater] = D3D11_COMPARISON_GREATER; 139 GFXD3D11CmpFunc[GFXCmpNotEqual] = D3D11_COMPARISON_NOT_EQUAL; 140 GFXD3D11CmpFunc[GFXCmpGreaterEqual] = D3D11_COMPARISON_GREATER_EQUAL; 141 GFXD3D11CmpFunc[GFXCmpAlways] = D3D11_COMPARISON_ALWAYS; 142//------------------------------------------------------------------------------ 143//------------------------------------------------------------------------------ 144 GFXD3D11CullMode[GFXCullNone] = D3D11_CULL_NONE; 145 GFXD3D11CullMode[GFXCullCW] = D3D11_CULL_FRONT; 146 GFXD3D11CullMode[GFXCullCCW] = D3D11_CULL_BACK; 147//------------------------------------------------------------------------------ 148//------------------------------------------------------------------------------ 149 GFXD3D11FillMode[GFXFillPoint] = D3D11_FILL_SOLID; 150 GFXD3D11FillMode[GFXFillWireframe] = D3D11_FILL_WIREFRAME; 151 GFXD3D11FillMode[GFXFillSolid] = D3D11_FILL_SOLID; 152//------------------------------------------------------------------------------ 153//------------------------------------------------------------------------------ 154 GFXD3D11PrimType[GFXPointList] = D3D_PRIMITIVE_TOPOLOGY_POINTLIST; 155 GFXD3D11PrimType[GFXLineList] = D3D_PRIMITIVE_TOPOLOGY_LINELIST; 156 GFXD3D11PrimType[GFXLineStrip] = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; 157 GFXD3D11PrimType[GFXTriangleList] = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; 158 GFXD3D11PrimType[GFXTriangleStrip] = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; 159//------------------------------------------------------------------------------ 160//------------------------------------------------------------------------------ 161 GFXD3D11TextureAddress[GFXAddressWrap] = D3D11_TEXTURE_ADDRESS_WRAP; 162 GFXD3D11TextureAddress[GFXAddressMirror] = D3D11_TEXTURE_ADDRESS_MIRROR; 163 GFXD3D11TextureAddress[GFXAddressClamp] = D3D11_TEXTURE_ADDRESS_CLAMP; 164 GFXD3D11TextureAddress[GFXAddressBorder] = D3D11_TEXTURE_ADDRESS_BORDER; 165 GFXD3D11TextureAddress[GFXAddressMirrorOnce] = D3D11_TEXTURE_ADDRESS_MIRROR_ONCE; 166//------------------------------------------------------------------------------ 167//------------------------------------------------------------------------------ 168 GFXD3D11DeclType[GFXDeclType_Float] = DXGI_FORMAT_R32_FLOAT; 169 GFXD3D11DeclType[GFXDeclType_Float2] = DXGI_FORMAT_R32G32_FLOAT; 170 GFXD3D11DeclType[GFXDeclType_Float3] = DXGI_FORMAT_R32G32B32_FLOAT; 171 GFXD3D11DeclType[GFXDeclType_Float4] = DXGI_FORMAT_R32G32B32A32_FLOAT; 172 GFXD3D11DeclType[GFXDeclType_Color] = DXGI_FORMAT_B8G8R8A8_UNORM; // DXGI_FORMAT_R8G8B8A8_UNORM; 173 GFXD3D11DeclType[GFXDeclType_UByte4] = DXGI_FORMAT_R8G8B8A8_UINT; 174} 175 176