Moved VulkanBuffer to vks namespce (Refs #260)
This commit is contained in:
parent
f917ea6640
commit
776b6f0106
54 changed files with 165 additions and 165 deletions
|
|
@ -15,7 +15,7 @@
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
#include "vulkantools.h"
|
#include "vulkantools.h"
|
||||||
|
|
||||||
namespace vk
|
namespace vks
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Encapsulates access to a Vulkan buffer backed up by device memory
|
* @brief Encapsulates access to a Vulkan buffer backed up by device memory
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
#include "vulkantools.h"
|
#include "vulkantools.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
namespace vks
|
namespace vks
|
||||||
{
|
{
|
||||||
|
|
@ -388,7 +388,7 @@ namespace vks
|
||||||
*
|
*
|
||||||
* @return VK_SUCCESS if buffer handle and memory have been created and (optionally passed) data has been copied
|
* @return VK_SUCCESS if buffer handle and memory have been created and (optionally passed) data has been copied
|
||||||
*/
|
*/
|
||||||
VkResult createBuffer(VkBufferUsageFlags usageFlags, VkMemoryPropertyFlags memoryPropertyFlags, vk::Buffer *buffer, VkDeviceSize size, void *data = nullptr)
|
VkResult createBuffer(VkBufferUsageFlags usageFlags, VkMemoryPropertyFlags memoryPropertyFlags, vks::Buffer *buffer, VkDeviceSize size, void *data = nullptr)
|
||||||
{
|
{
|
||||||
buffer->device = logicalDevice;
|
buffer->device = logicalDevice;
|
||||||
|
|
||||||
|
|
@ -435,7 +435,7 @@ namespace vks
|
||||||
*
|
*
|
||||||
* @note Source and destionation pointers must have the approriate transfer usage flags set (TRANSFER_SRC / TRANSFER_DST)
|
* @note Source and destionation pointers must have the approriate transfer usage flags set (TRANSFER_SRC / TRANSFER_DST)
|
||||||
*/
|
*/
|
||||||
void copyBuffer(vk::Buffer *src, vk::Buffer *dst, VkQueue queue, VkBufferCopy *copyRegion = nullptr)
|
void copyBuffer(vks::Buffer *src, vks::Buffer *dst, VkQueue queue, VkBufferCopy *copyRegion = nullptr)
|
||||||
{
|
{
|
||||||
assert(dst->size <= src->size);
|
assert(dst->size <= src->size);
|
||||||
assert(src->buffer && src->buffer);
|
assert(src->buffer && src->buffer);
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
#include <glm/gtc/type_ptr.hpp>
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#include <android/asset_manager.h>
|
#include <android/asset_manager.h>
|
||||||
|
|
@ -108,8 +108,8 @@ namespace vks
|
||||||
|
|
||||||
struct Model {
|
struct Model {
|
||||||
VkDevice device = nullptr;
|
VkDevice device = nullptr;
|
||||||
vk::Buffer vertices;
|
vks::Buffer vertices;
|
||||||
vk::Buffer indices;
|
vks::Buffer indices;
|
||||||
uint32_t indexCount = 0;
|
uint32_t indexCount = 0;
|
||||||
uint32_t vertexCount = 0;
|
uint32_t vertexCount = 0;
|
||||||
|
|
||||||
|
|
@ -306,7 +306,7 @@ namespace vks
|
||||||
|
|
||||||
// Use staging buffer to move vertex and index buffer to device local memory
|
// Use staging buffer to move vertex and index buffer to device local memory
|
||||||
// Create staging buffers
|
// Create staging buffers
|
||||||
vk::Buffer vertexStaging, indexStaging;
|
vks::Buffer vertexStaging, indexStaging;
|
||||||
|
|
||||||
// Vertex buffer
|
// Vertex buffer
|
||||||
VK_CHECK_RESULT(device->createBuffer(
|
VK_CHECK_RESULT(device->createBuffer(
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "vulkantools.h"
|
#include "vulkantools.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#if defined(__ANDROID__)
|
#if defined(__ANDROID__)
|
||||||
#include <android/asset_manager.h>
|
#include <android/asset_manager.h>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
#include "vulkan/vulkan.h"
|
#include "vulkan/vulkan.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
namespace vkTools
|
namespace vkTools
|
||||||
{
|
{
|
||||||
|
|
@ -31,8 +31,8 @@ namespace vkTools
|
||||||
float heightScale = 1.0f;
|
float heightScale = 1.0f;
|
||||||
float uvScale = 1.0f;
|
float uvScale = 1.0f;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
|
|
||||||
struct Vertex {
|
struct Vertex {
|
||||||
glm::vec3 pos;
|
glm::vec3 pos;
|
||||||
|
|
@ -192,7 +192,7 @@ namespace vkTools
|
||||||
|
|
||||||
// Generate Vulkan buffers
|
// Generate Vulkan buffers
|
||||||
|
|
||||||
vk::Buffer vertexStaging, indexStaging;
|
vks::Buffer vertexStaging, indexStaging;
|
||||||
|
|
||||||
// Create staging buffers
|
// Create staging buffers
|
||||||
device->createBuffer(
|
device->createBuffer(
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkantools.h"
|
#include "vulkantools.h"
|
||||||
#include "vulkandebug.h"
|
#include "vulkandebug.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
|
|
||||||
#include "../external/stb/stb_font_consolas_24_latin1.inl"
|
#include "../external/stb/stb_font_consolas_24_latin1.inl"
|
||||||
|
|
@ -54,7 +54,7 @@ private:
|
||||||
VkSampler sampler;
|
VkSampler sampler;
|
||||||
VkImage image;
|
VkImage image;
|
||||||
VkImageView view;
|
VkImageView view;
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
VkDeviceMemory imageMemory;
|
VkDeviceMemory imageMemory;
|
||||||
VkDescriptorPool descriptorPool;
|
VkDescriptorPool descriptorPool;
|
||||||
VkDescriptorSetLayout descriptorSetLayout;
|
VkDescriptorSetLayout descriptorSetLayout;
|
||||||
|
|
@ -203,7 +203,7 @@ public:
|
||||||
VK_CHECK_RESULT(vkBindImageMemory(vulkanDevice->logicalDevice, image, imageMemory, 0));
|
VK_CHECK_RESULT(vkBindImageMemory(vulkanDevice->logicalDevice, image, imageMemory, 0));
|
||||||
|
|
||||||
// Staging
|
// Staging
|
||||||
vk::Buffer stagingBuffer;
|
vks::Buffer stagingBuffer;
|
||||||
|
|
||||||
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -60,9 +60,9 @@ public:
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
vk::Buffer skyBox;
|
vks::Buffer skyBox;
|
||||||
vk::Buffer blurParams;
|
vks::Buffer blurParams;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBO {
|
struct UBO {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "frustum.hpp"
|
#include "frustum.hpp"
|
||||||
|
|
||||||
|
|
@ -68,10 +68,10 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Contains the instanced data
|
// Contains the instanced data
|
||||||
vk::Buffer instanceBuffer;
|
vks::Buffer instanceBuffer;
|
||||||
// Contains the indirect drawing commands
|
// Contains the indirect drawing commands
|
||||||
vk::Buffer indirectCommandsBuffer;
|
vks::Buffer indirectCommandsBuffer;
|
||||||
vk::Buffer indirectDrawCountBuffer;
|
vks::Buffer indirectDrawCountBuffer;
|
||||||
|
|
||||||
// Indirect draw statistics (updated via compute)
|
// Indirect draw statistics (updated via compute)
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -90,7 +90,7 @@ public:
|
||||||
} uboScene;
|
} uboScene;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
} uniformData;
|
} uniformData;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -103,7 +103,7 @@ public:
|
||||||
|
|
||||||
// Resources for the compute part of the example
|
// Resources for the compute part of the example
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer lodLevelsBuffers; // Contains index start and counts for the different lod levels
|
vks::Buffer lodLevelsBuffers; // Contains index start and counts for the different lod levels
|
||||||
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
||||||
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
||||||
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
||||||
|
|
@ -484,7 +484,7 @@ public:
|
||||||
{
|
{
|
||||||
objectCount = OBJECT_COUNT * OBJECT_COUNT * OBJECT_COUNT;
|
objectCount = OBJECT_COUNT * OBJECT_COUNT * OBJECT_COUNT;
|
||||||
|
|
||||||
vk::Buffer stagingBuffer;
|
vks::Buffer stagingBuffer;
|
||||||
|
|
||||||
std::vector<InstanceData> instanceData(objectCount);
|
std::vector<InstanceData> instanceData(objectCount);
|
||||||
indirectCommands.resize(objectCount);
|
indirectCommands.resize(objectCount);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public:
|
||||||
|
|
||||||
// Resources for the graphics part of the example
|
// Resources for the graphics part of the example
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer uniformBuffer; // Contains scene matrices
|
vks::Buffer uniformBuffer; // Contains scene matrices
|
||||||
VkDescriptorSetLayout descriptorSetLayout; // Particle system rendering shader binding layout
|
VkDescriptorSetLayout descriptorSetLayout; // Particle system rendering shader binding layout
|
||||||
VkDescriptorSet descriptorSet; // Particle system rendering shader bindings
|
VkDescriptorSet descriptorSet; // Particle system rendering shader bindings
|
||||||
VkPipelineLayout pipelineLayout; // Layout of the graphics pipeline
|
VkPipelineLayout pipelineLayout; // Layout of the graphics pipeline
|
||||||
|
|
@ -63,8 +63,8 @@ public:
|
||||||
|
|
||||||
// Resources for the compute part of the example
|
// Resources for the compute part of the example
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer storageBuffer; // (Shader) storage buffer object containing the particles
|
vks::Buffer storageBuffer; // (Shader) storage buffer object containing the particles
|
||||||
vk::Buffer uniformBuffer; // Uniform buffer object containing particle system parameters
|
vks::Buffer uniformBuffer; // Uniform buffer object containing particle system parameters
|
||||||
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
||||||
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
||||||
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
||||||
|
|
@ -333,7 +333,7 @@ public:
|
||||||
// Staging
|
// Staging
|
||||||
// SSBO won't be changed on the host after upload so copy to device local memory
|
// SSBO won't be changed on the host after upload so copy to device local memory
|
||||||
|
|
||||||
vk::Buffer stagingBuffer;
|
vks::Buffer stagingBuffer;
|
||||||
|
|
||||||
vulkanDevice->createBuffer(
|
vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ public:
|
||||||
|
|
||||||
// Resources for the compute part of the example
|
// Resources for the compute part of the example
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer storageBuffer; // (Shader) storage buffer object containing the particles
|
vks::Buffer storageBuffer; // (Shader) storage buffer object containing the particles
|
||||||
vk::Buffer uniformBuffer; // Uniform buffer object containing particle system parameters
|
vks::Buffer uniformBuffer; // Uniform buffer object containing particle system parameters
|
||||||
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
||||||
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
||||||
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
||||||
|
|
@ -250,7 +250,7 @@ public:
|
||||||
// Staging
|
// Staging
|
||||||
// SSBO won't be changed on the host after upload so copy to device local memory
|
// SSBO won't be changed on the host after upload so copy to device local memory
|
||||||
|
|
||||||
vk::Buffer stagingBuffer;
|
vks::Buffer stagingBuffer;
|
||||||
|
|
||||||
vulkanDevice->createBuffer(
|
vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -66,11 +66,11 @@ public:
|
||||||
uint32_t queueFamilyIndex; // Family index of the graphics queue, used for barriers
|
uint32_t queueFamilyIndex; // Family index of the graphics queue, used for barriers
|
||||||
} compute;
|
} compute;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
vk::Buffer uniformBufferVS;
|
vks::Buffer uniformBufferVS;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
|
|
@ -188,7 +188,7 @@ public:
|
||||||
|
|
||||||
Scene scene, sceneGlow;
|
Scene scene, sceneGlow;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -89,9 +89,9 @@ public:
|
||||||
} uboFragmentLights;
|
} uboFragmentLights;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer vsFullScreen;
|
vks::Buffer vsFullScreen;
|
||||||
vk::Buffer vsOffscreen;
|
vks::Buffer vsOffscreen;
|
||||||
vk::Buffer fsLights;
|
vks::Buffer fsLights;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -87,9 +87,9 @@ public:
|
||||||
} uboFragmentLights;
|
} uboFragmentLights;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer vsFullScreen;
|
vks::Buffer vsFullScreen;
|
||||||
vk::Buffer vsOffscreen;
|
vks::Buffer vsOffscreen;
|
||||||
vk::Buffer fsLights;
|
vks::Buffer fsLights;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanFramebuffer.hpp"
|
#include "VulkanFramebuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
@ -125,10 +125,10 @@ public:
|
||||||
} uboFragmentLights;
|
} uboFragmentLights;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer vsFullScreen;
|
vks::Buffer vsFullScreen;
|
||||||
vk::Buffer vsOffscreen;
|
vks::Buffer vsOffscreen;
|
||||||
vk::Buffer fsLights;
|
vks::Buffer fsLights;
|
||||||
vk::Buffer uboShadowGS;
|
vks::Buffer uboShadowGS;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -55,7 +55,7 @@ public:
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer tessControl, tessEval;
|
vks::Buffer tessControl, tessEval;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBOTessControl {
|
struct UBOTessControl {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -76,13 +76,13 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer vs;
|
vks::Buffer vs;
|
||||||
vk::Buffer fs;
|
vks::Buffer fs;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -77,13 +77,13 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer view;
|
vks::Buffer view;
|
||||||
vk::Buffer dynamic;
|
vks::Buffer dynamic;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ void VulkanGear::generate(GearInfo *gearinfo, VkQueue queue)
|
||||||
|
|
||||||
if (useStaging)
|
if (useStaging)
|
||||||
{
|
{
|
||||||
vk::Buffer vertexStaging, indexStaging;
|
vks::Buffer vertexStaging, indexStaging;
|
||||||
|
|
||||||
// Create staging buffers
|
// Create staging buffers
|
||||||
// Vertex data
|
// Vertex data
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "vulkantools.h"
|
#include "vulkantools.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
struct Vertex
|
struct Vertex
|
||||||
{
|
{
|
||||||
|
|
@ -77,12 +77,12 @@ private:
|
||||||
float rotSpeed;
|
float rotSpeed;
|
||||||
float rotOffset;
|
float rotOffset;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
UBO ubo;
|
UBO ubo;
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
int32_t newVertex(std::vector<Vertex> *vBuffer, float x, float y, float z, const glm::vec3& normal);
|
int32_t newVertex(std::vector<Vertex> *vBuffer, float x, float y, float z, const glm::vec3& normal);
|
||||||
void newFace(std::vector<uint32_t> *iBuffer, int a, int b, int c);
|
void newFace(std::vector<uint32_t> *iBuffer, int a, int b, int c);
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ public:
|
||||||
} uboGS;
|
} uboGS;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer VS;
|
vks::Buffer VS;
|
||||||
vk::Buffer GS;
|
vks::Buffer GS;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
|
|
||||||
|
|
@ -51,8 +51,8 @@ public:
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer matrices;
|
vks::Buffer matrices;
|
||||||
vk::Buffer params;
|
vks::Buffer params;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -90,9 +90,9 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Contains the instanced data
|
// Contains the instanced data
|
||||||
vk::Buffer instanceBuffer;
|
vks::Buffer instanceBuffer;
|
||||||
// Contains the indirect drawing commands
|
// Contains the indirect drawing commands
|
||||||
vk::Buffer indirectCommandsBuffer;
|
vks::Buffer indirectCommandsBuffer;
|
||||||
uint32_t indirectDrawCount;
|
uint32_t indirectDrawCount;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -101,7 +101,7 @@ public:
|
||||||
} uboVS;
|
} uboVS;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
} uniformData;
|
} uniformData;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
@ -536,7 +536,7 @@ public:
|
||||||
objectCount += indirectCmd.instanceCount;
|
objectCount += indirectCmd.instanceCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::Buffer stagingBuffer;
|
vks::Buffer stagingBuffer;
|
||||||
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||||
|
|
@ -574,7 +574,7 @@ public:
|
||||||
instanceData[i].texIndex = i / OBJECT_INSTANCE_COUNT;
|
instanceData[i].texIndex = i / OBJECT_INSTANCE_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::Buffer stagingBuffer;
|
vks::Buffer stagingBuffer;
|
||||||
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
VK_CHECK_RESULT(vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ public:
|
||||||
} uboVS;
|
} uboVS;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
VkPipelineLayout pipelineLayout;
|
VkPipelineLayout pipelineLayout;
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ public:
|
||||||
} model;
|
} model;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
|
|
@ -42,9 +42,9 @@ public:
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer occluder;
|
vks::Buffer occluder;
|
||||||
vk::Buffer teapot;
|
vks::Buffer teapot;
|
||||||
vk::Buffer sphere;
|
vks::Buffer sphere;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -60,10 +60,10 @@ public:
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer vsShared;
|
vks::Buffer vsShared;
|
||||||
vk::Buffer vsMirror;
|
vks::Buffer vsMirror;
|
||||||
vk::Buffer vsOffScreen;
|
vks::Buffer vsOffScreen;
|
||||||
vk::Buffer vsDebugQuad;
|
vks::Buffer vsDebugQuad;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBO {
|
struct UBO {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -58,8 +58,8 @@ public:
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer vertexShader;
|
vks::Buffer vertexShader;
|
||||||
vk::Buffer fragmentShader;
|
vks::Buffer fragmentShader;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -89,8 +89,8 @@ public:
|
||||||
} particles;
|
} particles;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer fire;
|
vks::Buffer fire;
|
||||||
vk::Buffer environment;
|
vks::Buffer environment;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -46,7 +46,7 @@ public:
|
||||||
vks::Model cube;
|
vks::Model cube;
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
// Same uniform buffer layout as shader
|
// Same uniform buffer layout as shader
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
|
|
@ -46,7 +46,7 @@ public:
|
||||||
vks::Model scene;
|
vks::Model scene;
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -59,8 +59,8 @@ public:
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
vk::Buffer blurParams;
|
vks::Buffer blurParams;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UboVS {
|
struct UboVS {
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,10 @@ public:
|
||||||
// Resources for the compute part of the example
|
// Resources for the compute part of the example
|
||||||
struct {
|
struct {
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer spheres; // (Shader) storage buffer object with scene spheres
|
vks::Buffer spheres; // (Shader) storage buffer object with scene spheres
|
||||||
vk::Buffer planes; // (Shader) storage buffer object with scene planes
|
vks::Buffer planes; // (Shader) storage buffer object with scene planes
|
||||||
} storageBuffers;
|
} storageBuffers;
|
||||||
vk::Buffer uniformBuffer; // Uniform buffer object containing scene data
|
vks::Buffer uniformBuffer; // Uniform buffer object containing scene data
|
||||||
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
VkQueue queue; // Separate queue for compute commands (queue family may differ from the one used for graphics)
|
||||||
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
VkCommandPool commandPool; // Use a separate command pool (queue family may differ from the one used for graphics)
|
||||||
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
VkCommandBuffer commandBuffer; // Command buffer storing the dispatch commands and barriers
|
||||||
|
|
@ -326,7 +326,7 @@ public:
|
||||||
VkDeviceSize storageBufferSize = spheres.size() * sizeof(Sphere);
|
VkDeviceSize storageBufferSize = spheres.size() * sizeof(Sphere);
|
||||||
|
|
||||||
// Stage
|
// Stage
|
||||||
vk::Buffer stagingBuffer;
|
vks::Buffer stagingBuffer;
|
||||||
|
|
||||||
vulkanDevice->createBuffer(
|
vulkanDevice->createBuffer(
|
||||||
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
VK_BUFFER_USAGE_TRANSFER_SRC_BIT,
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -112,8 +112,8 @@ private:
|
||||||
// We will be using one single index and vertex buffer
|
// We will be using one single index and vertex buffer
|
||||||
// containing vertices and indices for all meshes in the scene
|
// containing vertices and indices for all meshes in the scene
|
||||||
// This allows us to keep memory allocations down
|
// This allows us to keep memory allocations down
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
|
|
||||||
VkDescriptorSet descriptorSetScene;
|
VkDescriptorSet descriptorSetScene;
|
||||||
|
|
||||||
|
|
@ -322,7 +322,7 @@ private:
|
||||||
size_t vertexDataSize = vertices.size() * sizeof(Vertex);
|
size_t vertexDataSize = vertices.size() * sizeof(Vertex);
|
||||||
size_t indexDataSize = indices.size() * sizeof(uint32_t);
|
size_t indexDataSize = indices.size() * sizeof(uint32_t);
|
||||||
|
|
||||||
vk::Buffer vertexStaging, indexStaging;
|
vks::Buffer vertexStaging, indexStaging;
|
||||||
|
|
||||||
// Vertex buffer
|
// Vertex buffer
|
||||||
// Staging buffer
|
// Staging buffer
|
||||||
|
|
@ -402,7 +402,7 @@ public:
|
||||||
|
|
||||||
// Shared ubo containing matrices used by all
|
// Shared ubo containing matrices used by all
|
||||||
// materials and meshes
|
// materials and meshes
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
struct UniformData {
|
struct UniformData {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
glm::mat4 view;
|
glm::mat4 view;
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public:
|
||||||
vks::Model object;
|
vks::Model object;
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
|
|
@ -80,9 +80,9 @@ public:
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
vk::Buffer offscreen;
|
vks::Buffer offscreen;
|
||||||
vk::Buffer debug;
|
vks::Buffer debug;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -62,8 +62,8 @@ public:
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer scene;
|
vks::Buffer scene;
|
||||||
vk::Buffer offscreen;
|
vks::Buffer offscreen;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -360,8 +360,8 @@ public:
|
||||||
SkinnedMesh *skinnedMesh = nullptr;
|
SkinnedMesh *skinnedMesh = nullptr;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer mesh;
|
vks::Buffer mesh;
|
||||||
vk::Buffer floor;
|
vks::Buffer floor;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -53,7 +53,7 @@ public:
|
||||||
vks::Texture2D colormap;
|
vks::Texture2D colormap;
|
||||||
} textures;
|
} textures;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
// Same uniform buffer layout as shader
|
// Same uniform buffer layout as shader
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -56,7 +56,7 @@ public:
|
||||||
vks::Texture2DArray matCapArray;
|
vks::Texture2DArray matCapArray;
|
||||||
} textures;
|
} textures;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,9 @@ public:
|
||||||
} descriptorSetLayouts;
|
} descriptorSetLayouts;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer sceneMatrices;
|
vks::Buffer sceneMatrices;
|
||||||
vk::Buffer ssaoKernel;
|
vks::Buffer ssaoKernel;
|
||||||
vk::Buffer ssaoParams;
|
vks::Buffer ssaoParams;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
// Framebuffer for offscreen rendering
|
// Framebuffer for offscreen rendering
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,8 @@ public:
|
||||||
} uboLights;
|
} uboLights;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer GBuffer;
|
vks::Buffer GBuffer;
|
||||||
vk::Buffer lights;
|
vks::Buffer lights;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "frustum.hpp"
|
#include "frustum.hpp"
|
||||||
|
|
@ -60,8 +60,8 @@ public:
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer terrainTessellation;
|
vks::Buffer terrainTessellation;
|
||||||
vk::Buffer skysphereVertex;
|
vks::Buffer skysphereVertex;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
// Shared values for tessellation control and evaluation stages
|
// Shared values for tessellation control and evaluation stages
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -56,7 +56,7 @@ public:
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer tessControl, tessEval;
|
vks::Buffer tessControl, tessEval;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBOTessControl {
|
struct UBOTessControl {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
|
|
||||||
|
|
@ -713,7 +713,7 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer uniformBuffer;
|
vks::Buffer uniformBuffer;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -54,11 +54,11 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
vk::Buffer uniformBufferVS;
|
vks::Buffer uniformBufferVS;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
|
|
@ -171,11 +171,11 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> inputAttributes;
|
std::vector<VkVertexInputAttributeDescription> inputAttributes;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
vk::Buffer uniformBufferVS;
|
vks::Buffer uniformBufferVS;
|
||||||
|
|
||||||
struct UboVS {
|
struct UboVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
#define ENABLE_VALIDATION false
|
#define ENABLE_VALIDATION false
|
||||||
|
|
@ -46,11 +46,11 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer vertexBuffer;
|
vks::Buffer vertexBuffer;
|
||||||
vk::Buffer indexBuffer;
|
vks::Buffer indexBuffer;
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
vk::Buffer uniformBufferVS;
|
vks::Buffer uniformBufferVS;
|
||||||
|
|
||||||
struct UboInstanceData {
|
struct UboInstanceData {
|
||||||
// Model matrix
|
// Model matrix
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
|
|
@ -55,8 +55,8 @@ public:
|
||||||
} models;
|
} models;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer object;
|
vks::Buffer object;
|
||||||
vk::Buffer skybox;
|
vks::Buffer skybox;
|
||||||
} uniformBuffers;
|
} uniformBuffers;
|
||||||
|
|
||||||
struct UBOVS {
|
struct UBOVS {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
#include <vulkan/vulkan.h>
|
#include <vulkan/vulkan.h>
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "VulkanModel.hpp"
|
#include "VulkanModel.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
|
|
@ -63,7 +63,7 @@ public:
|
||||||
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
std::vector<VkVertexInputAttributeDescription> attributeDescriptions;
|
||||||
} vertices;
|
} vertices;
|
||||||
|
|
||||||
vk::Buffer uniformBufferVS;
|
vks::Buffer uniformBufferVS;
|
||||||
|
|
||||||
struct uboVS {
|
struct uboVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ todos:
|
||||||
#include "vulkanexamplebase.h"
|
#include "vulkanexamplebase.h"
|
||||||
#include "VulkanTexture.hpp"
|
#include "VulkanTexture.hpp"
|
||||||
#include "VulkanDevice.hpp"
|
#include "VulkanDevice.hpp"
|
||||||
#include "vulkanbuffer.hpp"
|
#include "VulkanBuffer.hpp"
|
||||||
#include "vulkanheightmap.hpp"
|
#include "vulkanheightmap.hpp"
|
||||||
|
|
||||||
#define VERTEX_BUFFER_BIND_ID 0
|
#define VERTEX_BUFFER_BIND_ID 0
|
||||||
|
|
@ -207,7 +207,7 @@ public:
|
||||||
|
|
||||||
uint32_t indexCount;
|
uint32_t indexCount;
|
||||||
|
|
||||||
vk::Buffer uniformBufferVS;
|
vks::Buffer uniformBufferVS;
|
||||||
|
|
||||||
struct UboVS {
|
struct UboVS {
|
||||||
glm::mat4 projection;
|
glm::mat4 projection;
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Base", "Base", "{09B9A54B-F
|
||||||
base\threadpool.hpp = base\threadpool.hpp
|
base\threadpool.hpp = base\threadpool.hpp
|
||||||
base\vulkanandroid.cpp = base\vulkanandroid.cpp
|
base\vulkanandroid.cpp = base\vulkanandroid.cpp
|
||||||
base\vulkanandroid.h = base\vulkanandroid.h
|
base\vulkanandroid.h = base\vulkanandroid.h
|
||||||
base\vulkanbuffer.hpp = base\vulkanbuffer.hpp
|
base\VulkanBuffer.hpp = base\VulkanBuffer.hpp
|
||||||
base\vulkandebug.cpp = base\vulkandebug.cpp
|
base\vulkandebug.cpp = base\vulkandebug.cpp
|
||||||
base\vulkandebug.h = base\vulkandebug.h
|
base\vulkandebug.h = base\vulkandebug.h
|
||||||
base\VulkanDevice.hpp = base\VulkanDevice.hpp
|
base\VulkanDevice.hpp = base\VulkanDevice.hpp
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ public:
|
||||||
std::vector<DemoModel> demoModels;
|
std::vector<DemoModel> demoModels;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
vk::Buffer meshVS;
|
vks::Buffer meshVS;
|
||||||
} uniformData;
|
} uniformData;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue