Replace uses of sw::Surface with vk::ImageView in the Renderer
sw::Surface contains a locking mechanism which is no longer required
in Vulkan. The app is now responsible for making sure the lifetime of
the objects is long enough for the driver to be able to use them in
any operation where they are required.
A few shortcuts were taken here:
- ImageView::getSampleCount() currently always returns the largest
available sample count.
- ImageView::subresourceRange.levelCount is not taken into account
- Context::getMultiSampleCount() still uses attachment 0 to get
the samples count, which may be incorrect.
Bug b/118619338
Change-Id: I8cd49926a1537c0f2bc20e6516f12d7de67d6c65
Reviewed-on: https://swiftshader-review.googlesource.com/c/25588
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
diff --git a/src/Device/Context.cpp b/src/Device/Context.cpp
index f18b4a8..d4ed3dc 100644
--- a/src/Device/Context.cpp
+++ b/src/Device/Context.cpp
@@ -18,6 +18,7 @@
#include "Surface.hpp"
#include "System/Memory.hpp"
#include "Vulkan/VkDebug.hpp"
+#include "Vulkan/VkImageView.hpp"
#include "Pipeline/SpirvShader.hpp"
#include <string.h>
@@ -714,14 +715,14 @@
int Context::getMultiSampleCount() const
{
- return renderTarget[0] ? renderTarget[0]->getMultiSampleCount() : 1;
+ return renderTarget[0] ? renderTarget[0]->getSampleCount() : 1;
}
VkFormat Context::renderTargetInternalFormat(int index)
{
if(renderTarget[index])
{
- return renderTarget[index]->getInternalFormat();
+ return renderTarget[index]->getFormat();
}
else
{
@@ -736,7 +737,7 @@
int Context::colorWriteActive(int index)
{
- if(!renderTarget[index] || renderTarget[index]->getInternalFormat() == VK_FORMAT_UNDEFINED)
+ if(!renderTarget[index] || renderTarget[index]->getFormat() == VK_FORMAT_UNDEFINED)
{
return 0;
}