Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .idea/QtSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/editor.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ option(NEON_UNITY_BUILD "Enable Unity Build" OFF)

set(CMAKE_CXX_STANDARD 20)
set(LIBZIPPP_INSTALL ON)
set(GLSLANG_ENABLE_INSTALL ON)
set(NEON_GENERATED_DIR ${CMAKE_BINARY_DIR}/generated)
set(CEF_RUNTIME_LIBRARY_FLAG "" CACHE STRING "Override CEF runtime flag" FORCE)

Expand Down Expand Up @@ -71,15 +72,15 @@ FetchContent_Declare(
# SPIRV-Headers
FetchContent_Declare(
spirv_headers
GIT_TAG cfbe4feef20c3c0628712c2792624f0221e378ac
GIT_TAG 6bb105b6c4b3a246e1e6bb96366fe14c6dbfde83
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Headers.git
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/spirv_headers
)

# SPIRV-Tools
FetchContent_Declare(
spirv_tools
GIT_TAG 6f276e05ccab210584996bc40a0bef82b91f4f40
GIT_TAG 5d01ec711f3077a89f33c7818d737cfa5dd932d6
GIT_REPOSITORY https://github.com/KhronosGroup/SPIRV-Tools.git
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/spirv_tools
)
Expand All @@ -88,7 +89,7 @@ FetchContent_Declare(
FetchContent_Declare(
glslang
GIT_REPOSITORY https://github.com/KhronosGroup/glslang.git
GIT_TAG 68f073b19569b580ecc7ba13fa96be3ecf65a0f6
GIT_TAG 5f6c7176c5483da9af6432afb3dd962e4f8873a1
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/glslang
)

Expand Down Expand Up @@ -149,8 +150,8 @@ list(APPEND UNITY_BUILD_TARGETS

# QT
if (NEON_USE_QT)
find_package(Qt5 REQUIRED COMPONENTS Core Gui)
list(APPEND NEON_LIBRARIES Qt5::Core Qt5::Gui)
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
list(APPEND NEON_LIBRARIES Qt6::Core Qt6::Gui)
endif ()

if (RELEASE_DEBUG)
Expand Down
3 changes: 2 additions & 1 deletion src/neon/loader/ShaderProgramLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ namespace neon
auto fileSystem = context.fileSystem;
auto parentPath = context.path.has_value() ? context.path.value().parent_path() : std::filesystem::path();

if (auto result = shader->compile(fileSystem, parentPath); result.has_value()) {
IncluderCreateInfo info{fileSystem, parentPath};
if (auto result = shader->compile(info); result.has_value()) {
logger.error(result.value());
return nullptr;
}
Expand Down
2 changes: 2 additions & 0 deletions src/neon/render/buffer/CommandBufferRun.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ namespace neon
virtual ~CommandBufferRun() = default;

virtual bool hasFinished() = 0;

virtual void wait() = 0;
};

} // namespace neon
Expand Down
8 changes: 8 additions & 0 deletions src/neon/render/buffer/CommandPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ namespace neon
return raw;
}

void CommandPool::waitForAll()
{
checkUsedBufferForAvailability();
for (auto cmd : _usedBuffers) {
_buffers[cmd]->wait();
}
}

CommandPool& CommandPool::operator=(CommandPool&& move) noexcept
{
_buffers.clear();
Expand Down
2 changes: 2 additions & 0 deletions src/neon/render/buffer/CommandPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ namespace neon

CommandBuffer* beginCommandBuffer(bool onlyOneSummit);

void waitForAll();

CommandPool& operator=(CommandPool&& move) noexcept;
};
} // namespace neon
Expand Down
16 changes: 8 additions & 8 deletions src/neon/render/buffer/QTSwapChainFrameBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

namespace neon
{
QTSwapChainFrameBuffer::QTSwapChainFrameBuffer(Application* application) :
FrameBuffer(),
QTSwapChainFrameBuffer::QTSwapChainFrameBuffer(Application* application, std::string name) :
FrameBuffer(std::move(name)),
_implementation(application)
{
}
Expand All @@ -33,19 +33,19 @@ namespace neon
return _implementation;
}

