Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8561503
Experiments with passing mipmap data via vsg::uivec4Array.
robertosfield Oct 15, 2025
1b868ae
Added support for ASTC.
robertosfield Oct 30, 2025
a29d4f5
Bumped VulkanSDK version number to fix automated build
robertosfield Oct 15, 2025
ab38cbd
Added additional format support
robertosfield Oct 31, 2025
f171670
Merge branch 'master' into mipmap_experiments
robertosfield Oct 31, 2025
87a3a87
Implemented support for more formats.
robertosfield Nov 5, 2025
d5f3e98
Queitened debug messages and added support for VK_FORMAT_EAC* formats
robertosfield Nov 6, 2025
f5cb83e
Refactored how mipmaps are managed.
robertosfield Nov 14, 2025
042e237
Moved transferImageData(..) function from ImageView header/source fil…
robertosfield Nov 15, 2025
bf6b422
Removed no longer required mipmap API
robertosfield Nov 15, 2025
8d41978
Added include to fix Windows build
robertosfield Nov 16, 2025
fa87f80
Improved handling of vsg::Data mipmap data.
robertosfield Nov 16, 2025
856cd2a
Renamed Properties.maxNumMipMaps to Properties.mipLevels to be consis…
robertosfield Nov 16, 2025
ad5c33d
Merge branch 'master' into mipmap_refinement
robertosfield Nov 16, 2025
0e5576f
Created dedicated MipmapDetails class to hold the mipmap layout
robertosfield Nov 17, 2025
f3280bc
Renamed MipmapDetails to MipmapLayout to better reflect it's role.
robertosfield Nov 17, 2025
dc421a7
Refined the MipmapLayout implementation.
robertosfield Nov 18, 2025
45a8137
Fixed reading/writing of mipmaps
robertosfield Nov 18, 2025
1787f55
Added MipmapLayout to Visitor and ConstVisitor
robertosfield Nov 18, 2025
cade7d4
Ran clang-format.
robertosfield Nov 18, 2025
663f506
cppcheck fixes
robertosfield Nov 19, 2025
58d3fa7
Bumped version for vsg::Data mipmap changes
robertosfield Nov 19, 2025
68ecba1
Refactored the clean up of MipmapLayout etc.
robertosfield Nov 19, 2025
bb05bab
Refactored how Auxiliary is cleared by Data subclasses
robertosfield Nov 19, 2025
4f331a3
Cleaned up includes and indentation
robertosfield Nov 19, 2025
8760def
Ran clang-format
robertosfield Nov 19, 2025
57f3ac5
Fixed cppcheck issue and removed debug output
robertosfield Nov 19, 2025
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
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cmake_minimum_required(VERSION 3.7)

project(vsg
VERSION 1.1.11
VERSION 1.1.12
DESCRIPTION "VulkanSceneGraph library"
LANGUAGES CXX
)
set(VSG_SOVERSION 14)
set(VSG_SOVERSION 15)
SET(VSG_RELEASE_CANDIDATE 0)
set(Vulkan_MIN_VERSION 1.1.70.0)

Expand Down
1 change: 1 addition & 0 deletions include/vsg/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
#include <vsg/core/IntrusiveAllocator.h>
#include <vsg/core/Mask.h>
#include <vsg/core/MemorySlots.h>
#include <vsg/core/MipmapLayout.h>
#include <vsg/core/Object.h>
#include <vsg/core/Objects.h>
#include <vsg/core/ScratchMemory.h>
Expand Down
1 change: 0 additions & 1 deletion include/vsg/app/RecordTraversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ namespace vsg
// clear the bins to record a new frame.
void clearBins();


// list of pairs of modelview matrix & region of interest
std::vector<std::pair<dmat4, const RegionOfInterest*>> regionsOfInterest;

Expand Down
3 changes: 3 additions & 0 deletions include/vsg/app/TransferTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,7 @@ namespace vsg
};
VSG_type_name(vsg::TransferTask);

