MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / cgpu_create_texture

Function cgpu_create_texture

modules/engine/graphics/src/common/cgpu.c:1081–1102  ·  view source on GitHub ↗

Texture/TextureView APIs

Source from the content-addressed store, hash-verified

1079
1080// Texture/TextureView APIs
1081CGPUTextureId cgpu_create_texture(CGPUDeviceId device, const struct CGPUTextureDescriptor* desc)
1082{
1083 SkrCZoneN(zz, "CGPUCreateTexture", 1);
1084
1085 cgpu_assert(device != CGPU_NULLPTR && "fatal: call on NULL device!");
1086 cgpu_assert(device->proc_table_cache->create_texture && "create_texture Proc Missing!");
1087 CGPUTextureDescriptor new_desc;
1088 memcpy(&new_desc, desc, sizeof(CGPUTextureDescriptor));
1089 if (desc->array_size == 0) new_desc.array_size = 1;
1090 if (desc->mip_levels == 0) new_desc.mip_levels = 1;
1091 if (desc->depth == 0) new_desc.depth = 1;
1092 if (desc->sample_count == 0) new_desc.sample_count = 1;
1093 CGPUProcCreateTexture fn_create_texture = device->proc_table_cache->create_texture;
1094 CGPUTexture* texture = (CGPUTexture*)fn_create_texture(device, &new_desc);
1095 CGPUTextureInfo* info = (CGPUTextureInfo*)texture->info;
1096 texture->device = device;
1097 info->sample_count = desc->sample_count;
1098
1099 SkrCZoneEnd(zz);
1100
1101 return texture;
1102}
1103
1104void cgpu_free_texture(CGPUTextureId texture)
1105{

Callers 10

resolveMethod · 0.85
allocateMethod · 0.85
try_aliasing_allocateMethod · 0.85
imgui_create_fontsFunction · 0.85
updateMethod · 0.85
create_sampled_textureFunction · 0.85
create_sampled_textureFunction · 0.85
create_sampled_textureFunction · 0.85
test_allMethod · 0.85

Calls 1

memcpyFunction · 0.85

Tested by 1

test_allMethod · 0.68