swr/rast: Refactor memory API between rasterizer core and swr
authorJan Zielinski <jan.zielinski@intel.com>
Wed, 17 Jul 2019 15:22:16 +0000 (17:22 +0200)
committerJan Zielinski <jan.zielinski@intel.com>
Thu, 18 Jul 2019 14:17:00 +0000 (16:17 +0200)
This commit cleans up API between the core of the rasterizer and swr.
Some formatting changes are also done.

Reviewed-by: Alok Hota <alok.hota@intel.com>
30 files changed:
src/gallium/drivers/swr/SConscript
src/gallium/drivers/swr/meson.build
src/gallium/drivers/swr/rasterizer/_clang-format [new file with mode: 0644]
src/gallium/drivers/swr/rasterizer/codegen/meson.build
src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp
src/gallium/drivers/swr/rasterizer/core/api.cpp
src/gallium/drivers/swr/rasterizer/core/api.h
src/gallium/drivers/swr/rasterizer/core/backend_impl.h
src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp
src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp
src/gallium/drivers/swr/rasterizer/core/context.h
src/gallium/drivers/swr/rasterizer/core/format_conversion.h
src/gallium/drivers/swr/rasterizer/core/state.h
src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp
src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp
src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp
src/gallium/drivers/swr/rasterizer/memory/InitMemory.h
src/gallium/drivers/swr/rasterizer/memory/LoadTile.h
src/gallium/drivers/swr/rasterizer/memory/StoreTile.h
src/gallium/drivers/swr/rasterizer/memory/SurfaceState.h [new file with mode: 0644]
src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
src/gallium/drivers/swr/swr_context.cpp
src/gallium/drivers/swr/swr_context.h
src/gallium/drivers/swr/swr_loader.cpp
src/gallium/drivers/swr/swr_memory.h
src/gallium/drivers/swr/swr_resource.h
src/gallium/drivers/swr/swr_screen.h
src/gallium/drivers/swr/swr_shader.cpp
src/gallium/drivers/swr/swr_state.cpp
src/gallium/drivers/swr/swr_tex_sample.cpp

