diff options
author | Chia-I Wu <[email protected]> | 2019-01-09 14:16:01 -0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2019-03-11 10:01:41 -0700 |
commit | d30baaaba645dcc1b4b4e16c4914554b896ea54a (patch) | |
tree | faacc671e482deb8614df319722b4eedc8eace50 /src/freedreno/vulkan/tu_pipeline_cache.c | |
parent | 6401ad389e9cec6f523e4e4e989c190fb25a8dfc (diff) |
turnip: add .clang-format
Add and apply .clang-format.
Diffstat (limited to 'src/freedreno/vulkan/tu_pipeline_cache.c')
-rw-r--r-- | src/freedreno/vulkan/tu_pipeline_cache.c | 46 |
1 files changed, 22 insertions, 24 deletions
diff --git a/src/freedreno/vulkan/tu_pipeline_cache.c b/src/freedreno/vulkan/tu_pipeline_cache.c index efb63383793..b8b2ceda263 100644 --- a/src/freedreno/vulkan/tu_pipeline_cache.c +++ b/src/freedreno/vulkan/tu_pipeline_cache.c @@ -17,11 +17,12 @@ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #include "tu_private.h" + #include "util/debug.h" #include "util/disk_cache.h" #include "util/mesa-sha1.h" @@ -33,8 +34,7 @@ struct cache_entry_variant_info struct cache_entry { - union - { + union { unsigned char sha1[20]; uint32_t sha1_dw[5]; }; @@ -83,7 +83,8 @@ entry_size(struct cache_entry *entry) size_t ret = sizeof(*entry); for (int i = 0; i < MESA_SHADER_STAGES; ++i) if (entry->code_sizes[i]) - ret += sizeof(struct cache_entry_variant_info) + entry->code_sizes[i]; + ret += + sizeof(struct cache_entry_variant_info) + entry->code_sizes[i]; return ret; } @@ -105,15 +106,15 @@ tu_hash_shaders(unsigned char *hash, for (int i = 0; i < MESA_SHADER_STAGES; ++i) { if (stages[i]) { TU_FROM_HANDLE(tu_shader_module, module, stages[i]->module); - const VkSpecializationInfo *spec_info = stages[i]->pSpecializationInfo; + const VkSpecializationInfo *spec_info = + stages[i]->pSpecializationInfo; _mesa_sha1_update(&ctx, module->sha1, sizeof(module->sha1)); _mesa_sha1_update(&ctx, stages[i]->pName, strlen(stages[i]->pName)); if (spec_info) { - _mesa_sha1_update(&ctx, - spec_info->pMapEntries, - spec_info->mapEntryCount * - sizeof spec_info->pMapEntries[0]); + _mesa_sha1_update( + &ctx, spec_info->pMapEntries, + spec_info->mapEntryCount * sizeof spec_info->pMapEntries[0]); _mesa_sha1_update(&ctx, spec_info->pData, spec_info->dataSize); } } @@ -127,7 +128,7 @@ tu_pipeline_cache_search_unlocked(struct tu_pipeline_cache *cache, const unsigned char *sha1) { const uint32_t mask = cache->table_size - 1; - const uint32_t start = (*(uint32_t *)sha1); + const uint32_t start = (*(uint32_t *) sha1); if (cache->table_size == 0) return NULL; @@ -258,22 +259,22 @@ tu_pipeline_cache_load(struct tu_pipeline_cache *cache, return; if (header.device_id != 0 /* TODO */) return; - if (memcmp(header.uuid, device->physical_device->cache_uuid, VK_UUID_SIZE) != - 0) + if (memcmp(header.uuid, device->physical_device->cache_uuid, + VK_UUID_SIZE) != 0) return; - char *end = (void *)data + size; - char *p = (void *)data + header.header_size; + char *end = (void *) data + size; + char *p = (void *) data + header.header_size; while (end - p >= sizeof(struct cache_entry)) { - struct cache_entry *entry = (struct cache_entry *)p; + struct cache_entry *entry = (struct cache_entry *) p; struct cache_entry *dest_entry; size_t size = entry_size(entry); if (end - p < size) break; dest_entry = - vk_alloc(&cache->alloc, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_CACHE); + vk_alloc(&cache->alloc, size, 8, VK_SYSTEM_ALLOCATION_SCOPE_CACHE); if (dest_entry) { memcpy(dest_entry, entry, size); for (int i = 0; i < MESA_SHADER_STAGES; ++i) @@ -296,10 +297,7 @@ tu_CreatePipelineCache(VkDevice _device, assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO); assert(pCreateInfo->flags == 0); - cache = vk_alloc2(&device->alloc, - pAllocator, - sizeof(*cache), - 8, + cache = vk_alloc2(&device->alloc, pAllocator, sizeof(*cache), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (cache == NULL) return vk_error(device->instance, VK_ERROR_OUT_OF_HOST_MEMORY); @@ -312,8 +310,8 @@ tu_CreatePipelineCache(VkDevice _device, tu_pipeline_cache_init(cache, device); if (pCreateInfo->initialDataSize > 0) { - tu_pipeline_cache_load( - cache, pCreateInfo->pInitialData, pCreateInfo->initialDataSize); + tu_pipeline_cache_load(cache, pCreateInfo->pInitialData, + pCreateInfo->initialDataSize); } *pPipelineCache = tu_pipeline_cache_to_handle(cache); @@ -382,7 +380,7 @@ tu_GetPipelineCacheData(VkDevice _device, memcpy(p, entry, size); for (int j = 0; j < MESA_SHADER_STAGES; ++j) - ((struct cache_entry *)p)->variants[j] = NULL; + ((struct cache_entry *) p)->variants[j] = NULL; p += size; } *pDataSize = p - pData; |