aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2019-02-28 01:13:33 -0800
committerKenneth Graunke <[email protected]>2019-03-07 11:39:27 -0800
commit4787bc944a2d219dd04201eef699d9f999b479b8 (patch)
tree082f124a94a40b269150e8b2e5c42ef91f393d41 /src/intel
parent575f8e8b60ab06e559a62ffe90913453352f32b4 (diff)
isl: Add a swizzle parameter to isl_buffer_fill_state()
This is necessary for legacy texture buffer object formats, where we'll need to use a swizzle to fake e.g. luminance. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/isl/isl.h5
-rw-r--r--src/intel/isl/isl_surface_state.c8
-rw-r--r--src/intel/vulkan/anv_device.c1
-rw-r--r--src/intel/vulkan/anv_image.c1
4 files changed, 11 insertions, 4 deletions
diff --git a/src/intel/isl/isl.h b/src/intel/isl/isl.h
index cfac922a3d2..a792e18e5d1 100644
--- a/src/intel/isl/isl.h
+++ b/src/intel/isl/isl.h
@@ -1361,6 +1361,11 @@ struct isl_buffer_fill_state_info {
*/
enum isl_format format;
+ /**
+ * The swizzle to use in the surface state
+ */
+ struct isl_swizzle swizzle;
+
uint32_t stride_B;
};
diff --git a/src/intel/isl/isl_surface_state.c b/src/intel/isl/isl_surface_state.c
index 7ab260d701b..cf31b36ccbe 100644
--- a/src/intel/isl/isl_surface_state.c
+++ b/src/intel/isl/isl_surface_state.c
@@ -745,10 +745,10 @@ isl_genX(buffer_fill_state_s)(void *state,
#endif
#if (GEN_GEN >= 8 || GEN_IS_HASWELL)
- s.ShaderChannelSelectRed = SCS_RED;
- s.ShaderChannelSelectGreen = SCS_GREEN;
- s.ShaderChannelSelectBlue = SCS_BLUE;
- s.ShaderChannelSelectAlpha = SCS_ALPHA;
+ s.ShaderChannelSelectRed = (enum GENX(ShaderChannelSelect)) info->swizzle.r;
+ s.ShaderChannelSelectGreen = (enum GENX(ShaderChannelSelect)) info->swizzle.g;
+ s.ShaderChannelSelectBlue = (enum GENX(ShaderChannelSelect)) info->swizzle.b;
+ s.ShaderChannelSelectAlpha = (enum GENX(ShaderChannelSelect)) info->swizzle.a;
#endif
GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &s);
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 92e8f40278f..963f108a0e8 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -3324,6 +3324,7 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state,
.mocs = device->default_mocs,
.size_B = range,
.format = format,
+ .swizzle = ISL_SWIZZLE_IDENTITY,
.stride_B = stride);
}
diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
index facf7d18006..dfa72cbfe6c 100644
--- a/src/intel/vulkan/anv_image.c
+++ b/src/intel/vulkan/anv_image.c
@@ -1203,6 +1203,7 @@ anv_image_fill_surface_state(struct anv_device *device,
.address = anv_address_physical(address),
.size_B = surface->isl.size_B,
.format = ISL_FORMAT_RAW,
+ .swizzle = ISL_SWIZZLE_IDENTITY,
.stride_B = 1,
.mocs = anv_mocs_for_bo(device, address.bo));
state_inout->address = address,