Skip to content

Commit

Permalink
more unnessary shared pointer removing
Browse files Browse the repository at this point in the history
  • Loading branch information
DadSchoorse committed May 16, 2020
1 parent d68db90 commit 6d0a450
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 141 deletions.
29 changes: 16 additions & 13 deletions src/basalt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@ namespace vkBasalt
pSwapchainImages[i] = pLogicalSwapchain->fakeImages[i];
}

VkFormat unormFormat = convertToUNORM(pLogicalSwapchain->format);
VkFormat srgbFormat = convertToSRGB(pLogicalSwapchain->format);

for (uint32_t i = 0; i < effectStrings.size(); i++)
{
Logger::debug("current effectString " + effectStrings[i]);
Expand All @@ -452,32 +455,32 @@ namespace vkBasalt
Logger::debug(std::to_string(secondImages.size()) + " images in secondImages");
if (effectStrings[i] == std::string("fxaa"))
{
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(new FxaaEffect(
pLogicalDevice, convertToSRGB(pLogicalSwapchain->format), pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig)));
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(
new FxaaEffect(pLogicalDevice, srgbFormat, pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig.get())));
Logger::debug("created FxaaEffect");
}
else if (effectStrings[i] == std::string("cas"))
{
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(new CasEffect(
pLogicalDevice, convertToUNORM(pLogicalSwapchain->format), pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig)));
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(
new CasEffect(pLogicalDevice, unormFormat, pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig.get())));
Logger::debug("created CasEffect");
}
else if (effectStrings[i] == std::string("deband"))
{
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(new DebandEffect(
pLogicalDevice, convertToUNORM(pLogicalSwapchain->format), pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig)));
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(
new DebandEffect(pLogicalDevice, unormFormat, pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig.get())));
Logger::debug("created DebandEffect");
}
else if (effectStrings[i] == std::string("smaa"))
{
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(new SmaaEffect(
pLogicalDevice, convertToUNORM(pLogicalSwapchain->format), pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig)));
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(
new SmaaEffect(pLogicalDevice, unormFormat, pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig.get())));
Logger::debug("created SmaaEffect");
}
else if (effectStrings[i] == std::string("lut"))
{
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(new LutEffect(
pLogicalDevice, convertToUNORM(pLogicalSwapchain->format), pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig)));
pLogicalSwapchain->effects.push_back(std::shared_ptr<Effect>(
new LutEffect(pLogicalDevice, unormFormat, pLogicalSwapchain->imageExtent, firstImages, secondImages, pConfig.get())));
Logger::debug("created LutEffect");
}
else
Expand All @@ -487,7 +490,7 @@ namespace vkBasalt
pLogicalSwapchain->imageExtent,
firstImages,
secondImages,
pConfig,
pConfig.get(),
effectStrings[i])));
Logger::debug("created ReshadeEffect");
}
Expand All @@ -501,7 +504,7 @@ namespace vkBasalt
pLogicalSwapchain->imageExtent,
std::vector<VkImage>(pLogicalSwapchain->fakeImages.end() - pLogicalSwapchain->imageCount, pLogicalSwapchain->fakeImages.end()),
pLogicalSwapchain->images,
pConfig)));
pConfig.get())));
}

VkImageView depthImageView = pLogicalDevice->depthImageViews.size() ? pLogicalDevice->depthImageViews[0] : VK_NULL_HANDLE;
Expand Down Expand Up @@ -533,7 +536,7 @@ namespace vkBasalt
pLogicalSwapchain->imageExtent,
std::vector<VkImage>(pLogicalSwapchain->fakeImages.begin(), pLogicalSwapchain->fakeImages.begin() + pLogicalSwapchain->imageCount),
pLogicalSwapchain->images,
pConfig));
pConfig.get()));

pLogicalSwapchain->commandBuffersNoEffect = allocateCommandBuffer(pLogicalDevice, pLogicalSwapchain->imageCount);

Expand Down
12 changes: 6 additions & 6 deletions src/effect_cas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