index b0bead242f7812e3093147de9acee0a6be7f98a8..2236b1aa5dedca02b774f24023d835018ef837f2 100644 (file)
@@ -102,6 +102,16 @@ env.CodeGenerate(
 Depends('rasterizer/jitter/gen_state_llvm.h',
         swrroot + 'rasterizer/codegen/templates/gen_llvm.hpp')
 
+env.CodeGenerate(
+    target = './gen_surf_state_llvm.h',
+    script = swrroot + 'rasterizer/codegen/gen_llvm_types.py',
+    source = 'rasterizer/memory/SurfaceState.h',
+    command = python_cmd + ' $SCRIPT --input $SOURCE --output $TARGET'
+)
+Depends('rasterizer/jitter/gen_state_llvm.h',
+        swrroot + 'rasterizer/codegen/templates/gen_llvm.hpp')
+
+
 env.CodeGenerate(
     script = swrroot + 'rasterizer/codegen/gen_archrast.py',
     target = ['rasterizer/archrast/gen_ar_event.hpp',
index 3f32d031e1457a6fa6c44dbaafc0d612adcd15fa..9e07724d5dcbb629299e839ed47036e4b2c095b3 100644 (file)
@@ -83,6 +83,7 @@ files_swr_mesa = files(
   'rasterizer/jitter/streamout_jit.h',
   'rasterizer/jitter/shader_lib/DebugOutput.cpp',
   'rasterizer/jitter/functionpasses/lower_x86.cpp',
+  'rasterizer/memory/SurfaceState.h'
 )
 
 files_swr_arch = files(
@@ -153,10 +154,12 @@ files_swr_arch = files(
   'rasterizer/memory/tilingtraits.h',
   'rasterizer/memory/InitMemory.h',
   'rasterizer/memory/InitMemory.cpp',
+  'rasterizer/memory/SurfaceState.h'
 )
 
 swr_context_files = files('swr_context.h')
 swr_state_files = files('rasterizer/core/state.h')
+swr_surf_state_files = files('rasterizer/memory/SurfaceState.h')
 swr_event_proto_files = files('rasterizer/archrast/events.proto')
 swr_event_pproto_files = files('rasterizer/archrast/events_private.proto')
 swr_gen_backend_files = files('rasterizer/codegen/templates/gen_backend.cpp')
diff --git a/src/gallium/drivers/swr/rasterizer/_clang-format b/src/gallium/drivers/swr/rasterizer/_clang-format
new file mode 100644 (file)
index 0000000..ed4b9b4
--- /dev/null
@@ -0,0 +1,114 @@
+---
+Language:        Cpp
+# BasedOnStyle:  LLVM
+AccessModifierOffset: -4
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: true
+AlignConsecutiveDeclarations: true
+AlignEscapedNewlines: Left
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: false
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortIfStatementsOnASingleLine: false
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: false
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: false
+BinPackParameters: false
+BraceWrapping:   
+  AfterClass:      true
+  AfterControlStatement: true
+  AfterEnum:       true
+  AfterFunction:   true
+  AfterNamespace:  true
+  AfterObjCDeclaration: true
+  AfterStruct:     true
+  AfterUnion:      true
+  #AfterExternBlock: false
+  BeforeCatch:     true
+  BeforeElse:      true
+  IndentBraces:    false
+  SplitEmptyFunction: true
+  SplitEmptyRecord: true
+  SplitEmptyNamespace: true
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeInheritanceComma: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: AfterColon
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit:     100
+CommentPragmas:  '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: true
+DerivePointerAlignment: false
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:   
+  - foreach
+  - Q_FOREACH
+  - BOOST_FOREACH
+#IncludeBlocks:   Preserve
+IncludeCategories: 
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+    Priority:        2
+  - Regex:           '^(<|"(gtest|gmock|isl|json)/)'
+    Priority:        3
+  - Regex:           '.*'
+    Priority:        1
+IncludeIsMainRegex: '(Test)?$'
+IndentCaseLabels: false
+#IndentPPDirectives: AfterHash
+IndentWidth:     4
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: All
+ObjCBlockIndentWidth: 4
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 60
+PointerAlignment: Left
+#RawStringFormats: 
+#  - Delimiter:       pb
+#    Language:        TextProto
+#    BasedOnStyle:    google
+ReflowComments:  true
+SortIncludes:    false
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: ControlStatements
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Cpp11
+TabWidth:        4
+UseTab:          Never
+...
index 98da7d3fc61e722ca425e985f61a07e906054095..daf79ed4c26bd0af9496a3de5d8627ad37ac5ca8 100644 (file)
@@ -48,7 +48,8 @@ files_swr_common += [
 ]
 
 foreach x : [[swr_context_files, 'gen_swr_context_llvm.h'],
-             [swr_state_files, 'gen_state_llvm.h']]
+             [swr_state_files, 'gen_state_llvm.h'],
+             [swr_surf_state_files, 'gen_surf_state_llvm.h']]
   files_swr_common += custom_target(
     x[1],
     input : ['gen_llvm_types.py', x[0]],
index a59fb10902b9b62f4e3396aa56944692e6b6e6cc..5182bc4259f0e5efc3dab458d4598537506dfa89 100644 (file)
@@ -50,11 +50,7 @@ ${func['decl']}
     %else:
     FunctionType* pFuncTy = FunctionType::get(${ func['returnType'] }, {}, false);
     %endif:
-#if LLVM_VERSION_MAJOR >= 9
-    Function* pFunc = cast<Function>(JM()->mpCurrentModule->getOrInsertFunction("meta.intrinsic.${func['name']}", pFuncTy).getCallee());
-#else
     Function* pFunc = cast<Function>(JM()->mpCurrentModule->getOrInsertFunction("meta.intrinsic.${func['name']}", pFuncTy));
-#endif
     return CALL(pFunc, std::initializer_list<Value*>{${argList}}, name);
 %elif isIntrin:
     %if len(func['types']) != 0:
index 04eabc4d468de15eab1ac385f6f6a78b69271899..228e85a25c907ac101a023be1ae66db977ca3be5 100644 (file)
@@ -193,15 +193,14 @@ HANDLE SwrCreateContext(SWR_CREATECONTEXT_INFO* pCreateInfo)
     pContext->pHotTileMgr = new HotTileMgr();
 
     // initialize callback functions
-    pContext->pfnLoadTile                 = pCreateInfo->pfnLoadTile;
-    pContext->pfnStoreTile                = pCreateInfo->pfnStoreTile;
-    pContext->pfnClearTile                = pCreateInfo->pfnClearTile;
-    pContext->pfnTranslateGfxptrForRead   = pCreateInfo->pfnTranslateGfxptrForRead;
-    pContext->pfnTranslateGfxptrForWrite  = pCreateInfo->pfnTranslateGfxptrForWrite;
-    pContext->pfnMakeGfxPtr               = pCreateInfo->pfnMakeGfxPtr;
-    pContext->pfnUpdateSoWriteOffset      = pCreateInfo->pfnUpdateSoWriteOffset;
-    pContext->pfnUpdateStats              = pCreateInfo->pfnUpdateStats;
-    pContext->pfnUpdateStatsFE            = pCreateInfo->pfnUpdateStatsFE;
+    pContext->pfnLoadTile                = pCreateInfo->pfnLoadTile;
+    pContext->pfnStoreTile               = pCreateInfo->pfnStoreTile;
+    pContext->pfnTranslateGfxptrForRead  = pCreateInfo->pfnTranslateGfxptrForRead;
+    pContext->pfnTranslateGfxptrForWrite = pCreateInfo->pfnTranslateGfxptrForWrite;
+    pContext->pfnMakeGfxPtr              = pCreateInfo->pfnMakeGfxPtr;
+    pContext->pfnUpdateSoWriteOffset     = pCreateInfo->pfnUpdateSoWriteOffset;
+    pContext->pfnUpdateStats             = pCreateInfo->pfnUpdateStats;
+    pContext->pfnUpdateStatsFE           = pCreateInfo->pfnUpdateStatsFE;
 
 
     // pass pointer to bucket manager back to caller
@@ -1769,7 +1768,4 @@ void SwrGetInterface(SWR_INTERFACE& out_funcs)
     out_funcs.pfnSwrEnableStatsBE          = SwrEnableStatsBE;
     out_funcs.pfnSwrEndFrame               = SwrEndFrame;
     out_funcs.pfnSwrInit                   = SwrInit;
-    out_funcs.pfnSwrLoadHotTile = SwrLoadHotTile;
-    out_funcs.pfnSwrStoreHotTileToSurface = SwrStoreHotTileToSurface;
-    out_funcs.pfnSwrStoreHotTileClear = SwrStoreHotTileClear;
 }
index e31e0446ba6244f0d81a2233ec8e50a321999dc2..c842859ba321275b28e4c3740ee0645b4dcf5d64 100644 (file)
@@ -145,17 +145,15 @@ typedef void(SWR_API* PFN_CLEAR_TILE)(HANDLE                      hPrivateContex
                                       uint32_t                    renderTargetArrayIndex,
                                       const float*                pClearColor);
 
+typedef void*(SWR_API* PFN_TRANSLATE_GFXPTR_FOR_READ)(HANDLE   hPrivateContext,
+                                                      gfxptr_t xpAddr,
+                                                      bool*    pbNullTileAccessed);
 
-typedef void* (SWR_API* PFN_TRANSLATE_GFXPTR_FOR_READ)(HANDLE hPrivateContext, 
-                                                    gfxptr_t xpAddr, 
-                                                    bool* pbNullTileAccessed);
+typedef void*(SWR_API* PFN_TRANSLATE_GFXPTR_FOR_WRITE)(HANDLE   hPrivateContext,
+                                                       gfxptr_t xpAddr,
+                                                       bool*    pbNullTileAccessed);
 
-typedef void* (SWR_API* PFN_TRANSLATE_GFXPTR_FOR_WRITE)(HANDLE hPrivateContext, 
-                                                        gfxptr_t xpAddr, 
-                                                        bool* pbNullTileAccessed);
-
-typedef gfxptr_t(SWR_API* PFN_MAKE_GFXPTR)(HANDLE                 hPrivateContext,
-                                           void*                  sysAddr);
+typedef gfxptr_t(SWR_API* PFN_MAKE_GFXPTR)(HANDLE hPrivateContext, void* sysAddr);
 
 //////////////////////////////////////////////////////////////////////////
 /// @brief Callback to allow driver to update their copy of streamout write offset.
@@ -250,15 +248,14 @@ struct SWR_CREATECONTEXT_INFO
     SWR_WORKER_PRIVATE_STATE* pWorkerPrivateState;
 
     // Callback functions
-    PFN_LOAD_TILE                   pfnLoadTile;
-    PFN_STORE_TILE                  pfnStoreTile;
-    PFN_CLEAR_TILE                  pfnClearTile;
-    PFN_TRANSLATE_GFXPTR_FOR_READ   pfnTranslateGfxptrForRead;
-    PFN_TRANSLATE_GFXPTR_FOR_WRITE  pfnTranslateGfxptrForWrite;
-    PFN_MAKE_GFXPTR                 pfnMakeGfxPtr;
-    PFN_UPDATE_SO_WRITE_OFFSET      pfnUpdateSoWriteOffset;
-    PFN_UPDATE_STATS                pfnUpdateStats;
-    PFN_UPDATE_STATS_FE             pfnUpdateStatsFE;
+    PFN_LOAD_TILE                  pfnLoadTile;
+    PFN_STORE_TILE                 pfnStoreTile;
+    PFN_TRANSLATE_GFXPTR_FOR_READ  pfnTranslateGfxptrForRead;
+    PFN_TRANSLATE_GFXPTR_FOR_WRITE pfnTranslateGfxptrForWrite;
+    PFN_MAKE_GFXPTR                pfnMakeGfxPtr;
+    PFN_UPDATE_SO_WRITE_OFFSET     pfnUpdateSoWriteOffset;
+    PFN_UPDATE_STATS               pfnUpdateStats;
+    PFN_UPDATE_STATS_FE            pfnUpdateStatsFE;
 
 
     // Pointer to rdtsc buckets mgr returned to the caller.
@@ -687,58 +684,6 @@ SWR_FUNC(void, SwrEndFrame, HANDLE hContext);
 SWR_FUNC(void, SwrInit);
 
 
-//////////////////////////////////////////////////////////////////////////
-/// @brief Loads a full hottile from a render surface
-/// @param hPrivateContext - Handle to private DC
-/// @param dstFormat - Format for hot tile.
-/// @param renderTargetIndex - Index to src render target
-/// @param x, y - Coordinates to raster tile.
-/// @param pDstHotTile - Pointer to Hot Tile
-SWR_FUNC(void,
-         SwrLoadHotTile,
-         HANDLE                      hWorkerPrivateData,
-         const SWR_SURFACE_STATE*    pSrcSurface,
-         SWR_FORMAT                  dstFormat,
-         SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-         uint32_t                    x,
-         uint32_t                    y,
-         uint32_t                    renderTargetArrayIndex,
-         uint8_t*                    pDstHotTile);
-
-//////////////////////////////////////////////////////////////////////////
-/// @brief Deswizzles and stores a full hottile to a render surface
-/// @param hPrivateContext - Handle to private DC
-/// @param srcFormat - Format for hot tile.
-/// @param renderTargetIndex - Index to destination render target
-/// @param x, y - Coordinates to raster tile.
-/// @param pSrcHotTile - Pointer to Hot Tile
-SWR_FUNC(void,
-         SwrStoreHotTileToSurface,
-         HANDLE                      hWorkerPrivateData,
-         SWR_SURFACE_STATE*          pDstSurface,
-         SWR_FORMAT                  srcFormat,
-         SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-         uint32_t                    x,
-         uint32_t                    y,
-         uint32_t                    renderTargetArrayIndex,
-         uint8_t*                    pSrcHotTile);
-
-//////////////////////////////////////////////////////////////////////////
-/// @brief Writes clear color to every pixel of a render surface
-/// @param hPrivateContext - Handle to private DC
-/// @param renderTargetIndex - Index to destination render target
-/// @param x, y - Coordinates to raster tile.
-/// @param pClearColor - Pointer to clear color
-SWR_FUNC(void,
-         SwrStoreHotTileClear,
-         HANDLE                      hWorkerPrivateData,
-         SWR_SURFACE_STATE*          pDstSurface,
-         SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-         uint32_t                    x,
-         uint32_t                    y,
-         uint32_t                    renderTargetArrayIndex,
-         const float*                pClearColor);
-
 struct SWR_INTERFACE
 {
     PFNSwrCreateContext          pfnSwrCreateContext;
@@ -788,9 +733,6 @@ struct SWR_INTERFACE
     PFNSwrEnableStatsBE          pfnSwrEnableStatsBE;
     PFNSwrEndFrame               pfnSwrEndFrame;
     PFNSwrInit                   pfnSwrInit;
-    PFNSwrLoadHotTile           pfnSwrLoadHotTile;
-    PFNSwrStoreHotTileToSurface pfnSwrStoreHotTileToSurface;
-    PFNSwrStoreHotTileClear     pfnSwrStoreHotTileClear;
 };
 
 extern "C" {
index b3de4e3e4e94b05ab3b21daa0a63cb26c3754e58..83d662bd9a71be024cb1747e2cb5a40c56ca0fe9 100644 (file)
@@ -1056,7 +1056,6 @@ void BackendPixelRate(DRAW_CONTEXT*        pDC,
         {
             const bool useAlternateOffset = ((xx & SIMD_TILE_X_DIM) != 0);
 
-            psContext.alternateOffset = useAlternateOffset ? 1 : 0;
 
             simdscalar activeLanes;
             if (!(work.anyCoveredSamples & MASK))
index 03152bb0cf70950421782bac1c59f7d0234ece5e..9b0b80f766fee1bd138d0d061344d196fa66c489 100644 (file)
@@ -83,7 +83,6 @@ void BackendSampleRate(DRAW_CONTEXT*        pDC,
         {
             const bool useAlternateOffset = ((xx & SIMD_TILE_X_DIM) != 0);
 
-            psContext.alternateOffset = useAlternateOffset ? 1 : 0;
 
             if (T::InputCoverage != SWR_INPUT_COVERAGE_NONE)
             {
index fe76d50fbfa4d607ed827dd987154c1968049694..46aabcdf34bbfa16c8457b075d4b32454007c121 100644 (file)
@@ -84,7 +84,6 @@ void BackendSingleSample(DRAW_CONTEXT*        pDC,
         {
             const bool useAlternateOffset = ((xx & SIMD_TILE_X_DIM) != 0);
 
-            psContext.alternateOffset = useAlternateOffset ? 1 : 0;
 
             simdmask coverageMask = work.coverageMask[0] & MASK;
 
index a8182559791f6910e3e7d42484441d7d745d29f9..8849e60c91f8a9bc4ffed8094ed04e8298a14b55 100644 (file)
@@ -525,7 +525,6 @@ struct SWR_CONTEXT
     // Callback functions, passed in at create context time
     PFN_LOAD_TILE                   pfnLoadTile;
     PFN_STORE_TILE                  pfnStoreTile;
-    PFN_CLEAR_TILE                  pfnClearTile;
     PFN_TRANSLATE_GFXPTR_FOR_READ   pfnTranslateGfxptrForRead;
     PFN_TRANSLATE_GFXPTR_FOR_WRITE  pfnTranslateGfxptrForWrite;
     PFN_MAKE_GFXPTR                 pfnMakeGfxPtr;
index 247ba0b0dcd90f44bc2fdf703e159652873f1491..ce908099e33fdf059f6fc89d5b48ad60801bb1ba 100644 (file)
@@ -139,7 +139,7 @@ INLINE Float<SIMD_T> SIMDCALL Clamp(Float<SIMD_T> const& v, uint32_t Component)
 }
 
 template <SWR_FORMAT Format>
-INLINE simdscalar SIMDCALL Clamp(simdscalar const& v, uint32_t Component)
+INLINE simd16scalar SIMDCALL Clamp(simdscalar const& v, uint32_t Component)
 {
     return Clamp<SIMD256, Format>(v, Component);
 }
@@ -168,7 +168,7 @@ INLINE Float<SIMD_T> SIMDCALL Normalize(Float<SIMD_T> const& vComp, uint32_t Com
 }
 
 template <SWR_FORMAT Format>
-INLINE simdscalar SIMDCALL Normalize(simdscalar const& vComp, uint32_t Component)
+INLINE simd16scalar SIMDCALL Normalize(simdscalar const& vComp, uint32_t Component)
 {
     return Normalize<SIMD256, Format>(vComp, Component);
 }
index a4d5e873d51cc2b1dfa5d6769bf7ecc334c73f89..3731c41c4e4d2d98fafb79e6e1fa82cf2aa020d0 100644 (file)
@@ -380,8 +380,6 @@ struct SWR_PS_CONTEXT
 
     uint8_t* pColorBuffer[SWR_NUM_RENDERTARGETS]; // IN: Pointers to render target hottiles
 
-    uint32_t alternateOffset; // IN: for 8x2 tile backend, which 4x2 do we need to read from
-
     SWR_SHADER_STATS stats; // OUT: shader statistics used for archrast.
 };
 
@@ -538,47 +536,6 @@ enum SWR_AUX_MODE
     AUX_MODE_DEPTH,
 };
 
-struct SWR_LOD_OFFSETS
-{
-    uint32_t offsets[2][15];
-};
-
-//////////////////////////////////////////////////////////////////////////
-/// SWR_SURFACE_STATE
-//////////////////////////////////////////////////////////////////////////
-struct SWR_SURFACE_STATE
-{
-    gfxptr_t         xpBaseAddress;
-    SWR_SURFACE_TYPE type;   // @llvm_enum
-    SWR_FORMAT       format; // @llvm_enum
-    uint32_t         width;
-    uint32_t         height;
-    uint32_t         depth;
-    uint32_t         numSamples;
-    uint32_t         samplePattern;
-    uint32_t         pitch;
-    uint32_t         qpitch;
-    uint32_t minLod; // for sampled surfaces, the most detailed LOD that can be accessed by sampler
-    uint32_t maxLod; // for sampled surfaces, the max LOD that can be accessed
-    float    resourceMinLod; // for sampled surfaces, the most detailed fractional mip that can be
-                             // accessed by sampler
-    uint32_t lod;            // for render targets, the lod being rendered to
-    uint32_t arrayIndex; // for render targets, the array index being rendered to for arrayed surfaces
-    SWR_TILE_MODE tileMode; // @llvm_enum
-    uint32_t      halign;
-    uint32_t      valign;
-    uint32_t      xOffset;
-    uint32_t      yOffset;
-
-    uint32_t lodOffsets[2][15]; // lod offsets for sampled surfaces
-
-    gfxptr_t     xpAuxBaseAddress; // Used for compression, append/consume counter, etc.
-    SWR_AUX_MODE auxMode;          // @llvm_enum
-
-
-    bool bInterleavedSamples; // are MSAA samples stored interleaved or planar
-};
-
 // vertex fetch state
 // WARNING- any changes to this struct need to be reflected
 // in the fetch shader jit
index 93a30b2cb452518f2fb956e3a0d7e5c377adf016..ed6cac04d018c21b6d6ebce5d82ea192d4f91e18 100644 (file)
@@ -445,11 +445,7 @@ namespace SwrJit
         args.push_back(PointerType::get(mInt8Ty, 0));
         FunctionType* callPrintTy = FunctionType::get(Type::getVoidTy(JM()->mContext), args, true);
         Function*     callPrintFn =
-#if LLVM_VERSION_MAJOR >= 9
-            cast<Function>(JM()->mpCurrentModule->getOrInsertFunction("CallPrint", callPrintTy).getCallee());
-#else
             cast<Function>(JM()->mpCurrentModule->getOrInsertFunction("CallPrint", callPrintTy));
-#endif
 
         // if we haven't yet added the symbol to the symbol table
         if ((sys::DynamicLibrary::SearchForAddressOfSymbol("CallPrint")) == nullptr)
@@ -618,11 +614,7 @@ namespace SwrJit
         {
             FunctionType* pFuncTy   = FunctionType::get(mFP32Ty, mInt16Ty);
             Function*     pCvtPh2Ps = cast<Function>(
-#if LLVM_VERSION_MAJOR >= 9
-                JM()->mpCurrentModule->getOrInsertFunction("ConvertFloat16ToFloat32", pFuncTy).getCallee());
-#else
                 JM()->mpCurrentModule->getOrInsertFunction("ConvertFloat16ToFloat32", pFuncTy));
-#endif
 
             if (sys::DynamicLibrary::SearchForAddressOfSymbol("ConvertFloat16ToFloat32") == nullptr)
             {
@@ -658,11 +650,7 @@ namespace SwrJit
             // call scalar C function for now
             FunctionType* pFuncTy   = FunctionType::get(mInt16Ty, mFP32Ty);
             Function*     pCvtPs2Ph = cast<Function>(
-#if LLVM_VERSION_MAJOR >= 9
-                JM()->mpCurrentModule->getOrInsertFunction("ConvertFloat32ToFloat16", pFuncTy).getCallee());
-#else
                 JM()->mpCurrentModule->getOrInsertFunction("ConvertFloat32ToFloat16", pFuncTy));
-#endif
 
             if (sys::DynamicLibrary::SearchForAddressOfSymbol("ConvertFloat32ToFloat16") == nullptr)
             {
@@ -786,6 +774,14 @@ namespace SwrJit
     {
         SWR_ASSERT((numIntBits + numFracBits) <= 32, "Can only handle 32-bit fixed-point values");
         Value* fixed = nullptr;
+#if 0
+        // This doesn't work for negative numbers!!
+        {
+            fixed = FP_TO_SI(VROUND(FMUL(vFloat, VIMMED1(float(1 << numFracBits))),
+                                    C(_MM_FROUND_TO_NEAREST_INT)),
+                             mSimdInt32Ty);
+        }
+#else
         {
             // Do round to nearest int on fractional bits first
             // Not entirely perfect for negative numbers, but close enough
@@ -808,7 +804,7 @@ namespace SwrJit
 
             fixed = ASHR(vFixed, vExtraBits, name);
         }
-
+#endif
         return fixed;
     }
 
@@ -849,6 +845,7 @@ namespace SwrJit
     {
         SWR_ASSERT((numIntBits + numFracBits) <= 32, "Can only handle 32-bit fixed-point values");
         Value* fixed = nullptr;
+#if 1
         // KNOB_SIM_FAST_MATH?  Below works correctly from a precision
         // standpoint...
         {
@@ -856,6 +853,28 @@ namespace SwrJit
                                     C(_MM_FROUND_TO_NEAREST_INT)),
                              mSimdInt32Ty);
         }
+#else
+        {
+            // Do round to nearest int on fractional bits first
+            vFloat = VROUND(FMUL(vFloat, VIMMED1(float(1 << numFracBits))),
+                            C(_MM_FROUND_TO_NEAREST_INT));
+            vFloat = FMUL(vFloat, VIMMED1(1.0f / float(1 << numFracBits)));
+
+            // TODO: Handle INF, NAN, overflow / underflow, etc.
+
+            Value* vSgn      = FCMP_OLT(vFloat, VIMMED1(0.0f));
+            Value* vFloatInt = BITCAST(vFloat, mSimdInt32Ty);
+            Value* vFixed    = AND(vFloatInt, VIMMED1((1 << 23) - 1));
+            vFixed           = OR(vFixed, VIMMED1(1 << 23));
+
+            Value* vExp = LSHR(SHL(vFloatInt, VIMMED1(1)), VIMMED1(24));
+            vExp        = SUB(vExp, VIMMED1(127));
+
+            Value* vExtraBits = SUB(VIMMED1(23 - numFracBits), vExp);
+
+            fixed = LSHR(vFixed, vExtraBits, name);
+        }
+#endif
         return fixed;
     }
 
@@ -940,11 +959,7 @@ namespace SwrJit
 
             FunctionType* pFuncTy = FunctionType::get(Type::getVoidTy(JM()->mContext), args, false);
             Function*     pFunc   = cast<Function>(
-#if LLVM_VERSION_MAJOR >= 9
-                JM()->mpCurrentModule->getOrInsertFunction("BucketManager_StartBucket", pFuncTy).getCallee());
-#else
                 JM()->mpCurrentModule->getOrInsertFunction("BucketManager_StartBucket", pFuncTy));
-#endif
             if (sys::DynamicLibrary::SearchForAddressOfSymbol("BucketManager_StartBucket") ==
                 nullptr)
             {
@@ -969,11 +984,7 @@ namespace SwrJit
 
             FunctionType* pFuncTy = FunctionType::get(Type::getVoidTy(JM()->mContext), args, false);
             Function*     pFunc   = cast<Function>(
-#if LLVM_VERSION_MAJOR >=9
-                JM()->mpCurrentModule->getOrInsertFunction("BucketManager_StopBucket", pFuncTy).getCallee());
-#else
                 JM()->mpCurrentModule->getOrInsertFunction("BucketManager_StopBucket", pFuncTy));
-#endif
             if (sys::DynamicLibrary::SearchForAddressOfSymbol("BucketManager_StopBucket") ==
                 nullptr)
             {
index 2e99bb7a5d5cd0318de41d8d5572cc9957d276e1..43e2c4492010abfc7800b4d1fa3b3158ce79698a 100644 (file)
@@ -263,15 +263,12 @@ struct StreamOutJit : public BuilderGfxMem
                                  std::ios_base::in | std::ios_base::out | std::ios_base::ate);
         fnName << ComputeCRC(0, &state, sizeof(state));
 
-        // SO function signature
-        // typedef void(__cdecl *PFN_SO_FUNC)(SimDrawContext, SWR_STREAMOUT_CONTEXT*)
-
         Type* typeParam0;
         typeParam0 = mInt8PtrTy;
 
         std::vector<Type*> args{
-            typeParam0,
-            PointerType::get(Gen_SWR_STREAMOUT_CONTEXT(JM()), 0), // SWR_STREAMOUT_CONTEXT*
+                            typeParam0,
+                            PointerType::get(Gen_SWR_STREAMOUT_CONTEXT(JM()), 0), // SWR_STREAMOUT_CONTEXT*
         };
 
         FunctionType* fTy    = FunctionType::get(IRB()->getVoidTy(), args, false);
index bff96e17f432e1b8171d060846c854c144a9fdf5..3a19bbac70e969a961d7b3f7249f4e57a463a5df 100644 (file)
 * @brief Provide access to tiles table initialization functions
 *
 ******************************************************************************/
+
 #include "memory/InitMemory.h"
+#include "memory/LoadTile.h"
+#include "memory/StoreTile.h"
+#include "InitMemory.h"
 
 void InitSimLoadTilesTable();
 void InitSimStoreTilesTable();
@@ -37,3 +41,10 @@ void InitTilesTable()
     InitSimStoreTilesTable();
     InitSimClearTilesTable();
 }
+
+
+void SwrGetTileIterface(SWR_TILE_INTERFACE &out_funcs)
+{
+    out_funcs.pfnSwrLoadHotTile = SwrLoadHotTile;
+    out_funcs.pfnSwrStoreHotTileToSurface = SwrStoreHotTileToSurface;
+}
\ No newline at end of file
index 14cca6ab3245c67697913b0a92ad3aa9c7416a38..6838ddc701d13504c934025dad3e230b05d09581 100644 (file)
 * @brief Provide access to tiles table initialization functions
 *
 ******************************************************************************/
+
+#pragma once
+
 #include "common/os.h"
+#include "memory/SurfaceState.h"
+
+//////////////////////////////////////////////////////////////////////////
+/// @brief Loads a full hottile from a render surface
+/// @param hPrivateContext - Handle to private DC
+/// @param dstFormat - Format for hot tile.
+/// @param renderTargetIndex - Index to src render target
+/// @param x, y - Coordinates to raster tile.
+/// @param pDstHotTile - Pointer to Hot Tile
+SWR_FUNC(void,
+         SwrLoadHotTile,
+         HANDLE                      hWorkerPrivateData,
+         const SWR_SURFACE_STATE*    pSrcSurface,
+         SWR_FORMAT                  dstFormat,
+         SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+         uint32_t                    x,
+         uint32_t                    y,
+         uint32_t                    renderTargetArrayIndex,
+         uint8_t*                    pDstHotTile);
+
+//////////////////////////////////////////////////////////////////////////
+/// @brief Deswizzles and stores a full hottile to a render surface
+/// @param hPrivateContext - Handle to private DC
+/// @param srcFormat - Format for hot tile.
+/// @param renderTargetIndex - Index to destination render target
+/// @param x, y - Coordinates to raster tile.
+/// @param pSrcHotTile - Pointer to Hot Tile
+SWR_FUNC(void,
+         SwrStoreHotTileToSurface,
+         HANDLE                      hWorkerPrivateData,
+         SWR_SURFACE_STATE*          pDstSurface,
+         SWR_FORMAT                  srcFormat,
+         SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+         uint32_t                    x,
+         uint32_t                    y,
+         uint32_t                    renderTargetArrayIndex,
+         uint8_t*                    pSrcHotTile);
+
+struct SWR_TILE_INTERFACE {
+    PFNSwrLoadHotTile           pfnSwrLoadHotTile;
+    PFNSwrStoreHotTileToSurface pfnSwrStoreHotTileToSurface;
+};
 
 extern "C"
 {
     SWR_VISIBLE void SWR_API InitTilesTable();
+
+    typedef void(SWR_API* PFNSwrGetTileInterface)(SWR_TILE_INTERFACE& out_funcs);
+    SWR_VISIBLE void SWR_API SwrGetTileIterface(SWR_TILE_INTERFACE &out_funcs);
 }
index d85a3353526258e5148c04f60ca0fa5e30bf41ce..37be28c5ec7700c3e6cd6b2247f9f6e2c683bb0c 100644 (file)
@@ -336,3 +336,18 @@ static INLINE void InitLoadTileDepthTable(PFN_LOAD_TILES(&table)[NUM_SWR_FORMATS
    table[R16_UNORM]                       = LoadMacroTile<TilingTraits<TTileMode, 16>, R16_UNORM, R32_FLOAT>::Load;
 }
 
+
+//////////////////////////////////////////////////////////////////////////
+/// @brief Loads a full hottile from a render surface
+/// @param hPrivateContext - Handle to private DC
+/// @param dstFormat - Format for hot tile.
+/// @param renderTargetIndex - Index to src render target
+/// @param x, y - Coordinates to raster tile.
+/// @param pDstHotTile - Pointer to Hot Tile
+void SwrLoadHotTile(
+        HANDLE hWorkerPrivateData,
+        const SWR_SURFACE_STATE *pSrcSurface,
+        SWR_FORMAT dstFormat,
+        SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+        uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
+        uint8_t *pDstHotTile);
\ No newline at end of file
index 02c6df0e07581b63237165b23ed13a4cd6ba818d..9b7f5aa3efc1f2d1b46a9e2650d153ec010f5638 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "memory/TilingFunctions.h"
 #include "memory/Convert.h"
+#include "memory/SurfaceState.h"
 #include "core/multisample.h"
 
 #include <array>
@@ -2031,3 +2032,19 @@ void InitStoreTilesTableStencil(
 {
     table[TTileMode][R8_UINT]                       = StoreMacroTile<TilingTraits<TTileMode, 8>, R8_UINT, R8_UINT>::Store;
 }
+
+
+//////////////////////////////////////////////////////////////////////////
+/// @brief Deswizzles and stores a full hottile to a render surface
+/// @param hPrivateContext - Handle to private DC
+/// @param srcFormat - Format for hot tile.
+/// @param renderTargetIndex - Index to destination render target
+/// @param x, y - Coordinates to raster tile.
+/// @param pSrcHotTile - Pointer to Hot Tile
+void SwrStoreHotTileToSurface(
+        HANDLE hWorkerPrivateData,
+        SWR_SURFACE_STATE *pDstSurface,
+        SWR_FORMAT srcFormat,
+        SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
+        uint32_t x, uint32_t y, uint32_t renderTargetArrayIndex,
+        uint8_t *pSrcHotTile);
\ No newline at end of file
diff --git a/src/gallium/drivers/swr/rasterizer/memory/SurfaceState.h b/src/gallium/drivers/swr/rasterizer/memory/SurfaceState.h
new file mode 100644 (file)
index 0000000..6b1b78e
--- /dev/null
@@ -0,0 +1,66 @@
+/****************************************************************************
+* Copyright (C) 2014-2019 Intel Corporation.   All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+* IN THE SOFTWARE.
+* 
+* @file SurfaceState.h
+* 
+* @brief Common definitions for surface state
+* 
+******************************************************************************/
+#pragma once
+
+#include "core/state.h"
+
+//////////////////////////////////////////////////////////////////////////
+/// SWR_SURFACE_STATE
+//////////////////////////////////////////////////////////////////////////
+struct SWR_SURFACE_STATE
+{
+    gfxptr_t         xpBaseAddress;
+    SWR_SURFACE_TYPE type;   // @llvm_enum
+    SWR_FORMAT       format; // @llvm_enum
+    uint32_t         width;
+    uint32_t         height;
+    uint32_t         depth;
+    uint32_t         numSamples;
+    uint32_t         samplePattern;
+    uint32_t         pitch;
+    uint32_t         qpitch;
+    uint32_t minLod; // for sampled surfaces, the most detailed LOD that can be accessed by sampler
+    uint32_t maxLod; // for sampled surfaces, the max LOD that can be accessed
+    float    resourceMinLod; // for sampled surfaces, the most detailed fractional mip that can be
+    // accessed by sampler
+    uint32_t lod;            // for render targets, the lod being rendered to
+    uint32_t arrayIndex; // for render targets, the array index being rendered to for arrayed surfaces
+    SWR_TILE_MODE tileMode; // @llvm_enum
+    uint32_t      halign;
+    uint32_t      valign;
+    uint32_t      xOffset;
+    uint32_t      yOffset;
+
+    uint32_t lodOffsets[2][15]; // lod offsets for sampled surfaces
+
+    gfxptr_t     xpAuxBaseAddress; // Used for compression, append/consume counter, etc.
+    SWR_AUX_MODE auxMode;          // @llvm_enum
+
+
+    bool bInterleavedSamples; // are MSAA samples stored interleaved or planar
+};
\ No newline at end of file
index cd29550691dfdbf4104729b61f84a3608ff9964c..90143718eb83ccb08808300ed5b89ebcdd0177fb 100644 (file)
@@ -30,6 +30,7 @@
 #include "core/state.h"
 #include "core/format_traits.h"
 #include "memory/tilingtraits.h"
+#include "memory/SurfaceState.h"
 
 #include <algorithm>
 
index ea3ab6a657d972a6ff6e5b52382025eb8635fbec..8a1ef95c2c658b348faf08db2229e184c2a4799b 100644 (file)
@@ -480,7 +480,9 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
    memset(ctx, 0, sizeof(struct swr_context));
 
    swr_screen(p_screen)->pfnSwrGetInterface(ctx->api);
+   swr_screen(p_screen)->pfnSwrGetTileInterface(ctx->tileApi);
    ctx->swrDC.pAPI = &ctx->api;
+   ctx->swrDC.pTileAPI = &ctx->tileApi;
 
    ctx->blendJIT =
       new std::unordered_map<BLEND_COMPILE_STATE, PFN_BLEND_JIT_FUNC>;
@@ -492,7 +494,6 @@ swr_create_context(struct pipe_screen *p_screen, void *priv, unsigned flags)
    createInfo.privateStateSize = sizeof(swr_draw_context);
    createInfo.pfnLoadTile = swr_LoadHotTile;
    createInfo.pfnStoreTile = swr_StoreHotTile;
-   createInfo.pfnClearTile = swr_StoreHotTileClear;
    createInfo.pfnUpdateStats = swr_UpdateStats;
    createInfo.pfnUpdateStatsFE = swr_UpdateStatsFE;
    createInfo.pfnMakeGfxPtr = swr_MakeGfxPtr;
index b207c02ca8a001142a5bb79ed8599bb4bf487392..3b83458b947b6f8a58a267ad0906cd9c12773a76 100644 (file)
@@ -29,6 +29,8 @@
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "util/u_blitter.h"
+#include "rasterizer/memory/SurfaceState.h"
+#include "rasterizer/memory/InitMemory.h"
 #include "jit_api.h"
 #include "swr_state.h"
 #include <unordered_map>
@@ -104,6 +106,7 @@ struct swr_draw_context {
    SWR_SURFACE_STATE renderTargets[SWR_NUM_ATTACHMENTS];
    struct swr_query_result *pStats; // @llvm_struct
    SWR_INTERFACE *pAPI; // @llvm_struct - Needed for the swr_memory callbacks
+   SWR_TILE_INTERFACE *pTileAPI; // @llvm_struct - Needed for the swr_memory callbacks
 };
 
 /* gen_llvm_types FINI */
@@ -173,6 +176,7 @@ struct swr_context {
    unsigned dirty; /**< Mask of SWR_NEW_x flags */
 
    SWR_INTERFACE api;
+   SWR_TILE_INTERFACE tileApi;
 
    uint32_t max_draws_in_flight;
 };
index c5b2e294ef7ef5ae0671a9192fb2e8c85f594f44..f597b5015e46c14ee4fb84ccf93055e5c02c7567 100644 (file)
@@ -36,6 +36,7 @@ swr_initialize_screen_interface(struct swr_screen *screen, const char arch[])
 #ifdef HAVE_SWR_BUILTIN
    screen->pLibrary = NULL;
    screen->pfnSwrGetInterface = SwrGetInterface;
+   screen->pfnSwrGetInterface = SwrGetTileInterface;
    InitTilesTable();
    fprintf(stderr, "(using: builtin).\n");
 #else
@@ -50,9 +51,11 @@ swr_initialize_screen_interface(struct swr_screen *screen, const char arch[])
 
    util_dl_proc pApiProc = util_dl_get_proc_address(screen->pLibrary,
       "SwrGetInterface");
+   util_dl_proc pTileApiProc = util_dl_get_proc_address(screen->pLibrary,
+      "SwrGetTileIterface");
    util_dl_proc pInitFunc = util_dl_get_proc_address(screen->pLibrary,
       "InitTilesTable");
-   if (!pApiProc || !pInitFunc) {
+   if (!pApiProc || !pInitFunc || !pTileApiProc) {
       fprintf(stderr, "(skipping: %s).\n", util_dl_error());
       util_dl_close(screen->pLibrary);
       screen->pLibrary = NULL;
@@ -60,6 +63,12 @@ swr_initialize_screen_interface(struct swr_screen *screen, const char arch[])
    }
 
    screen->pfnSwrGetInterface = (PFNSwrGetInterface)pApiProc;
+   screen->pfnSwrGetTileInterface = (PFNSwrGetTileInterface)pTileApiProc;
+
+   SWR_ASSERT(screen->pfnSwrGetInterface != nullptr);
+   SWR_ASSERT(screen->pfnSwrGetTileInterface != nullptr);
+   SWR_ASSERT(pInitFunc != nullptr);
+
    pInitFunc();
 
    fprintf(stderr, "(using: %s).\n", filename);
index 7ccbf5a549780a968a7634df109c63b07f3c12a7..c7c05fb7c65ae8f3da8cf617575932bdb4b36812 100644 (file)
@@ -35,7 +35,7 @@ swr_LoadHotTile(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pSrcSurface = &pDC->renderTargets[renderTargetIndex];
 
-   pDC->pAPI->pfnSwrLoadHotTile(hWorkerPrivateData, pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
+   pDC->pTileAPI->pfnSwrLoadHotTile(hWorkerPrivateData, pSrcSurface, dstFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pDstHotTile);
 }
 
 INLINE void
@@ -50,23 +50,7 @@ swr_StoreHotTile(HANDLE hPrivateContext,
    swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
    SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
 
-   pDC->pAPI->pfnSwrStoreHotTileToSurface(hWorkerPrivateData, pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
-}
-
-INLINE void
-swr_StoreHotTileClear(HANDLE hPrivateContext,
-                      HANDLE hWorkerPrivateData,
-                      SWR_RENDERTARGET_ATTACHMENT renderTargetIndex,
-                      UINT x,
-                      UINT y,
-                      uint32_t renderTargetArrayIndex,
-                      const float* pClearColor)
-{
-   // Grab destination surface state from private context
-   swr_draw_context *pDC = (swr_draw_context*)hPrivateContext;
-   SWR_SURFACE_STATE *pDstSurface = &pDC->renderTargets[renderTargetIndex];
-
-   pDC->pAPI->pfnSwrStoreHotTileClear(hWorkerPrivateData, pDstSurface, renderTargetIndex, x, y, renderTargetArrayIndex, pClearColor);
+   pDC->pTileAPI->pfnSwrStoreHotTileToSurface(hWorkerPrivateData, pDstSurface, srcFormat, renderTargetIndex, x, y, renderTargetArrayIndex, pSrcHotTile);
 }
 
 INLINE gfxptr_t
index 12694332addd590f20bf2a893a8b24876f9d2115..63327d6bd3542c756fa11ce55a5b4277da7f4513 100644 (file)
@@ -24,6 +24,7 @@
 #ifndef SWR_RESOURCE_H
 #define SWR_RESOURCE_H
 
+#include "memory/SurfaceState.h"
 #include "pipe/p_state.h"
 #include "api.h"
 
index b80d8c70ec97a913cf0155644d02a396461d7f5a..51826a8af12940c4836c4c5d3ae69d5884d37eac 100644 (file)
@@ -33,6 +33,7 @@
 #include "api.h"
 
 #include "memory/TilingFunctions.h"
+#include "memory/InitMemory.h"
 
 struct sw_winsys;
 
@@ -54,6 +55,7 @@ struct swr_screen {
    /* Dynamic backend implementations */
    util_dl_library *pLibrary;
    PFNSwrGetInterface pfnSwrGetInterface;
+   PFNSwrGetTileInterface pfnSwrGetTileInterface;
 
    /* Do we run on Xeon Phi? */
    bool is_knl;
index 3f5a3688b0beef36906580cafb906d175b0d440f..f3492bd429ca9ca128bb7f5f8db123813f404183 100644 (file)
@@ -44,6 +44,7 @@
 #include "gallivm/lp_bld_tgsi.h"
 
 #include "swr_context.h"
+#include "gen_surf_state_llvm.h"
 #include "gen_swr_context_llvm.h"
 #include "swr_resource.h"
 #include "swr_state.h"
index 42b3fe4d68d9471caa096e971897b78a290cf2db..f33f96c18400beb6a2986636dd2fee67f2f770f3 100644 (file)
@@ -45,6 +45,7 @@
 
 #include "swr_state.h"
 #include "swr_context.h"
+#include "gen_surf_state_llvm.h"
 #include "gen_swr_context_llvm.h"
 #include "swr_screen.h"
 #include "swr_resource.h"
index f1ac41b0895920467a52f15ff5c54e9de5bfe94a..fb9d8ed22c096c62a23c91ea16465eefb351673d 100644 (file)
@@ -58,6 +58,7 @@
 #include "util/u_memory.h"
 
 #include "swr_tex_sample.h"
+#include "gen_surf_state_llvm.h"
 #include "gen_swr_context_llvm.h"
 
 using namespace SwrJit;