| 1 | 
 /* | 
 
 
 
 
 
 | 2 | 
  * Copyright 2017 Ihsan Akmal | 
 
 
 
 
 
 | 3 | 
  * | 
 
 
 
 
 
 | 4 | 
  * This library is free software; you can redistribute it and/or | 
 
 
 
 
 
 | 5 | 
  * modify it under the terms of the GNU Lesser General Public | 
 
 
 
 
 
 | 6 | 
  * License as published by the Free Software Foundation; either | 
 
 
 
 
 
 | 7 | 
  * version 2.1 of the License, or (at your option) any later version. | 
 
 
 
 
 
 | 8 | 
  * | 
 
 
 
 
 
 | 9 | 
  * This library is distributed in the hope that it will be useful, | 
 
 
 
 
 
 | 10 | 
  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 
 
 
 
 
 | 11 | 
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
 
 
 
 
 
 | 12 | 
  * Lesser General Public License for more details. | 
 
 
 
 
 
 | 13 | 
  * | 
 
 
 
 
 
 | 14 | 
  * You should have received a copy of the GNU Lesser General Public | 
 
 
 
 
 
 | 15 | 
  * License along with this library; if not, write to the Free Software | 
 
 
 
 
 
 | 16 | 
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA | 
 
 
 
 
 
 | 17 | 
  */ | 
 
 
 
 
 
 | 18 | 
  | 
 
 
 
 
 
 | 19 | 
 import "oaidl.idl"; | 
 
 
 
 
 
 | 20 | 
 import "ocidl.idl"; | 
 
 
 
 
 
 | 21 | 
 import "dxgi1_3.idl"; | 
 
 
 
 
 
 | 22 | 
 import "d3dcommon.idl"; | 
 
 
 
 
 
 | 23 | 
 import "d3d11_1.idl"; | 
 
 
 
 
 
 | 24 | 
  | 
 
 
 
 
 
 | 25 | 
 const UINT D3D11_PACKED_TILE = 0xffffffff; | 
 
 
 
 
 
 | 26 | 
  | 
 
 
 
 
 
 | 27 | 
 typedef enum D3D11_TILE_MAPPING_FLAG | 
 
 
 
 
 
 | 28 | 
 { | 
 
 
 
 
 
 | 29 | 
     D3D11_TILE_MAPPING_NO_OVERWRITE = 0x1, | 
 
 
 
 
 
 | 30 | 
 } D3D11_TILE_MAPPING_FLAG; | 
 
 
 
 
 
 | 31 | 
  | 
 
 
 
 
 
 | 32 | 
 typedef enum D3D11_TILE_RANGE_FLAG | 
 
 
 
 
 
 | 33 | 
 { | 
 
 
 
 
 
 | 34 | 
     D3D11_TILE_RANGE_NULL = 0x1, | 
 
 
 
 
 
 | 35 | 
     D3D11_TILE_RANGE_SKIP = 0x2, | 
 
 
 
 
 
 | 36 | 
     D3D11_TILE_RANGE_REUSE_SINGLE_TILE = 0x4, | 
 
 
 
 
 
 | 37 | 
 } D3D11_TILE_RANGE_FLAG; | 
 
 
 
 
 
 | 38 | 
  | 
 
 
 
 
 
 | 39 | 
 typedef enum D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_FLAG | 
 
 
 
 
 
 | 40 | 
 { | 
 
 
 
 
 
 | 41 | 
     D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_TILED_RESOURCE = 0x1, | 
 
 
 
 
 
 | 42 | 
 } D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_FLAG; | 
 
 
 
 
 
 | 43 | 
  | 
 
 
 
 
 
 | 44 | 
 typedef enum D3D11_TILE_COPY_FLAG | 
 
 
 
 
 
 | 45 | 
 { | 
 
 
 
 
 
 | 46 | 
     D3D11_TILE_COPY_NO_OVERWRITE = 0x1, | 
 
 
 
 
 
 | 47 | 
     D3D11_TILE_COPY_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 0x2, | 
 
 
 
 
 
 | 48 | 
     D3D11_TILE_COPY_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 0x4, | 
 
 
 
 
 
 | 49 | 
 } D3D11_TILE_COPY_FLAG; | 
 
 
 
 
 
 | 50 | 
  | 
 
 
 
 
 
 | 51 | 
 typedef struct D3D11_TILED_RESOURCE_COORDINATE | 
 
 
 
 
 
 | 52 | 
 { | 
 
 
 
 
 
 | 53 | 
     UINT X; | 
 
 
 
 
 
 | 54 | 
     UINT Y; | 
 
 
 
 
 
 | 55 | 
     UINT Z; | 
 
 
 
 
 
 | 56 | 
     UINT Subresource; | 
 
 
 
 
 
 | 57 | 
 } D3D11_TILED_RESOURCE_COORDINATE; | 
 
 
 
 
 
 | 58 | 
  | 
 
 
 
 
 
 | 59 | 
 typedef struct D3D11_TILE_REGION_SIZE | 
 
 
 
 
 
 | 60 | 
 { | 
 
 
 
 
 
 | 61 | 
     UINT NumTiles; | 
 
 
 
 
 
 | 62 | 
     BOOL bUseBox; | 
 
 
 
 
 
 | 63 | 
     UINT Width; | 
 
 
 
 
 
 | 64 | 
     UINT16 Height; | 
 
 
 
 
 
 | 65 | 
     UINT16 Depth; | 
 
 
 
 
 
 | 66 | 
 } D3D11_TILE_REGION_SIZE; | 
 
 
 
 
 
 | 67 | 
  | 
 
 
 
 
 
 | 68 | 
 typedef struct D3D11_SUBRESOURCE_TILING | 
 
 
 
 
 
 | 69 | 
 { | 
 
 
 
 
 
 | 70 | 
     UINT WidthInTiles; | 
 
 
 
 
 
 | 71 | 
     UINT16 HeightInTiles; | 
 
 
 
 
 
 | 72 | 
     UINT16 DepthInTiles; | 
 
 
 
 
 
 | 73 | 
     UINT StartTileIndexInOverallResource; | 
 
 
 
 
 
 | 74 | 
 } D3D11_SUBRESOURCE_TILING; | 
 
 
 
 
 
 | 75 | 
  | 
 
 
 
 
 
 | 76 | 
 typedef struct D3D11_TILE_SHAPE | 
 
 
 
 
 
 | 77 | 
 { | 
 
 
 
 
 
 | 78 | 
     UINT WidthInTexels; | 
 
 
 
 
 
 | 79 | 
     UINT HeightInTexels; | 
 
 
 
 
 
 | 80 | 
     UINT DepthInTexels; | 
 
 
 
 
 
 | 81 | 
 } D3D11_TILE_SHAPE; | 
 
 
 
 
 
 | 82 | 
  | 
 
 
 
 
 
 | 83 | 
 typedef struct D3D11_PACKED_MIP_DESC | 
 
 
 
 
 
 | 84 | 
 { | 
 
 
 
 
 
 | 85 | 
     UINT8 NumStandardMips; | 
 
 
 
 
 
 | 86 | 
     UINT8 NumPackedMips; | 
 
 
 
 
 
 | 87 | 
     UINT NumTilesForPackedMips; | 
 
 
 
 
 
 | 88 | 
     UINT StartTileIndexInOverallResource; | 
 
 
 
 
 
 | 89 | 
 } D3D11_PACKED_MIP_DESC; | 
 
 
 
 
 
 | 90 | 
  | 
 
 
 
 
 
 | 91 | 
 [ | 
 
 
 
 
 
 | 92 | 
     uuid(420d5b32-b90c-4da4-bef0-359f6a24a83a), | 
 
 
 
 
 
 | 93 | 
     object, | 
 
 
 
 
 
 | 94 | 
     local, | 
 
 
 
 
 
 | 95 | 
     pointer_default(unique) | 
 
 
 
 
 
 | 96 | 
 ] | 
 
 
 
 
 
 | 97 | 
 interface ID3D11DeviceContext2 : ID3D11DeviceContext1 | 
 
 
 
 
 
 | 98 | 
 { | 
 
 
 
 
 
 | 99 | 
     HRESULT UpdateTileMappings( | 
 
 
 
 
 
 | 100 | 
         ID3D11Resource *resource, | 
 
 
 
 
 
 | 101 | 
         UINT region_count, | 
 
 
 
 
 
 | 102 | 
         const D3D11_TILED_RESOURCE_COORDINATE *region_start_coordinates, | 
 
 
 
 
 
 | 103 | 
         const D3D11_TILE_REGION_SIZE *region_sizes, | 
 
 
 
 
 
 | 104 | 
         ID3D11Buffer *pool, | 
 
 
 
 
 
 | 105 | 
         UINT range_count, | 
 
 
 
 
 
 | 106 | 
         const UINT *range_flags, | 
 
 
 
 
 
 | 107 | 
         const UINT *pool_start_offsets, | 
 
 
 
 
 
 | 108 | 
         const UINT *range_tile_counts, | 
 
 
 
 
 
 | 109 | 
         UINT flags | 
 
 
 
 
 
 | 110 | 
     ); | 
 
 
 
 
 
 | 111 | 
     HRESULT CopyTileMappings( | 
 
 
 
 
 
 | 112 | 
         ID3D11Resource *dst_resource, | 
 
 
 
 
 
 | 113 | 
         const D3D11_TILED_RESOURCE_COORDINATE *dst_start_coordinate, | 
 
 
 
 
 
 | 114 | 
         ID3D11Resource *src_resource, | 
 
 
 
 
 
 | 115 | 
         const D3D11_TILED_RESOURCE_COORDINATE *src_start_coordinate, | 
 
 
 
 
 
 | 116 | 
         const D3D11_TILE_REGION_SIZE *region_size, | 
 
 
 
 
 
 | 117 | 
         UINT flags | 
 
 
 
 
 
 | 118 | 
     ); | 
 
 
 
 
 
 | 119 | 
     void CopyTiles( | 
 
 
 
 
 
 | 120 | 
         ID3D11Resource *resource, | 
 
 
 
 
 
 | 121 | 
         const D3D11_TILED_RESOURCE_COORDINATE *start_coordinate, | 
 
 
 
 
 
 | 122 | 
         const D3D11_TILE_REGION_SIZE *size, | 
 
 
 
 
 
 | 123 | 
         ID3D11Buffer *buffer, | 
 
 
 
 
 
 | 124 | 
         UINT64 start_offset, | 
 
 
 
 
 
 | 125 | 
         UINT flags | 
 
 
 
 
 
 | 126 | 
     ); | 
 
 
 
 
 
 | 127 | 
     void UpdateTiles( | 
 
 
 
 
 
 | 128 | 
         ID3D11Resource *dst_resource, | 
 
 
 
 
 
 | 129 | 
         const D3D11_TILED_RESOURCE_COORDINATE *dst_start_coordinate, | 
 
 
 
 
 
 | 130 | 
         const D3D11_TILE_REGION_SIZE *dst_region_size, | 
 
 
 
 
 
 | 131 | 
         const void *src_data, | 
 
 
 
 
 
 | 132 | 
         UINT flags | 
 
 
 
 
 
 | 133 | 
     ); | 
 
 
 
 
 
 | 134 | 
     HRESULT ResizeTilePool( | 
 
 
 
 
 
 | 135 | 
         ID3D11Buffer *pool, | 
 
 
 
 
 
 | 136 | 
         UINT64 size | 
 
 
 
 
 
 | 137 | 
     ); | 
 
 
 
 
 
 | 138 | 
     void TiledResourceBarrier( | 
 
 
 
 
 
 | 139 | 
         ID3D11DeviceChild *before_barrier, | 
 
 
 
 
 
 | 140 | 
         ID3D11DeviceChild *after_barrier | 
 
 
 
 
 
 | 141 | 
     ); | 
 
 
 
 
 
 | 142 | 
     BOOL IsAnnotationEnabled(); | 
 
 
 
 
 
 | 143 | 
     void SetMarkerInt(const WCHAR *label, int data); | 
 
 
 
 
 
 | 144 | 
     void BeginEventInt(const WCHAR *label, int data); | 
 
 
 
 
 
 | 145 | 
     void EndEvent(); | 
 
 
 
 
 
 | 146 | 
 } | 
 
 
 
 
 
 | 147 | 
  | 
 
 
 
 
 
 | 148 | 
 [ | 
 
 
 
 
 
 | 149 | 
     uuid(9d06dffa-d1e5-4d07-83a8-1bb123f2f841), | 
 
 
 
 
 
 | 150 | 
     object, | 
 
 
 
 
 
 | 151 | 
     local, | 
 
 
 
 
 
 | 152 | 
     pointer_default(unique) | 
 
 
 
 
 
 | 153 | 
 ] | 
 
 
 
 
 
 | 154 | 
 interface ID3D11Device2 : ID3D11Device1 | 
 
 
 
 
 
 | 155 | 
 { | 
 
 
 
 
 
 | 156 | 
     void GetImmediateContext2(ID3D11DeviceContext2 **context); | 
 
 
 
 
 
 | 157 | 
     HRESULT CreateDeferredContext2(UINT flags, ID3D11DeviceContext2 **context); | 
 
 
 
 
 
 | 158 | 
     void GetResourceTiling( | 
 
 
 
 
 
 | 159 | 
         ID3D11Resource *resource, | 
 
 
 
 
 
 | 160 | 
         UINT *tile_count, | 
 
 
 
 
 
 | 161 | 
         D3D11_PACKED_MIP_DESC *mip_desc, | 
 
 
 
 
 
 | 162 | 
         D3D11_TILE_SHAPE *tile_shape, | 
 
 
 
 
 
 | 163 | 
         UINT *subresource_tiling_count, | 
 
 
 
 
 
 | 164 | 
         UINT first_subresource_tiling, | 
 
 
 
 
 
 | 165 | 
         D3D11_SUBRESOURCE_TILING *subresource_tiling | 
 
 
 
 
 
 | 166 | 
     ); | 
 
 
 
 
 
 | 167 | 
     HRESULT CheckMultisampleQualityLevels1( | 
 
 
 
 
 
 | 168 | 
         DXGI_FORMAT format, | 
 
 
 
 
 
 | 169 | 
         UINT sample_count, | 
 
 
 
 
 
 | 170 | 
         UINT flags, | 
 
 
 
 
 
 | 171 | 
         UINT *quality_level_count | 
 
 
 
 
 
 | 172 | 
     ); | 
 
 
 
 
 
 | 173 | 
 } |