From 6f7306c029a7ebe776b513a157b939c866f4d240 Mon Sep 17 00:00:00 2001 From: Jan Zielinski Date: Wed, 17 Jul 2019 17:22:16 +0200 Subject: [PATCH] swr/rast: Refactor memory API between rasterizer core and swr This commit cleans up API between the core of the rasterizer and swr. Some formatting changes are also done. Reviewed-by: Alok Hota --- src/gallium/drivers/swr/SConscript | 10 ++ src/gallium/drivers/swr/meson.build | 3 + .../drivers/swr/rasterizer/_clang-format | 114 ++++++++++++++++++ .../swr/rasterizer/codegen/meson.build | 3 +- .../codegen/templates/gen_builder.hpp | 4 - .../drivers/swr/rasterizer/core/api.cpp | 20 ++- src/gallium/drivers/swr/rasterizer/core/api.h | 88 +++----------- .../swr/rasterizer/core/backend_impl.h | 1 - .../swr/rasterizer/core/backend_sample.cpp | 1 - .../rasterizer/core/backend_singlesample.cpp | 1 - .../drivers/swr/rasterizer/core/context.h | 1 - .../swr/rasterizer/core/format_conversion.h | 4 +- .../drivers/swr/rasterizer/core/state.h | 43 ------- .../swr/rasterizer/jitter/builder_misc.cpp | 53 ++++---- .../swr/rasterizer/jitter/streamout_jit.cpp | 7 +- .../swr/rasterizer/memory/InitMemory.cpp | 11 ++ .../swr/rasterizer/memory/InitMemory.h | 48 ++++++++ .../drivers/swr/rasterizer/memory/LoadTile.h | 15 +++ .../drivers/swr/rasterizer/memory/StoreTile.h | 17 +++ .../swr/rasterizer/memory/SurfaceState.h | 66 ++++++++++ .../swr/rasterizer/memory/TilingFunctions.h | 1 + src/gallium/drivers/swr/swr_context.cpp | 3 +- src/gallium/drivers/swr/swr_context.h | 4 + src/gallium/drivers/swr/swr_loader.cpp | 11 +- src/gallium/drivers/swr/swr_memory.h | 20 +-- src/gallium/drivers/swr/swr_resource.h | 1 + src/gallium/drivers/swr/swr_screen.h | 2 + src/gallium/drivers/swr/swr_shader.cpp | 1 + src/gallium/drivers/swr/swr_state.cpp | 1 + src/gallium/drivers/swr/swr_tex_sample.cpp | 1 + 30 files changed, 370 insertions(+), 185 deletions(-) create mode 100644 src/gallium/drivers/swr/rasterizer/_clang-format create mode 100644 src/gallium/drivers/swr/rasterizer/memory/SurfaceState.h diff --git a/src/gallium/drivers/swr/SConscript b/src/gallium/drivers/swr/SConscript index b0bead242f7..2236b1aa5de 100644 --- a/src/gallium/drivers/swr/SConscript +++ b/src/gallium/drivers/swr/SConscript @@ -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', diff --git a/src/gallium/drivers/swr/meson.build b/src/gallium/drivers/swr/meson.build index 3f32d031e14..9e07724d5dc 100644 --- a/src/gallium/drivers/swr/meson.build +++ b/src/gallium/drivers/swr/meson.build @@ -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 index 00000000000..ed4b9b409d8 --- /dev/null +++ b/src/gallium/drivers/swr/rasterizer/_clang-format @@ -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 +... diff --git a/src/gallium/drivers/swr/rasterizer/codegen/meson.build b/src/gallium/drivers/swr/rasterizer/codegen/meson.build index 98da7d3fc61..daf79ed4c26 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/meson.build +++ b/src/gallium/drivers/swr/rasterizer/codegen/meson.build @@ -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]], diff --git a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp index a59fb10902b..5182bc4259f 100644 --- a/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp +++ b/src/gallium/drivers/swr/rasterizer/codegen/templates/gen_builder.hpp @@ -50,11 +50,7 @@ ${func['decl']} %else: FunctionType* pFuncTy = FunctionType::get(${ func['returnType'] }, {}, false); %endif: -#if LLVM_VERSION_MAJOR >= 9 - Function* pFunc = cast(JM()->mpCurrentModule->getOrInsertFunction("meta.intrinsic.${func['name']}", pFuncTy).getCallee()); -#else Function* pFunc = cast(JM()->mpCurrentModule->getOrInsertFunction("meta.intrinsic.${func['name']}", pFuncTy)); -#endif return CALL(pFunc, std::initializer_list{${argList}}, name); %elif isIntrin: %if len(func['types']) != 0: diff --git a/src/gallium/drivers/swr/rasterizer/core/api.cpp b/src/gallium/drivers/swr/rasterizer/core/api.cpp index 04eabc4d468..228e85a25c9 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/api.cpp @@ -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; } diff --git a/src/gallium/drivers/swr/rasterizer/core/api.h b/src/gallium/drivers/swr/rasterizer/core/api.h index e31e0446ba6..c842859ba32 100644 --- a/src/gallium/drivers/swr/rasterizer/core/api.h +++ b/src/gallium/drivers/swr/rasterizer/core/api.h @@ -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" { diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h index b3de4e3e4e9..83d662bd9a7 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend_impl.h +++ b/src/gallium/drivers/swr/rasterizer/core/backend_impl.h @@ -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)) diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp b/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp index 03152bb0cf7..9b0b80f766f 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/backend_sample.cpp @@ -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) { diff --git a/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp b/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp index fe76d50fbfa..46aabcdf34b 100644 --- a/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp +++ b/src/gallium/drivers/swr/rasterizer/core/backend_singlesample.cpp @@ -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; diff --git a/src/gallium/drivers/swr/rasterizer/core/context.h b/src/gallium/drivers/swr/rasterizer/core/context.h index a8182559791..8849e60c91f 100644 --- a/src/gallium/drivers/swr/rasterizer/core/context.h +++ b/src/gallium/drivers/swr/rasterizer/core/context.h @@ -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; diff --git a/src/gallium/drivers/swr/rasterizer/core/format_conversion.h b/src/gallium/drivers/swr/rasterizer/core/format_conversion.h index 247ba0b0dcd..ce908099e33 100644 --- a/src/gallium/drivers/swr/rasterizer/core/format_conversion.h +++ b/src/gallium/drivers/swr/rasterizer/core/format_conversion.h @@ -139,7 +139,7 @@ INLINE Float SIMDCALL Clamp(Float const& v, uint32_t Component) } template -INLINE simdscalar SIMDCALL Clamp(simdscalar const& v, uint32_t Component) +INLINE simd16scalar SIMDCALL Clamp(simdscalar const& v, uint32_t Component) { return Clamp(v, Component); } @@ -168,7 +168,7 @@ INLINE Float SIMDCALL Normalize(Float const& vComp, uint32_t Com } template -INLINE simdscalar SIMDCALL Normalize(simdscalar const& vComp, uint32_t Component) +INLINE simd16scalar SIMDCALL Normalize(simdscalar const& vComp, uint32_t Component) { return Normalize(vComp, Component); } diff --git a/src/gallium/drivers/swr/rasterizer/core/state.h b/src/gallium/drivers/swr/rasterizer/core/state.h index a4d5e873d51..3731c41c4e4 100644 --- a/src/gallium/drivers/swr/rasterizer/core/state.h +++ b/src/gallium/drivers/swr/rasterizer/core/state.h @@ -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 diff --git a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp index 93a30b2cb45..ed6cac04d01 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/builder_misc.cpp @@ -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(JM()->mpCurrentModule->getOrInsertFunction("CallPrint", callPrintTy).getCallee()); -#else cast(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( -#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( -#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( -#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( -#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) { diff --git a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp index 2e99bb7a5d5..43e2c449201 100644 --- a/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp +++ b/src/gallium/drivers/swr/rasterizer/jitter/streamout_jit.cpp @@ -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 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); diff --git a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp index bff96e17f43..3a19bbac70e 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp +++ b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.cpp @@ -25,7 +25,11 @@ * @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 diff --git a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h index 14cca6ab324..6838ddc701d 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h +++ b/src/gallium/drivers/swr/rasterizer/memory/InitMemory.h @@ -25,9 +25,57 @@ * @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); } diff --git a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h index d85a3353526..37be28c5ec7 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h +++ b/src/gallium/drivers/swr/rasterizer/memory/LoadTile.h @@ -336,3 +336,18 @@ static INLINE void InitLoadTileDepthTable(PFN_LOAD_TILES(&table)[NUM_SWR_FORMATS table[R16_UNORM] = LoadMacroTile, 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 diff --git a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h index 02c6df0e075..9b7f5aa3efc 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h +++ b/src/gallium/drivers/swr/rasterizer/memory/StoreTile.h @@ -35,6 +35,7 @@ #include "memory/TilingFunctions.h" #include "memory/Convert.h" +#include "memory/SurfaceState.h" #include "core/multisample.h" #include @@ -2031,3 +2032,19 @@ void InitStoreTilesTableStencil( { table[TTileMode][R8_UINT] = StoreMacroTile, 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 index 00000000000..6b1b78eee46 --- /dev/null +++ b/src/gallium/drivers/swr/rasterizer/memory/SurfaceState.h @@ -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 diff --git a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h index cd29550691d..90143718eb8 100644 --- a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h +++ b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h @@ -30,6 +30,7 @@ #include "core/state.h" #include "core/format_traits.h" #include "memory/tilingtraits.h" +#include "memory/SurfaceState.h" #include diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp index ea3ab6a657d..8a1ef95c2c6 100644 --- a/src/gallium/drivers/swr/swr_context.cpp +++ b/src/gallium/drivers/swr/swr_context.cpp @@ -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; @@ -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; diff --git a/src/gallium/drivers/swr/swr_context.h b/src/gallium/drivers/swr/swr_context.h index b207c02ca8a..3b83458b947 100644 --- a/src/gallium/drivers/swr/swr_context.h +++ b/src/gallium/drivers/swr/swr_context.h @@ -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 @@ -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; }; diff --git a/src/gallium/drivers/swr/swr_loader.cpp b/src/gallium/drivers/swr/swr_loader.cpp index c5b2e294ef7..f597b5015e4 100644 --- a/src/gallium/drivers/swr/swr_loader.cpp +++ b/src/gallium/drivers/swr/swr_loader.cpp @@ -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); diff --git a/src/gallium/drivers/swr/swr_memory.h b/src/gallium/drivers/swr/swr_memory.h index 7ccbf5a5497..c7c05fb7c65 100644 --- a/src/gallium/drivers/swr/swr_memory.h +++ b/src/gallium/drivers/swr/swr_memory.h @@ -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 diff --git a/src/gallium/drivers/swr/swr_resource.h b/src/gallium/drivers/swr/swr_resource.h index 12694332add..63327d6bd35 100644 --- a/src/gallium/drivers/swr/swr_resource.h +++ b/src/gallium/drivers/swr/swr_resource.h @@ -24,6 +24,7 @@ #ifndef SWR_RESOURCE_H #define SWR_RESOURCE_H +#include "memory/SurfaceState.h" #include "pipe/p_state.h" #include "api.h" diff --git a/src/gallium/drivers/swr/swr_screen.h b/src/gallium/drivers/swr/swr_screen.h index b80d8c70ec9..51826a8af12 100644 --- a/src/gallium/drivers/swr/swr_screen.h +++ b/src/gallium/drivers/swr/swr_screen.h @@ -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; diff --git a/src/gallium/drivers/swr/swr_shader.cpp b/src/gallium/drivers/swr/swr_shader.cpp index 3f5a3688b0b..f3492bd429c 100644 --- a/src/gallium/drivers/swr/swr_shader.cpp +++ b/src/gallium/drivers/swr/swr_shader.cpp @@ -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" diff --git a/src/gallium/drivers/swr/swr_state.cpp b/src/gallium/drivers/swr/swr_state.cpp index 42b3fe4d68d..f33f96c1840 100644 --- a/src/gallium/drivers/swr/swr_state.cpp +++ b/src/gallium/drivers/swr/swr_state.cpp @@ -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" diff --git a/src/gallium/drivers/swr/swr_tex_sample.cpp b/src/gallium/drivers/swr/swr_tex_sample.cpp index f1ac41b0895..fb9d8ed22c0 100644 --- a/src/gallium/drivers/swr/swr_tex_sample.cpp +++ b/src/gallium/drivers/swr/swr_tex_sample.cpp @@ -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; -- 2.30.2