Fix vertex rendering, somewhat
This commit is contained in:
parent
075431545a
commit
cce494899a
1 changed files with 7 additions and 7 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "gfx_rendering_api.h"
|
||||
#include "gfx_pc.h"
|
||||
#include "gfx_window_manager_api.h"
|
||||
#include "gfx_cc.h"
|
||||
|
||||
static VkInstance instance = VK_NULL_HANDLE;
|
||||
static VkPhysicalDevice physical_device = VK_NULL_HANDLE;
|
||||
|
@ -100,11 +101,10 @@ static void gfx_vulkan_create_pipeline() {
|
|||
std::array<VkPipelineShaderStageCreateInfo, 2> shader_stages = { vertex_stage, fragment_stage };
|
||||
|
||||
VkVertexInputBindingDescription binding = {};
|
||||
binding.stride = sizeof(float) * 3;
|
||||
binding.stride = sizeof(float) * 4;
|
||||
|
||||
VkVertexInputAttributeDescription position_attribute = {};
|
||||
position_attribute.format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
position_attribute.format = VK_FORMAT_R32G32B32_SFLOAT;
|
||||
position_attribute.format = VK_FORMAT_R32G32B32A32_SFLOAT;
|
||||
|
||||
const std::array attributes = { position_attribute };
|
||||
|
||||
|
@ -138,8 +138,8 @@ static void gfx_vulkan_create_pipeline() {
|
|||
VkPipelineRasterizationStateCreateInfo rasterizer = {};
|
||||
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||
rasterizer.lineWidth = 1.0f;
|
||||
rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||
rasterizer.frontFace = VK_FRONT_FACE_CLOCKWISE;
|
||||
rasterizer.cullMode = VK_CULL_MODE_NONE;
|
||||
rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
|
||||
VkPipelineMultisampleStateCreateInfo multisampling = {};
|
||||
multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||
|
@ -767,7 +767,7 @@ static void gfx_vulkan_renderer_draw_triangles(float buf_vbo[], size_t buf_vbo_l
|
|||
void* mapped_data = nullptr;
|
||||
vkMapMemory(device, vertex_memory, 0, buf_vbo_len, 0, &mapped_data);
|
||||
|
||||
memcpy(mapped_data, buf_vbo, buf_vbo_len);
|
||||
memcpy(mapped_data, buf_vbo, buf_vbo_len * sizeof(float));
|
||||
|
||||
VkMappedMemoryRange range = {};
|
||||
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
|
||||
|
@ -780,7 +780,7 @@ static void gfx_vulkan_renderer_draw_triangles(float buf_vbo[], size_t buf_vbo_l
|
|||
VkDeviceSize offsets[] = {0};
|
||||
vkCmdBindVertexBuffers(current_cmd, 0, 1, &vertex_buffer, offsets);
|
||||
|
||||
vkCmdDraw(current_cmd, buf_vbo_num_tris, 1, 0, 0);
|
||||
vkCmdDraw(current_cmd, buf_vbo_num_tris * 3, 1, 0, 0);
|
||||
}
|
||||
|
||||
/* end draw commands */
|
||||
|
|
Loading…
Add table
Reference in a new issue