forked from AuroraMiddleware/gtk
vulkan: Remove color from push constants
It's now handled by the color pipeline.
This commit is contained in:
parent
b04eecf860
commit
1b90ce6b33
@ -8,10 +8,7 @@ void
|
||||
gsk_vulkan_push_constants_init (GskVulkanPushConstants *constants,
|
||||
const graphene_matrix_t *mvp)
|
||||
{
|
||||
GdkRGBA transparent = { 0, 0, 0, 0 };
|
||||
|
||||
gsk_vulkan_push_constants_set_mvp (constants, mvp);
|
||||
gsk_vulkan_push_constants_set_color (constants, &transparent);
|
||||
}
|
||||
|
||||
void
|
||||
@ -39,16 +36,6 @@ gsk_vulkan_push_constants_multiply_mvp (GskVulkanPushConstants *self,
|
||||
gsk_vulkan_push_constants_set_mvp (self, &new_mvp);
|
||||
}
|
||||
|
||||
void
|
||||
gsk_vulkan_push_constants_set_color (GskVulkanPushConstants *self,
|
||||
const GdkRGBA *color)
|
||||
{
|
||||
self->fragment.color[0] = pow (color->red, 2.2);
|
||||
self->fragment.color[1] = pow (color->green, 2.2);
|
||||
self->fragment.color[2] = pow (color->blue, 2.2);
|
||||
self->fragment.color[3] = color->alpha;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_vulkan_push_constants_push_vertex (GskVulkanPushConstants *self,
|
||||
VkCommandBuffer command_buffer,
|
||||
@ -62,6 +49,7 @@ gsk_vulkan_push_constants_push_vertex (GskVulkanPushConstants *self,
|
||||
&self->vertex);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
gsk_vulkan_push_constants_push_fragment (GskVulkanPushConstants *self,
|
||||
VkCommandBuffer command_buffer,
|
||||
@ -74,6 +62,7 @@ gsk_vulkan_push_constants_push_fragment (GskVulkanPushConstants *self,
|
||||
sizeof (self->fragment),
|
||||
&self->fragment);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t
|
||||
gst_vulkan_push_constants_get_range_count (void)
|
||||
@ -89,11 +78,13 @@ gst_vulkan_push_constants_get_ranges (void)
|
||||
.stageFlags = VK_SHADER_STAGE_VERTEX_BIT,
|
||||
.offset = G_STRUCT_OFFSET (GskVulkanPushConstants, vertex),
|
||||
.size = sizeof (((GskVulkanPushConstants *) 0)->vertex)
|
||||
#if 0
|
||||
},
|
||||
{
|
||||
.stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT,
|
||||
.offset = G_STRUCT_OFFSET (GskVulkanPushConstants, fragment),
|
||||
.size = sizeof (((GskVulkanPushConstants *) 0)->fragment)
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -13,9 +13,10 @@ struct _GskVulkanPushConstants
|
||||
struct {
|
||||
float mvp[16];
|
||||
} vertex;
|
||||
#if 0
|
||||
struct {
|
||||
float color[4];
|
||||
} fragment;
|
||||
#endif
|
||||
};
|
||||
|
||||
const VkPushConstantRange *
|
||||
@ -31,15 +32,10 @@ void gsk_vulkan_push_constants_set_mvp (GskVulk
|
||||
const graphene_matrix_t *mvp);
|
||||
void gsk_vulkan_push_constants_multiply_mvp (GskVulkanPushConstants *self,
|
||||
const graphene_matrix_t *transform);
|
||||
void gsk_vulkan_push_constants_set_color (GskVulkanPushConstants *self,
|
||||
const GdkRGBA *color);
|
||||
|
||||
void gsk_vulkan_push_constants_push_vertex (GskVulkanPushConstants *self,
|
||||
VkCommandBuffer command_buffer,
|
||||
VkPipelineLayout pipeline_layout);
|
||||
void gsk_vulkan_push_constants_push_fragment (GskVulkanPushConstants *self,
|
||||
VkCommandBuffer command_buffer,
|
||||
VkPipelineLayout pipeline_layout);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -21,8 +21,7 @@ typedef enum {
|
||||
GSK_VULKAN_OP_TEXTURE,
|
||||
GSK_VULKAN_OP_COLOR,
|
||||
/* GskVulkanOpPushConstants */
|
||||
GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS,
|
||||
GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS
|
||||
GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS
|
||||
} GskVulkanOpType;
|
||||
|
||||
struct _GskVulkanOpRender
|
||||
@ -117,11 +116,6 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
break;
|
||||
|
||||
case GSK_COLOR_NODE:
|
||||
op.type = GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS;
|
||||
gsk_vulkan_push_constants_init_copy (&op.constants.constants, constants);
|
||||
gsk_vulkan_push_constants_set_color (&op.constants.constants, gsk_color_node_peek_color (node));
|
||||
g_array_append_val (self->render_ops, op);
|
||||
|
||||
op.type = GSK_VULKAN_OP_COLOR;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, GSK_VULKAN_PIPELINE_COLOR);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -168,9 +162,6 @@ gsk_vulkan_render_pass_add (GskVulkanRenderPass *self,
|
||||
gsk_vulkan_push_constants_init (&op.constants.constants, mvp);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
|
||||
op.type = GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS;
|
||||
g_array_append_val (self->render_ops, op);
|
||||
|
||||
gsk_vulkan_render_pass_add_node (self, render, &op.constants.constants, node);
|
||||
}
|
||||
|
||||
@ -250,7 +241,6 @@ gsk_vulkan_render_pass_upload (GskVulkanRenderPass *self,
|
||||
g_assert_not_reached ();
|
||||
case GSK_VULKAN_OP_COLOR:
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
case GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -285,7 +275,6 @@ gsk_vulkan_render_pass_count_vertex_data (GskVulkanRenderPass *self)
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
case GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS:
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -342,7 +331,6 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
case GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS:
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -375,7 +363,6 @@ gsk_vulkan_render_pass_reserve_descriptor_sets (GskVulkanRenderPass *self,
|
||||
g_assert_not_reached ();
|
||||
case GSK_VULKAN_OP_COLOR:
|
||||
case GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS:
|
||||
case GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -462,12 +449,6 @@ gsk_vulkan_render_pass_draw (GskVulkanRenderPass *self,
|
||||
gsk_vulkan_pipeline_layout_get_pipeline_layout (layout));
|
||||
break;
|
||||
|
||||
case GSK_VULKAN_OP_PUSH_FRAGMENT_CONSTANTS:
|
||||
gsk_vulkan_push_constants_push_fragment (&op->constants.constants,
|
||||
command_buffer,
|
||||
gsk_vulkan_pipeline_layout_get_pipeline_layout (layout));
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user