tgsi/transform: add support for SVIEW decls
authorRob Clark <robclark@freedesktop.org>
Wed, 10 Jun 2015 23:51:32 +0000 (19:51 -0400)
committerRob Clark <robclark@freedesktop.org>
Sun, 21 Jun 2015 11:52:02 +0000 (07:52 -0400)
TODO single return_type (use enum)

v2: single return_type arg, and use enum

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
src/gallium/auxiliary/tgsi/tgsi_transform.h

index 921aa906527e781c256caf37f7622678f1bf9755..39d7688ab3b98399aa9273fd932fd7ba1b7dcc27 100644 (file)
@@ -143,6 +143,27 @@ tgsi_transform_sampler_decl(struct tgsi_transform_context *ctx,
    ctx->emit_declaration(ctx, &decl);
 }
 
+static INLINE void
+tgsi_transform_sampler_view_decl(struct tgsi_transform_context *ctx,
+                                 unsigned index,
+                                 unsigned target,
+                                 enum tgsi_return_type type)
+{
+   struct tgsi_full_declaration decl;
+
+   decl = tgsi_default_full_declaration();
+   decl.Declaration.File = TGSI_FILE_SAMPLER_VIEW;
+   decl.Declaration.UsageMask = 0xf;
+   decl.Range.First =
+   decl.Range.Last = index;
+   decl.SamplerView.Resource = target;
+   decl.SamplerView.ReturnTypeX = type;
+   decl.SamplerView.ReturnTypeY = type;
+   decl.SamplerView.ReturnTypeZ = type;
+   decl.SamplerView.ReturnTypeW = type;
+
+   ctx->emit_declaration(ctx, &decl);
+}
 
 static INLINE void
 tgsi_transform_immediate_decl(struct tgsi_transform_context *ctx,