Skip to content

Commit

Permalink
[api] Vulkan updated and UI fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
travisdoor committed Nov 15, 2024
1 parent ed5d2ed commit 88acd27
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/bl/api/extra/glm/glm.bl
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ mat4_zero :: fn (m: *mat4) #inline {
zeromem(auto m, sizeof(@m));
}

// fov = fov y
mat4_init_perspective :: fn (m: *mat4, fov_rad: f32, aspect: f32, near: f32, far: f32) #inline {
mat4_zero(m);
tanHalfFovy :: std.tan(fov_rad / 2.f);
Expand Down
9 changes: 5 additions & 4 deletions lib/bl/api/extra/ui/ui.bl
Original file line number Diff line number Diff line change
Expand Up @@ -711,10 +711,11 @@ textbox :: fn {
// Canvas
//

canvas_begin :: fn (background_color: glm.v4 = TRANSPARENT) {
canvas_begin :: fn (background_color: glm.v4 = TRANSPARENT) Rect {
rect :: peek();
push(rect_translated(rect));
fill_current_rect(background_color);
return rect_translated(rect);
}

canvas_end :: fn () {
Expand Down Expand Up @@ -1414,7 +1415,7 @@ checkbox_item_impl :: fn (name: string_view, value: *bool, _style: *CheckboxStyl
// Variants Impl
//

variants_impl :: fn (rect: Rect, value: Any, _style: *VariantsStyle = null, flags := VariantsFlags.DEFAULT, index : u64 = 0, _ := #call_location) bool {
variants_impl :: fn (rect: Rect, value: Any, _style: *VariantsStyle = null, flags := VariantsFlags.DEFAULT, index : u64 = 0, loc := #call_location) bool {
style :: get_style(_style);

info :: cast(*TypeInfoEnum) value.type_info;
Expand All @@ -1438,10 +1439,10 @@ variants_impl :: fn (rect: Rect, value: Any, _style: *VariantsStyle = null, flag
if is_flag(flags, VariantsFlags.READONLY) { button_flags = ButtonFlags.DISABLED; }

prev_variant_index :: variant_index;
if button(make_rect(0.f, 0.f, rect.h, rect.h), icon_utf8(ICON_ARROW_LEFT), button_flags, &style.button, index) {
if button(make_rect(0.f, 0.f, rect.h, rect.h), icon_utf8(ICON_ARROW_LEFT), button_flags, &style.button, index, loc) {
variant_index -= 1;
}
if button(make_rect(rect.w - rect.h, 0.f, rect.h, rect.h), icon_utf8(ICON_ARROW_RIGHT), button_flags, &style.button, index) {
if button(make_rect(rect.w - rect.h, 0.f, rect.h, rect.h), icon_utf8(ICON_ARROW_RIGHT), button_flags, &style.button, index+1, loc) {
variant_index += 1;
}

Expand Down
10 changes: 10 additions & 0 deletions lib/bl/api/extra/vulkan/vulkan.bl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ VkResult :: enum s32 {
VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT = 0x3b9f5228;
VK_RESULT_MAX_ENUM = 0x7fffffff;
}

VkStructureType :: enum s32 {
VK_STRUCTURE_TYPE_APPLICATION_INFO = 0x0;
VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 0x1;
Expand Down Expand Up @@ -974,8 +975,10 @@ VkStructureType :: enum s32 {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES_KHR = 0x3ba11749;
VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS_KHR = 0x3ba1174a;
VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS_KHR = 0x3ba1174b;
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_VALIDATION_FEATURES_NV = 1000568000;
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7fffffff;
}

VkPipelineCacheHeaderVersion :: enum s32 {
VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 0x1;
VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7fffffff;
Expand Down Expand Up @@ -2151,6 +2154,7 @@ VkPipelineCreateFlagBits :: enum u32 #flags {
VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x80;
VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x40000;
VK_PIPELINE_CREATE_LIBRARY_BIT_KHR = 0x800;
VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT = 0x20000000;
VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT = 0x800000;
VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT = 0x400;
VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV = 0x100000;
Expand Down Expand Up @@ -10388,3 +10392,9 @@ PFN_vkCmdDrawMeshTasksIndirectCountEXT :: *fn (VkCommandBuffer, VkBuffer, VkDevi
vkCmdDrawMeshTasksEXT :: fn (commandBuffer: VkCommandBuffer, groupCountX: u32, groupCountY: u32, groupCountZ: u32) #extern;
vkCmdDrawMeshTasksIndirectEXT :: fn (commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, drawCount: u32, stride: u32) #extern;
vkCmdDrawMeshTasksIndirectCountEXT :: fn (commandBuffer: VkCommandBuffer, buffer: VkBuffer, offset: VkDeviceSize, countBuffer: VkBuffer, countBufferOffset: VkDeviceSize, maxDrawCount: u32, stride: u32) #extern;

VkPhysicalDeviceRayTracingValidationFeaturesNV :: struct {
sType: VkStructureType;
pNext: *u8;
rayTracingValidation: VkBool32;
}
Binary file modified lib/bl/api/extra/vulkan/win32/vulkan-1.lib
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/bl/api/std/string/string.bl
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ str_upper_single_character :: fn (str: *string, index: s64) #inline {
/// If `with` replacement is 0 character, all `c` occurrences will be erased from the string.
///
/// Function return count of replaced characters or zero.
str_replace_all :: fn (str: *string, c: u8, with := '\0') s32 {
str_replace_all :: fn (str: *string, c: u8, with := '\0') s32 { // 2024-10-06 Why not to use string_view here?
replaced := 0;
loop i := 0; i < (@str).len; i += 1 {
if (@str)[i] == c {
Expand Down

0 comments on commit 88acd27

Please sign in to comment.