diff --git a/Bindless/Deployment/numbers.png b/Bindless/Deployment/numbers.png index a9d8e3a..bb596ff 100644 Binary files a/Bindless/Deployment/numbers.png and b/Bindless/Deployment/numbers.png differ diff --git a/Bindless/Sources/texture.c b/Bindless/Sources/texture.c index dcc4d43..a0d9c34 100644 --- a/Bindless/Sources/texture.c +++ b/Bindless/Sources/texture.c @@ -8,6 +8,7 @@ #include #include +#include #ifdef SCREENSHOT #include "../../screenshot.h" @@ -18,7 +19,7 @@ static kope_g5_command_list list; static vertex_in_buffer vertices; static kope_g5_buffer indices; static kope_g5_buffer image_buffer; -static kope_g5_texture texture; +static kope_g5_texture textures[9]; static kope_g5_sampler sampler; static kope_g5_buffer constants; static everything_set everything; @@ -45,15 +46,17 @@ static void update(void *data) { constants_type_buffer_unlock(&constants); if (first_update) { - kope_g5_image_copy_buffer source = {0}; - source.buffer = &image_buffer; - source.bytes_per_row = kope_g5_device_align_texture_row_bytes(&device, 250 * 4); + for (int i = 0; i < 9; ++i) { + kope_g5_image_copy_buffer source = {0}; + source.buffer = &image_buffer; + source.bytes_per_row = kope_g5_device_align_texture_row_bytes(&device, 250 * 4); - kope_g5_image_copy_texture destination = {0}; - destination.texture = &texture; - destination.mip_level = 0; + kope_g5_image_copy_texture destination = {0}; + destination.texture = &textures[i]; + destination.mip_level = 0; - kope_g5_command_list_copy_buffer_to_texture(&list, &source, &destination, 250, 250, 1); + kope_g5_command_list_copy_buffer_to_texture(&list, &source, &destination, 639 / 3, 642 / 3, 1); + } first_update = false; } @@ -106,26 +109,28 @@ int kickstart(int argc, char **argv) { kope_g5_device_create_command_list(&device, &list); kope_g5_buffer_parameters buffer_parameters = {0}; - buffer_parameters.size = kope_g5_device_align_texture_row_bytes(&device, 250 * 4) * 250; + buffer_parameters.size = kope_g5_device_align_texture_row_bytes(&device, 639 * 4) * 642; buffer_parameters.usage_flags = KOPE_G5_BUFFER_USAGE_CPU_WRITE; kope_g5_device_create_buffer(&device, &buffer_parameters, &image_buffer); kinc_image_t image; - kinc_image_init_from_file_with_stride(&image, kope_g5_buffer_lock_all(&image_buffer), "parrot.png", - kope_g5_device_align_texture_row_bytes(&device, 250 * 4)); + kinc_image_init_from_file_with_stride(&image, kope_g5_buffer_lock_all(&image_buffer), "numbers.png", + kope_g5_device_align_texture_row_bytes(&device, 639 * 4)); kinc_image_destroy(&image); kope_g5_buffer_unlock(&image_buffer); - kope_g5_texture_parameters texture_parameters = {0}; - texture_parameters.width = 250; - texture_parameters.height = 250; - texture_parameters.depth_or_array_layers = 1; - texture_parameters.mip_level_count = 1; - texture_parameters.sample_count = 1; - texture_parameters.dimension = KOPE_G5_TEXTURE_DIMENSION_2D; - texture_parameters.format = KOPE_G5_TEXTURE_FORMAT_RGBA8_UNORM; - texture_parameters.usage = KONG_G5_TEXTURE_USAGE_SAMPLE | KONG_G5_TEXTURE_USAGE_COPY_DST; - kope_g5_device_create_texture(&device, &texture_parameters, &texture); + for (int i = 0; i < 9; ++i) { + kope_g5_texture_parameters texture_parameters = {0}; + texture_parameters.width = 639 / 3; + texture_parameters.height = 642 / 3; + texture_parameters.depth_or_array_layers = 1; + texture_parameters.mip_level_count = 1; + texture_parameters.sample_count = 1; + texture_parameters.dimension = KOPE_G5_TEXTURE_DIMENSION_2D; + texture_parameters.format = KOPE_G5_TEXTURE_FORMAT_RGBA8_UNORM; + texture_parameters.usage = KONG_G5_TEXTURE_USAGE_SAMPLE | KONG_G5_TEXTURE_USAGE_COPY_DST; + kope_g5_device_create_texture(&device, &texture_parameters, &textures[i]); + } kope_g5_sampler_parameters sampler_parameters = {0}; sampler_parameters.address_mode_u = KOPE_G5_ADDRESS_MODE_REPEAT; @@ -183,10 +188,13 @@ int kickstart(int argc, char **argv) { { everything_parameters parameters = {0}; parameters.constants = &constants; - parameters.tex.texture = &texture; - parameters.tex.base_mip_level = 0; - parameters.tex.mip_level_count = 1; - parameters.tex.array_layer_count = 1; + parameters.textures = calloc(9, sizeof(kope_g5_texture_view)); + for (int i = 0; i < 9; ++i) { + parameters.textures[i].texture = &textures[i]; + parameters.textures[i].base_mip_level = 0; + parameters.textures[i].mip_level_count = 1; + parameters.textures[i].array_layer_count = 1; + } parameters.sam = &sampler; kong_create_everything_set(&device, ¶meters, &everything); }