mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
vulkan: implement setWireframe
This commit is contained in:
@@ -249,6 +249,7 @@ namespace love {
|
||||
updatedBatchedDrawBuffers();
|
||||
|
||||
Shader::current = Shader::standardShaders[graphics::Shader::StandardShader::STANDARD_DEFAULT];
|
||||
currentPolygonMode = VK_POLYGON_MODE_FILL;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -350,6 +351,21 @@ namespace love {
|
||||
states.back().color = c;
|
||||
}
|
||||
|
||||
void Graphics::setWireframe(bool enable) {
|
||||
std::cout << "setWireframe ";
|
||||
|
||||
flushBatchedDraws();
|
||||
|
||||
if (enable) {
|
||||
currentPolygonMode = VK_POLYGON_MODE_LINE;
|
||||
}
|
||||
else {
|
||||
currentPolygonMode = VK_POLYGON_MODE_FILL;
|
||||
}
|
||||
|
||||
states.back().wireframe = enable;
|
||||
}
|
||||
|
||||
PixelFormat Graphics::getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const {
|
||||
std::cout << "getSizedFormat ";
|
||||
|
||||
@@ -1194,6 +1210,7 @@ namespace love {
|
||||
GraphicsPipelineConfiguration configuration;
|
||||
configuration.shader = (Shader*)Shader::current;
|
||||
configuration.primitiveType = primitiveType;
|
||||
configuration.polygonMode = currentPolygonMode;
|
||||
std::vector<VkBuffer> bufferVector;
|
||||
|
||||
std::vector<VkDeviceSize> offsets;
|
||||
@@ -1265,8 +1282,8 @@ namespace love {
|
||||
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||
rasterizer.depthClampEnable = VK_FALSE;
|
||||
rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
||||
rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
|
||||
rasterizer.lineWidth = 2.0f;
|
||||
rasterizer.polygonMode = configuration.polygonMode;
|
||||
rasterizer.lineWidth = 1.0f;
|
||||
rasterizer.cullMode = VK_CULL_MODE_FRONT_BIT;
|
||||
rasterizer.frontFace = VK_FRONT_FACE_CLOCKWISE;
|
||||
rasterizer.depthBiasEnable = VK_FALSE;
|
||||
@@ -1449,6 +1466,9 @@ namespace love {
|
||||
}
|
||||
|
||||
bool operator==(const GraphicsPipelineConfiguration& first, const GraphicsPipelineConfiguration& other) {
|
||||
if (first.polygonMode != other.polygonMode) {
|
||||
return false;
|
||||
}
|
||||
if (first.primitiveType != other.primitiveType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace love {
|
||||
std::vector<VkVertexInputAttributeDescription> vertexInputAttributeDescriptions;
|
||||
Shader* shader = nullptr;
|
||||
PrimitiveType primitiveType = PRIMITIVE_MAX_ENUM;
|
||||
VkPolygonMode polygonMode = VK_POLYGON_MODE_FILL;
|
||||
|
||||
friend static bool operator==(const GraphicsPipelineConfiguration& first, const GraphicsPipelineConfiguration& other);
|
||||
};
|
||||
@@ -102,7 +103,7 @@ namespace love {
|
||||
void setColorMask(ColorChannelMask mask) override { std::cout << "setColorMask "; }
|
||||
void setBlendState(const BlendState& blend) override { std::cout << "setBlendState "; }
|
||||
void setPointSize(float size) override { std::cout << "setPointSize "; }
|
||||
void setWireframe(bool enable) override { std::cout << "setWireframe "; }
|
||||
void setWireframe(bool enable) override;
|
||||
PixelFormat getSizedFormat(PixelFormat format, bool rendertarget, bool readable) const override;
|
||||
bool isPixelFormatSupported(PixelFormat format, uint32 usage, bool sRGB = false) override;
|
||||
Renderer getRenderer() const override;
|
||||
@@ -214,6 +215,7 @@ namespace love {
|
||||
graphics::Texture* currentTexture = nullptr;
|
||||
std::vector<std::pair<graphics::Shader::BuiltinUniformData, graphics::StreamBuffer*>> uniformBufferMap;
|
||||
std::vector<std::pair<DecriptorSetConfiguration, std::vector<VkDescriptorSet>>> descriptorSetsMap;
|
||||
VkPolygonMode currentPolygonMode = VK_POLYGON_MODE_FILL;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user