namespace vkBasalt
{
CasEffect::CasEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig)
CasEffect::CasEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig)
{

float sharpness = pConfig->getOption<float>("casSharpness", 0.4f);
Expand Down
12 changes: 6 additions & 6 deletions src/effect_cas.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ namespace vkBasalt
class CasEffect : public SimpleEffect
{
public:
CasEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig);
CasEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig);
~CasEffect();
};
} // namespace vkBasalt
Expand Down
12 changes: 6 additions & 6 deletions src/effect_deband.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

namespace vkBasalt
{
DebandEffect::DebandEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig)
DebandEffect::DebandEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig)
{
vertexCode = full_screen_triangle_vert;
fragmentCode = deband_frag;
Expand Down
12 changes: 6 additions & 6 deletions src/effect_deband.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ namespace vkBasalt
class DebandEffect : public SimpleEffect
{
public:
DebandEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig);
DebandEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig);
~DebandEffect();
};
} // namespace vkBasalt
Expand Down
12 changes: 6 additions & 6 deletions src/effect_fxaa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

namespace vkBasalt
{
FxaaEffect::FxaaEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig)
FxaaEffect::FxaaEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig)
{
float fxaaQualitySubpix = pConfig->getOption<float>("fxaaQualitySubpix", 0.75f);
float fxaaQualityEdgeThreshold = pConfig->getOption<float>("fxaaQualityEdgeThreshold", 0.125f);
Expand Down
12 changes: 6 additions & 6 deletions src/effect_fxaa.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ namespace vkBasalt
class FxaaEffect : public SimpleEffect
{
public:
FxaaEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig);
FxaaEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig);
~FxaaEffect();
};
} // namespace vkBasalt
Expand Down
12 changes: 6 additions & 6 deletions src/effect_lut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

namespace vkBasalt
{
LutEffect::LutEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig)
LutEffect::LutEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig)
{
vertexCode = full_screen_triangle_vert;
fragmentCode = lut_frag;
Expand Down
12 changes: 6 additions & 6 deletions src/effect_lut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ namespace vkBasalt
class LutEffect : public SimpleEffect
{
public:
LutEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig);
LutEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig);
~LutEffect();
void applyEffect(uint32_t imageIndex, VkCommandBuffer commandBuffer) override;

Expand Down
14 changes: 7 additions & 7 deletions src/effect_reshade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

namespace vkBasalt
{
ReshadeEffect::ReshadeEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig,
std::string effectName)
ReshadeEffect::ReshadeEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig,
std::string effectName)
{
Logger::debug("in creating ReshadeEffect");

Expand Down
16 changes: 8 additions & 8 deletions src/effect_reshade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ namespace vkBasalt
class ReshadeEffect : public Effect
{
public:
ReshadeEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig,
std::string effectName);
ReshadeEffect(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig,
std::string effectName);
void virtual applyEffect(uint32_t imageIndex, VkCommandBuffer commandBuffer) override;
void virtual updateEffect() override;
void virtual useDepthImage(VkImageView depthImageView) override;
Expand Down Expand Up @@ -75,7 +75,7 @@ namespace vkBasalt
std::vector<bool> switchSamplers;
VkExtent2D imageExtent;
std::vector<VkSampler> samplers;
std::shared_ptr<vkBasalt::Config> pConfig;
Config* pConfig;
std::string effectName;
reshadefx::module module;
std::vector<VkDeviceMemory> textureMemory;
Expand Down
12 changes: 6 additions & 6 deletions src/effect_simple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ namespace vkBasalt
SimpleEffect::SimpleEffect()
{
}
void SimpleEffect::init(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
std::shared_ptr<vkBasalt::Config> pConfig)
void SimpleEffect::init(std::shared_ptr<LogicalDevice> pLogicalDevice,
VkFormat format,
VkExtent2D imageExtent,
std::vector<VkImage> inputImages,
std::vector<VkImage> outputImages,
Config* pConfig)
{
Logger::debug("in creating SimpleEffect");

Expand Down
Loading

0 comments on commit 6d0a450

Please sign in to comment.