mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
vulkan: implement setColor
This commit is contained in:
@@ -62,7 +62,9 @@ namespace love {
|
||||
}
|
||||
|
||||
Graphics::~Graphics() {
|
||||
// FIXME: most resources that are allocated dynamically need proper cleanup.
|
||||
// We already cleaned those up by clearing out batchedDrawBuffers.
|
||||
// We set them to nullptr here so the base class doesn't crash
|
||||
// when it tries to free this.
|
||||
batchedDrawState.vb[0] = nullptr;
|
||||
batchedDrawState.vb[1] = nullptr;
|
||||
batchedDrawState.indexBuffer = nullptr;
|
||||
@@ -329,6 +331,17 @@ namespace love {
|
||||
vkCmdDrawIndexed(commandBuffers.at(imageIndex), static_cast<uint32_t>(cmd.indexCount), 1, 0, 0, 0);
|
||||
}
|
||||
|
||||
void Graphics::setColor(Colorf c) {
|
||||
std::cout << "setColor ";
|
||||
|
||||
c.r = std::min(std::max(c.r, 0.0f), 1.0f);
|
||||
c.g = std::min(std::max(c.g, 0.0f), 1.0f);
|
||||
c.b = std::min(std::max(c.b, 0.0f), 1.0f);
|
||||
c.a = std::min(std::max(c.a, 0.0f), 1.0f);
|
||||
|
||||
states.back().color = c;
|
||||
}
|
||||
|
||||
PixelFormat Graphics::getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const {
|
||||
std::cout << "getSizedFormat ";
|
||||
|
||||
@@ -514,7 +527,7 @@ namespace love {
|
||||
appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0); //todo, get this version from somewhere else?
|
||||
appInfo.pEngineName = "LOVE Engine";
|
||||
appInfo.engineVersion = VK_MAKE_VERSION(VERSION_MAJOR, VERSION_MINOR, VERSION_REV);
|
||||
appInfo.apiVersion = VK_API_VERSION_1_3;
|
||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
||||
|
||||
VkInstanceCreateInfo createInfo{};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
@@ -758,7 +771,7 @@ namespace love {
|
||||
vulkanFunctions.vkGetDeviceProcAddr = &vkGetDeviceProcAddr;
|
||||
|
||||
VmaAllocatorCreateInfo allocatorCreateInfo = {};
|
||||
allocatorCreateInfo.vulkanApiVersion = VK_API_VERSION_1_2;
|
||||
allocatorCreateInfo.vulkanApiVersion = VK_API_VERSION_1_0;
|
||||
allocatorCreateInfo.physicalDevice = physicalDevice;
|
||||
allocatorCreateInfo.device = device;
|
||||
allocatorCreateInfo.instance = instance;
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace love {
|
||||
void setActive(bool active) override { std::cout << "setActive "; }
|
||||
int getRequestedBackbufferMSAA() const override { std::cout << "getRequestedBackbufferMSAA "; return 0; }
|
||||
int getBackbufferMSAA() const override { std::cout << "getBackbufferMSAA "; return 0; }
|
||||
void setColor(Colorf c) override { std::cout << "setColor "; }
|
||||
void setColor(Colorf c) override;
|
||||
void setScissor(const Rect& rect) override { std::cout << "setScissor "; }
|
||||
void setScissor() override { std::cout << "setScissor2 "; }
|
||||
void setStencilMode(StencilAction action, CompareMode compare, int value, love::uint32 readmask, love::uint32 writemask) override { std::cout << "setStencilMode "; }
|
||||
|
||||
Reference in New Issue
Block a user