Skip to content

Commit

Permalink
Fixed C-API provision (#5203)
Browse files Browse the repository at this point in the history
  • Loading branch information
PENGUINLIONG authored Jun 20, 2022
1 parent 69f5458 commit 753773e
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions c_api/include/taichi/taichi_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ typedef enum TiArgumentType {

// bit_field.memory_usage
typedef enum TiMemoryUsageFlagBits {
TI_MEMORY_USAGE_STORAGE_BIT = 0,
TI_MEMORY_USAGE_UNIFORM_BIT = 1,
TI_MEMORY_USAGE_VERTEX_BIT = 2,
TI_MEMORY_USAGE_INDEX_BIT = 3,
TI_MEMORY_USAGE_STORAGE_BIT = 1 << 0,
TI_MEMORY_USAGE_UNIFORM_BIT = 1 << 1,
TI_MEMORY_USAGE_VERTEX_BIT = 1 << 2,
TI_MEMORY_USAGE_INDEX_BIT = 1 << 3,
} TiMemoryUsageFlagBits;
typedef TiFlags TiMemoryUsageFlags;

Expand Down
2 changes: 1 addition & 1 deletion c_api/include/taichi/taichi_vulkan.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ typedef struct TiVulkanRuntimeInteropInfo {
// structure.vulkan_memory_interop_info
typedef struct TiVulkanMemoryInteropInfo {
VkBuffer buffer;
size_t size;
uint64_t size;
VkBufferUsageFlags usage;
} TiVulkanMemoryInteropInfo;

Expand Down
2 changes: 1 addition & 1 deletion c_api/src/taichi_vulkan_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void ti_export_vulkan_runtime(TiRuntime runtime,
vk_device.graphics_queue_family_index();
}

TiMemory ti_import_vulkan_runtime_allocation(
TiMemory ti_import_vulkan_memory(
TiRuntime runtime,
const TiVulkanMemoryInteropInfo *interop_info) {
Runtime *runtime2 = (Runtime *)runtime;
Expand Down
2 changes: 1 addition & 1 deletion c_api/taichi.json
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
},
{
"name": "size",
"type": "size_t"
"type": "uint64_t"
},
{
"name": "usage",
Expand Down
2 changes: 1 addition & 1 deletion misc/generate_c_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def get_flag_name(self, flag_name: Name):
def declr(self):
out = ["typedef enum " + self.type_name + " {"]
for name, value in self.bits.items():
out += [f" {name} = {value},"]
out += [f" {name} = 1 << {value},"]
out += ["} " + self.type_name + ";"]
out += [f"typedef TiFlags {self.field_type_name};"]
return '\n'.join(out)
Expand Down

0 comments on commit 753773e

Please sign in to comment.