mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
vulkan: fix wireframe validation error
This commit is contained in:
@@ -250,7 +250,6 @@ bool Graphics::setMode(void* context, int width, int height, int pixelwidth, int
|
|||||||
updatedBatchedDrawBuffers();
|
updatedBatchedDrawBuffers();
|
||||||
|
|
||||||
Shader::current = Shader::standardShaders[graphics::Shader::StandardShader::STANDARD_DEFAULT];
|
Shader::current = Shader::standardShaders[graphics::Shader::StandardShader::STANDARD_DEFAULT];
|
||||||
currentPolygonMode = VK_POLYGON_MODE_FILL;
|
|
||||||
restoreState(states.back());
|
restoreState(states.back());
|
||||||
|
|
||||||
setViewportSize(width, height, pixelwidth, pixelheight);
|
setViewportSize(width, height, pixelwidth, pixelheight);
|
||||||
@@ -428,13 +427,6 @@ void Graphics::setScissor() {
|
|||||||
void Graphics::setWireframe(bool enable) {
|
void Graphics::setWireframe(bool enable) {
|
||||||
flushBatchedDraws();
|
flushBatchedDraws();
|
||||||
|
|
||||||
if (enable) {
|
|
||||||
currentPolygonMode = VK_POLYGON_MODE_LINE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
currentPolygonMode = VK_POLYGON_MODE_FILL;
|
|
||||||
}
|
|
||||||
|
|
||||||
states.back().wireframe = enable;
|
states.back().wireframe = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -876,6 +868,7 @@ void Graphics::createLogicalDevice() {
|
|||||||
|
|
||||||
VkPhysicalDeviceFeatures deviceFeatures{};
|
VkPhysicalDeviceFeatures deviceFeatures{};
|
||||||
deviceFeatures.samplerAnisotropy = VK_TRUE;
|
deviceFeatures.samplerAnisotropy = VK_TRUE;
|
||||||
|
deviceFeatures.fillModeNonSolid = VK_TRUE;
|
||||||
|
|
||||||
VkDeviceCreateInfo createInfo{};
|
VkDeviceCreateInfo createInfo{};
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||||
@@ -1176,7 +1169,7 @@ void Graphics::prepareDraw(const VertexAttributes& attributes, const BufferBindi
|
|||||||
configuration.vertexAttributes = attributes;
|
configuration.vertexAttributes = attributes;
|
||||||
configuration.shader = (Shader*)Shader::current;
|
configuration.shader = (Shader*)Shader::current;
|
||||||
configuration.primitiveType = primitiveType;
|
configuration.primitiveType = primitiveType;
|
||||||
configuration.polygonMode = currentPolygonMode;
|
configuration.wireFrame = states.back().wireframe;
|
||||||
configuration.blendState = states.back().blend;
|
configuration.blendState = states.back().blend;
|
||||||
configuration.colorChannelMask = states.back().colorMask;
|
configuration.colorChannelMask = states.back().colorMask;
|
||||||
configuration.winding = states.back().winding;
|
configuration.winding = states.back().winding;
|
||||||
@@ -1319,7 +1312,7 @@ VkPipeline Graphics::createGraphicsPipeline(GraphicsPipelineConfiguration config
|
|||||||
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
rasterizer.sType = VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO;
|
||||||
rasterizer.depthClampEnable = VK_FALSE;
|
rasterizer.depthClampEnable = VK_FALSE;
|
||||||
rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
||||||
rasterizer.polygonMode = configuration.polygonMode;
|
rasterizer.polygonMode = Vulkan::getPolygonMode(configuration.wireFrame);
|
||||||
rasterizer.lineWidth = 1.0f;
|
rasterizer.lineWidth = 1.0f;
|
||||||
rasterizer.cullMode = Vulkan::getCullMode(configuration.cullmode);
|
rasterizer.cullMode = Vulkan::getCullMode(configuration.cullmode);
|
||||||
rasterizer.frontFace = Vulkan::getFrontFace(configuration.winding);
|
rasterizer.frontFace = Vulkan::getFrontFace(configuration.winding);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ struct GraphicsPipelineConfiguration {
|
|||||||
VertexAttributes vertexAttributes;
|
VertexAttributes vertexAttributes;
|
||||||
Shader* shader = nullptr;
|
Shader* shader = nullptr;
|
||||||
PrimitiveType primitiveType = PRIMITIVE_MAX_ENUM;
|
PrimitiveType primitiveType = PRIMITIVE_MAX_ENUM;
|
||||||
VkPolygonMode polygonMode = VK_POLYGON_MODE_FILL;
|
bool wireFrame;
|
||||||
BlendState blendState;
|
BlendState blendState;
|
||||||
ColorChannelMask colorChannelMask;
|
ColorChannelMask colorChannelMask;
|
||||||
Winding winding;
|
Winding winding;
|
||||||
@@ -230,7 +230,6 @@ private:
|
|||||||
// just like batchedDrawBuffers we need a vector for each frame in flight.
|
// just like batchedDrawBuffers we need a vector for each frame in flight.
|
||||||
std::vector<std::vector<std::function<void()>>> cleanUpFunctions;
|
std::vector<std::vector<std::function<void()>>> cleanUpFunctions;
|
||||||
graphics::Texture* currentTexture = nullptr;
|
graphics::Texture* currentTexture = nullptr;
|
||||||
VkPolygonMode currentPolygonMode = VK_POLYGON_MODE_FILL;
|
|
||||||
|
|
||||||
// render pass variables.
|
// render pass variables.
|
||||||
VkFormat currentFramebufferOutputFormat = VK_FORMAT_UNDEFINED;
|
VkFormat currentFramebufferOutputFormat = VK_FORMAT_UNDEFINED;
|
||||||
|
|||||||
@@ -481,6 +481,14 @@ VkImageViewType Vulkan::getImageViewType(TextureType textureType) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VkPolygonMode Vulkan::getPolygonMode(bool wireframe) {
|
||||||
|
if (wireframe) {
|
||||||
|
return VK_POLYGON_MODE_LINE;
|
||||||
|
} else {
|
||||||
|
return VK_POLYGON_MODE_FILL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Vulkan::cmdTransitionImageLayout(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout,
|
void Vulkan::cmdTransitionImageLayout(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout,
|
||||||
uint32_t baseLevel, uint32_t levelCount, uint32_t baseLayer, uint32_t layerCount) {
|
uint32_t baseLevel, uint32_t levelCount, uint32_t baseLayer, uint32_t layerCount) {
|
||||||
VkImageMemoryBarrier barrier{};
|
VkImageMemoryBarrier barrier{};
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public:
|
|||||||
static VkCullModeFlags getCullMode(CullMode);
|
static VkCullModeFlags getCullMode(CullMode);
|
||||||
static VkImageType getImageType(TextureType);
|
static VkImageType getImageType(TextureType);
|
||||||
static VkImageViewType getImageViewType(TextureType);
|
static VkImageViewType getImageViewType(TextureType);
|
||||||
|
static VkPolygonMode getPolygonMode(bool wireframe);
|
||||||
|
|
||||||
static void cmdTransitionImageLayout(
|
static void cmdTransitionImageLayout(
|
||||||
VkCommandBuffer, VkImage, VkImageLayout oldLayout, VkImageLayout newLayout,
|
VkCommandBuffer, VkImage, VkImageLayout oldLayout, VkImageLayout newLayout,
|
||||||
|
|||||||
Reference in New Issue
Block a user