Remove stack implementation

There is no need for stack implementation to be used here.
Simple C operations are enough for now

Signed-off-by: Piotr Krygier <piotrkrygier@everyonecancode@xyz>
This commit is contained in:
Piotr Krygier
2026-02-10 09:18:10 +01:00
parent 3dcf7fec56
commit 55e0ee261e
3 changed files with 19 additions and 58 deletions
+5 -3
View File
@@ -20,7 +20,6 @@
#include <vulkan/vulkan.h>
#include "utilities/entity.h"
#include "utilities/stack.h"
#include "utilities/vector.h"
#include "vma/vk_mem_alloc.h"
#include "vulkan/vulkan_core.h"
@@ -55,8 +54,6 @@
#define FONT_CHARACTERS_COUNT (94U)
#define FONTS_MAX_COUNT (32U)
RSE_STACK_DEFINE(required_dynamic_states_t, VkDynamicState, 16U);
struct graphics_context_t;
enum QUEUE_FAMILY_INDEX {
@@ -124,6 +121,11 @@ struct shader_modules_t
VkShaderStageFlagBits shaders_stages[MAX_SHADER_MODULES_COUNT];
};
struct required_dynamic_states_t {
size_t dynamic_states_count;
VkDynamicState dynamic_states[MAX_DYNAMIC_STATES_COUNT];
};
struct pipeline_infos_t
{
size_t pipeline_create_infos_count;
+14 -10
View File
@@ -102,11 +102,13 @@ static rse_err_t pipeline_add_viewport_state(struct pipeline_t* pipeline)
pipeline->viewport_state.pScissors = NULL; /* This is set during rendering */
if (pipeline->viewport_state.pViewports == NULL || pipeline->viewport_state.viewportCount == 0U) {
RSE_STACK_PUSH(pipeline->required_dynamic_states, VK_DYNAMIC_STATE_VIEWPORT);
pipeline->required_dynamic_states.dynamic_states[pipeline->required_dynamic_states.dynamic_states_count++] =
VK_DYNAMIC_STATE_VIEWPORT;
}
if (pipeline->viewport_state.pScissors == NULL || pipeline->viewport_state.scissorCount == 0U) {
RSE_STACK_PUSH(pipeline->required_dynamic_states, VK_DYNAMIC_STATE_SCISSOR);
pipeline->required_dynamic_states.dynamic_states[pipeline->required_dynamic_states.dynamic_states_count++] =
VK_DYNAMIC_STATE_SCISSOR;
}
return RSE_ERROR_NO_ERROR;
@@ -346,12 +348,13 @@ rse_err_t pipelines_build(struct graphics_context_t* context, struct pipeline_in
rse_err_t status = RSE_ERROR_NO_ERROR;
if (VK_SUCCESS != vkCreateGraphicsPipelines(context->vulkan_handles.device,
VK_NULL_HANDLE,
pipelines_infos_list->pipeline_create_infos_count,
pipelines_infos_list->create_infos,
NULL,
&context->pipelines_data.pipelines[context->pipelines_data.pipelines_count])) {
if (VK_SUCCESS !=
vkCreateGraphicsPipelines(context->vulkan_handles.device,
VK_NULL_HANDLE,
pipelines_infos_list->pipeline_create_infos_count,
pipelines_infos_list->create_infos,
NULL,
&context->pipelines_data.pipelines[context->pipelines_data.pipelines_count])) {
SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "Failed to create graphics pipelines");
status = RSE_ERROR_INTERNAL_ERROR;
}
@@ -375,9 +378,10 @@ rse_err_t pipeline_add(const struct graphics_context_t* context,
VkPipelineVertexInputStateCreateInfo* vertex_bindings_ci = NULL;
VkPipelineDynamicStateCreateInfo* dynamic_states_ci = NULL;
while (RSE_STACK_IS_EMPTY(pipeline->required_dynamic_states) == 0) {
while (pipeline->required_dynamic_states.dynamic_states_count > 0) {
dynamic_state_found = 0;
VkDynamicState dynamic_state = RSE_STACK_POP(pipeline->required_dynamic_states);
VkDynamicState dynamic_state =
pipeline->required_dynamic_states.dynamic_states[pipeline->required_dynamic_states.dynamic_states_count--];
for (iter = 0U; iter < pipeline->dynamic_states_count; ++iter) {
if (pipeline->dynamic_states[iter] == dynamic_state) {
dynamic_state_found = 1;