mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Add texture creation to C example
This commit is contained in:
parent
b2ec3233b0
commit
897c5b9e86
@ -135,5 +135,27 @@ int main()
|
||||
WGPUQueueId queue = wgpu_device_get_queue(device);
|
||||
wgpu_queue_submit(queue, &cmd_buf, 1);
|
||||
|
||||
const uint32_t TEXTURE_WIDTH = 800;
|
||||
const uint32_t TEXTURE_HEIGHT = 600;
|
||||
|
||||
WGPUExtent3d texture_size = {
|
||||
.width = TEXTURE_WIDTH,
|
||||
.height = TEXTURE_HEIGHT,
|
||||
.depth = 1,
|
||||
};
|
||||
|
||||
const WGPUTextureFormat texture_format = WGPUTextureFormat_R8g8b8a8Unorm;
|
||||
const WGPUTextureUsageFlags texture_usage = WGPUTextureUsageFlags_TRANSFER_DST | WGPUTextureUsageFlags_SAMPLED;
|
||||
|
||||
WGPUTextureDescriptor texture_desc = {
|
||||
.size = texture_size,
|
||||
.array_size = 1,
|
||||
.dimension = WGPUTextureDimension_D2,
|
||||
.format = texture_format,
|
||||
.usage = texture_usage,
|
||||
};
|
||||
|
||||
WGPUTextureId texture = wgpu_device_create_texture(device, texture_desc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user