if (cmdbuf->queries.ht) {
hash_table_foreach(cmdbuf->queries.ht, he) {
- struct dzn_cmd_buffer_query_pool_state *qpstate =
- (struct dzn_cmd_buffer_query_pool_state *)he->data;
+ struct dzn_cmd_buffer_query_pool_state *qpstate = he->data;
util_dynarray_fini(&qpstate->reset);
util_dynarray_fini(&qpstate->collect);
util_dynarray_fini(&qpstate->wait);
D3D12_COMMAND_LIST_TYPE type =
pdev->queue_families[pool->queue_family_index].desc.Type;
- struct dzn_cmd_buffer *cmdbuf = (struct dzn_cmd_buffer *)
+ struct dzn_cmd_buffer *cmdbuf =
vk_zalloc(&pool->alloc, sizeof(*cmdbuf), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!cmdbuf)
return vk_error(pool->base.device, VK_ERROR_OUT_OF_HOST_MEMORY);
vk_free(&cmdbuf->vk.pool->alloc, he->data);
_mesa_hash_table_clear(cmdbuf->dsvs.ht, NULL);
hash_table_foreach(cmdbuf->queries.ht, he) {
- struct dzn_cmd_buffer_query_pool_state *qpstate =
- (struct dzn_cmd_buffer_query_pool_state *)he->data;
+ struct dzn_cmd_buffer_query_pool_state *qpstate = he->data;
util_dynarray_fini(&qpstate->reset);
util_dynarray_fini(&qpstate->collect);
util_dynarray_fini(&qpstate->wait);
if (state != DZN_EVENT_STATE_EXTERNAL_WAIT) {
struct dzn_cmd_event_signal signal = { (struct dzn_event *)he->key, state == DZN_EVENT_STATE_SET };
- struct dzn_cmd_event_signal *entry = (struct dzn_cmd_event_signal *)
+ struct dzn_cmd_event_signal *entry =
util_dynarray_grow(&cmdbuf->events.signal, struct dzn_cmd_event_signal, 1);
if (!entry) {
dzn_cmd_buffer_create_query_pool_state(struct dzn_cmd_buffer *cmdbuf)
{
struct dzn_device *device = container_of(cmdbuf->vk.base.device, struct dzn_device, vk);
- struct dzn_cmd_buffer_query_pool_state *state = (struct dzn_cmd_buffer_query_pool_state *)
+ struct dzn_cmd_buffer_query_pool_state *state =
vk_alloc(&cmdbuf->vk.pool->alloc, sizeof(*state),
8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!state) {
return NULL;
}
} else {
- state = (struct dzn_cmd_buffer_query_pool_state *)he->data;
+ state = he->data;
}
return state;
BITSET_FOREACH_RANGE(start, end, bitset, nbits) {
struct dzn_cmd_buffer_query_range range = { qpool, start, end - start };
- struct dzn_cmd_buffer_query_range *entry = (struct dzn_cmd_buffer_query_range *)
+ struct dzn_cmd_buffer_query_range *entry =
util_dynarray_grow(ops_array, struct dzn_cmd_buffer_query_range, 1);
if (!entry) {
{
hash_table_foreach(cmdbuf->queries.ht, he) {
struct dzn_query_pool *qpool = (struct dzn_query_pool *)he->key;
- struct dzn_cmd_buffer_query_pool_state *state =
- (struct dzn_cmd_buffer_query_pool_state *)he->data;
+ struct dzn_cmd_buffer_query_pool_state *state = he->data;
VkResult result =
dzn_cmd_buffer_collect_queries(cmdbuf, qpool, state, 0, qpool->query_count);
if (result != VK_SUCCESS)
uint32_t slot;
// TODO: error handling
- dsve = (struct dzn_cmd_buffer_dsv_entry *)
- vk_alloc(&cmdbuf->vk.pool->alloc, sizeof(*dsve), 8,
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ dsve = vk_alloc(&cmdbuf->vk.pool->alloc, sizeof(*dsve), 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
dsve->key = key;
dzn_descriptor_heap_pool_alloc_slots(&cmdbuf->dsvs.pool, device, 1, &heap, &slot);
dsve->handle = dzn_descriptor_heap_get_cpu_handle(heap, slot);
ID3D12Device1_CreateDepthStencilView(device->dev, image->res, desc, dsve->handle);
_mesa_hash_table_insert(cmdbuf->dsvs.ht, &dsve->key, dsve);
} else {
- dsve = (struct dzn_cmd_buffer_dsv_entry *)he->data;
+ dsve = he->data;
}
return dsve->handle;
uint32_t slot;
// TODO: error handling
- rtve = (struct dzn_cmd_buffer_rtv_entry *)
- vk_alloc(&cmdbuf->vk.pool->alloc, sizeof(*rtve), 8,
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ rtve = vk_alloc(&cmdbuf->vk.pool->alloc, sizeof(*rtve), 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
rtve->key = key;
dzn_descriptor_heap_pool_alloc_slots(&cmdbuf->rtvs.pool, device, 1, &heap, &slot);
rtve->handle = dzn_descriptor_heap_get_cpu_handle(heap, slot);
ID3D12Device1_CreateRenderTargetView(device->dev, image->res, desc, rtve->handle);
he = _mesa_hash_table_insert(cmdbuf->rtvs.ht, &rtve->key, rtve);
} else {
- rtve = (struct dzn_cmd_buffer_rtv_entry *)he->data;
+ rtve = he->data;
}
return rtve->handle;
return cmdbuf->error;
}
- struct dzn_internal_resource *entry = (struct dzn_internal_resource *)
+ struct dzn_internal_resource *entry =
vk_alloc(&cmdbuf->vk.pool->alloc, sizeof(*entry), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!entry) {
assert(blksize <= sizeof(raw));
assert(!(sizeof(buf) % blksize));
- util_format_write_4(pfmt, (void *)color, 0, (void *)raw, 0, 0, 0, 1, 1);
+ util_format_write_4(pfmt, color, 0, raw, 0, 0, 0, 1, 1);
uint32_t fill_step = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT;
while (fill_step % blksize)
assert(!(res_size % fill_step));
uint8_t *cpu_ptr;
- ID3D12Resource_Map(src_res, 0, NULL, (void **)&cpu_ptr);
+ ID3D12Resource_Map(src_res, 0, NULL, &cpu_ptr);
for (uint32_t i = 0; i < res_size; i += fill_step)
memcpy(&cpu_ptr[i], buf, fill_step);
assert(blksize <= sizeof(raw));
assert(!(sizeof(buf) % blksize));
- util_format_write_4(pfmt, (void *)color, 0, (void *)raw, 0, 0, 0, 1, 1);
+ util_format_write_4(pfmt, color, 0, raw, 0, 0, 0, 1, 1);
uint32_t fill_step = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT;
while (fill_step % blksize)
assert(!(res_size % fill_step));
uint8_t *cpu_ptr;
- ID3D12Resource_Map(src_res, 0, NULL, (void **)&cpu_ptr);
+ ID3D12Resource_Map(src_res, 0, NULL, &cpu_ptr);
for (uint32_t i = 0; i < res_size; i += fill_step)
memcpy(&cpu_ptr[i], buf, fill_step);
ID3D12GraphicsCommandList1_SetComputeRootSignature(cmdbuf->cmdlist, indirect_draw->root_sig);
ID3D12GraphicsCommandList1_SetPipelineState(cmdbuf->cmdlist, indirect_draw->pipeline_state);
- ID3D12GraphicsCommandList1_SetComputeRoot32BitConstants(cmdbuf->cmdlist, 0, params_size / 4, (const void *)¶ms, 0);
+ ID3D12GraphicsCommandList1_SetComputeRoot32BitConstants(cmdbuf->cmdlist, 0, params_size / 4, ¶ms, 0);
ID3D12GraphicsCommandList1_SetComputeRootShaderResourceView(cmdbuf->cmdlist, 1, draw_buf_gpu);
ID3D12GraphicsCommandList1_SetComputeRootUnorderedAccessView(cmdbuf->cmdlist, 2, ID3D12Resource_GetGPUVirtualAddress(exec_buf));
if (triangle_fan_exec_buf)
return;
uint32_t *cpu_ptr;
- ID3D12Resource_Map(src_res, 0, NULL, (void **)&cpu_ptr);
+ ID3D12Resource_Map(src_res, 0, NULL, &cpu_ptr);
for (uint32_t i = 0; i < size / 4; i++)
cpu_ptr[i] = data;
return;
}
- struct dzn_event **entry = (struct dzn_event **)
+ struct dzn_event **entry =
util_dynarray_grow(&cmdbuf->events.wait, struct dzn_event *, 1);
if (!entry) {
const VkAllocationCallbacks *pAllocator,
VkInstance *out)
{
- struct dzn_instance *instance = (struct dzn_instance *)
+ struct dzn_instance *instance =
vk_zalloc2(vk_default_allocator(), pAllocator, sizeof(*instance), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!instance)
IDXGIAdapter1 *adapter,
const DXGI_ADAPTER_DESC1 *adapter_desc)
{
- struct dzn_physical_device *pdev = (struct dzn_physical_device *)
+ struct dzn_physical_device *pdev =
vk_zalloc(&instance->vk.alloc, sizeof(*pdev), 8,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
struct dzn_physical_device *pdevice =
container_of(device->vk.physical, struct dzn_physical_device, vk);
- struct dzn_device_memory *mem = (struct dzn_device_memory *)
+ struct dzn_device_memory *mem =
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*mem), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!mem)
const VkAllocationCallbacks *pAllocator,
VkBuffer *out)
{
- struct dzn_buffer *buf = (struct dzn_buffer *)
+ struct dzn_buffer *buf =
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*buf), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!buf)
const VkAllocationCallbacks *pAllocator,
VkEvent *out)
{
- struct dzn_event *event = (struct dzn_event *)
+ struct dzn_event *event =
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*event), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!event)
const VkAllocationCallbacks *pAllocator,
VkSampler *out)
{
- struct dzn_sampler *sampler = (struct dzn_sampler *)
+ struct dzn_sampler *sampler =
vk_zalloc2(&device->vk.alloc, pAllocator, sizeof(*sampler), 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (!sampler)
dzn_meta_compile_shader(device, nir, &bc);
- out = (D3D12_SHADER_BYTECODE *)
- vk_alloc(&device->vk.alloc,
- sizeof(D3D12_SHADER_BYTECODE) + bc.BytecodeLength, 8,
- VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
+ out = vk_alloc(&device->vk.alloc,
+ sizeof(D3D12_SHADER_BYTECODE) + bc.BytecodeLength, 8,
+ VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
if (out) {
- out->pShaderBytecode = (void *)(out + 1);
+ out->pShaderBytecode = out + 1;
memcpy((void *)out->pShaderBytecode, bc.pShaderBytecode, bc.BytecodeLength);
out->BytecodeLength = bc.BytecodeLength;
_mesa_hash_table_insert(meta->fs, &info->hash_key, out);
free((void *)bc.pShaderBytecode);
ralloc_free(nir);
} else {
- out = (D3D12_SHADER_BYTECODE *)he->data;
+ out = he->data;
}
mtx_unlock(&meta->shaders_lock);
dzn_meta_blit_create(struct dzn_device *device, const struct dzn_meta_blit_key *key)
{
struct dzn_meta_blits *blits = &device->blits;
- struct dzn_meta_blit *blit = (struct dzn_meta_blit *)
+ struct dzn_meta_blit *blit =
vk_zalloc(&device->vk.alloc, sizeof(*blit), 8,
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
mtx_lock(&device->blits.contexts_lock);
- out = (struct dzn_meta_blit *)
+ out =
_mesa_hash_table_u64_search(device->blits.contexts, key->u64);
if (!out) {
out = dzn_meta_blit_create(device, key);
if (meta->contexts) {
hash_table_foreach(meta->contexts->table, he)
- dzn_meta_blit_destroy(device, (struct dzn_meta_blit *)he->data);
+ dzn_meta_blit_destroy(device, he->data);
_mesa_hash_table_u64_destroy(meta->contexts);
}