/// convenience function that uploads staging buffer data to device including mipmaps.
extern VSG_DECLSPEC void transferImageData(ref_ptr<ImageView> imageView, VkImageLayout targetImageLayout, Data::Properties properties, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevels, ref_ptr<Buffer> stagingBuffer, VkDeviceSize stagingBufferOffset, VkCommandBuffer vk_commandBuffer, vsg::Device* device);

} // namespace vsg
1 change: 0 additions & 1 deletion include/vsg/commands/CopyAndReleaseImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ namespace vsg
uint32_t width = 0;
uint32_t height = 0;
uint32_t depth = 0;
Data::MipmapOffsets mipmapOffsets;

void record(CommandBuffer& commandBuffer) const;
};
Expand Down
37 changes: 23 additions & 14 deletions include/vsg/core/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

namespace vsg
{

template<typename T>
class Array : public Data
{
Expand Down Expand Up @@ -63,10 +62,14 @@ namespace vsg
_data(_allocate(numElements)),
_size(numElements) { dirty(); }

Array(uint32_t numElements, value_type* data, Properties in_properties = {}) :
Array(uint32_t numElements, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
Data(in_properties, sizeof(value_type)),
_data(data),
_size(numElements) { dirty(); }
_size(numElements)
{
setMipmapLayout(mipmapLayout);
dirty();
}

Array(uint32_t numElements, const value_type& value, Properties in_properties = {}) :
Data(in_properties, sizeof(value_type)),
Expand All @@ -77,12 +80,12 @@ namespace vsg
dirty();
}

Array(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t numElements, Properties in_properties = {}) :
Array(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t numElements, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
Data(),
_data(nullptr),
_size(0)
{
assign(data, offset, stride, numElements, in_properties);
assign(data, offset, stride, numElements, in_properties, mipmapLayout);
}

explicit Array(std::initializer_list<value_type> l) :
Expand Down Expand Up @@ -165,7 +168,10 @@ namespace vsg

if (input.matchPropertyName("data"))
{
size_t new_total_size = computeValueCountIncludingMipmaps(width_size, 1, 1, properties.maxNumMipmaps);
properties.stride = sizeof(value_type);
_size = width_size;
_storage = nullptr;
size_t new_total_size = computeValueCountIncludingMipmaps();

if (_data) // if data exists already may be able to reuse it
{
Expand All @@ -181,10 +187,6 @@ namespace vsg
_data = _allocate(new_total_size);
}

properties.stride = sizeof(value_type);
_size = width_size;
_storage = nullptr;

if (_data) input.read(new_total_size, _data);

dirty();
Expand All @@ -209,7 +211,7 @@ namespace vsg
output.writeEndOfLine();
}

size_t size() const { return (properties.maxNumMipmaps <= 1) ? _size : computeValueCountIncludingMipmaps(_size, 1, 1, properties.maxNumMipmaps); }
size_t size() const { return (properties.mipLevels <= 1) ? _size : computeValueCountIncludingMipmaps(); }

bool available() const { return _data != nullptr; }
bool empty() const { return _data == nullptr; }
Expand All @@ -229,7 +231,8 @@ namespace vsg

clear();

properties = rhs.properties;
_copy(rhs);

_size = rhs._size;

if (_size != 0)
Expand All @@ -244,7 +247,7 @@ namespace vsg
return *this;
}

void assign(uint32_t numElements, value_type* data, Properties in_properties = {})
void assign(uint32_t numElements, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
{
_delete();

Expand All @@ -254,10 +257,12 @@ namespace vsg
_data = data;
_storage = nullptr;

setMipmapLayout(mipmapLayout);

dirty();
}

void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t numElements, Properties in_properties = {})
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t numElements, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
{
_delete();

Expand All @@ -275,6 +280,8 @@ namespace vsg
_size = 0;
}

setMipmapLayout(mipmapLayout);

dirty();
}

Expand Down Expand Up @@ -365,6 +372,8 @@ namespace vsg
else if (properties.allocatorType != 0)
vsg::deallocate(_data);
}

