Commit c98c8da8 authored by Florian Oetke's avatar Florian Oetke
Browse files

windows compatiblity changes

parent c2754f9d
......@@ -44,7 +44,7 @@ vec3 calculate_gi(vec2 uv, vec2 gi_uv, int gi_lod, sampler2D diff_sampler, sampl
sampler2D albedo_sampler, sampler2D mat_sampler, sampler2D brdf_sampler,
out vec3 diffuse) {
// load diff + spec GI
vec3 radiance = textureLod(diff_sampler, gi_uv, 0).rgb;
vec3 radiance = upsampled_result(depth_sampler, mat_data_sampler, diff_sampler, gi_lod, 0, gi_uv, 1.0).rgb;
vec3 specular = upsampled_result(depth_sampler, mat_data_sampler, spec_sampler, gi_lod, 0, gi_uv, 2.0).rgb;
return calculate_gi(uv, radiance, specular, albedo_sampler, mat_sampler, brdf_sampler, diffuse);
......
cmake_minimum_required(VERSION 2.8.7)
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)
project(SDL_vulkan)
option(DEV_BUILD "Development Build" OFF)
......@@ -10,7 +10,17 @@ set(VERSION_PATCH 0)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(SDL2 REQUIRED)
find_package(Vulkan REQUIRED)
find_package(Vulkan)
IF (NOT Vulkan_FOUND)
find_library(Vulkan_LIBRARY NAMES vulkan-1 vulkan PATHS ${CMAKE_SOURCE_DIR}/libs/vulkan)
IF (Vulkan_LIBRARY)
set(Vulkan_FOUND ON)
MESSAGE("Using bundled Vulkan library version")
ELSE()
message( FATAL_ERROR "Vulkan library not found!" )
ENDIF()
ENDIF()
include_directories(
${SDL2_INCLUDE_DIRS}
${VULKAN_INCLUDE_DIR})
......
......@@ -8,7 +8,7 @@
#include <cstring>
#include <cstdio>
#ifdef WIN
#ifdef _WIN32
#include <windows.h>
#include <direct.h>
#else
......@@ -31,7 +31,7 @@ namespace {
return folder+"/"+file;
}
void create_dir(const std::string& dir) {
#ifdef WIN
#ifdef _WIN32
CreateDirectory(dir.c_str(), NULL);
#else
mkdir(dir.c_str(), 0777);
......@@ -184,7 +184,7 @@ namespace asset {
// TODO: Windows savegames should be stored in FOLDERID_SavedGames, but the API and conventions are a pain in the ass
std::string write_dir_parent = append_file(PHYSFS_getUserDir(),
#ifdef WIN
#ifdef _WIN32
"Documents/My Games"
#else
".config"
......
......@@ -36,7 +36,7 @@ namespace renderer {
}
GBuffer::GBuffer(graphic::Device& device, std::uint32_t width, std::uint32_t height)
: mip_levels(gsl::narrow<std::uint32_t>(std::floor(std::log2(std::min(width, height))) + 1))
: mip_levels(gsl::narrow<std::uint32_t>(std::floor(std::log2(std::min(width, height))) - 2))
, depth_format(get_depth_format(device))
, depth(device, {width, height}, mip_levels, depth_format,
vk::ImageUsageFlagBits::eColorAttachment | vk::ImageUsageFlagBits::eSampled
......
......@@ -27,11 +27,15 @@ namespace renderer {
auto create_material_descriptor_set_layout(Device& device, vk::Sampler sampler) -> vk::UniqueDescriptorSetLayout {
auto bindings = std::array<vk::DescriptorSetLayoutBinding, material_textures>();
auto samplers = std::array<vk::Sampler, material_textures>();
std::fill_n(samplers.begin(), material_textures, sampler);
std::fill_n(bindings.begin(), material_textures, vk::DescriptorSetLayoutBinding {
0, vk::DescriptorType::eCombinedImageSampler,
1,
vk::ShaderStageFlagBits::eFragment,
&sampler} );
samplers.data()} );
for(auto i=std::size_t(0); i<material_textures; i++) {
bindings[i].binding = i;
......@@ -73,8 +77,8 @@ namespace renderer {
std::function<void(char*)> write_indices,
std::vector<Sub_mesh> sub_meshes,
util::maybe<const asset::AID> aid)
: _mesh(device, owner_qfamily, vertex_count, index_count, write_vertices, write_indices)
, _sub_meshes(std::move(sub_meshes)), _aid(aid) {
: _mesh(device, owner_qfamily, vertex_count, index_count, write_vertices, write_indices)
, _sub_meshes(std::move(sub_meshes)), _aid(aid) {
}
void Model::bind_mesh(const graphic::Command_buffer& cb,
......
......@@ -24,7 +24,7 @@ target_compile_options(mirrage_utils PRIVATE -Wextra -Wall -pedantic -Werror -Wn
target_compile_definitions(mirrage_utils PUBLIC GLM_FORCE_RADIANS)
target_compile_definitions(mirrage_utils PUBLIC GLM_FORCE_DEPTH_ZERO_TO_ONE)
target_compile_definitions(mirrage_utils PUBLIC ENABLE_SF2_ASSETS)
target_compile_definitions(mirrage_utils PUBLIC STACKTRACE)
# target_compile_definitions(mirrage_utils PUBLIC STACKTRACE)
target_include_directories(mirrage_utils PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment