diff options
author | Jason Ekstrand <[email protected]> | 2016-02-22 16:54:25 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-02-27 10:26:14 -0800 |
commit | eb19d640eb46249ba20734aa478c84fadfc35d80 (patch) | |
tree | 0d7b6f625fed8f464c64abe7dd424c54544a099f /src | |
parent | a0cd20eb7fc9396f5ba2ad201018989074091b8f (diff) |
anv: Use isl to fill buffer surface states
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 24 | ||||
-rw-r--r-- | src/intel/vulkan/gen7_state.c | 31 | ||||
-rw-r--r-- | src/intel/vulkan/gen8_state.c | 32 |
3 files changed, 6 insertions, 81 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 59930552f59..857c4b1d1f4 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -1697,24 +1697,12 @@ anv_fill_buffer_surface_state(struct anv_device *device, struct anv_state state, enum isl_format format, uint32_t offset, uint32_t range, uint32_t stride) { - switch (device->info.gen) { - case 7: - if (device->info.is_haswell) - gen75_fill_buffer_surface_state(state.map, format, offset, range, - stride); - else - gen7_fill_buffer_surface_state(state.map, format, offset, range, - stride); - break; - case 8: - gen8_fill_buffer_surface_state(state.map, format, offset, range, stride); - break; - case 9: - gen9_fill_buffer_surface_state(state.map, format, offset, range, stride); - break; - default: - unreachable("unsupported gen\n"); - } + isl_buffer_fill_state(&device->isl_dev, state.map, + .address = offset, + .mocs = device->default_mocs, + .size = range, + .format = format, + .stride = stride); if (!device->info.has_llc) anv_state_clflush(state); diff --git a/src/intel/vulkan/gen7_state.c b/src/intel/vulkan/gen7_state.c index ac5b5ed21cd..1360697f0de 100644 --- a/src/intel/vulkan/gen7_state.c +++ b/src/intel/vulkan/gen7_state.c @@ -63,37 +63,6 @@ genX(init_device_state)(struct anv_device *device) return anv_device_submit_simple_batch(device, &batch); } -void -genX(fill_buffer_surface_state)(void *state, enum isl_format format, - uint32_t offset, uint32_t range, - uint32_t stride) -{ - uint32_t num_elements = range / stride; - - struct GENX(RENDER_SURFACE_STATE) surface_state = { - .SurfaceType = SURFTYPE_BUFFER, - .SurfaceFormat = format, - .SurfaceVerticalAlignment = VALIGN_4, - .SurfaceHorizontalAlignment = HALIGN_4, - .TiledSurface = false, - .RenderCacheReadWriteMode = false, - .SurfaceObjectControlState = GENX(MOCS), - .Height = ((num_elements - 1) >> 7) & 0x3fff, - .Width = (num_elements - 1) & 0x7f, - .Depth = ((num_elements - 1) >> 21) & 0x3f, - .SurfacePitch = stride - 1, -# if (GEN_IS_HASWELL) - .ShaderChannelSelectRed = SCS_RED, - .ShaderChannelSelectGreen = SCS_GREEN, - .ShaderChannelSelectBlue = SCS_BLUE, - .ShaderChannelSelectAlpha = SCS_ALPHA, -# endif - .SurfaceBaseAddress = { NULL, offset }, - }; - - GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &surface_state); -} - VkResult genX(CreateSampler)( VkDevice _device, const VkSamplerCreateInfo* pCreateInfo, diff --git a/src/intel/vulkan/gen8_state.c b/src/intel/vulkan/gen8_state.c index 1ecd34058d9..784269b98cb 100644 --- a/src/intel/vulkan/gen8_state.c +++ b/src/intel/vulkan/gen8_state.c @@ -139,38 +139,6 @@ genX(init_device_state)(struct anv_device *device) return anv_device_submit_simple_batch(device, &batch); } -void -genX(fill_buffer_surface_state)(void *state, enum isl_format format, - uint32_t offset, uint32_t range, uint32_t stride) -{ - uint32_t num_elements = range / stride; - - struct GENX(RENDER_SURFACE_STATE) surface_state = { - .SurfaceType = SURFTYPE_BUFFER, - .SurfaceArray = false, - .SurfaceFormat = format, - .SurfaceVerticalAlignment = VALIGN4, - .SurfaceHorizontalAlignment = HALIGN4, - .TileMode = LINEAR, - .SamplerL2BypassModeDisable = true, - .RenderCacheReadWriteMode = WriteOnlyCache, - .MemoryObjectControlState = GENX(MOCS), - .Height = ((num_elements - 1) >> 7) & 0x3fff, - .Width = (num_elements - 1) & 0x7f, - .Depth = ((num_elements - 1) >> 21) & 0x3f, - .SurfacePitch = stride - 1, - .NumberofMultisamples = MULTISAMPLECOUNT_1, - .ShaderChannelSelectRed = SCS_RED, - .ShaderChannelSelectGreen = SCS_GREEN, - .ShaderChannelSelectBlue = SCS_BLUE, - .ShaderChannelSelectAlpha = SCS_ALPHA, - /* FIXME: We assume that the image must be bound at this time. */ - .SurfaceBaseAddress = { NULL, offset }, - }; - - GENX(RENDER_SURFACE_STATE_pack)(NULL, state, &surface_state); -} - VkResult genX(CreateSampler)( VkDevice _device, const VkSamplerCreateInfo* pCreateInfo, |