Fixing sampler parameters
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include "Containers/Array.h"
|
||||
#include "Enums.h"
|
||||
#include "Math/Math.h"
|
||||
#include "Initializer.h"
|
||||
|
||||
namespace Seele {
|
||||
DECLARE_REF(Material)
|
||||
@@ -14,7 +15,9 @@ DECLARE_REF(GraphicsPipeline)
|
||||
DECLARE_REF(ComputePipeline)
|
||||
class Sampler {
|
||||
public:
|
||||
Sampler(SamplerCreateInfo createInfo): samplerInfo(createInfo) {}
|
||||
virtual ~Sampler() {}
|
||||
SamplerCreateInfo samplerInfo;
|
||||
};
|
||||
DEFINE_REF(Sampler)
|
||||
|
||||
|
||||
@@ -285,27 +285,7 @@ Gfx::PComputePipeline Graphics::createComputePipeline(Gfx::ComputePipelineCreate
|
||||
}
|
||||
|
||||
Gfx::OSampler Graphics::createSampler(const SamplerCreateInfo& createInfo) {
|
||||
VkSamplerCreateInfo vkInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = createInfo.flags,
|
||||
.magFilter = cast(createInfo.magFilter),
|
||||
.minFilter = cast(createInfo.minFilter),
|
||||
.mipmapMode = cast(createInfo.mipmapMode),
|
||||
.addressModeU = cast(createInfo.addressModeU),
|
||||
.addressModeV = cast(createInfo.addressModeV),
|
||||
.addressModeW = cast(createInfo.addressModeW),
|
||||
.mipLodBias = createInfo.mipLodBias,
|
||||
.anisotropyEnable = createInfo.anisotropyEnable,
|
||||
.maxAnisotropy = createInfo.maxAnisotropy,
|
||||
.compareEnable = createInfo.compareEnable,
|
||||
.compareOp = cast(createInfo.compareOp),
|
||||
.minLod = createInfo.minLod,
|
||||
.maxLod = createInfo.maxLod,
|
||||
.borderColor = cast(createInfo.borderColor),
|
||||
.unnormalizedCoordinates = createInfo.unnormalizedCoordinates,
|
||||
};
|
||||
return new Sampler(this, vkInfo);
|
||||
return new Sampler(this, createInfo);
|
||||
}
|
||||
|
||||
Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name) { return new DescriptorLayout(this, name); }
|
||||
|
||||
@@ -110,13 +110,33 @@ void DestructionManager::notifyCommandComplete() {
|
||||
}
|
||||
}
|
||||
|
||||
SamplerHandle::SamplerHandle(PGraphics graphics, VkSamplerCreateInfo createInfo) : CommandBoundResource(graphics, "Sampler") {
|
||||
vkCreateSampler(graphics->getDevice(), &createInfo, nullptr, &sampler);
|
||||
SamplerHandle::SamplerHandle(PGraphics graphics, SamplerCreateInfo createInfo) : CommandBoundResource(graphics, "Sampler") {
|
||||
VkSamplerCreateInfo vkInfo = {
|
||||
.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO,
|
||||
.pNext = nullptr,
|
||||
.flags = createInfo.flags,
|
||||
.magFilter = cast(createInfo.magFilter),
|
||||
.minFilter = cast(createInfo.minFilter),
|
||||
.mipmapMode = cast(createInfo.mipmapMode),
|
||||
.addressModeU = cast(createInfo.addressModeU),
|
||||
.addressModeV = cast(createInfo.addressModeV),
|
||||
.addressModeW = cast(createInfo.addressModeW),
|
||||
.mipLodBias = createInfo.mipLodBias,
|
||||
.anisotropyEnable = createInfo.anisotropyEnable,
|
||||
.maxAnisotropy = createInfo.maxAnisotropy,
|
||||
.compareEnable = createInfo.compareEnable,
|
||||
.compareOp = cast(createInfo.compareOp),
|
||||
.minLod = createInfo.minLod,
|
||||
.maxLod = createInfo.maxLod,
|
||||
.borderColor = cast(createInfo.borderColor),
|
||||
.unnormalizedCoordinates = createInfo.unnormalizedCoordinates,
|
||||
};
|
||||
vkCreateSampler(graphics->getDevice(), &vkInfo, nullptr, &sampler);
|
||||
}
|
||||
|
||||
SamplerHandle::~SamplerHandle() { vkDestroySampler(graphics->getDevice(), sampler, nullptr); }
|
||||
|
||||
Sampler::Sampler(PGraphics graphics, VkSamplerCreateInfo createInfo)
|
||||
: graphics(graphics), handle(new SamplerHandle(graphics, createInfo)) {}
|
||||
Sampler::Sampler(PGraphics graphics, SamplerCreateInfo createInfo)
|
||||
: Gfx::Sampler(createInfo), graphics(graphics), handle(new SamplerHandle(graphics, createInfo)) {}
|
||||
|
||||
Sampler::~Sampler() { graphics->getDestructionManager()->queueResourceForDestruction(std::move(handle)); }
|
||||
|
||||
@@ -106,7 +106,7 @@ DEFINE_REF(DestructionManager)
|
||||
|
||||
class SamplerHandle : public CommandBoundResource {
|
||||
public:
|
||||
SamplerHandle(PGraphics graphics, VkSamplerCreateInfo createInfo);
|
||||
SamplerHandle(PGraphics graphics, SamplerCreateInfo createInfo);
|
||||
virtual ~SamplerHandle();
|
||||
VkSampler sampler;
|
||||
};
|
||||
@@ -114,7 +114,7 @@ DEFINE_REF(SamplerHandle)
|
||||
|
||||
class Sampler : public Gfx::Sampler {
|
||||
public:
|
||||
Sampler(PGraphics graphics, VkSamplerCreateInfo createInfo);
|
||||
Sampler(PGraphics graphics, SamplerCreateInfo createInfo);
|
||||
virtual ~Sampler();
|
||||
PSamplerHandle getHandle() const { return handle; }
|
||||
VkSampler getSampler() const { return handle->sampler; }
|
||||
|
||||
Reference in New Issue
Block a user