[vulkan] Switch glyph vertex and texture data bindings

With an eye towards merging the 2d pipelines as much as possible, I
found that the glyph and basic 2d quad texture descriptors were in
different slots for no reason I can think of. Having them in the same
slot would mean I could use the same fragment shader for all 2d
pipelines (though the plan is to get it down to two: (sliced) quads and
lines).
This commit is contained in:
Bill Currie 2023-01-05 13:25:46 +09:00
parent 70e93bb7e8
commit 37b6d4da7e
5 changed files with 15 additions and 15 deletions

View file

@ -281,20 +281,20 @@
}; };
glyph_data_set = { glyph_data_set = {
bindings = ( bindings = (
{
// glyph geometry data (offset and uv)
binding = 0;
descriptorType = uniform_texel_buffer;
descriptorCount = 1;
stageFlags = vertex;
},
{ {
// glyph texture data // glyph texture data
binding = 1; binding = 0;
descriptorType = combined_image_sampler; descriptorType = combined_image_sampler;
descriptorCount = 1; descriptorCount = 1;
stageFlags = fragment; stageFlags = fragment;
}, },
{
// glyph geometry data (offset and uv)
binding = 1;
descriptorType = uniform_texel_buffer;
descriptorCount = 1;
stageFlags = vertex;
},
); );
}; };
texture_set = { texture_set = {

View file

@ -1,6 +1,6 @@
#version 450 #version 450
layout (set = 1, binding = 1) uniform sampler2D Texture; layout (set = 1, binding = 0) uniform sampler2D Texture;
layout (location = 0) in vec2 uv; layout (location = 0) in vec2 uv;
layout (location = 1) in vec4 color; layout (location = 1) in vec4 color;

View file

@ -4,7 +4,7 @@
layout (set = 0, binding = 0) uniform layout (set = 0, binding = 0) uniform
#include "matrices.h" #include "matrices.h"
; ;
layout (set = 1, binding = 0) uniform textureBuffer glyph_data; layout (set = 1, binding = 1) uniform textureBuffer glyph_data;
// per instance data // per instance data
layout (location = 0) in uint glyph_index; layout (location = 0) in uint glyph_index;

View file

@ -4,7 +4,7 @@
layout (set = 0, binding = 0) uniform layout (set = 0, binding = 0) uniform
#include "matrices.h" #include "matrices.h"
; ;
layout (set = 1, binding = 0) uniform textureBuffer glyph_data; layout (set = 1, binding = 1) uniform textureBuffer glyph_data;
// per instance data // per instance data
layout (location = 0) in uint glyph_index; layout (location = 0) in uint glyph_index;

View file

@ -1503,12 +1503,12 @@ Vulkan_Draw_AddFont (font_t *rfont, vulkan_ctx_t *ctx)
VkWriteDescriptorSet write[] = { VkWriteDescriptorSet write[] = {
{ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, 0, { VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, 0,
font->set, 0, 0, 1, font->set, 0, 0, 1,
VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER,
0, 0, &glyph_bview->buffer_view.view },
{ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, 0,
font->set, 1, 0, 1,
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
&imageInfo, 0, 0 }, &imageInfo, 0, 0 },
{ VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, 0,
font->set, 1, 0, 1,
VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER,
0, 0, &glyph_bview->buffer_view.view },
}; };
dfunc->vkUpdateDescriptorSets (device->dev, 2, write, 0, 0); dfunc->vkUpdateDescriptorSets (device->dev, 2, write, 0, 0);
free (glyph_sets); free (glyph_sets);