std::vector<std::shared_ptr<Texture>> QTSwapChainFrameBuffer::getTextures() const
rush::Vec2ui QTSwapChainFrameBuffer::getDimensions() const
{
return {};
return _implementation.getDimensions();
}

uint32_t QTSwapChainFrameBuffer::getWidth() const
std::vector<FrameBufferOutput> QTSwapChainFrameBuffer::getOutputs() const
{
return _implementation.getWidth();
return _implementation.getOutputs();
}

uint32_t QTSwapChainFrameBuffer::getHeight() const
SamplesPerTexel QTSwapChainFrameBuffer::getSamples() const
{
return _implementation.getHeight();
return _implementation.getSamples();
}
} // namespace neon

Expand Down
10 changes: 5 additions & 5 deletions src/neon/render/buffer/QTSwapChainFrameBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace neon
Implementation _implementation;

public:
explicit QTSwapChainFrameBuffer(Application* application);
QTSwapChainFrameBuffer(Application* application, std::string name);

~QTSwapChainFrameBuffer() override = default;

Expand All @@ -43,14 +43,14 @@ namespace neon

[[nodiscard]] const FrameBuffer::Implementation& getImplementation() const override;

[[nodiscard]] std::vector<std::shared_ptr<Texture>> getTextures() const override;
[[nodiscard]] rush::Vec2ui getDimensions() const override;

[[nodiscard]] uint32_t getWidth() const override;
[[nodiscard]] std::vector<FrameBufferOutput> getOutputs() const override;

[[nodiscard]] uint32_t getHeight() const override;
[[nodiscard]] SamplesPerTexel getSamples() const override;
};
} // namespace neon

#endif

#endif //NEON_QTSWAPCHAINFRAMEBUFFER_H
#endif // NEON_QTSWAPCHAINFRAMEBUFFER_H
20 changes: 8 additions & 12 deletions src/neon/render/model/BasicInstanceData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,19 @@ namespace neon
bool BasicInstanceData::uploadData(Instance instance, size_t index, const void* data)
{
if (_slots.size() < index) {
logger.error(MessageBuilder()
.group("vulkan")
.print("Cannot upload instance data. Index ")
.print(index)
.print(" is not defined!"));
neon::error().group("vulkan") << "Cannot upload instance data. Slot " << index << " is not defined!";
return false;
}
auto& slot = _slots[index];
if (slot.size == 0) {
neon::error().group("vulkan") << "Cannot upload instance data. Slot" << index << " has no memory!";
return false;
}

uint32_t id = *instance.id;
auto& slot = _slots[index];

if (slot.size == 0) {
logger.error(MessageBuilder()
.group("vulkan")
.print("Cannot upload instance data. Invalid id ")
.print(instance.id)
.print("!"));
if (id >= _positions.size()) {
neon::error().group("vulkan") << "Cannot upload instance data. Instance" << id << " is not valid!";
return false;
}

Expand Down
24 changes: 10 additions & 14 deletions src/neon/render/model/ConcurrentInstanceData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,29 +165,25 @@ namespace neon
bool ConcurrentInstanceData::uploadData(Instance instance, size_t index, const void* data)
{
if (_slots.size() < index) {
logger.error(MessageBuilder()
.group("vulkan")
.print("Cannot upload instance data. Index ")
.print(index)
.print(" is not defined!"));
neon::error().group("vulkan") << "Cannot upload instance data. Slot " << index << " is not defined!";
return false;
}
auto& slot = _slots[index];
if (slot.size == 0) {
neon::error().group("vulkan") << "Cannot upload instance data. Slot" << index << " has no memory!";
return false;
}


std::lock_guard slotLock(_mutex[index]);

uint32_t id = *instance.id;
auto& slot = _slots[index];

std::lock_guard posLock(_positionMutex);
if (id >= _positions.size()) {
logger.error(MessageBuilder()
.group("vulkan")
.print("Cannot upload instance data. Invalid id ")
.print(id)
.print("!"));
neon::error().group("vulkan") << "Cannot upload instance data. Instance" << id << " is not valid!";
return false;
}

std::lock_guard slotLock(_mutex[index]);

memcpy(slot.data + slot.size * id, data, slot.size);

slot.changeRange += Range(id, id + 1);
Expand Down
Loading