Made navmesh compile on Windows
Small updates to remove warnings Testing nonuniform descriptor access in shader
This commit is contained in:
33
code/first.c
33
code/first.c
@@ -65,13 +65,13 @@ int main(int argc, char **argv) {
|
||||
|
||||
G_Vertex *vertices = cast(G_Vertex *) vbo->data;
|
||||
|
||||
vertices[0] = (G_Vertex) { -0.25f, -0.25f, 1.0f, 1.0f, 0.0f, 0.0f, 0xFFFFFFFF, 0};
|
||||
vertices[1] = (G_Vertex) { 0.25f, -0.25f, 1.0f, 1.0f, 1.0f, 0.0f, 0xFFFFFFFF, 0};
|
||||
vertices[2] = (G_Vertex) { -0.25f, 0.25f, 1.0f, 1.0f, 0.0f, 1.0f, 0xFFFFFFFF, 0};
|
||||
vertices[0] = (G_Vertex) { -0.25f, -0.25f, 1.0f, 1.0f, 0.0f, 0.0f, 0xFFFFFFFF, 1};
|
||||
vertices[1] = (G_Vertex) { 0.25f, -0.25f, 1.0f, 1.0f, 1.0f, 0.0f, 0xFFFFFFFF, 1};
|
||||
vertices[2] = (G_Vertex) { -0.25f, 0.25f, 1.0f, 1.0f, 0.0f, 1.0f, 0xFFFFFFFF, 1};
|
||||
|
||||
vertices[3] = (G_Vertex) { 0.25f, -0.25f, 1.0f, 1.0f, 1.0f, 0.0f, 0xFFFFFFFF, 0};
|
||||
vertices[4] = (G_Vertex) { 0.25f, 0.25f, 1.0f, 1.0f, 1.0f, 1.0f, 0xFFFFFFFF, 0};
|
||||
vertices[5] = (G_Vertex) { -0.25f, 0.25f, 1.0f, 1.0f, 0.0f, 1.0f, 0xFFFFFFFF, 0};
|
||||
vertices[3] = (G_Vertex) { 0.25f, -0.25f, 1.0f, 1.0f, 1.0f, 0.0f, 0xFFFFFFFF, 1};
|
||||
vertices[4] = (G_Vertex) { 0.25f, 0.25f, 1.0f, 1.0f, 1.0f, 1.0f, 0xFFFFFFFF, 1};
|
||||
vertices[5] = (G_Vertex) { -0.25f, 0.25f, 1.0f, 1.0f, 0.0f, 1.0f, 0xFFFFFFFF, 1};
|
||||
}
|
||||
|
||||
bool running = true;
|
||||
@@ -100,6 +100,7 @@ int main(int argc, char **argv) {
|
||||
.navMesh = TestNavMesh,
|
||||
.npcPOI = {100}
|
||||
};
|
||||
|
||||
while (running)
|
||||
{
|
||||
SDL_Event e;
|
||||
@@ -111,7 +112,8 @@ int main(int argc, char **argv) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
UpdateNPCs(1.0/60.0, &world);
|
||||
|
||||
UpdateNPCs(1.0f / 60.0f, &world);
|
||||
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(window, &w, &h);
|
||||
@@ -154,7 +156,7 @@ int main(int argc, char **argv) {
|
||||
vk.AllocateDescriptorSets(vk.device, &alloc_info, &set);
|
||||
|
||||
// 'update' the descriptor sets for binding
|
||||
{
|
||||
M_TempScope(0, 0) {
|
||||
VkWriteDescriptorSet writes[2] = { 0 };
|
||||
|
||||
VkDescriptorBufferInfo vbo_info = { 0 };
|
||||
@@ -162,10 +164,13 @@ int main(int argc, char **argv) {
|
||||
vbo_info.offset = 0;
|
||||
vbo_info.range = 256;
|
||||
|
||||
VkDescriptorImageInfo image_info = { 0 };
|
||||
image_info.imageView = img->image.view;
|
||||
image_info.sampler = vk.sampler;
|
||||
image_info.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
VkDescriptorImageInfo *image_info = M_ArenaPush(temp.arena, VkDescriptorImageInfo, .count = game->n_images);
|
||||
|
||||
for (U32 it = 0; it < game->n_images; ++it) {
|
||||
image_info[it].imageView = game->images[it].image.view;
|
||||
image_info[it].sampler = vk.sampler;
|
||||
image_info[it].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
|
||||
}
|
||||
|
||||
writes[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
writes[0].dstSet = set;
|
||||
@@ -177,9 +182,9 @@ int main(int argc, char **argv) {
|
||||
writes[1].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
|
||||
writes[1].dstSet = set;
|
||||
writes[1].dstBinding = 1;
|
||||
writes[1].descriptorCount = 1;
|
||||
writes[1].descriptorCount = game->n_images;
|
||||
writes[1].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
writes[1].pImageInfo = &image_info;
|
||||
writes[1].pImageInfo = image_info;
|
||||
|
||||
vk.UpdateDescriptorSets(vk.device, ArraySize(writes), writes, 0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user