it at least does something
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "Graphics/Resources.h"
|
||||
#include "Metal/MTLArgumentEncoder.hpp"
|
||||
#include "Metal/MTLCaptureManager.hpp"
|
||||
#include "Metal/MTLCommandEncoder.hpp"
|
||||
#include "Metal/MTLLibrary.hpp"
|
||||
#include "Metal/MTLRenderCommandEncoder.hpp"
|
||||
#include "Pipeline.h"
|
||||
@@ -114,19 +115,20 @@ void RenderCommand::bindDescriptor(Gfx::PDescriptorSet descriptorSet) {
|
||||
}
|
||||
for (const auto& write : metalSet->bufferWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
encoder->useResource(write.buffer, write.access);
|
||||
}
|
||||
|
||||
for (const auto& write : metalSet->samplerWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
}
|
||||
|
||||
for (const auto& write : metalSet->textureWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
encoder->useResource(write.texture, write.access);
|
||||
}
|
||||
|
||||
for (const auto& write : metalSet->accelerationWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
encoder->useResource(write.accelerationStructure, write.access);
|
||||
}
|
||||
encoder->useResource(metalSet->argumentBuffer, MTL::ResourceUsageRead);
|
||||
encoder->setObjectBuffer(metalSet->argumentBuffer, 0, descriptorIndex);
|
||||
encoder->setMeshBuffer(metalSet->argumentBuffer, 0, descriptorIndex);
|
||||
encoder->setVertexBuffer(metalSet->argumentBuffer, 0, descriptorIndex);
|
||||
@@ -222,19 +224,20 @@ void ComputeCommand::bindDescriptor(Gfx::PDescriptorSet set) {
|
||||
}
|
||||
for (const auto& write : metalSet->bufferWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
encoder->useResource(write.buffer, write.access);
|
||||
}
|
||||
|
||||
for (const auto& write : metalSet->samplerWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
}
|
||||
|
||||
for (const auto& write : metalSet->textureWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
encoder->useResource(write.texture, write.access);
|
||||
}
|
||||
|
||||
for (const auto& write : metalSet->accelerationWrites) {
|
||||
write.apply(metalSet->encoder);
|
||||
encoder->useResource(write.accelerationStructure, write.access);
|
||||
}
|
||||
encoder->useResource(metalSet->argumentBuffer, MTL::ResourceUsageRead);
|
||||
encoder->setBuffer(metalSet->argumentBuffer, 0, descriptorIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "Graphics/Metal/Resources.h"
|
||||
#include "Metal/MTLAccelerationStructure.hpp"
|
||||
#include "Metal/MTLArgumentEncoder.hpp"
|
||||
#include "Metal/MTLCommandEncoder.hpp"
|
||||
#include "Metal/MTLLibrary.hpp"
|
||||
#include "Metal/MTLResource.hpp"
|
||||
#include "MinimalEngine.h"
|
||||
@@ -15,25 +16,30 @@
|
||||
namespace Seele {
|
||||
namespace Metal {
|
||||
DECLARE_REF(Graphics)
|
||||
struct DescriptorMapping
|
||||
{
|
||||
uint32 index;
|
||||
uint32 constantSize;
|
||||
MTL::ResourceUsage access;
|
||||
};
|
||||
class DescriptorLayout : public Gfx::DescriptorLayout {
|
||||
public:
|
||||
DescriptorLayout(PGraphics graphics, const std::string& name);
|
||||
virtual ~DescriptorLayout();
|
||||
virtual void create() override;
|
||||
MTL::ArgumentEncoder* createEncoder();
|
||||
uint32 getFlattenedIndex(uint32 binding, uint32 arrayIndex) const { return flattenMap.at(flattenIndex(binding, arrayIndex)); }
|
||||
constexpr uint32 getTotalBindingCount() const { return flattenedBindingCount; }
|
||||
constexpr bool isPlainDescriptor() const { return plainDescriptor; }
|
||||
|
||||
private:
|
||||
constexpr uint64 flattenIndex(uint32 binding, uint32 arrayIndex) const { return uint64(arrayIndex) << 32 | binding; }
|
||||
PGraphics graphics;
|
||||
NS::Array* arguments;
|
||||
Map<uint64, uint32> flattenMap;
|
||||
uint32 flattenedBindingCount = 0;
|
||||
Map<std::string, DescriptorMapping> variableMapping;
|
||||
uint32 numResources;
|
||||
// descriptor sets containing only uniform data are not actually argument buffers, so they need to be
|
||||
// handled separately
|
||||
bool plainDescriptor = true;
|
||||
friend class DescriptorSet;
|
||||
};
|
||||
DEFINE_REF(DescriptorLayout)
|
||||
|
||||
@@ -56,25 +62,24 @@ class DescriptorSet : public Gfx::DescriptorSet, public CommandBoundResource {
|
||||
public:
|
||||
DescriptorSet(PGraphics graphics, PDescriptorPool owner);
|
||||
virtual ~DescriptorSet();
|
||||
virtual void reset();
|
||||
virtual void writeChanges() override;
|
||||
virtual void updateBuffer(uint32 binding, uint32 index, Gfx::PUniformBuffer uniformBuffer) override;
|
||||
virtual void updateBuffer(uint32 binding, uint32 index, Gfx::PShaderBuffer uniformBuffer) override;
|
||||
virtual void updateBuffer(uint32 binding, uint32 index, Gfx::PVertexBuffer uniformBuffer) override;
|
||||
virtual void updateBuffer(uint32 binding, uint32 index, Gfx::PIndexBuffer uniformBuffer) override;
|
||||
virtual void updateSampler(uint32 binding, uint32 index, Gfx::PSampler samplerState) override;
|
||||
virtual void updateTexture(uint32 binding, uint32 index, Gfx::PTexture2D texture) override;
|
||||
virtual void updateTexture(uint32 binding, uint32 index, Gfx::PTexture3D texture) override;
|
||||
virtual void updateTexture(uint32 binding, uint32 index, Gfx::PTextureCube texture) override;
|
||||
virtual void updateAccelerationStructure(uint32 binding, uint32 index, Gfx::PTopLevelAS as) override;
|
||||
virtual void updateConstants(const std::string& name, uint32 offset, void* data) override;
|
||||
virtual void updateBuffer(const std::string& name, uint32 index, Gfx::PShaderBuffer uniformBuffer) override;
|
||||
virtual void updateBuffer(const std::string& name, uint32 index, Gfx::PVertexBuffer uniformBuffer) override;
|
||||
virtual void updateBuffer(const std::string& name, uint32 index, Gfx::PIndexBuffer uniformBuffer) override;
|
||||
virtual void updateSampler(const std::string& name, uint32 index, Gfx::PSampler samplerState) override;
|
||||
virtual void updateTexture(const std::string& name, uint32 index, Gfx::PTexture2D texture) override;
|
||||
virtual void updateTexture(const std::string& name, uint32 index, Gfx::PTexture3D texture) override;
|
||||
virtual void updateTexture(const std::string& name, uint32 index, Gfx::PTextureCube texture) override;
|
||||
virtual void updateAccelerationStructure(const std::string& name, uint32 index, Gfx::PTopLevelAS as) override;
|
||||
|
||||
constexpr const Array<MTL::Resource*>& getBoundResources() const { return boundResources; }
|
||||
constexpr bool isPlainDescriptor() const { return owner->getLayout()->isPlainDescriptor(); }
|
||||
constexpr MTL::ArgumentEncoder* createEncoder() const { return owner->getLayout()->createEncoder(); }
|
||||
|
||||
private:
|
||||
PGraphics graphics;
|
||||
PDescriptorPool owner;
|
||||
Array<MTL::Resource*> boundResources;
|
||||
MTL::Buffer* argumentBuffer = nullptr;
|
||||
MTL::ArgumentEncoder* encoder = nullptr;
|
||||
|
||||
@@ -88,13 +93,15 @@ class DescriptorSet : public Gfx::DescriptorSet, public CommandBoundResource {
|
||||
struct BufferWriteInfo
|
||||
{
|
||||
uint32 index;
|
||||
MTL::ResourceUsage access;
|
||||
MTL::Buffer* buffer;
|
||||
void apply(MTL::ArgumentEncoder* encoder) const { encoder->setBuffer(buffer, 0, 2); }
|
||||
void apply(MTL::ArgumentEncoder* encoder) const { encoder->setBuffer(buffer, 0, index); }
|
||||
};
|
||||
Array<BufferWriteInfo> bufferWrites;
|
||||
struct TextureWriteInfo
|
||||
{
|
||||
uint32 index;
|
||||
MTL::ResourceUsage access;
|
||||
MTL::Texture* texture;
|
||||
void apply(MTL::ArgumentEncoder* encoder) const { encoder->setTexture(texture, index); }
|
||||
};
|
||||
@@ -109,6 +116,7 @@ class DescriptorSet : public Gfx::DescriptorSet, public CommandBoundResource {
|
||||
struct AccelerationStructureWriteInfo
|
||||
{
|
||||
uint32 index;
|
||||
MTL::ResourceUsage access;
|
||||
MTL::AccelerationStructure* accelerationStructure;
|
||||
void apply(MTL::ArgumentEncoder* encoder) const { encoder->setAccelerationStructure(accelerationStructure, index); }
|
||||
};
|
||||
|
||||
@@ -32,22 +32,26 @@ void DescriptorLayout::create() {
|
||||
pool = new DescriptorPool(graphics, this);
|
||||
hash = CRC::Calculate(descriptorBindings.data(), sizeof(Gfx::DescriptorBinding) * descriptorBindings.size(), CRC::CRC_32());
|
||||
MTL::ArgumentDescriptor** objects = new MTL::ArgumentDescriptor*[descriptorBindings.size()];
|
||||
flattenedBindingCount = 0;
|
||||
uint32 mappingCounter = 0;
|
||||
for (uint32 i = 0; i < descriptorBindings.size(); ++i) {
|
||||
if(descriptorBindings[i].descriptorType != Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER) {
|
||||
if (descriptorBindings[i].descriptorType != Gfx::SE_DESCRIPTOR_TYPE_UNIFORM_BUFFER) {
|
||||
plainDescriptor = false;
|
||||
} else {
|
||||
objects[i] = MTL::ArgumentDescriptor::alloc()->init();
|
||||
objects[i]->setIndex(flattenedBindingCount);
|
||||
objects[i]->setAccess(cast(descriptorBindings[i].access));
|
||||
objects[i]->setIndex(mappingCounter);
|
||||
objects[i]->setAccess(MTL::BindingAccessReadOnly);
|
||||
objects[i]->setArrayLength(descriptorBindings[i].descriptorCount);
|
||||
objects[i]->setDataType(MTL::DataTypeChar);
|
||||
objects[i]->setArrayLength(descriptorBindings[i].uniformLength);
|
||||
}
|
||||
for(uint32 j = 0; j < descriptorBindings[i].descriptorCount; ++j) {
|
||||
flattenMap[flattenIndex(i, j)] = flattenedBindingCount++;
|
||||
}
|
||||
variableMapping[descriptorBindings[i].name] = DescriptorMapping{
|
||||
.index = mappingCounter,
|
||||
.constantSize = descriptorBindings[i].uniformLength,
|
||||
.access = descriptorBindings[i].access,
|
||||
};
|
||||
mappingCounter += descriptorBindings[i].descriptorCount;
|
||||
}
|
||||
numResources = mappingCounter;
|
||||
arguments = NS::Array::array((NS::Object**)objects, descriptorBindings.size());
|
||||
}
|
||||
|
||||
@@ -63,8 +67,8 @@ Gfx::PDescriptorSet DescriptorPool::allocateDescriptorSet() {
|
||||
// Currently in use, skip
|
||||
continue;
|
||||
}
|
||||
|
||||
// Found set, stop searching
|
||||
allocatedSets[setIndex]->reset();
|
||||
return PDescriptorSet(allocatedSets[setIndex]);
|
||||
}
|
||||
allocatedSets.add(new DescriptorSet(graphics, this));
|
||||
@@ -75,94 +79,100 @@ void DescriptorPool::reset() {}
|
||||
|
||||
DescriptorSet::DescriptorSet(PGraphics graphics, PDescriptorPool owner)
|
||||
: Gfx::DescriptorSet(owner->getLayout()), CommandBoundResource(graphics), graphics(graphics), owner(owner) {
|
||||
boundResources.resize(owner->getLayout()->getTotalBindingCount());
|
||||
}
|
||||
|
||||
DescriptorSet::~DescriptorSet() {}
|
||||
|
||||
void DescriptorSet::reset() {
|
||||
uniformWrites.clear();
|
||||
bufferWrites.clear();
|
||||
textureWrites.clear();
|
||||
samplerWrites.clear();
|
||||
accelerationWrites.clear();
|
||||
}
|
||||
|
||||
void DescriptorSet::writeChanges() {}
|
||||
|
||||
void DescriptorSet::updateBuffer(uint32 binding, uint32 index, Gfx::PUniformBuffer uniformBuffer) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
PUniformBuffer buffer = uniformBuffer.cast<UniformBuffer>();
|
||||
boundResources[flattenedIndex] = nullptr;
|
||||
void DescriptorSet::updateConstants(const std::string& name, uint32 offset, void* data) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index;
|
||||
Array<uint8> contents(owner->getLayout()->variableMapping[name].constantSize);
|
||||
std::memcpy(contents.data(), (uint8*)data + offset, contents.size());
|
||||
uniformWrites.add(UniformWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.content = buffer->getContents(),
|
||||
.content = contents,
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateBuffer(uint32 binding, uint32 index, Gfx::PShaderBuffer uniformBuffer) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PShaderBuffer uniformBuffer) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index + index;
|
||||
PShaderBuffer buffer = uniformBuffer.cast<ShaderBuffer>();
|
||||
boundResources[flattenedIndex] = buffer->getHandle();
|
||||
bufferWrites.add(BufferWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.buffer = buffer->getHandle(),
|
||||
.access = owner->getLayout()->variableMapping[name].access,
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateBuffer(uint32 binding, uint32 index, Gfx::PVertexBuffer uniformBuffer) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PVertexBuffer uniformBuffer) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index + index;
|
||||
PVertexBuffer buffer = uniformBuffer.cast<VertexBuffer>();
|
||||
boundResources[flattenedIndex] = buffer->getHandle();
|
||||
bufferWrites.add(BufferWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.buffer = buffer->getHandle(),
|
||||
.access = owner->getLayout()->variableMapping[name].access,
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateBuffer(uint32 binding, uint32 index, Gfx::PIndexBuffer uniformBuffer) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
void DescriptorSet::updateBuffer(const std::string& name, uint32 index, Gfx::PIndexBuffer uniformBuffer) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index + index;
|
||||
PIndexBuffer buffer = uniformBuffer.cast<IndexBuffer>();
|
||||
boundResources[flattenedIndex] = buffer->getHandle();
|
||||
bufferWrites.add(BufferWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.buffer = buffer->getHandle(),
|
||||
.access = owner->getLayout()->variableMapping[name].access,
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateSampler(uint32 binding, uint32 index, Gfx::PSampler samplerState) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
void DescriptorSet::updateSampler(const std::string& name, uint32 index, Gfx::PSampler samplerState) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index + index;
|
||||
PSampler sampler = samplerState.cast<Sampler>();
|
||||
boundResources[flattenedIndex] = nullptr;
|
||||
samplerWrites.add(SamplerWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.sampler = sampler->getHandle(),
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateTexture(uint32 binding, uint32 index, Gfx::PTexture2D texture) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PTexture2D texture) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index + index;
|
||||
PTextureBase tex = texture.cast<TextureBase>();
|
||||
boundResources[flattenedIndex] = tex->getImage();
|
||||
textureWrites.add(TextureWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.texture = tex->getImage(),
|
||||
.access = owner->getLayout()->variableMapping[name].access,
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateTexture(uint32 binding, uint32 index, Gfx::PTexture3D texture) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PTexture3D texture) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index + index;
|
||||
PTextureBase tex = texture.cast<TextureBase>();
|
||||
boundResources[flattenedIndex] = tex->getImage();
|
||||
textureWrites.add(TextureWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.texture = tex->getImage(),
|
||||
.access = owner->getLayout()->variableMapping[name].access,
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateTexture(uint32 binding, uint32 index, Gfx::PTextureCube texture) {
|
||||
uint32 flattenedIndex = owner->getLayout()->getFlattenedIndex(binding, index);
|
||||
void DescriptorSet::updateTexture(const std::string& name, uint32 index, Gfx::PTextureCube texture) {
|
||||
uint32 flattenedIndex = owner->getLayout()->variableMapping[name].index + index;
|
||||
PTextureBase tex = texture.cast<TextureBase>();
|
||||
boundResources[flattenedIndex] = tex->getImage();
|
||||
textureWrites.add(TextureWriteInfo{
|
||||
.index = flattenedIndex,
|
||||
.texture = tex->getImage(),
|
||||
.access = owner->getLayout()->variableMapping[name].access,
|
||||
});
|
||||
}
|
||||
|
||||
void DescriptorSet::updateAccelerationStructure(uint32 binding, uint32 index, Gfx::PTopLevelAS as) { assert(false && "TODO"); }
|
||||
void DescriptorSet::updateAccelerationStructure(const std::string& name, uint32 index, Gfx::PTopLevelAS as) { assert(false && "TODO"); }
|
||||
|
||||
PipelineLayout::PipelineLayout(PGraphics graphics, const std::string& name, Gfx::PPipelineLayout baseLayout)
|
||||
: Gfx::PipelineLayout(name, baseLayout), graphics(graphics) {}
|
||||
|
||||
@@ -14,8 +14,6 @@ MTL::LoadAction cast(Gfx::SeAttachmentLoadOp loadOp);
|
||||
Gfx::SeAttachmentLoadOp cast(MTL::LoadAction loadOp);
|
||||
MTL::StoreAction cast(Gfx::SeAttachmentStoreOp storeOp);
|
||||
Gfx::SeAttachmentStoreOp cast(MTL::StoreAction storeOp);
|
||||
MTL::BindingAccess cast(Gfx::SeDescriptorAccessTypeFlags access);
|
||||
Gfx::SeDescriptorAccessTypeFlags cast(MTL::BindingAccess access);
|
||||
MTL::SamplerBorderColor cast(Gfx::SeBorderColor color);
|
||||
Gfx::SeBorderColor cast(MTL::SamplerBorderColor color);
|
||||
MTL::CompareFunction cast(Gfx::SeCompareOp compare);
|
||||
@@ -31,4 +29,4 @@ Gfx::SePrimitiveTopology cast(MTL::PrimitiveTopologyClass topology);
|
||||
MTL::IndexType cast(Gfx::SeIndexType indexType);
|
||||
Gfx::SeIndexType cast(MTL::IndexType indexType);
|
||||
} // namespace Metal
|
||||
} // namespace Seele
|
||||
} // namespace Seele
|
||||
|
||||
@@ -589,32 +589,6 @@ Gfx::SeAttachmentStoreOp Seele::Metal::cast(MTL::StoreAction storeOp) {
|
||||
}
|
||||
}
|
||||
|
||||
MTL::BindingAccess Seele::Metal::cast(Gfx::SeDescriptorAccessTypeFlags access) {
|
||||
switch (access) {
|
||||
case Gfx::SE_DESCRIPTOR_ACCESS_READ_ONLY_BIT:
|
||||
return MTL::ArgumentAccessReadOnly;
|
||||
case Gfx::SE_DESCRIPTOR_ACCESS_READ_WRITE_BIT:
|
||||
return MTL::ArgumentAccessReadWrite;
|
||||
case Gfx::SE_DESCRIPTOR_ACCESS_WRITE_ONLY_BIT:
|
||||
return MTL::ArgumentAccessWriteOnly;
|
||||
default:
|
||||
throw std::logic_error("Not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
Gfx::SeDescriptorAccessTypeFlags Seele::Metal::cast(MTL::BindingAccess access) {
|
||||
switch (access) {
|
||||
case MTL::ArgumentAccessReadOnly:
|
||||
return Gfx::SE_DESCRIPTOR_ACCESS_READ_ONLY_BIT;
|
||||
case MTL::ArgumentAccessReadWrite:
|
||||
return Gfx::SE_DESCRIPTOR_ACCESS_READ_WRITE_BIT;
|
||||
case MTL::ArgumentAccessWriteOnly:
|
||||
return Gfx::SE_DESCRIPTOR_ACCESS_WRITE_ONLY_BIT;
|
||||
default:
|
||||
throw std::logic_error("Not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
MTL::SamplerBorderColor Seele::Metal::cast(Gfx::SeBorderColor color) {
|
||||
switch (color) {
|
||||
case Gfx::SE_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK:
|
||||
|
||||
@@ -20,6 +20,7 @@ class Window : public Gfx::Window {
|
||||
public:
|
||||
Window(PGraphics graphics, const WindowCreateInfo& createInfo);
|
||||
virtual ~Window();
|
||||
virtual void show() override;
|
||||
virtual void pollInput() override;
|
||||
virtual void beginFrame() override;
|
||||
virtual void endFrame() override;
|
||||
|
||||
@@ -67,6 +67,7 @@ Window::Window(PGraphics graphics, const WindowCreateInfo& createInfo) : graphic
|
||||
float xscale = 1, yscale = 1;
|
||||
glfwGetMonitorContentScale(glfwGetPrimaryMonitor(), &xscale, &yscale);
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||
GLFWwindow* handle = glfwCreateWindow(createInfo.width / xscale, createInfo.height / yscale, createInfo.title, nullptr, nullptr);
|
||||
windowHandle = handle;
|
||||
glfwSetWindowUserPointer(handle, this);
|
||||
@@ -98,6 +99,8 @@ Window::Window(PGraphics graphics, const WindowCreateInfo& createInfo) : graphic
|
||||
|
||||
Window::~Window() { glfwDestroyWindow(static_cast<GLFWwindow*>(windowHandle)); }
|
||||
|
||||
void Window::show() { glfwShowWindow(windowHandle); }
|
||||
|
||||
void Window::pollInput() { glfwPollEvents(); }
|
||||
|
||||
void Window::beginFrame() {
|
||||
|
||||
Reference in New Issue
Block a user