mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-28 02:41:18 +00:00
More vulkan fixing
This commit is contained in:
parent
eedd81988c
commit
2a449f78bb
@ -170,6 +170,7 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -323,4 +324,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -45,7 +45,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
@ -158,6 +157,7 @@
|
||||
<PreprocessorDefinitions>USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;USE_FFMPEG;WIN32;_ARCH_64=1;_M_X64=1;_LIB;NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -737,4 +737,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -45,7 +45,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
@ -168,6 +167,7 @@
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PreprocessorDefinitions>USING_WIN_UI;_CRT_SECURE_NO_WARNINGS;WIN32;_ARCH_64=1;_M_X64=1;_LIB;NDEBUG;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -350,4 +350,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -104,7 +104,6 @@
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -212,6 +211,7 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -227,4 +227,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -73,10 +73,17 @@ bool WindowsVulkanContext::Init(HINSTANCE hInst, HWND hWnd, std::string *error_m
|
||||
g_Vulkan->InitObjects(hInst, hWnd, true);
|
||||
|
||||
_CrtCheckMemory();
|
||||
|
||||
VkClearValue clearVal[2];
|
||||
memset(clearVal, 0, sizeof(clearVal));
|
||||
clearVal[0].color.float32[0] = 0.5f;
|
||||
g_Vulkan->BeginSurfaceRenderPass(clearVal);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WindowsVulkanContext::Shutdown() {
|
||||
g_Vulkan->EndSurfaceRenderPass();
|
||||
|
||||
g_Vulkan->DestroyObjects();
|
||||
delete g_Vulkan;
|
||||
g_Vulkan = nullptr;
|
||||
@ -87,6 +94,12 @@ Thin3DContext *WindowsVulkanContext::CreateThin3DContext() {
|
||||
}
|
||||
|
||||
void WindowsVulkanContext::SwapBuffers() {
|
||||
g_Vulkan->EndSurfaceRenderPass();
|
||||
|
||||
VkClearValue clearVal[2];
|
||||
memset(clearVal, 0, sizeof(clearVal));
|
||||
clearVal[0].color.float32[0] = 0.5f;
|
||||
g_Vulkan->BeginSurfaceRenderPass(clearVal);
|
||||
}
|
||||
|
||||
void WindowsVulkanContext::Resize() {
|
||||
@ -101,7 +114,3 @@ void WindowsVulkanContext::Resize() {
|
||||
|
||||
void WindowsVulkanContext::SwapInterval(int interval) {
|
||||
}
|
||||
|
||||
Thin3DContext *Vulkan_CreateThin3DContext() {
|
||||
return T3DCreateVulkanContext(g_Vulkan);
|
||||
}
|
||||
|
@ -32,5 +32,3 @@ public:
|
||||
Thin3DContext *CreateThin3DContext() override;
|
||||
};
|
||||
|
||||
void Vulkan_BeginSurfaceRender();
|
||||
void Vulkan_EndSurfaceRender();
|
||||
|
@ -39,7 +39,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
@ -135,7 +134,7 @@
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\ext\vulkan\vulkan-1.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;dxerr.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>..\ext\vulkan\vulkan-1.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
@ -175,11 +174,10 @@
|
||||
<AdditionalDependencies>x64\Debug\glslang.lib;..\ext\vulkan\vulkan-1.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(ProjectName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<LargeAddressAware>true</LargeAddressAware>
|
||||
<ShowProgress>NotSet</ShowProgress>
|
||||
<AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>../Windows/git-version-gen.cmd</Command>
|
||||
@ -208,7 +206,7 @@
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\ext\vulkan\vulkan-1.lib;dxerr.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>..\ext\vulkan\vulkan-1.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86\lib\avcodec.lib;..\ffmpeg\Windows\x86\lib\avformat.lib;..\ffmpeg\Windows\x86\lib\avutil.lib;..\ffmpeg\Windows\x86\lib\swresample.lib;..\ffmpeg\Windows\x86\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -252,7 +250,7 @@
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\ext\vulkan\vulkan-1.lib;dxerr.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>..\ext\vulkan\vulkan-1.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;d3d9.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -260,6 +258,7 @@
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalOptions>/ignore:4049 /ignore:4217 %(AdditionalOptions)</AdditionalOptions>
|
||||
<LargeAddressAware>true</LargeAddressAware>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>../Windows/git-version-gen.cmd</Command>
|
||||
@ -454,4 +453,4 @@
|
||||
<UserProperties RESOURCE_FILE="DaSh.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -69,7 +69,9 @@ static BOOL PostDialogMessage(Dialog *dialog, UINT message, WPARAM wParam = 0, L
|
||||
}
|
||||
|
||||
WindowsHost::WindowsHost(HINSTANCE hInstance, HWND mainWindow, HWND displayWindow)
|
||||
: gfx_(nullptr), hInstance_(hInstance), mainWindow_(mainWindow), displayWindow_(displayWindow)
|
||||
: gfx_(nullptr), hInstance_(hInstance),
|
||||
mainWindow_(mainWindow),
|
||||
displayWindow_(displayWindow)
|
||||
{
|
||||
mouseDeltaX = 0;
|
||||
mouseDeltaY = 0;
|
||||
|
@ -67,7 +67,6 @@
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -221,6 +220,8 @@
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>armips</AdditionalIncludeDirectories>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -333,4 +334,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -46,7 +46,6 @@
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -129,6 +128,7 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
@ -156,4 +156,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -46,7 +46,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
@ -160,6 +159,8 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -749,4 +750,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -9,7 +9,10 @@
|
||||
#undef new
|
||||
#endif
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
#include "glslang/SPIRV/GlslangToSpv.h"
|
||||
#pragma warning(pop)
|
||||
|
||||
#ifdef USE_CRT_DBG
|
||||
#define new DBG_NEW
|
||||
@ -61,19 +64,19 @@ VulkanContext::VulkanContext(const char *app_name, uint32_t flags)
|
||||
device_extension_names.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
|
||||
|
||||
if (flags & VULKAN_FLAG_VALIDATE) {
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_Threading");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_DrawState");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_Image");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_MemTracker");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_ObjectTracker");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_ParamChecker");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_threading");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_draw_state");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_image");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_mem_tracker");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_object_tracker");
|
||||
instance_layer_names.push_back("VK_LAYER_LUNARG_param_checker");
|
||||
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_Threading");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_DrawState");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_Image");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_MemTracker");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_ObjectTracker");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_ParamChecker");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_threading");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_draw_state");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_image");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_mem_tracker");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_object_tracker");
|
||||
device_layer_names.push_back("VK_LAYER_LUNARG_param_checker");
|
||||
|
||||
instance_extension_names.push_back(VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
|
||||
}
|
||||
@ -542,7 +545,7 @@ VkResult VulkanContext::CreateDevice(int physical_device) {
|
||||
assert(queue_count >= 1);
|
||||
|
||||
bool found = false;
|
||||
for (int i = 0; i < queue_count; i++) {
|
||||
for (int i = 0; i < (int)queue_count; i++) {
|
||||
if (queue_props[i].queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||
queue_info.queueFamilyIndex = i;
|
||||
found = true;
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include <unistd.h>
|
||||
#endif // _WIN32
|
||||
|
||||
#include "ext/vulkan/vulkan.h"
|
||||
#include "ext/vulkan/vk_sdk_platform.h"
|
||||
#include "vulkan/vulkan.h"
|
||||
#include "vulkan/vk_sdk_platform.h"
|
||||
|
||||
/* Amount of time, in nanoseconds, to wait for a command buffer to complete */
|
||||
#define FENCE_TIMEOUT 10000000000
|
||||
|
@ -124,7 +124,8 @@ public:
|
||||
b.sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
b.queueFamilyIndexCount = 0;
|
||||
b.pQueueFamilyIndices = nullptr;
|
||||
assert(VK_SUCCESS == vkCreateBuffer(device, &b, nullptr, &buffer_));
|
||||
VkResult res = vkCreateBuffer(device, &b, nullptr, &buffer_);
|
||||
assert(VK_SUCCESS == res);
|
||||
|
||||
// Okay, that's the buffer. Now let's allocate some memory for it.
|
||||
VkMemoryAllocateInfo alloc;
|
||||
@ -133,8 +134,10 @@ public:
|
||||
memMan->memory_type_from_properties(0xFFFFFFFF, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, &alloc.memoryTypeIndex);
|
||||
alloc.allocationSize = size;
|
||||
|
||||
assert(VK_SUCCESS == vkAllocateMemory(device, &alloc, nullptr, &deviceMemory_));
|
||||
assert(VK_SUCCESS == vkBindBufferMemory(device, buffer_, deviceMemory_, 0));
|
||||
res = vkAllocateMemory(device, &alloc, nullptr, &deviceMemory_);
|
||||
assert(VK_SUCCESS == res);
|
||||
res = vkBindBufferMemory(device, buffer_, deviceMemory_, 0);
|
||||
assert(VK_SUCCESS == res);
|
||||
}
|
||||
|
||||
void Destroy(VkDevice device) {
|
||||
@ -146,7 +149,8 @@ public:
|
||||
|
||||
void Begin(VkDevice device) {
|
||||
offset_ = 0;
|
||||
assert(VK_SUCCESS == vkMapMemory(device, deviceMemory_, 0, size_, 0, (void **)(&writePtr_)));
|
||||
VkResult res = vkMapMemory(device, deviceMemory_, 0, size_, 0, (void **)(&writePtr_));
|
||||
assert(VK_SUCCESS == res);
|
||||
}
|
||||
|
||||
void End(VkDevice device) {
|
||||
@ -273,7 +277,7 @@ private:
|
||||
// invoke Compile again to recreate the shader then link them together.
|
||||
class Thin3DVKShader : public Thin3DShader {
|
||||
public:
|
||||
Thin3DVKShader(bool isFragmentShader) : module_(nullptr), ok_(false) {
|
||||
Thin3DVKShader(VulkanContext *vulkan, bool isFragmentShader) : vulkan_(vulkan), module_(nullptr), ok_(false) {
|
||||
stage_ = isFragmentShader ? VK_SHADER_STAGE_FRAGMENT_BIT : VK_SHADER_STAGE_VERTEX_BIT;
|
||||
}
|
||||
bool Compile(VkDevice device, const char *source);
|
||||
@ -283,6 +287,7 @@ public:
|
||||
VkShaderModule Get() const { return module_; }
|
||||
|
||||
private:
|
||||
VulkanContext *vulkan_;
|
||||
VkShaderModule module_;
|
||||
VkShaderStageFlagBits stage_;
|
||||
bool ok_;
|
||||
@ -305,7 +310,7 @@ bool Thin3DVKShader::Compile(VkDevice device, const char *source) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (vulkan->CreateShaderModule(spirv, &module_)) {
|
||||
if (CreateShaderModule(device, spirv, &module_)) {
|
||||
ok_ = true;
|
||||
} else {
|
||||
ok_ = false;
|
||||
@ -596,7 +601,7 @@ public:
|
||||
s.maxLod = 0.0; // TODO: Actually support mipmaps
|
||||
|
||||
VkResult res = vkCreateSampler(vulkan_->Device(), &s, nullptr, &sampler_);
|
||||
assert(res);
|
||||
assert(VK_SUCCESS == res);
|
||||
}
|
||||
~Thin3DVKSamplerState() {
|
||||
vkDestroySampler(vulkan_->Device(), sampler_, nullptr);
|
||||
@ -781,7 +786,7 @@ Thin3DVKContext::Thin3DVKContext(VulkanContext *vulkan)
|
||||
res = vkCreateFence(device_, &f, nullptr, &cmdFences_[1]);
|
||||
assert(VK_SUCCESS == res);
|
||||
// Create as already signalled, so we can wait for it the first time.
|
||||
// f.flags = VK_FENCE_CREATE_SIGNALED_BIT;
|
||||
f.flags = VK_FENCE_CREATE_SIGNALED_BIT;
|
||||
res = vkCreateFence(device_, &f, nullptr, &initFence_);
|
||||
assert(VK_SUCCESS == res);
|
||||
pendingInitFence_ = false;
|
||||
@ -794,6 +799,7 @@ Thin3DVKContext::Thin3DVKContext(VulkanContext *vulkan)
|
||||
pc.flags = 0;
|
||||
res = vkCreatePipelineCache(device_, &pc, nullptr, &pipelineCache_);
|
||||
assert(VK_SUCCESS == res);
|
||||
|
||||
push_ = pushBuffer_[0];
|
||||
cmd_ = cmdBuffer_[0];
|
||||
}
|
||||
@ -836,12 +842,14 @@ void Thin3DVKContext::BeginInitCommands() {
|
||||
begin.pNext = nullptr;
|
||||
begin.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;
|
||||
begin.pInheritanceInfo = nullptr;
|
||||
assert(VK_SUCCESS == vkBeginCommandBuffer(initCmd_, &begin));
|
||||
VkResult res = vkBeginCommandBuffer(initCmd_, &begin);
|
||||
assert(VK_SUCCESS == res);
|
||||
hasInitCommands_ = true;
|
||||
}
|
||||
|
||||
void Thin3DVKContext::EndInitCommands() {
|
||||
assert(VK_SUCCESS == vkEndCommandBuffer(initCmd_));
|
||||
VkResult res = vkEndCommandBuffer(initCmd_);
|
||||
assert(VK_SUCCESS == res);
|
||||
}
|
||||
|
||||
void Thin3DVKContext::End() {
|
||||
@ -861,7 +869,8 @@ void Thin3DVKContext::End() {
|
||||
submit.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
submit.pCommandBuffers = &initCmd_;
|
||||
submit.commandBufferCount = 1;
|
||||
assert(VK_SUCCESS == vkQueueSubmit(queue_, 1, &submit, initFence_));
|
||||
VkResult res = vkQueueSubmit(queue_, 1, &submit, initFence_);
|
||||
assert(VK_SUCCESS == res);
|
||||
hasInitCommands_ = false;
|
||||
}
|
||||
|
||||
@ -873,7 +882,8 @@ void Thin3DVKContext::End() {
|
||||
submit.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
submit.pCommandBuffers = &cmd_;
|
||||
submit.commandBufferCount = 1;
|
||||
assert(VK_SUCCESS == vkQueueSubmit(queue_, 1, &submit, cmdFence_));
|
||||
VkResult res = vkQueueSubmit(queue_, 1, &submit, cmdFence_);
|
||||
assert(VK_SUCCESS == res);
|
||||
}
|
||||
|
||||
frameNum_++;
|
||||
@ -905,6 +915,7 @@ VkDescriptorSet Thin3DVKContext::GetOrCreateDescriptorSet() {
|
||||
alloc.descriptorSetCount = 1;
|
||||
VkResult res = vkAllocateDescriptorSets(device_, &alloc, &descSet);
|
||||
assert(VK_SUCCESS == res);
|
||||
|
||||
// bindings[0].descriptorType = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT;
|
||||
// bindings[1].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC;
|
||||
// bindings[2].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||
@ -1238,7 +1249,7 @@ void Thin3DVKContext::SetTextures(int start, int count, Thin3DTexture **textures
|
||||
}
|
||||
|
||||
Thin3DShader *Thin3DVKContext::CreateVertexShader(const char *glsl_source, const char *hlsl_source, const char *vulkan_source) {
|
||||
Thin3DVKShader *shader = new Thin3DVKShader(false);
|
||||
Thin3DVKShader *shader = new Thin3DVKShader(vulkan_, false);
|
||||
if (shader->Compile(device_, vulkan_source)) {
|
||||
return shader;
|
||||
} else {
|
||||
@ -1248,7 +1259,7 @@ Thin3DShader *Thin3DVKContext::CreateVertexShader(const char *glsl_source, const
|
||||
}
|
||||
|
||||
Thin3DShader *Thin3DVKContext::CreateFragmentShader(const char *glsl_source, const char *hlsl_source, const char *vulkan_source) {
|
||||
Thin3DVKShader *shader = new Thin3DVKShader(true);
|
||||
Thin3DVKShader *shader = new Thin3DVKShader(vulkan_, true);
|
||||
if (shader->Compile(device_, vulkan_source)) {
|
||||
return shader;
|
||||
} else {
|
||||
|
@ -156,7 +156,6 @@ void VulkanImage::ChangeLayout(VkCommandBuffer cmd, VkImageAspectFlags aspectMas
|
||||
vkCmdPipelineBarrier(cmd, src_stages, dest_stages, false, 0, nullptr, 0, nullptr, 1, &image_memory_barrier);
|
||||
}
|
||||
|
||||
|
||||
bool CreateShaderModule(VkDevice device, const std::vector<uint32_t> &spirv, VkShaderModule *shaderModule) {
|
||||
VkShaderModuleCreateInfo sm;
|
||||
sm.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO;
|
||||
|
@ -76,7 +76,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
@ -183,6 +182,7 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -194,4 +194,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
@ -47,7 +47,6 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
@ -138,7 +137,7 @@
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>..\Windows\x64\Debug\glslang.lib;..\ext\vulkan\vulkan-1.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;d3d9.lib;d3dx9d.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>..\ext\vulkan\vulkan-1.lib;Winmm.lib;Ws2_32.lib;opengl32.lib;dsound.lib;glu32.lib;..\ffmpeg\Windows\x86_64\lib\avcodec.lib;..\ffmpeg\Windows\x86_64\lib\avformat.lib;..\ffmpeg\Windows\x86_64\lib\avutil.lib;..\ffmpeg\Windows\x86_64\lib\swresample.lib;..\ffmpeg\Windows\x86_64\lib\swscale.lib;comctl32.lib;d3d9.lib;d3dx9d.lib;dxguid.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<BaseAddress>0x00400000</BaseAddress>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<FixedBaseAddress>true</FixedBaseAddress>
|
||||
@ -203,6 +202,7 @@
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -48,7 +48,6 @@
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -88,8 +87,8 @@
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_ARCH_32=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_ARCH_32=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../ext;../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
@ -111,7 +110,7 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PreprocessorDefinitions>_CRTDBG_MAP_ALLOC;USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_ARCH_64=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../ext;../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
@ -137,7 +136,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_32=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../ext;../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
@ -163,11 +162,12 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>USING_WIN_UI;GLEW_STATIC;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_ARCH_64=1;_WINDOWS;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../ext;../common;..;../ext/native;../ext/native/ext/glew;../ext/zlib</AdditionalIncludeDirectories>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
Loading…
Reference in New Issue
Block a user