iris: sampler states
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 12 Jan 2018 06:18:54 +0000 (22:18 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:04 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_pipe.h [new file with mode: 0644]
src/gallium/drivers/iris/iris_screen.c
src/gallium/drivers/iris/iris_state.c

index 7e8d358e39d934d490e660548639e2fe5eb2a357..d4eaab75f4a492190738553942a47cc62ced6214 100644 (file)
@@ -78,6 +78,8 @@ struct iris_context {
       struct pipe_scissor_state scissors[IRIS_MAX_VIEWPORTS];
       struct pipe_stencil_ref stencil_ref;
       struct pipe_framebuffer_state framebuffer;
+
+      struct iris_sampler_state *samplers[MESA_SHADER_STAGES][IRIS_MAX_TEXTURE_SAMPLERS];
    } state;
 };
 
diff --git a/src/gallium/drivers/iris/iris_pipe.h b/src/gallium/drivers/iris/iris_pipe.h
new file mode 100644 (file)
index 0000000..06ff938
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright © 2017 Intel Corporation
+ *
+ * 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
+ * on the rights to use, copy, modify, merge, publish, distribute, sub
+ * license, 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 NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHOR(S) AND/OR THEIR SUPPLIERS 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.
+ */
+#ifndef IRIS_PIPE_H
+#define IRIS_PIPE_H
+
+#include "pipe/p_defines.h"
+#include "compiler/shader_enums.h"
+
+static gl_shader_stage
+stage_from_pipe(enum pipe_shader_type pstage)
+{
+   static const gl_shader_stage stages[PIPE_SHADER_TYPES] = {
+      [PIPE_SHADER_VERTEX] = MESA_SHADER_VERTEX,
+      [PIPE_SHADER_TESS_CTRL] = MESA_SHADER_TESS_CTRL,
+      [PIPE_SHADER_TESS_EVAL] = MESA_SHADER_TESS_EVAL,
+      [PIPE_SHADER_GEOMETRY] = MESA_SHADER_GEOMETRY,
+      [PIPE_SHADER_FRAGMENT] = MESA_SHADER_FRAGMENT,
+      [PIPE_SHADER_COMPUTE] = MESA_SHADER_COMPUTE,
+   };
+   return stages[pstage];
+}
+
+#endif
index 9d679848364707ee3a6f876b5c276389c1c09967..d1b4d443363e41989def7a03c28fc0df673df403 100644 (file)
@@ -33,6 +33,7 @@
 #include "util/ralloc.h"
 #include "drm-uapi/i915_drm.h"
 #include "iris_context.h"
+#include "iris_pipe.h"
 #include "iris_resource.h"
 #include "iris_screen.h"
 #include "intel/compiler/brw_compiler.h"
@@ -422,20 +423,6 @@ iris_query_memory_info(struct pipe_screen *pscreen,
 {
 }
 
-static gl_shader_stage
-stage_from_pipe(enum pipe_shader_type pstage)
-{
-   static const gl_shader_stage stages[PIPE_SHADER_TYPES] = {
-      [PIPE_SHADER_VERTEX] = MESA_SHADER_VERTEX,
-      [PIPE_SHADER_TESS_CTRL] = MESA_SHADER_TESS_CTRL,
-      [PIPE_SHADER_TESS_EVAL] = MESA_SHADER_TESS_EVAL,
-      [PIPE_SHADER_GEOMETRY] = MESA_SHADER_GEOMETRY,
-      [PIPE_SHADER_FRAGMENT] = MESA_SHADER_FRAGMENT,
-      [PIPE_SHADER_COMPUTE] = MESA_SHADER_COMPUTE,
-   };
-   return stages[pstage];
-}
-
 static const void *
 iris_get_compiler_options(struct pipe_screen *pscreen,
                           enum pipe_shader_ir ir,
index 69bdaafc79631159acc5cd2e77abb95eddf80a48..5da3e791a530c70c9e06215df67dce78f032027a 100644 (file)
@@ -42,6 +42,7 @@
 #include "intel/common/gen_sample_positions.h"
 #include "iris_batch.h"
 #include "iris_context.h"
+#include "iris_pipe.h"
 #include "iris_resource.h"
 
 #define __gen_address_type unsigned
@@ -710,6 +711,22 @@ iris_create_sampler_state(struct pipe_context *pctx,
    return cso;
 }
 
+static void
+iris_bind_sampler_states(struct pipe_context *ctx,
+                         enum pipe_shader_type p_stage,
+                         unsigned start, unsigned count,
+                         void **states)
+{
+   struct iris_context *ice = (struct iris_context *) ctx;
+   gl_shader_stage stage = stage_from_pipe(p_stage);
+
+   assert(start + count <= IRIS_MAX_TEXTURE_SAMPLERS);
+
+   for (int i = 0; i < count; i++) {
+      ice->state.samplers[stage][start + i] = states[i];
+   }
+}
+
 struct iris_sampler_view {
    struct pipe_sampler_view pipe;
    struct isl_view view;
@@ -840,14 +857,6 @@ iris_set_sampler_views(struct pipe_context *ctx,
 {
 }
 
-static void
-iris_bind_sampler_states(struct pipe_context *ctx,
-                         enum pipe_shader_type shader,
-                         unsigned start, unsigned count,
-                         void **states)
-{
-}
-
 static void
 iris_set_clip_state(struct pipe_context *ctx,
                     const struct pipe_clip_state *state)