Fixed really annoying colorblend issue caused by me setting two greens and no blues in my colorwritemask

This commit is contained in:
connellpaxton 2024-01-26 14:51:41 -05:00
parent c4c796c98e
commit 063f908d60
7 changed files with 15 additions and 13 deletions

View File

@ -105,7 +105,7 @@ GraphicsPipeline::GraphicsPipeline(vk::Device dev, const std::vector<Shader>& sh
const auto color_blend_attachment = vk::PipelineColorBlendAttachmentState{ const auto color_blend_attachment = vk::PipelineColorBlendAttachmentState{
.blendEnable = vk::False, .blendEnable = vk::False,
.colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eG .colorWriteMask = vk::ColorComponentFlagBits::eR | vk::ColorComponentFlagBits::eB
| vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eA, | vk::ColorComponentFlagBits::eG | vk::ColorComponentFlagBits::eA,
}; };

View File

@ -14,6 +14,16 @@
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
const static std::vector<Vertex> triangle = {
{{ 1.0, -1.0, 1.0 }, { 1.0, 0.0 }},
{{ 1.0, 1.0, 1.0 }, { 1.0, 1.0 }},
{{-1.0, 1.0, 1.0 }, { 0.0, 1.0 }},
{{-1.0, 1.0, 1.0 }, { 0.0, 1.0 }},
{{-1.0, -1.0, 1.0 }, { 0.0, 0.0 }},
{{ 1.0, -1.0, 1.0 }, { 1.0, 0.0 }},
};
using namespace std::string_literals; using namespace std::string_literals;
Renderer::Renderer(Window& win) : win(win) { Renderer::Renderer(Window& win) : win(win) {
@ -169,14 +179,6 @@ Renderer::Renderer(Window& win) : win(win) {
command_buffer = std::make_unique<CommandBuffer>(dev, queue_family); command_buffer = std::make_unique<CommandBuffer>(dev, queue_family);
/* basic triangle */
const std::vector<Vertex> triangle = {
{{ 1.0, 1.0, -50.0 }, {1.0, 0.0}},
{{-1.0, 1.0, -50.0 }, {0.0, 0.0}},
{{ 0.0,-1.0, -50.0 }, {0.0, 1.0}},
};
vertex_buffer = std::make_unique<VertexBuffer>(phys_dev, dev, triangle.size()); vertex_buffer = std::make_unique<VertexBuffer>(phys_dev, dev, triangle.size());
uniform_buffer = std::make_unique<UniformBuffer>(phys_dev, dev); uniform_buffer = std::make_unique<UniformBuffer>(phys_dev, dev);
@ -266,12 +268,12 @@ void Renderer::draw() {
const auto p = glm::perspective(glm::radians(90.0f), static_cast<float>(swapchain->extent.width) / static_cast<float>(swapchain->extent.height), 0.01f, 50.0f); const auto p = glm::perspective(glm::radians(90.0f), static_cast<float>(swapchain->extent.width) / static_cast<float>(swapchain->extent.height), 0.01f, 50.0f);
uniform_buffer->upload(UniformData{ uniform_buffer->upload(UniformData{
.mvp = p * glm::rotate(glm::mat4(1.0), glm::radians(static_cast<float>(frame)), glm::vec3(1.0, 1.0, 1.0)), //.mvp = p * glm::rotate(glm::mat4(1.0), glm::radians(static_cast<float>(frame)), glm::vec3(1.0, 1.0, 1.0)),
.time = static_cast<float>(frame), .time = static_cast<float>(frame),
}); });
command_buffer->draw(9, 1, 0, 0); command_buffer->draw(std::size(triangle), 1, 0, 0);
command_buffer->command_buffer.endRenderPass(); command_buffer->command_buffer.endRenderPass();

View File

@ -9,5 +9,5 @@ layout (set = 0, binding = 0) uniform Matrices {
}; };
void main() { void main() {
FragColor = vec4(cos(time), 1.0, 0.0, 1.0); FragColor = vec4(1.0, 1.0, 1.0, 1.0);
} }

Binary file not shown.

View File

@ -10,6 +10,6 @@ layout (set = 0, binding = 0) uniform Matrices {
}; };
void main() { void main() {
gl_Position = mpv*vec4(aPos, 1.0); gl_Position = vec4(aPos, 1.0);
texCoord = aTexCoord; texCoord = aTexCoord;
} }

Binary file not shown.

BIN
pleascach.exe Normal file

Binary file not shown.