xref: /aosp_15_r20/external/gmmlib/Source/GmmLib/inc/Internal/Common/Texture/GmmGen7TextureCalc.h (revision 35ffd701415c9e32e53136d61a677a8d0a8fc4a5)
1 /*==============================================================================
2 Copyright(c) 2017 Intel Corporation
3 
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files(the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and / or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21 ============================================================================*/
22 
23 #pragma once
24 #ifdef __cplusplus
25 #include "GmmTextureCalc.h"
26 /////////////////////////////////////////////////////////////////////////////////////
27 /// @file GmmGen7TextureCalc.h
28 /// @brief This file contains the common functions and members for texture calculations
29 ///        on all GENs/Platforms
30 /////////////////////////////////////////////////////////////////////////////////////
31 namespace GmmLib
32 {
33     /////////////////////////////////////////////////////////////////////////
34     /// Contains texture calc functions and members for Gen7 platforms.
35     /// This class is derived from the base GmmTextureCalc class  so clients
36     /// shouldn't have to ever interact  with this class directly.
37     /////////////////////////////////////////////////////////////////////////
38     class NON_PAGED_SECTION GmmGen7TextureCalc :
39                                 public GmmTextureCalc
40     {
41         private:
42             uint32_t                   GetTotal3DHeight(
43                                         GMM_TEXTURE_INFO* pTexInfo);
44 
45             void                    Fill3DTexOffsetAddress(
46                                         GMM_TEXTURE_INFO *pTexInfo);
47 
48         protected:
49             /* Function prototypes */
50             virtual uint32_t           Get2DMipMapHeight(
51                                         GMM_TEXTURE_INFO   *pTexInfo);
52 
53             virtual void            Fill2DTexOffsetAddress(
54                                         GMM_TEXTURE_INFO *pTexInfo);
55 
56             virtual GMM_GFX_SIZE_T  Get2DTexOffsetAddressPerMip(
57                                         GMM_TEXTURE_INFO *pTexInfo,
58                                         uint32_t            MipLevel);
59         public:
60             /* Constructors */
GmmGen7TextureCalc(Context * pGmmLibContext)61             GmmGen7TextureCalc(Context *pGmmLibContext)
62                 : GmmTextureCalc(pGmmLibContext)
63             {
64 
65             }
66 
~GmmGen7TextureCalc()67             ~GmmGen7TextureCalc()
68             {
69 
70             }
71 
72             /* Function prototypes */
73 
74             virtual GMM_STATUS GMM_STDCALL  FillTex1D(GMM_TEXTURE_INFO   *pTexInfo,
75                                                       __GMM_BUFFER_TYPE  *pRestrictions);
76 
77             virtual GMM_STATUS GMM_STDCALL  FillTex2D(GMM_TEXTURE_INFO   *pTexInfo,
78                                                       __GMM_BUFFER_TYPE  *pRestrictions);
79 
80             virtual GMM_STATUS GMM_STDCALL  FillTex3D(GMM_TEXTURE_INFO   *pTexInfo,
81                                                       __GMM_BUFFER_TYPE  *pRestrictions);
82 
83             virtual GMM_STATUS GMM_STDCALL  FillTexCube(GMM_TEXTURE_INFO   *pTexInfo,
84                                                         __GMM_BUFFER_TYPE  *pRestrictions);
85 
86             /* inline functions */
87     };
88 }
89 #endif // #ifdef __cplusplus
90