• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  * Copyright (C) 2015 Intel Corporation.   All Rights Reserved.
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 (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * 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
18  * THE 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 #pragma once
25 
26 INLINE void
swr_LoadHotTile(HANDLE hPrivateContext,SWR_FORMAT dstFormat,SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,UINT x,UINT y,uint32_t renderTargetArrayIndex,uint8_t * pDstHotTile)27 swr_LoadHotTile(HANDLE hPrivateContext,
28                 SWR_FORMAT dstFormat,
29                 SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
30                 UINT x, UINT y,
31                 uint32_t renderTargetArrayIndex, uint8_t* pDstHotTile)
32 {
33    // Grab source surface state from private context
34    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
35    SWR_SURFACE_STATE *pSrcSurface = &pDC->renderTargets[renderTargetIndex];
36 
37    pDC->pAPI->pfnSwrLoadHotTile(pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
38 }
39 
40 INLINE void
swr_StoreHotTile(HANDLE hPrivateContext,SWR_FORMAT srcFormat,SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,UINT x,UINT y,uint32_t renderTargetArrayIndex,uint8_t * pSrcHotTile)41 swr_StoreHotTile(HANDLE hPrivateContext,
42                  SWR_FORMAT srcFormat,
43                  SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
44                  UINT x, UINT y,
45                  uint32_t renderTargetArrayIndex, uint8_t* pSrcHotTile)
46 {
47    // Grab destination surface state from private context
48    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
49    SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
50 
51    pDC->pAPI->pfnSwrStoreHotTileToSurface(pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
52 }
53 
54 INLINE void
swr_StoreHotTileClear(HANDLE hPrivateContext,SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,UINT x,UINT y,uint32_t renderTargetArrayIndex,const float * pClearColor)55 swr_StoreHotTileClear(HANDLE hPrivateContext,
56                       SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
57                       UINT x,
58                       UINT y,
59                       uint32_t renderTargetArrayIndex,
60                       const float* pClearColor)
61 {
62    // Grab destination surface state from private context
63    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
64    SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
65 
66    pDC->pAPI->pfnSwrStoreHotTileClear(pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor);
67 }
68