Mercurial > games > semicongine
comparison semiconginev2/rendering/shaders.nim @ 1240:42eeb59f3a43
add: more tests, line and point rendering
| author | sam <sam@basx.dev> |
|---|---|
| date | Mon, 22 Jul 2024 12:42:35 +0700 |
| parents | 70f6c1cfe005 |
| children | c15770761865 |
comparison
equal
deleted
inserted
replaced
| 1239:69489a678141 | 1240:42eeb59f3a43 |
|---|---|
| 347 renderPass: RenderPass, | 347 renderPass: RenderPass, |
| 348 topology: VkPrimitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, | 348 topology: VkPrimitiveTopology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, |
| 349 polygonMode: VkPolygonMode = VK_POLYGON_MODE_FILL, | 349 polygonMode: VkPolygonMode = VK_POLYGON_MODE_FILL, |
| 350 cullMode: openArray[VkCullModeFlagBits] = [VK_CULL_MODE_BACK_BIT], | 350 cullMode: openArray[VkCullModeFlagBits] = [VK_CULL_MODE_BACK_BIT], |
| 351 frontFace: VkFrontFace = VK_FRONT_FACE_CLOCKWISE, | 351 frontFace: VkFrontFace = VK_FRONT_FACE_CLOCKWISE, |
| 352 descriptorPoolLimit = 1024, | 352 lineWidth = 1'f32, |
| 353 ): Pipeline[TShader] = | 353 ): Pipeline[TShader] = |
| 354 # create pipeline | 354 # create pipeline |
| 355 | 355 |
| 356 const shader = default(TShader) | 356 const shader = default(TShader) |
| 357 (result.vertexShaderModule, result.fragmentShaderModule) = CompileShader(shader) | 357 (result.vertexShaderModule, result.fragmentShaderModule) = CompileShader(shader) |
| 425 rasterizer = VkPipelineRasterizationStateCreateInfo( | 425 rasterizer = VkPipelineRasterizationStateCreateInfo( |
| 426 sType: VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, | 426 sType: VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO, |
| 427 depthClampEnable: VK_FALSE, | 427 depthClampEnable: VK_FALSE, |
| 428 rasterizerDiscardEnable: VK_FALSE, | 428 rasterizerDiscardEnable: VK_FALSE, |
| 429 polygonMode: polygonMode, | 429 polygonMode: polygonMode, |
| 430 lineWidth: 1.0, | 430 lineWidth: lineWidth, |
| 431 cullMode: toBits cullMode, | 431 cullMode: toBits cullMode, |
| 432 frontFace: frontFace, | 432 frontFace: frontFace, |
| 433 depthBiasEnable: VK_FALSE, | 433 depthBiasEnable: VK_FALSE, |
| 434 depthBiasConstantFactor: 0.0, | 434 depthBiasConstantFactor: 0.0, |
| 435 depthBiasClamp: 0.0, | 435 depthBiasClamp: 0.0, |
| 455 minDepthBounds: 0'f32, | 455 minDepthBounds: 0'f32, |
| 456 maxDepthBounds: 0'f32, | 456 maxDepthBounds: 0'f32, |
| 457 ) | 457 ) |
| 458 colorBlendAttachment = VkPipelineColorBlendAttachmentState( | 458 colorBlendAttachment = VkPipelineColorBlendAttachmentState( |
| 459 colorWriteMask: toBits [VK_COLOR_COMPONENT_R_BIT, VK_COLOR_COMPONENT_G_BIT, VK_COLOR_COMPONENT_B_BIT, VK_COLOR_COMPONENT_A_BIT], | 459 colorWriteMask: toBits [VK_COLOR_COMPONENT_R_BIT, VK_COLOR_COMPONENT_G_BIT, VK_COLOR_COMPONENT_B_BIT, VK_COLOR_COMPONENT_A_BIT], |
| 460 blendEnable: VK_TRUE, | 460 blendEnable: true, |
| 461 srcColorBlendFactor: VK_BLEND_FACTOR_SRC_ALPHA, | 461 srcColorBlendFactor: VK_BLEND_FACTOR_SRC_ALPHA, |
| 462 dstColorBlendFactor: VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, | 462 dstColorBlendFactor: VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA, |
| 463 colorBlendOp: VK_BLEND_OP_ADD, | 463 colorBlendOp: VK_BLEND_OP_ADD, |
| 464 srcAlphaBlendFactor: VK_BLEND_FACTOR_ONE, | 464 srcAlphaBlendFactor: VK_BLEND_FACTOR_ONE, |
| 465 dstAlphaBlendFactor: VK_BLEND_FACTOR_ZERO, | 465 dstAlphaBlendFactor: VK_BLEND_FACTOR_ZERO, |
| 466 alphaBlendOp: VK_BLEND_OP_ADD, | 466 alphaBlendOp: VK_BLEND_OP_ADD, |
| 467 ) | 467 ) |
| 468 colorBlending = VkPipelineColorBlendStateCreateInfo( | 468 colorBlending = VkPipelineColorBlendStateCreateInfo( |
| 469 sType: VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, | 469 sType: VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO, |
| 470 logicOpEnable: false, | 470 logicOpEnable: false, |
| 471 logicOp: VK_LOGIC_OP_COPY, | |
| 471 attachmentCount: 1, | 472 attachmentCount: 1, |
| 472 pAttachments: addr(colorBlendAttachment), | 473 pAttachments: addr(colorBlendAttachment), |
| 474 blendConstants: [0'f32, 0'f32, 0'f32, 0'f32] | |
| 473 ) | 475 ) |
| 474 dynamicStates = [VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR] | 476 dynamicStates = [VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR] |
| 475 dynamicState = VkPipelineDynamicStateCreateInfo( | 477 dynamicState = VkPipelineDynamicStateCreateInfo( |
| 476 sType: VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, | 478 sType: VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO, |
| 477 dynamicStateCount: dynamicStates.len.uint32, | 479 dynamicStateCount: dynamicStates.len.uint32, |
