Port all the limits

This commit is contained in:
Dzmitry Malyshau 2020-04-03 21:59:25 -04:00 committed by Dzmitry Malyshau
parent d6a92224ab
commit 1b19af0f5d

View file

@ -14,47 +14,110 @@ pub fn limits_from_hal(limits: Limits) -> VkPhysicalDeviceLimits {
maxImageDimension2D: limits.max_image_2d_size, maxImageDimension2D: limits.max_image_2d_size,
maxImageDimension3D: limits.max_image_3d_size, maxImageDimension3D: limits.max_image_3d_size,
maxImageDimensionCube: limits.max_image_cube_size, maxImageDimensionCube: limits.max_image_cube_size,
maxFramebufferWidth: limits.max_framebuffer_extent.width, maxImageArrayLayers: limits.max_image_array_layers as _,
maxFramebufferHeight: limits.max_framebuffer_extent.height,
maxTexelBufferElements: limits.max_texel_elements as _, maxTexelBufferElements: limits.max_texel_elements as _,
maxTessellationPatchSize: limits.max_patch_size as _,
maxPushConstantsSize: limits.max_push_constants_size as _,
maxViewports: limits.max_viewports as _,
maxViewportDimensions: limits.max_viewport_dimensions,
maxBoundDescriptorSets: limits.max_bound_descriptor_sets as _,
maxPerStageDescriptorUniformBuffers: limits.max_per_stage_descriptor_uniform_buffers as _,
maxDescriptorSetUniformBuffers: limits.max_descriptor_set_uniform_buffers as _,
maxFragmentInputComponents: limits.max_fragment_input_components as _,
maxFramebufferLayers: limits.max_framebuffer_layers as _,
maxMemoryAllocationCount: limits.max_memory_allocation_count as _,
maxUniformBufferRange: limits.max_uniform_buffer_range as _, maxUniformBufferRange: limits.max_uniform_buffer_range as _,
// Warning: spec violation maxStorageBufferRange: limits.max_storage_buffer_range as _,
// "The x/y rectangle of the viewport must lie entirely within the current attachment size." maxPushConstantsSize: limits.max_push_constants_size as _,
viewportBoundsRange: [0.0, viewport_size as f32], maxMemoryAllocationCount: limits.max_memory_allocation_count as _,
maxSamplerAllocationCount: limits.max_sampler_allocation_count as _,
bufferImageGranularity: limits.buffer_image_granularity,
sparseAddressSpaceSize: 0,
maxBoundDescriptorSets: limits.max_bound_descriptor_sets as _,
maxPerStageDescriptorSamplers: limits.max_per_stage_descriptor_samplers as _,
maxPerStageDescriptorUniformBuffers: limits.max_per_stage_descriptor_uniform_buffers as _,
maxPerStageDescriptorStorageBuffers: limits.max_per_stage_descriptor_storage_buffers as _,
maxPerStageDescriptorSampledImages: limits.max_per_stage_descriptor_sampled_images as _,
maxPerStageDescriptorStorageImages: limits.max_per_stage_descriptor_storage_images as _,
maxPerStageDescriptorInputAttachments: limits.max_per_stage_descriptor_input_attachments as _,
maxPerStageResources: limits.max_per_stage_resources as _,
maxDescriptorSetSamplers: limits.max_descriptor_set_samplers as _,
maxDescriptorSetUniformBuffers: limits.max_descriptor_set_uniform_buffers as _,
maxDescriptorSetUniformBuffersDynamic: limits.max_descriptor_set_uniform_buffers_dynamic.max(1) as _,
maxDescriptorSetStorageBuffers: limits.max_descriptor_set_storage_buffers as _,
maxDescriptorSetStorageBuffersDynamic: limits.max_descriptor_set_storage_buffers_dynamic.max(1) as _,
maxDescriptorSetSampledImages: limits.max_descriptor_set_sampled_images as _,
maxDescriptorSetStorageImages: limits.max_descriptor_set_storage_images as _,
maxDescriptorSetInputAttachments: limits.max_descriptor_set_input_attachments as _,
maxVertexInputAttributes: limits.max_vertex_input_attributes as _, maxVertexInputAttributes: limits.max_vertex_input_attributes as _,
maxVertexInputBindings: limits.max_vertex_input_bindings as _, maxVertexInputBindings: limits.max_vertex_input_bindings as _,
maxVertexInputAttributeOffset: limits.max_vertex_input_attribute_offset as _, maxVertexInputAttributeOffset: limits.max_vertex_input_attribute_offset as _,
maxVertexInputBindingStride: limits.max_vertex_input_binding_stride as _, maxVertexInputBindingStride: limits.max_vertex_input_binding_stride as _,
maxVertexOutputComponents: limits.max_vertex_output_components as _, maxVertexOutputComponents: limits.max_vertex_output_components as _,
maxTessellationGenerationLevel: 0,
maxTessellationPatchSize: limits.max_patch_size as _,
maxTessellationControlPerVertexInputComponents: 0,
maxTessellationControlPerVertexOutputComponents: 0,
maxTessellationControlPerPatchOutputComponents: 0,
maxTessellationControlTotalOutputComponents: 0,
maxTessellationEvaluationInputComponents: 0,
maxTessellationEvaluationOutputComponents: 0,
maxGeometryShaderInvocations: limits.max_geometry_shader_invocations as _,
maxGeometryInputComponents: limits.max_geometry_input_components as _,
maxGeometryOutputComponents: limits.max_geometry_output_components as _,
maxGeometryOutputVertices: limits.max_geometry_output_vertices as _,
maxGeometryTotalOutputComponents: limits.max_geometry_total_output_components as _,
maxFragmentInputComponents: limits.max_fragment_input_components as _,
maxFragmentOutputAttachments: limits.max_fragment_output_attachments as _,
maxFragmentDualSrcAttachments: limits.max_fragment_dual_source_attachments as _,
maxFragmentCombinedOutputResources: limits.max_fragment_combined_output_resources as _,
maxComputeSharedMemorySize: limits.max_compute_shared_memory_size as _,
maxComputeWorkGroupCount: limits.max_compute_work_group_count, maxComputeWorkGroupCount: limits.max_compute_work_group_count,
maxComputeWorkGroupInvocations: limits.max_compute_work_group_invocations as _,
maxComputeWorkGroupSize: limits.max_compute_work_group_size, maxComputeWorkGroupSize: limits.max_compute_work_group_size,
bufferImageGranularity: limits.buffer_image_granularity, subPixelPrecisionBits: 0,
subTexelPrecisionBits: 0,
mipmapPrecisionBits: 0,
maxDrawIndexedIndexValue: limits.max_draw_indexed_index_value,
maxDrawIndirectCount: limits.max_draw_indirect_count,
maxSamplerLodBias: limits.max_sampler_lod_bias,
maxSamplerAnisotropy: limits.max_sampler_anisotropy,
maxViewports: limits.max_viewports as _,
maxViewportDimensions: limits.max_viewport_dimensions,
// Warning: spec violation
// "The x/y rectangle of the viewport must lie entirely within the current attachment size."
viewportBoundsRange: [0.0, viewport_size as f32],
viewportSubPixelBits: 0,
minMemoryMapAlignment: limits.min_memory_map_alignment.max(1),
minTexelBufferOffsetAlignment: limits.min_texel_buffer_offset_alignment, minTexelBufferOffsetAlignment: limits.min_texel_buffer_offset_alignment,
minUniformBufferOffsetAlignment: limits.min_uniform_buffer_offset_alignment, minUniformBufferOffsetAlignment: limits.min_uniform_buffer_offset_alignment,
minStorageBufferOffsetAlignment: limits.min_storage_buffer_offset_alignment, minStorageBufferOffsetAlignment: limits.min_storage_buffer_offset_alignment,
minTexelOffset: 0,
maxTexelOffset: 0,
minTexelGatherOffset: 0,
maxTexelGatherOffset: 0,
minInterpolationOffset: 0.0,
maxInterpolationOffset: 0.0,
subPixelInterpolationOffsetBits: 0,
maxFramebufferWidth: limits.max_framebuffer_extent.width,
maxFramebufferHeight: limits.max_framebuffer_extent.height,
maxFramebufferLayers: limits.max_framebuffer_layers as _,
framebufferColorSampleCounts: limits.framebuffer_color_sample_counts as _, framebufferColorSampleCounts: limits.framebuffer_color_sample_counts as _,
framebufferDepthSampleCounts: limits.framebuffer_depth_sample_counts as _, framebufferDepthSampleCounts: limits.framebuffer_depth_sample_counts as _,
framebufferStencilSampleCounts: limits.framebuffer_stencil_sample_counts as _, framebufferStencilSampleCounts: limits.framebuffer_stencil_sample_counts as _,
framebufferNoAttachmentsSampleCounts: 0, //TODO
maxColorAttachments: limits.max_color_attachments as _, maxColorAttachments: limits.max_color_attachments as _,
nonCoherentAtomSize: limits.non_coherent_atom_size as _, sampledImageColorSampleCounts: 0,
maxSamplerAnisotropy: limits.max_sampler_anisotropy, sampledImageIntegerSampleCounts: 0,
sampledImageDepthSampleCounts: 0,
sampledImageStencilSampleCounts: 0,
storageImageSampleCounts: 0,
maxSampleMaskWords: 0,
timestampComputeAndGraphics: 0,
timestampPeriod: 0.0,
maxClipDistances: 0,
maxCullDistances: 0,
maxCombinedClipAndCullDistances: 0,
discreteQueuePriorities: 0,
pointSizeRange: [0.0; 2],
lineWidthRange: [0.0; 2],
pointSizeGranularity: 0.0,
lineWidthGranularity: 0.0,
strictLines: 0,
standardSampleLocations: if limits.standard_sample_locations { VK_TRUE } else { VK_FALSE },
optimalBufferCopyOffsetAlignment: limits.optimal_buffer_copy_offset_alignment, optimalBufferCopyOffsetAlignment: limits.optimal_buffer_copy_offset_alignment,
optimalBufferCopyRowPitchAlignment: limits.optimal_buffer_copy_pitch_alignment, optimalBufferCopyRowPitchAlignment: limits.optimal_buffer_copy_pitch_alignment,
maxPerStageDescriptorSampledImages: limits.max_per_stage_descriptor_sampled_images as _, nonCoherentAtomSize: limits.non_coherent_atom_size as _,
maxPerStageDescriptorSamplers: limits.max_per_stage_descriptor_samplers as _,
maxDescriptorSetSampledImages: limits.max_descriptor_set_sampled_images as _,
maxDescriptorSetSamplers: limits.max_descriptor_set_samplers as _,
..unsafe { mem::zeroed() } //TODO
} }
} }