OSDN Git Service

gallium: add PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY
authorMarek Olšák <marek.olsak@amd.com>
Wed, 12 Oct 2016 01:06:08 +0000 (03:06 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 13 Oct 2016 17:00:51 +0000 (19:00 +0200)
For performance tuning in drivers. It filters out window system
framebuffers and OpenGL renderbuffers.

radeonsi will use this to guess whether a depth buffer will be read
by a shader. There is no guarantee about what will actually happen.

This is a departure from PIPE_BIND flags which are defined to be strict
but they are useless in practice.

Acked-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/include/pipe/p_defines.h
src/mesa/state_tracker/st_texture.c

index cdad415..746a822 100644 (file)
@@ -450,6 +450,7 @@ enum pipe_flush_flags
  */
 #define PIPE_RESOURCE_FLAG_MAP_PERSISTENT (1 << 0)
 #define PIPE_RESOURCE_FLAG_MAP_COHERENT   (1 << 1)
+#define PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY (1 << 2)
 #define PIPE_RESOURCE_FLAG_DRV_PRIV    (1 << 16) /* driver/winsys private */
 #define PIPE_RESOURCE_FLAG_ST_PRIV     (1 << 24) /* state-tracker/winsys private */
 
index a2c36ac..7b72ffd 100644 (file)
@@ -91,7 +91,8 @@ st_texture_create(struct st_context *st,
    pt.array_size = layers;
    pt.usage = PIPE_USAGE_DEFAULT;
    pt.bind = bind;
-   pt.flags = 0;
+   /* only set this for OpenGL textures, not renderbuffers */
+   pt.flags = PIPE_RESOURCE_FLAG_TEXTURING_MORE_LIKELY;
    pt.nr_samples = nr_samples;
 
    newtex = screen->resource_create(screen, &pt);