swr/rasterizer: Adding support for unhandled clipEnable state
authorJan Zielinski <jan.zielinski@intel.com>
Tue, 23 Jul 2019 08:30:47 +0000 (10:30 +0200)
committerJan Zielinski <jan.zielinski@intel.com>
Tue, 23 Jul 2019 19:55:09 +0000 (21:55 +0200)
Clipping is not correctly handled by the rasterizer - fixing this.

Reviewed-by: Alok Hota <alok.hota@intel.com>
src/gallium/drivers/swr/rasterizer/core/api.cpp
src/gallium/drivers/swr/rasterizer/core/state.h
src/gallium/drivers/swr/swr_state.cpp

index 228e85a25c907ac101a023be1ae66db977ca3be5..f9b86cfbb8de4f75afb46e26b9e9479379cf0e3a 100644 (file)
@@ -904,8 +904,8 @@ void SetupPipeline(DRAW_CONTEXT* pDC)
     };
 
 
-    // Disable clipper if viewport transform is disabled
-    if (pState->state.frontendState.vpTransformDisable)
+    // Disable clipper if viewport transform is disabled or if clipper is disabled
+    if (pState->state.frontendState.vpTransformDisable || !pState->state.rastState.clipEnable)
     {
         pState->pfnProcessPrims = pfnBinner;
 #if USE_SIMD16_FRONTEND
index 3731c41c4e4d2d98fafb79e6e1fa82cf2aa020d0..e85144c258277b069e85e75acc15e662e678e53a 100644 (file)
@@ -1050,6 +1050,7 @@ struct SWR_RASTSTATE
     uint32_t frontWinding : 1;
     uint32_t scissorEnable : 1;
     uint32_t depthClipEnable : 1;
+    uint32_t clipEnable : 1;
     uint32_t clipHalfZ : 1;
     uint32_t pointParam : 1;
     uint32_t pointSpriteEnable : 1;
index c21e08b4a5a16a1e4832cf2ed672ec4fb7031097..84c67597c4679f8199d364dae93af9d9b0d6ecde 100644 (file)
@@ -24,6 +24,8 @@
 // llvm redefines DEBUG
 #pragma push_macro("DEBUG")
 #undef DEBUG
+
+#include <rasterizer/core/state.h>
 #include "JitManager.h"
 #pragma pop_macro("DEBUG")
 
@@ -1198,6 +1200,7 @@ swr_update_derived(struct pipe_context *pipe,
          rastState->depthFormat = swr_resource(zb->texture)->swr.format;
 
       rastState->depthClipEnable = rasterizer->depth_clip_near;
+      rastState->clipEnable = rasterizer->depth_clip_near | rasterizer->depth_clip_far;
       rastState->clipHalfZ = rasterizer->clip_halfz;
 
       ctx->api.pfnSwrSetRastState(ctx->swrContext, rastState);
@@ -1272,8 +1275,8 @@ swr_update_derived(struct pipe_context *pipe,
       /* vertex buffers */
       SWR_VERTEX_BUFFER_STATE swrVertexBuffers[PIPE_MAX_ATTRIBS];
       for (UINT i = 0; i < ctx->num_vertex_buffers; i++) {
-         uint32_t size, pitch, elems, partial_inbounds;
-         uint32_t min_vertex_index;
+         uint32_t size = 0, pitch = 0, elems = 0, partial_inbounds = 0;
+         uint32_t min_vertex_index = 0;
          const uint8_t *p_data;
          struct pipe_vertex_buffer *vb = &ctx->vertex_buffer[i];