st: add support for INTEL_blackhole_render
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Thu, 5 Dec 2019 12:46:51 +0000 (14:46 +0200)
committerMarge Bot <eric+marge@anholt.net>
Thu, 13 Feb 2020 17:05:05 +0000 (17:05 +0000)
Adding a new CSO proved to be fairly difficult especially because this
extension affect draw/dispatch/blit alike.

Instead this change passes the state of the noop into the entry points
emitting the operations affected.

v2: Fix assert in default pipe caps

v3: Drop whitespace changes (Ken)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2964>

src/gallium/auxiliary/util/u_screen.c
src/gallium/include/pipe/p_context.h
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_extensions.c

index 785d1bd3e24a52b02ceb5bddc558ea6f7b86d32b..821bb16d5394988e96b7ed8176ada7a0243113b5 100644 (file)
@@ -408,6 +408,10 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
    case PIPE_CAP_INTEGER_MULTIPLY_32X16:
       return 0;
 
+   case PIPE_CAP_FRONTEND_NOOP:
+      /* Enables INTEL_blackhole_render */
+      return 0;
+
    default:
       unreachable("bad PIPE_CAP_*");
    }
index b8051df57fe860aa1860b010cef4032fb3080134..3a8b9eba462ac6479b68ad936ba33e6e545ebf6b 100644 (file)
@@ -468,6 +468,17 @@ struct pipe_context {
    /*@}*/
 
 
+   /**
+    * INTEL_blackhole_render
+    */
+   /*@{*/
+
+   void (*set_frontend_noop)(struct pipe_context *,
+                             bool enable);
+
+   /*@}*/
+
+
    /**
     * Resource functions for blit-like functionality
     *
index 4a7edd4e08431bf640944222e6936df271dc8a7b..ca6d27e9700a6079f766e4b8b8d660634f364959 100644 (file)
@@ -912,6 +912,8 @@ enum pipe_cap
    PIPE_CAP_MAX_VERTEX_BUFFERS,
    PIPE_CAP_OPENCL_INTEGER_FUNCTIONS,
    PIPE_CAP_INTEGER_MULTIPLY_32X16,
+   /* Turn draw, dispatch, blit into NOOP */
+   PIPE_CAP_FRONTEND_NOOP,
 };
 
 /**
index 2ec0532ce5725a8f02ad283fbf373a4f816d2302..b67850e1f0464042b3f8b9bb333f73613c9d5f73 100644 (file)
@@ -105,6 +105,9 @@ st_Enable(struct gl_context *ctx, GLenum cap, GLboolean state)
    case GL_DEBUG_OUTPUT_SYNCHRONOUS:
       st_update_debug_callback(st);
       break;
+   case GL_BLACKHOLE_RENDER_INTEL:
+      st->pipe->set_frontend_noop(st->pipe, ctx->IntelBlackholeRender);
+      break;
    default:
       break;
    }
index 3c598fef2bdd3fbcf0c72350511bc6012422d4c6..f3d13d7ad8c8dd265323b89d0c9581c42cc1f8b2 100644 (file)
@@ -793,6 +793,7 @@ void st_init_extensions(struct pipe_screen *screen,
       { o(OES_texture_float_linear),         PIPE_CAP_TEXTURE_FLOAT_LINEAR             },
       { o(OES_texture_half_float_linear),    PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR        },
       { o(OES_texture_view),                 PIPE_CAP_SAMPLER_VIEW_TARGET              },
+      { o(INTEL_blackhole_render),           PIPE_CAP_FRONTEND_NOOP,                   },
    };
 
    /* Required: render target and sampler support */