Resolved conflicts across devices
This commit is contained in:
commit
5342906098
@ -50,7 +50,7 @@ add_dependencies(pleascach shaders)
|
||||
# copy assets somewhere accessible by the accessable
|
||||
add_custom_command(
|
||||
TARGET shaders POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
COMMAND cmake -E copy_directory
|
||||
"$<TARGET_PROPERTY:pleascach,SOURCE_DIR>/assets"
|
||||
"$<TARGET_PROPERTY:pleascach,BINARY_DIR>/assets")
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
#include <Memory/Buffer.hpp>
|
||||
#include <Memory/Memory.hpp>
|
||||
|
||||
#include <util/log.hpp>
|
||||
|
||||
Buffer::Buffer(vk::PhysicalDevice phys_dev, vk::Device dev, vk::DeviceSize sz, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags mem_flags, vk::SharingMode sharing) : dev(dev), size(sz) {
|
||||
auto info = vk::BufferCreateInfo {
|
||||
.size = sz,
|
||||
@ -9,6 +11,8 @@ Buffer::Buffer(vk::PhysicalDevice phys_dev, vk::Device dev, vk::DeviceSize sz, v
|
||||
};
|
||||
buffer = dev.createBuffer(info);
|
||||
|
||||
Log::debug("Is memory flagged for host: %d\n", mem_flags & vk::MemoryPropertyFlagBits::eHostVisible);
|
||||
|
||||
auto reqs = dev.getBufferMemoryRequirements(buffer);
|
||||
auto alloc_info = vk::MemoryAllocateInfo{
|
||||
.allocationSize = reqs.size,
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
struct Buffer {
|
||||
Buffer(vk::PhysicalDevice phys_dev, vk::Device dev, vk::DeviceSize sz, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags mem_flags, vk::SharingMode sharing = vk::SharingMode::eExclusive);
|
||||
|
||||
vk::DeviceSize size;
|
||||
vk::Device dev;
|
||||
vk::DeviceSize size;
|
||||
vk::DeviceMemory memory;
|
||||
vk::Buffer buffer;
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@ namespace mem {
|
||||
auto dev_props = phys_dev.getMemoryProperties();
|
||||
|
||||
if(static_cast<int>(pref_flags.operator VkImageCreateFlags()) != -1) {
|
||||
|
||||
/* try to find an exact match for preferred flags first */
|
||||
for (u32 memory_type = 0; memory_type < 32; memory_type++) {
|
||||
if (requirements.memoryTypeBits & (1 << memory_type)) {
|
||||
@ -17,11 +16,11 @@ namespace mem {
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 memory_type = 0; memory_type < 32; memory_type++) {
|
||||
for (u32 memory_type = 0; memory_type < dev_props.memoryTypeCount; memory_type++) {
|
||||
if (requirements.memoryTypeBits & (1 << memory_type)) {
|
||||
const auto& type = dev_props.memoryTypes[memory_type];
|
||||
if ((type.propertyFlags & req_flags) == req_flags) {
|
||||
return type.heapIndex;
|
||||
return memory_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,6 +173,7 @@ GraphicsPipeline::GraphicsPipeline(vk::Device dev, const std::vector<Shader>& sh
|
||||
}
|
||||
|
||||
pipeline = res.value;
|
||||
|
||||
dev.destroyPipelineLayout(layout);
|
||||
}
|
||||
|
||||
|
||||
@ -5,10 +5,12 @@
|
||||
|
||||
struct Shader {
|
||||
vk::Device dev;
|
||||
vk::ShaderModule module;
|
||||
std::string fname;
|
||||
vk::ShaderStageFlagBits stage;
|
||||
vk::ShaderModule module;
|
||||
|
||||
Shader(vk::Device dev, const std::string& fname, vk::ShaderStageFlagBits stage);
|
||||
void cleanup();
|
||||
|
||||
inline operator vk::ShaderModule() const {
|
||||
return module;
|
||||
@ -26,7 +28,4 @@ struct Shader {
|
||||
};
|
||||
}
|
||||
|
||||
std::string fname;
|
||||
|
||||
void cleanup();
|
||||
};
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct UniformData {
|
||||
glm::mat4 mvp;
|
||||
float time;
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#include <Memory/Buffer.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
struct Vertex {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user