_clear();
}

private:
Expand Down
40 changes: 25 additions & 15 deletions include/vsg/core/Array2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
</editor-fold> */

#include <vsg/core/Data.h>

#include <vsg/maths/mat4.h>
#include <vsg/maths/vec2.h>
#include <vsg/maths/vec3.h>
Expand Down Expand Up @@ -68,11 +67,15 @@ namespace vsg
dirty();
}

Array2D(uint32_t width, uint32_t height, value_type* data, Properties in_properties = {}) :
Array2D(uint32_t width, uint32_t height, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
Data(in_properties, sizeof(value_type)),
_data(data),
_width(width),
_height(height) { dirty(); }
_height(height)
{
setMipmapLayout(mipmapLayout);
dirty();
}

Array2D(uint32_t width, uint32_t height, const value_type& value, Properties in_properties = {}) :
Data(in_properties, sizeof(value_type)),
Expand All @@ -88,13 +91,13 @@ namespace vsg
}
}

Array2D(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, Properties in_properties = {}) :
Array2D(ref_ptr<Data> data, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr) :
Data(),
_data(nullptr),
_width(0),
_height(0)
{
assign(data, offset, stride, width, height, in_properties);
assign(data, offset, stride, width, height, in_properties, mipmapLayout);
}

template<typename... Args>
Expand Down Expand Up @@ -144,7 +147,12 @@ namespace vsg

if (input.matchPropertyName("data"))
{
size_t new_size = computeValueCountIncludingMipmaps(w, h, 1, properties.maxNumMipmaps);
properties.stride = sizeof(value_type);
_width = w;
_height = h;
_storage = nullptr;

size_t new_size = computeValueCountIncludingMipmaps();

if (_data) // if data exists already may be able to reuse it
{
Expand All @@ -159,11 +167,6 @@ namespace vsg
_data = _allocate(new_size);
}

properties.stride = sizeof(value_type);
_width = w;
_height = h;
_storage = nullptr;

if (_data) input.read(new_size, _data);

dirty();
Expand All @@ -190,7 +193,7 @@ namespace vsg
output.writeEndOfLine();
}

size_t size() const { return (properties.maxNumMipmaps <= 1) ? (static_cast<size_t>(_width) * static_cast<size_t>(_height)) : computeValueCountIncludingMipmaps(_width, _height, 1, properties.maxNumMipmaps); }
size_t size() const { return (properties.mipLevels <= 1) ? (static_cast<size_t>(_width) * static_cast<size_t>(_height)) : computeValueCountIncludingMipmaps(); }

bool available() const { return _data != nullptr; }
bool empty() const { return _data == nullptr; }
Expand All @@ -211,7 +214,8 @@ namespace vsg

clear();

properties = rhs.properties;
_copy(rhs);

_width = rhs._width;
_height = rhs._height;

Expand All @@ -227,7 +231,7 @@ namespace vsg
return *this;
}

void assign(uint32_t width, uint32_t height, value_type* data, Properties in_properties = {})
void assign(uint32_t width, uint32_t height, value_type* data, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
{
_delete();

Expand All @@ -238,10 +242,12 @@ namespace vsg
_data = data;
_storage = nullptr;

setMipmapLayout(mipmapLayout);

dirty();
}

void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, Properties in_properties = {})
void assign(ref_ptr<Data> storage, uint32_t offset, uint32_t stride, uint32_t width, uint32_t height, Properties in_properties = {}, MipmapLayout* mipmapLayout = nullptr)
{
_delete();

Expand All @@ -261,6 +267,8 @@ namespace vsg
_height = 0;
}

setMipmapLayout(mipmapLayout);

dirty();
}

Expand Down Expand Up @@ -360,6 +368,8 @@ namespace vsg
else if (properties.allocatorType != 0)
vsg::deallocate(_data);
}

_clear();
}

private:
Expand Down
Loading
Loading