VkInstanceCreateInfo info = VkInstanceCreateInfo.create(
0,
VkApplicationInfo.create("cube", 1, "cube-engine", 2, VK_API_VERSION_1_0, frame),
- new String[]{"VK_LAYER_KHRONOS_validation"},
- new String[]{"VK_KHR_surface", "VK_KHR_xlib_surface", "VK_EXT_debug_utils"},
+ 1, new String[]{"VK_LAYER_KHRONOS_validation"},
+ 3, new String[]{"VK_KHR_surface", "VK_KHR_xlib_surface", "VK_EXT_debug_utils"},
frame
);
VkDeviceQueueCreateInfo qinfo = VkDeviceQueueCreateInfo.create(
0,
graphics_queue,
- qpri,
+ 1, qpri,
frame);
String[] extensions = {
"VK_KHR_swapchain"
features.setDepthClamp(1);
VkDeviceCreateInfo devinfo = VkDeviceCreateInfo.create(
0,
- qinfo,
- null,
- extensions,
+ 1, qinfo,
+ 0, null,
+ extensions.length, extensions,
features,
frame);
surface,
surfCapabilities.getMinImageCount(),
format,
- swapchainExtent.getWidth(), swapchainExtent.getHeight(),
VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
+ swapchainExtent.getWidth(), swapchainExtent.getHeight(),
1, //.imageArrayLayers = 1,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
VK_SHARING_MODE_EXCLUSIVE,
// assumes queues are same.
- null,
+ 0, null,
(surfCapabilities.getSupportedTransforms() & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) != 0
? VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR : surfCapabilities.getCurrentTransform(),
compositeAlpha,
0,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
VK_SHARING_MODE_EXCLUSIVE,
- null,
+ 0, null,
VK_IMAGE_LAYOUT_UNDEFINED,
frame);
frame);
VkDescriptorSetLayoutCreateInfo descriptor_layout = VkDescriptorSetLayoutCreateInfo.create(
0,
- layout_binding,
+ 1, layout_binding,
frame);
desc_layout = device.vkCreateDescriptorSetLayout(descriptor_layout, scope);
VkPipelineLayoutCreateInfo pipeline_info = VkPipelineLayoutCreateInfo.create(
0,
- //1,
- layout_table,
- null,
+ 1, layout_table,
+ 0, null,
frame);
pipeline_layout = device.vkCreatePipelineLayout(pipeline_info, scope);
VkDescriptorPoolCreateInfo descriptor_pool = VkDescriptorPoolCreateInfo.create(
0,
1,
- type_count,
+ 1, type_count,
frame);
desc_pool = device.vkCreateDescriptorPool(descriptor_pool, scope);
VkDescriptorSetAllocateInfo alloc_info = VkDescriptorSetAllocateInfo.create(
desc_pool,
- //1,
- layout_table,
+ 1, layout_table,
frame);
System.out.println(alloc_info);
VkSubpassDescription subpass = VkSubpassDescription.create(
0,
VK_PIPELINE_BIND_POINT_GRAPHICS,
- null,
- 1,
- color_reference,
+ 0, null,
+ 1, color_reference,
null,
depth_reference,
- null,
+ 0, null,
frame);
VkRenderPassCreateInfo rp_info = VkRenderPassCreateInfo.create(
0,
- //(int)attachments.length(),
- attachments,
- subpass,
- null,
+ 2, attachments,
+ 1, subpass,
+ 0, null,
frame);
render_pass = device.vkCreateRenderPass(rp_info, scope);
attachments.setAtIndex(1, depthView);
- // FIXME: I don't think i want lenghts implied for types tbh
VkFramebufferCreateInfo fb_info = VkFramebufferCreateInfo.create(
0,
render_pass,
- //2,
- attachments,
- width,
- height,
- 1,
+ 2, attachments,
+ width, height, 1,
frame);
framebuffers = VkFramebuffer.createArray(chainImage.length(), (SegmentAllocator)scope);
VK_DYNAMIC_STATE_SCISSOR);
VkPipelineDynamicStateCreateInfo dynamicState = VkPipelineDynamicStateCreateInfo.create(
- 0, dynamicStateEnables,
+ 0,
+ 2, dynamicStateEnables,
frame);
VkPipelineVertexInputStateCreateInfo vi = VkPipelineVertexInputStateCreateInfo.create(
0,
- vi_binding,
- vi_attribs,
+ (int)vi_binding.length(), vi_binding,
+ (int)vi_attribs.length(), vi_attribs,
frame);
VkPipelineInputAssemblyStateCreateInfo ia = VkPipelineInputAssemblyStateCreateInfo.create(
0,
VK_FALSE,
VK_LOGIC_OP_NO_OP,
- att_state,
+ 1, att_state,
1.0f, 1.0f, 1.0f, 1.0f,
frame);
VkGraphicsPipelineCreateInfo pipeline = VkGraphicsPipelineCreateInfo.create(
0,
- //2, shaderStages,
- shaderStages,
+ 2, shaderStages,
vi,
ia,
null,
VkSubmitInfo submit_info = VkSubmitInfo.create(
1, null, pipe_stage_flags,
- cmd,
- null,
+ (int)cmd.length(), cmd,
+ 0, null,
frame);
graphics_queue.vkQueueSubmit(1, submit_info, drawFence);
render_pass,
framebuffers.getAtIndex(chainIndex),
0, 0, width, height,
- clear_values,
+ 2, clear_values,
frame);
cmd.vkCmdBeginRenderPass(rp_begin, VK_SUBPASS_CONTENTS_INLINE);
VkSubmitInfo submit_info = VkSubmitInfo.create(
1, semaphores, pipe_stage_flags,
- this.cmd,
- null,
+ (int)this.cmd.length(), this.cmd,
+ 0, null,
frame);
HandleArray<VkFence> fences = VkFence.createArray(1, frame);
HandleArray<VkSwapchainKHR> chains = VkSwapchainKHR.createArray(1, frame);
chains.setAtIndex(0, chain);
VkPresentInfoKHR present = VkPresentInfoKHR.create(
- null,
- 1,
- chains,
- chainIndices,
- null,
+ 0, null,
+ 1, chains, chainIndices, null,
frame);
present_queue.vkQueuePresentKHR(present);
dataSize,
usage,
VK_SHARING_MODE_EXCLUSIVE,
- //0,
- null,
+ 0, null,
frame);
VkBuffer buffer = device.vkCreateBuffer(buf_info, scope);
init_instance();
init_debug();
-
init_surface();
init_device();
init_device_queue();
+
init_command();
init_depth();
init_uniform();
VkInstanceCreateInfo info = VkInstanceCreateInfo.create(
0,
VkApplicationInfo.create("test", 1, "test-engine", 2, VK_API_VERSION_1_0, frame),
+ 1,
new String[]{"VK_LAYER_KHRONOS_validation"},
+ debug ? 1 : 0,
debug ? new String[]{"VK_EXT_debug_utils"} : null,
frame
);
VkDeviceQueueCreateInfo qinfo = VkDeviceQueueCreateInfo.create(
0,
queueid,
+ 1,
qpri,
frame);
VkDeviceCreateInfo devinfo = VkDeviceCreateInfo.create(
0,
- qinfo,
- null,
- null,
+ 1, qinfo,
+ 0, null,
+ 0, null,
null,
frame);
dataSize,
usage,
VK_SHARING_MODE_EXCLUSIVE,
- null,
+ 0, null,
frame);
VkBuffer buffer = device.vkCreateBuffer(buf_info, scope);
VkDescriptorSetLayoutCreateInfo descriptor_layout = VkDescriptorSetLayoutCreateInfo.create(
0,
- layout_binding,
+ 1, layout_binding,
frame);
descriptorSetLayout = device.vkCreateDescriptorSetLayout(descriptor_layout, scope);
VkDescriptorPoolCreateInfo descriptor_pool = VkDescriptorPoolCreateInfo.create(
0,
1,
- type_count,
+ 1, type_count,
frame);
descriptorPool = device.vkCreateDescriptorPool(descriptor_pool, scope);
VkDescriptorSetAllocateInfo alloc_info = VkDescriptorSetAllocateInfo.create(
descriptorPool,
- layout_table,
+ 1, layout_table,
frame);
descriptorSets = device.vkAllocateDescriptorSets(alloc_info, (SegmentAllocator)scope);
VkPipelineLayoutCreateInfo pipelineinfo = VkPipelineLayoutCreateInfo.create(
0,
- layout_table,
- null,
+ 1, layout_table,
+ 0, null,
frame);
pipelineLayout = device.vkCreatePipelineLayout(pipelineinfo, scope);
VkInstanceCreateInfo info = VkInstanceCreateInfo.create(
0,
VkApplicationInfo.create("cube", 1, "cube-engine", 2, VK_API_VERSION_1_0, frame),
- new String[]{"VK_LAYER_KHRONOS_validation"},
- new String[]{"VK_KHR_surface", "VK_KHR_xlib_surface", "VK_EXT_debug_utils"},
+ 1, new String[]{"VK_LAYER_KHRONOS_validation"},
+ 3, new String[]{"VK_KHR_surface", "VK_KHR_xlib_surface", "VK_EXT_debug_utils"},
frame
);
VkDeviceQueueCreateInfo qinfo = VkDeviceQueueCreateInfo.create(
0,
graphics_queue,
- qpri,
+ 1, qpri,
frame);
String[] extensions = {
"VK_KHR_swapchain"
features.setDepthClamp(1);
VkDeviceCreateInfo devinfo = VkDeviceCreateInfo.create(
0,
- qinfo,
- null,
- extensions,
+ 1, qinfo,
+ 0, null,
+ extensions.length, extensions,
features,
frame);
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT,
VK_SHARING_MODE_EXCLUSIVE,
// assumes queues are same.
- null,
+ 0, null,
(surfCapabilities.getSupportedTransforms() & VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR) != 0
? VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR : surfCapabilities.getCurrentTransform(),
compositeAlpha,
0,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
VK_SHARING_MODE_EXCLUSIVE,
- null,
+ 0, null,
VK_IMAGE_LAYOUT_UNDEFINED,
frame);
frame);
VkDescriptorSetLayoutCreateInfo descriptor_layout = VkDescriptorSetLayoutCreateInfo.create(
0,
- layout_binding,
+ 1, layout_binding,
frame);
desc_layout = device.vkCreateDescriptorSetLayout(descriptor_layout, scope);
VkPipelineLayoutCreateInfo pipeline_info = VkPipelineLayoutCreateInfo.create(
0,
- //1,
- layout_table,
- null,
+ 1, layout_table,
+ 0, null,
frame);
pipeline_layout = device.vkCreatePipelineLayout(pipeline_info, scope);
VkDescriptorPoolCreateInfo descriptor_pool = VkDescriptorPoolCreateInfo.create(
0,
1,
- type_count,
+ 1, type_count,
frame);
desc_pool = device.vkCreateDescriptorPool(descriptor_pool, scope);
VkDescriptorSetAllocateInfo alloc_info = VkDescriptorSetAllocateInfo.create(
desc_pool,
- //1,
- layout_table,
+ 1, layout_table,
frame);
System.out.println(alloc_info);
VkSubpassDescription subpass = VkSubpassDescription.create(
0,
VK_PIPELINE_BIND_POINT_GRAPHICS,
- null,
- 1,
- color_reference,
+ 0, null,
+ 1, color_reference,
null,
depth_reference,
- null,
+ 0, null,
frame);
VkRenderPassCreateInfo rp_info = VkRenderPassCreateInfo.create(
0,
- //(int)attachments.length(),
- attachments,
- subpass,
- null,
+ 2, attachments,
+ 1, subpass,
+ 0, null,
frame);
render_pass = device.vkCreateRenderPass(rp_info, scope);
attachments.setAtIndex(1, depthView);
- // FIXME: I don't think i want lenghts implied for types tbh
VkFramebufferCreateInfo fb_info = VkFramebufferCreateInfo.create(
0,
render_pass,
- //2,
- attachments,
- width,
- height,
- 1,
+ 2, attachments,
+ width, height, 1,
frame);
framebuffers = VkFramebuffer.createArray(chainImage.length(), (SegmentAllocator)scope);
VK_DYNAMIC_STATE_SCISSOR);
VkPipelineDynamicStateCreateInfo dynamicState = VkPipelineDynamicStateCreateInfo.create(
- 0, dynamicStateEnables,
+ 0,
+ 2, dynamicStateEnables,
frame);
VkPipelineVertexInputStateCreateInfo vi = VkPipelineVertexInputStateCreateInfo.create(
0,
- vi_binding,
- vi_attribs,
+ (int)vi_binding.length(), vi_binding,
+ (int)vi_attribs.length(), vi_attribs,
frame);
VkPipelineInputAssemblyStateCreateInfo ia = VkPipelineInputAssemblyStateCreateInfo.create(
0,
VK_FALSE,
VK_LOGIC_OP_NO_OP,
- att_state,
+ 1, att_state,
1.0f, 1.0f, 1.0f, 1.0f,
frame);
VkGraphicsPipelineCreateInfo pipeline = VkGraphicsPipelineCreateInfo.create(
0,
- //2, shaderStages,
- shaderStages,
+ 2, shaderStages,
vi,
ia,
null,
VkSubmitInfo submit_info = VkSubmitInfo.create(
1, null, pipe_stage_flags,
- cmd,
- null,
+ (int)cmd.length(), cmd,
+ 0, null,
frame);
graphics_queue.vkQueueSubmit(1, submit_info, drawFence);
render_pass,
framebuffers.getAtIndex(chainIndex),
0, 0, width, height,
- clear_values,
+ 2, clear_values,
frame);
cmd.vkCmdBeginRenderPass(rp_begin, VK_SUBPASS_CONTENTS_INLINE);
VkSubmitInfo submit_info = VkSubmitInfo.create(
1, semaphores, pipe_stage_flags,
- this.cmd,
- null,
+ (int)this.cmd.length(), this.cmd,
+ 0, null,
frame);
HandleArray<VkFence> fences = VkFence.createArray(1, frame);
HandleArray<VkSwapchainKHR> chains = VkSwapchainKHR.createArray(1, frame);
chains.setAtIndex(0, chain);
VkPresentInfoKHR present = VkPresentInfoKHR.create(
- null,
- 1,
- chains,
- chainIndices,
- null,
+ 0, null,
+ 1, chains, chainIndices, null,
frame);
present_queue.vkQueuePresentKHR(present);
dataSize,
usage,
VK_SHARING_MODE_EXCLUSIVE,
- //0,
- null,
+ 0, null,
frame);
VkBuffer buffer = device.vkCreateBuffer(buf_info, scope);
layout {{ Memory.DOUBLE }}
}
-# ###################################################################### #
-# implied length types
-type uint64_t-implied,size_t-implied uint64_t {
- java-arg {{ }}
- invoke-arg {{ Memory.length({lengthfor}) }}
-}
-
-type uint32_t-implied uint32_t {
- java-arg {{ }}
- invoke-arg {{ (int)Memory.length({lengthfor}) }}
-}
-
# ###################################################################### #
# type uint8_t[],char[] value-array {
next if (defined($overrides->{$s->{name}}));
- my %lengths;
- map { $lengths{$_->{lengthfrom}}++ if $_->{lengthfrom} } @{$s->{items}};
-
foreach my $m (@{$s->{items}}) {
my $nstar = $m->{deref} =~ tr/*/*/;
- if ($m->{lengthfor} && $nstar == 0 && $lengths{$m->{name}} == 1) {
- die "No type '$m->{deref}-implied'" if !defined($types->{"$m->{deref}-implied"});
-
- $overrides->{$s->{name}}->{$m->{name}}->{type} = "$m->{deref}-implied";
- print "implied: $s->{name} $m->{name} $m->{deref} $s->{index}->{$m->{lengthfor}}->{deref}\n" if $sys->{verbose};
- }
-
if ($m->{deref} eq 'struct*-length') {
$defaultTemplate{$m->{baseType}}->{array} = 1;
} elsif ($m->{deref} eq 'struct[]') {
my $len = $index->{$2};
if (defined $len) {
$m->{length} = $1.'get'.ucfirst($2).'()'.$3;
- #$index->{$2}->{lengthfor} = $m->{name} if $index->{$2};
- $m->{lengthfrom} = $len->{name};
}
} else {
die "Unhandled len/altlen: ".Dumper($m);
my $len = $index->{$1};
if (defined $len) {
$m->{length} = "get$len->{Name}()";
- $m->{lengthfrom} = $len->{name};
- $len->{lengthfor} = $m->{name};
}
} elsif ($m->{len} eq 'null-terminated') {
# ignore
die "Not simple type" if ($len->{fullType} ne $len->{baseType});
$m->{length} = "get$len->{Name}()";
- $m->{lengthfrom} = $len->{name};
- $len->{lengthfor} = $m->{name};
} else {
die "what?".Dumper($m);
}
setall {{ self$.set{Name}({name}, alloc$); }}
}
-# implied accessors are ignored in constructors
-code value-implied value {
- setall-arg;
- setall {{ self$.set{Name}(({type})Memory.length({lengthfor})); }}
-}
-
# ###################################################################### #
code Vulkan {
layout {{ Memory.DOUBLE }}
}
-# ###################################################################### #
-# implied length types
-type uint64_t-implied,size_t-implied uint64_t accessor=value-implied {
-}
-
-type uint32_t-implied uint32_t accessor=value-implied {
-}
-
# ###################################################################### #
type uint8_t[],char[] value-array {
VkDebugUtilsLabelEXT template=struct-readonly-array;
VkDebugUtilsObjectNameInfoEXT template=struct-readonly-array;
- # override default array-length behaviours, some of these are independent of the array pointer
- VkAccelerationStructureBuildGeometryInfoKHR geometryCount=type:uint32_t;
- VkDescriptorSetLayoutBinding pImmutableSamplers=type:handle* descriptorCount=type:uint32_t;
- VkPipelineViewportStateCreateInfo scissorCount=type:uint32_t viewportCount=type:uint32_t;
-
# can't really work out what this is it's a void ** but it stays it's a pointer to uint8_t * in the spec
VkCuLaunchInfoNVX pParams=type:pointer pExtras=type:pointer;
}