~/bend-docscommunity

LAWS.bend source

LAWS.bend on the hub · documented module

import Baseimport ./src/core.bend as Coreimport ./src/constants.bend as vkimport ./deps/bend-collections/src/math/u64.bend as W# Native marshalling must preserve these limbs; the C boundary is tested separately.law size_words_roundtrip:  for value: W.U64  {Core.size_from_words(Core.size_words(value)) == value : W.U64}law whole_size_bits:  {Core.whole_size() == W.U64{4294967295, 4294967295} : W.U64}law no_allowed_memory:  for types: List<Core.MemoryType>  for required: U32  for index: U32  {Core.memory_type_go(types, 0, required, index) == None{} : Maybe<U32>}law memory_filters_flags:  {Core.find_memory_type([Core.MemoryType{1, 0}, Core.MemoryType{6, 0}], 3, 6) == Some{1} : Maybe<U32>}law memory_filters_type_bits:  {Core.find_memory_type([Core.MemoryType{6, 0}, Core.MemoryType{6, 0}], 2, 6) == Some{1} : Maybe<U32>}law memory_uses_first_match:  {Core.find_memory_type([Core.MemoryType{6, 0}, Core.MemoryType{6, 0}], 3, 6) == Some{0} : Maybe<U32>}law queue_skips_empty:  {Core.find_queue_family([(3, 0), (1, 1)], 1) == Some{1} : Maybe<U32>}law queue_filters_flags:  {Core.find_queue_family([(2, 1), (1, 1)], 1) == Some{1} : Maybe<U32>}law version_1_0:  {Core.make_api_version(0, 1, 0, 0) == 4194304 : U32}law version_fields:  {(Core.api_version_major(536887305), (Core.api_version_minor(536887305), Core.api_version_patch(536887305))) == (0, (4, 9)) : U32 & (U32 & U32)}law result_device_lost_bits:  {vk.VK_ERROR_DEVICE_LOST() == 4294967292 : U32}law packed_word_bytes:  {(Core.word_byte(16909060, 0), (Core.word_byte(16909060, 1), (Core.word_byte(16909060, 2), Core.word_byte(16909060, 3)))) == (4, (3, (2, 1))) : U32 & (U32 & (U32 & U32))}law packed_index_wraps:  {Core.word_byte(16909060, 4) == 4 : U32}law image_copy_last_byte:  {Core.image_copy_end(W.of_u32(12),7,5,3,2,2,4) == Some{W.of_u32(192)} : Maybe<W.U64>}law image_copy_readback_last_byte:  {Core.image_copy_end(W.of_u32(20),9,6,3,2,2,4) == Some{W.of_u32(284)} : Maybe<W.U64>}law image_copy_tight_padding:  {Core.image_copy_end(W.of_u32(8),0,0,3,2,2,4) == Core.image_copy_end(W.of_u32(8),3,2,3,2,2,4) : Maybe<W.U64>}law image_copy_overflow:  {Core.image_copy_end(Core.whole_size(),0,0,1,1,1,4) == None{} : Maybe<W.U64>}law image_copy_product_overflow:  {Core.image_copy_end(W.zero(),4294967295,4294967295,1,1,4294967295,4) == None{} : Maybe<W.U64>}law size_checked_wrap:  {Core.size_add_checked(Core.whole_size(),W.of_u32(1)) == None{} : Maybe<W.U64>}law image_mip_floor:  {(Core.image_mip_dimension(9,1),Core.image_mip_dimension(9,32)) == (4,1) : U32 & U32}law image_range_no_wrap:  {Core.image_range_contains(5,4294967295,2) == False{} : Bool}law size_limbs_roundtrip:  for words: U32 & U32  {Core.size_words(Core.size_from_words(words)) == words : U32 & U32}law size_scale_zero:  {Core.size_scale_checked(Core.whole_size(),0) == Some{W.zero()} : Maybe<W.U64>}law index_span_u16:  {Core.index_span_end(W.of_u32(6),3,6,2) == Some{W.of_u32(24)} : Maybe<W.U64>}law index_span_widens:  {Core.index_span_end(W.zero(),4294967295,2,4) == Some{W.U64{4,4}} : Maybe<W.U64>}law index_span_rejects_width:  {Core.index_span_end(W.zero(),0,1,3) == None{} : Maybe<W.U64>}law index_span_overflow:  {Core.index_span_end(Core.whole_size(),0,1,2) == None{} : Maybe<W.U64>}law binding_alignment_includes_memory:  {Core.binding_aligned(W.of_u32(2),W.of_u32(8),4) == False{} : Bool}law binding_alignment_compensates:  {Core.binding_aligned(W.of_u32(2),W.of_u32(10),4) == True{} : Bool}law binding_alignment_high_limbs:  {Core.binding_aligned(W.U64{2,4294967295},W.U64{10,4294967295},4) == True{} : Bool}law binding_alignment_rejects_width:  {Core.binding_aligned(W.zero(),W.zero(),3) == False{} : Bool}law voxel_intact_counts:  {((384 * 4 : U32),(384 * 6 : U32),(384 * 160 : U32),(384 * 24 : U32)) == (1536,2304,61440,9216) : U32 & U32 & U32 & U32}law presentation_common_queue:  {Core.queue_pair([Core.QueueSupport{1,1,True{}},Core.QueueSupport{4,1,True{}}],False{}) == Some{Core.QueuePair{0,0}} : Maybe<Core.QueuePair>}law presentation_split_queue:  {Core.queue_pair([Core.QueueSupport{1,1,False{}},Core.QueueSupport{4,1,True{}}],False{}) == Some{Core.QueuePair{0,1}} : Maybe<Core.QueuePair>}law presentation_forced_split_queue:  {Core.queue_pair([Core.QueueSupport{1,1,True{}},Core.QueueSupport{4,1,True{}}],True{}) == Some{Core.QueuePair{0,1}} : Maybe<Core.QueuePair>}law presentation_empty_queue_rejected:  {Core.queue_pair([Core.QueueSupport{1,0,True{}}],False{}) == None{} : Maybe<Core.QueuePair>}law presentation_image_count:  {(Core.present_image_count(2,0),Core.present_image_count(2,2),Core.present_image_count(2,4)) == (3,2,3) : U32 & U32 & U32}law presentation_suspend_before_clamp:  for mapped: Bool  {Core.drawable(mapped,0,720) == False{} : Bool}law presentation_variable_extent:  {Core.surface_extent(4294967295,4294967295,16,16,1024,1024,800,450) == (800,450) : U32 & U32}law presentation_fixed_extent:  {Core.surface_extent(450,700,16,16,1024,1024,800,450) == (450,700) : U32 & U32}law presentation_landscape_pixel_center:  {Core.viewport_pixel_units(800,450,399,224) == (4294967295,1) : U32 & U32}law presentation_portrait_pixel_center:  {Core.viewport_pixel_units(450,700,225,350) == (1,4294967295) : U32 & U32}law presentation_undefined_format:  {Core.surface_format([(0,17)]) == Some{(44,17)} : Maybe<(U32 & U32)>}law presentation_preserves_color_space:  {Core.surface_format([(7,0),(44,1000104001)]) == Some{(44,1000104001)} : Maybe<(U32 & U32)>}law presentation_fifo_required:  {(Core.fifo_supported([0,1]),Core.fifo_supported([0,2])) == (False{},True{}) : Bool & Bool}law presentation_prefers_unorm:  {Core.surface_format([(50,0),(44,0)]) == Some{(44,0)} : Maybe<(U32 & U32)>}law presentation_undefined_requires_single_format:  {Core.surface_format([(37,0),(0,17)]) == Some{(37,0)} : Maybe<(U32 & U32)>}law descriptor_empty_schema:  {Core.descriptor_schema(~U32,~(x => x),[]) == [] : List<U32>}law descriptor_insert_single:  for binding: U32  {Core.descriptor_insert(~U32,~(x => x),[],binding) == [binding] : List<U32>}law descriptor_sparse_canonical:  {Core.descriptor_schema(~U32,~(x => x),[9,3,0]) == [0,3,9] : List<U32>}law upload_source_range_exact_end:  {Core.subrange_contains(W.of_u32(16),W.of_u32(9),W.of_u32(7)) == True{} : Bool}law upload_source_range_rejects_next:  {Core.subrange_contains(W.of_u32(16),W.of_u32(10),W.of_u32(7)) == False{} : Bool}law upload_source_range_no_wrap:  {Core.subrange_contains(W.of_u32(16),Core.whole_size(),W.of_u32(2)) == False{} : Bool}law upload_empty_at_end:  {Core.subrange_contains(W.of_u32(16),W.of_u32(16),W.zero()) == True{} : Bool}law completed_revision_first_zero:  {Core.completed_revision(4294967295,0) == 0 : U32}law completed_revision_reverse_order:  {Core.completed_revision(Core.completed_revision(4294967295,2),1) == 2 : U32}law completed_revision_unavailable_ignored:  {Core.completed_revision(7,4294967295) == 7 : U32}law revision_last_valid:  {Core.next_revision(4294967293) == Some{4294967294} : Maybe<&2,U32>}law revision_exhaustion_does_not_wrap:  {Core.next_revision(4294967294) == None{} : Maybe<&2,U32>}law submission_sequence_blocks_newer:  {Core.sequence_ready(W.U64{0,0},W.U64{1,0}) == False{} : Bool}law submission_sequence_accepts_exact:  {Core.sequence_ready(W.U64{1,0},W.U64{1,0}) == True{} : Bool}law submission_sequence_checks_high_limb:  {Core.sequence_ready(W.U64{0,1},W.U64{0,2}) == False{} : Bool}law submission_sequence_carries:  {Core.sequence_next(W.U64{4294967295,0}) == Some{W.U64{0,1}} : Maybe<&2,W.U64>}law submission_sequence_never_wraps:  {Core.sequence_next(W.U64{4294967295,4294967295}) == None{} : Maybe<&2,W.U64>}