From 1e20024a15e19744b48f8a72aa61fc7c27851f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 09:28:24 +0200 Subject: [PATCH 01/43] Vulkan: Just some extra logging. --- Common/Vulkan/VulkanLoader.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Common/Vulkan/VulkanLoader.cpp b/Common/Vulkan/VulkanLoader.cpp index 683f56a7f6..93aff18cec 100644 --- a/Common/Vulkan/VulkanLoader.cpp +++ b/Common/Vulkan/VulkanLoader.cpp @@ -220,6 +220,7 @@ static HINSTANCE vulkanLibrary; #else static void *vulkanLibrary; #endif +const char *VulkanResultToString(VkResult res); bool g_vulkanAvailabilityChecked = false; bool g_vulkanMayBeAvailable = false; @@ -322,7 +323,7 @@ bool VulkanMayBeAvailable() { res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, nullptr); // Maximum paranoia. if (res != VK_SUCCESS) { - ELOG("Enumerating VK extensions failed."); + ELOG("Enumerating VK extensions failed (%s)", VulkanResultToString(res)); goto bail; } if (instanceExtCount == 0) { @@ -333,7 +334,7 @@ bool VulkanMayBeAvailable() { instanceExts.resize(instanceExtCount); res = localEnumerateInstanceExtensionProperties(nullptr, &instanceExtCount, instanceExts.data()); if (res != VK_SUCCESS) { - ELOG("Enumerating VK extensions failed."); + ELOG("Enumerating VK extensions failed (%s)", VulkanResultToString(res)); goto bail; } for (auto iter : instanceExts) { @@ -379,13 +380,13 @@ bool VulkanMayBeAvailable() { res = localCreateInstance(&ci, nullptr, &instance); if (res != VK_SUCCESS) { instance = nullptr; - ELOG("Failed to create vulkan instance."); + ELOG("VulkanMayBeAvailable: Failed to create vulkan instance (%s)", VulkanResultToString(res)); goto bail; } ILOG("VulkanMayBeAvailable: Vulkan test instance created successfully."); res = localEnumerate(instance, &physicalDeviceCount, nullptr); if (res != VK_SUCCESS) { - ELOG("VulkanMayBeAvailable: Failed to count physical devices."); + ELOG("VulkanMayBeAvailable: Failed to count physical devices (%s)", VulkanResultToString(res)); goto bail; } if (physicalDeviceCount == 0) { @@ -395,7 +396,7 @@ bool VulkanMayBeAvailable() { devices.resize(physicalDeviceCount); res = localEnumerate(instance, &physicalDeviceCount, devices.data()); if (res != VK_SUCCESS) { - ELOG("VulkanMayBeAvailable: Failed to enumerate physical devices."); + ELOG("VulkanMayBeAvailable: Failed to enumerate physical devices (%s)", VulkanResultToString(res)); goto bail; } anyGood = false; From 4cebea6a143c661f737998d1423f27ac5a597012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 10:50:25 +0200 Subject: [PATCH 02/43] Don't let a delayed config load mess with the GPU backend option. Fixes #12284. --- UI/NativeApp.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index e065035e62..392da5b128 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -514,6 +514,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch LogManager *logman = LogManager::GetInstance(); #ifdef __ANDROID__ + // On early versions of Android we don't need to ask permission. CreateDirectoriesAndroid(); #endif @@ -978,6 +979,7 @@ void NativeRender(GraphicsContext *graphicsContext) { ortho.setOrthoD3D(0.0f, xres, yres, 0.0f, -1.0f, 1.0f); break; case GPUBackend::OPENGL: + default: ortho.setOrtho(0.0f, xres, yres, 0.0f, -1.0f, 1.0f); break; } @@ -1005,7 +1007,6 @@ void NativeRender(GraphicsContext *graphicsContext) { uiContext->SetBounds(Bounds(0, 0, dp_xres, dp_yres)); // uiContext->SetBounds(Bounds(dp_xres/2, 0, dp_xres / 2, dp_yres / 2)); - // OSX 10.6 and SDL 1.2 bug. #if defined(__APPLE__) && !defined(USING_QT_UI) static int dp_xres_old = dp_xres; @@ -1016,14 +1017,6 @@ void NativeRender(GraphicsContext *graphicsContext) { #endif } - // Test lost/restore on PC -#if 0 - if (gpu) { - gpu->DeviceLost(); - gpu->DeviceRestore(); - } -#endif - graphicsContext->Resize(); screenManager->resized(); @@ -1101,9 +1094,15 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) { #endif // We must have failed to load the config before, so load it now to avoid overwriting the old config // with a freshly generated one. + // NOTE: If graphics backend isn't what's in the config (due to error fallback, or not matching the default + // and then getting permission), it will get out of sync. So we save and restore g_Config.iGPUBackend. + // Ideally we should simply reinitialize graphics to the mode from the config, but there are potential issues + // and I can't risk it before 1.9.0. + int gpuBackend = g_Config.iGPUBackend; ILOG("Reloading config after storage permission grant."); g_Config.Load(); PostLoadConfig(); + g_Config.iGPUBackend = gpuBackend; } } From 309d6562d5af16eef1ae1b33eeb9eea0cbcb8e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 10:52:02 +0200 Subject: [PATCH 03/43] We had an old fallback to the EGL GL loop in the Vulkan init. Remove it. --- android/jni/AndroidVulkanContext.cpp | 14 ++++++++++++-- android/jni/app-android.cpp | 9 +++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/android/jni/AndroidVulkanContext.cpp b/android/jni/AndroidVulkanContext.cpp index 5060d4de77..b514f13d6a 100644 --- a/android/jni/AndroidVulkanContext.cpp +++ b/android/jni/AndroidVulkanContext.cpp @@ -141,8 +141,18 @@ bool AndroidVulkanContext::InitAPI() { } bool AndroidVulkanContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) { - ILOG("InitSurfaceAndroid: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); - g_Vulkan->InitSurface(WINDOWSYSTEM_ANDROID, (void *)wnd, nullptr); + ILOG("AndroidVulkanContext::InitFromRenderThread: desiredwidth=%d desiredheight=%d", desiredBackbufferSizeX, desiredBackbufferSizeY); + if (!g_Vulkan) { + ELOG("AndroidVulkanContext::InitFromRenderThread: No Vulkan context"); + return false; + } + + VkResult res = g_Vulkan->InitSurface(WINDOWSYSTEM_ANDROID, (void *)wnd, nullptr); + if (res != VK_SUCCESS) { + ELOG("g_Vulkan->InitSurface failed: '%s'", VulkanResultToString(res)); + return false; + } + if (g_validate_) { int bits = VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT | VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; g_Vulkan->InitDebugMsgCallback(&Vulkan_Dbg, bits, &g_LogOptions); diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index 7014ee72ca..c8049939d4 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -974,8 +974,13 @@ retry: ILOG("Trying again, this time with OpenGL."); g_Config.iGPUBackend = (int)GPUBackend::OPENGL; SetGPUBackend((GPUBackend)g_Config.iGPUBackend); - tries++; - goto retry; + // If we were still supporting EGL for GL: + // tries++; + // goto retry; + delete graphicsContext; + graphicsContext = nullptr; + renderLoopRunning = false; + return false; } delete graphicsContext; From 50920266d1f6a1b5c209bd404432f1c8d0e144d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 10:52:28 +0200 Subject: [PATCH 04/43] Remove some logging, add a comment. --- ext/native/gfx_es2/draw_text_android.cpp | 3 --- ext/native/gfx_es2/gpu_features.cpp | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ext/native/gfx_es2/draw_text_android.cpp b/ext/native/gfx_es2/draw_text_android.cpp index afb9bf6104..a1d453f7ed 100644 --- a/ext/native/gfx_es2/draw_text_android.cpp +++ b/ext/native/gfx_es2/draw_text_android.cpp @@ -20,12 +20,9 @@ TextDrawerAndroid::TextDrawerAndroid(Draw::DrawContext *draw) : TextDrawer(draw) const char *textRendererClassName = "org/ppsspp/ppsspp/TextRenderer"; jclass localClass = findClass(textRendererClassName); cls_textRenderer = reinterpret_cast(env_->NewGlobalRef(localClass)); - ILOG("cls_textRender: %p", cls_textRenderer); if (cls_textRenderer) { method_measureText = env_->GetStaticMethodID(cls_textRenderer, "measureText", "(Ljava/lang/String;D)I"); - ILOG("method_measureText: %p", method_measureText); method_renderText = env_->GetStaticMethodID(cls_textRenderer, "renderText", "(Ljava/lang/String;D)[I"); - ILOG("method_renderText: %p", method_renderText); } else { ELOG("Failed to find class: '%s'", textRendererClassName); } diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index 6843e87cad..757ccb43f3 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -109,6 +109,7 @@ void ProcessGPUFeatures() { WLOG("GL DRIVER BUG: PVR with bad and terrible precision"); gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_TERRIBLE | BUG_PVR_SHADER_PRECISION_BAD; } else { + // TODO: I'm not sure if the Rogue series is affected by this. WLOG("GL DRIVER BUG: PVR with bad precision"); gl_extensions.bugs |= BUG_PVR_SHADER_PRECISION_BAD; } From c7798715a55a401ab2887d82b5d5329f7086d7b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 14:45:40 +0200 Subject: [PATCH 05/43] Fix issue preventing video to work correctly in Digimon. Fixes #12186 (due to BlockTransferAllowCreateFB not updating the framebuffer range speedhack). --- GPU/Common/FramebufferCommon.cpp | 22 ++++++++++++++-------- GPU/Common/FramebufferCommon.h | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 6c900531e7..337bdd9646 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -187,7 +187,7 @@ VirtualFramebuffer *FramebufferManagerCommon::GetVFBAt(u32 addr) { return match; } -u32 FramebufferManagerCommon::FramebufferByteSize(const VirtualFramebuffer *vfb) const { +u32 FramebufferManagerCommon::ColorBufferByteSize(const VirtualFramebuffer *vfb) const { return vfb->fb_stride * vfb->height * (vfb->format == GE_FORMAT_8888 ? 4 : 2); } @@ -209,6 +209,7 @@ void FramebufferManagerCommon::SetNumExtraFBOs(int num) { } // Heuristics to figure out the size of FBO to create. +// TODO: Possibly differentiate on whether through mode is used (since in through mode, viewport is meaningless?) void FramebufferManagerCommon::EstimateDrawingSize(u32 fb_address, GEBufferFormat fb_format, int viewport_width, int viewport_height, int region_width, int region_height, int scissor_width, int scissor_height, int fb_stride, int &drawing_width, int &drawing_height) { static const int MAX_FRAMEBUF_HEIGHT = 512; @@ -440,8 +441,7 @@ VirtualFramebuffer *FramebufferManagerCommon::DoSetRenderFrameBuffer(const Frame vfb->usageFlags = FB_USAGE_RENDERTARGET; SetColorUpdated(vfb, skipDrawReason); - u32 byteSize = FramebufferByteSize(vfb); - // FB heuristics always produce an address in VRAM (this is during rendering) so we don't need to poke in the 0x04000000 flag here. + u32 byteSize = ColorBufferByteSize(vfb); if (Memory::IsVRAMAddress(params.fb_address) && params.fb_address + byteSize > framebufRangeEnd_) { framebufRangeEnd_ = params.fb_address + byteSize; } @@ -857,13 +857,13 @@ void FramebufferManagerCommon::CopyDisplayToOutput() { VirtualFramebuffer *vfb = GetVFBAt(displayFramebufPtr_); if (!vfb) { // Let's search for a framebuf within this range. Note that we also look for - // "framebuffers" sitting in RAM so we only take off the kernel and uncached bits of the address - // when comparing. + // "framebuffers" sitting in RAM (created from block transfer or similar) so we only take off the kernel + // and uncached bits of the address when comparing. const u32 addr = displayFramebufPtr_ & 0x3FFFFFFF; for (size_t i = 0; i < vfbs_.size(); ++i) { VirtualFramebuffer *v = vfbs_[i]; const u32 v_addr = v->fb_address & 0x3FFFFFFF; - const u32 v_size = FramebufferByteSize(v); + const u32 v_size = ColorBufferByteSize(v); if (addr >= v_addr && addr < v_addr + v_size) { const u32 dstBpp = v->format == GE_FORMAT_8888 ? 4 : 2; const u32 v_offsetX = ((addr - v_addr) / dstBpp) % v->fb_stride; @@ -1184,7 +1184,7 @@ bool FramebufferManagerCommon::NotifyFramebufferCopy(u32 src, u32 dst, int size, // We only remove the kernel and uncached bits when comparing. const u32 vfb_address = vfb->fb_address & 0x3FFFFFFF; - const u32 vfb_size = FramebufferByteSize(vfb); + const u32 vfb_size = ColorBufferByteSize(vfb); const u32 vfb_bpp = vfb->format == GE_FORMAT_8888 ? 4 : 2; const u32 vfb_byteStride = vfb->fb_stride * vfb_bpp; const int vfb_byteWidth = vfb->width * vfb_bpp; @@ -1290,7 +1290,7 @@ void FramebufferManagerCommon::FindTransferFramebuffers(VirtualFramebuffer *&dst for (size_t i = 0; i < vfbs_.size(); ++i) { VirtualFramebuffer *vfb = vfbs_[i]; const u32 vfb_address = vfb->fb_address & 0x3FFFFFFF; - const u32 vfb_size = FramebufferByteSize(vfb); + const u32 vfb_size = ColorBufferByteSize(vfb); const u32 vfb_bpp = vfb->format == GE_FORMAT_8888 ? 4 : 2; const u32 vfb_byteStride = vfb->fb_stride * vfb_bpp; const u32 vfb_byteWidth = vfb->width * vfb_bpp; @@ -1406,6 +1406,12 @@ VirtualFramebuffer *FramebufferManagerCommon::CreateRAMFramebuffer(uint32_t fbAd textureCache_->NotifyFramebuffer(vfb->fb_address, vfb, NOTIFY_FB_CREATED); vfb->fbo = draw_->CreateFramebuffer({ vfb->renderWidth, vfb->renderHeight, 1, 1, true, (Draw::FBColorDepth)vfb->colorDepth }); vfbs_.push_back(vfb); + + size_t byteSize = ColorBufferByteSize(vfb); + if (fbAddress + byteSize > framebufRangeEnd_) { + framebufRangeEnd_ = fbAddress + byteSize; + } + return vfb; } diff --git a/GPU/Common/FramebufferCommon.h b/GPU/Common/FramebufferCommon.h index ce5e0c8aef..5fbcb05571 100644 --- a/GPU/Common/FramebufferCommon.h +++ b/GPU/Common/FramebufferCommon.h @@ -68,7 +68,7 @@ struct VirtualFramebuffer { bool firstFrameSaved; u32 fb_address; - u32 z_address; + u32 z_address; // If 0, it's a "RAM" framebuffer. int fb_stride; int z_stride; @@ -327,7 +327,7 @@ protected: void CopyFramebufferForColorTexture(VirtualFramebuffer *dst, VirtualFramebuffer *src, int flags); void EstimateDrawingSize(u32 fb_address, GEBufferFormat fb_format, int viewport_width, int viewport_height, int region_width, int region_height, int scissor_width, int scissor_height, int fb_stride, int &drawing_width, int &drawing_height); - u32 FramebufferByteSize(const VirtualFramebuffer *vfb) const; + u32 ColorBufferByteSize(const VirtualFramebuffer *vfb) const; void NotifyRenderFramebufferCreated(VirtualFramebuffer *vfb); void NotifyRenderFramebufferUpdated(VirtualFramebuffer *vfb, bool vfbFormatChanged); From e7235941331efbd188093a7b3b2f52dd2521ee57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 14:46:58 +0200 Subject: [PATCH 06/43] Vulkan: Fix shutdown crash accidentally caused by #12324 --- GPU/Vulkan/DepalettizeShaderVulkan.cpp | 1 + GPU/Vulkan/GPU_Vulkan.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/GPU/Vulkan/DepalettizeShaderVulkan.cpp b/GPU/Vulkan/DepalettizeShaderVulkan.cpp index 76d74b3d72..2503f59f96 100644 --- a/GPU/Vulkan/DepalettizeShaderVulkan.cpp +++ b/GPU/Vulkan/DepalettizeShaderVulkan.cpp @@ -72,6 +72,7 @@ void DepalShaderCacheVulkan::DeviceLost() { if (vshader_) { vulkan2D_->PurgeVertexShader(vshader_); vulkan_->Delete().QueueDeleteShaderModule(vshader_); + vshader_ = VK_NULL_HANDLE; } draw_ = nullptr; vulkan_ = nullptr; diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index a1e6152503..1a5e254e27 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -172,9 +172,10 @@ GPU_Vulkan::~GPU_Vulkan() { // Note: We save the cache in DeviceLost DestroyDeviceObjects(); framebufferManagerVulkan_->DestroyAllFBOs(); - vulkan2D_.Shutdown(); depalShaderCache_.Clear(); + depalShaderCache_.DeviceLost(); drawEngine_.DeviceLost(); + vulkan2D_.Shutdown(); delete textureCacheVulkan_; delete pipelineManager_; delete shaderManagerVulkan_; From 54570fdfb499ac8b45e71249f41a21277d0f55df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 09:26:52 +0200 Subject: [PATCH 07/43] Android OpenSL: Fix bug where we should have enqueued two buffers on startup. I don't actually think this matters much though. Seems to make absolutely no difference on any of my devices, but you never know. --- android/jni/native-audio-so.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/android/jni/native-audio-so.cpp b/android/jni/native-audio-so.cpp index 27729ab2cd..b2d684da00 100644 --- a/android/jni/native-audio-so.cpp +++ b/android/jni/native-audio-so.cpp @@ -124,13 +124,16 @@ bool OpenSLContext::Init() { result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); assert(SL_RESULT_SUCCESS == result); - // Render and enqueue a first buffer. (or should we just play the buffer empty?) - buffer[0] = new short[framesPerBuffer * 2]; - buffer[1] = new short[framesPerBuffer * 2]; + // Enqueue two empty buffers. + buffer[0] = new short[framesPerBuffer * 2]{}; + buffer[1] = new short[framesPerBuffer * 2]{}; curBuffer = 0; - audioCallback(buffer[curBuffer], framesPerBuffer); - + result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[curBuffer])); + if (SL_RESULT_SUCCESS != result) { + return false; + } + curBuffer ^= 1; result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[curBuffer])); if (SL_RESULT_SUCCESS != result) { return false; From e69b71b58f48fceeb6291daf5ae4e930875ab78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 23:26:42 +0200 Subject: [PATCH 08/43] Remove some legacy --- android/jni/app-android.cpp | 2 +- android/jni/native_audio.cpp | 2 +- android/jni/native_audio.h | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/android/jni/app-android.cpp b/android/jni/app-android.cpp index c8049939d4..1bebc69c87 100644 --- a/android/jni/app-android.cpp +++ b/android/jni/app-android.cpp @@ -506,7 +506,7 @@ extern "C" void Java_org_ppsspp_ppsspp_NativeApp_audioInit(JNIEnv *, jclass) { ILOG("NativeApp.audioInit() -- Using OpenSL audio! frames/buffer: %i optimal sr: %i actual sr: %i", optimalFramesPerBuffer, optimalSampleRate, sampleRate); if (!g_audioState) { - g_audioState = AndroidAudio_Init(&NativeMix, library_path, framesPerBuffer, sampleRate); + g_audioState = AndroidAudio_Init(&NativeMix, framesPerBuffer, sampleRate); } else { ELOG("Audio state already initialized"); } diff --git a/android/jni/native_audio.cpp b/android/jni/native_audio.cpp index 1bb027f3c6..a06159a89c 100644 --- a/android/jni/native_audio.cpp +++ b/android/jni/native_audio.cpp @@ -9,7 +9,7 @@ struct AndroidAudioState { int sample_rate = 0; }; -AndroidAudioState *AndroidAudio_Init(AndroidAudioCallback callback, std::string libraryDir, int optimalFramesPerBuffer, int optimalSampleRate) { +AndroidAudioState *AndroidAudio_Init(AndroidAudioCallback callback, int optimalFramesPerBuffer, int optimalSampleRate) { AndroidAudioState *state = new AndroidAudioState(); state->callback = callback; state->frames_per_buffer = optimalFramesPerBuffer ? optimalFramesPerBuffer : 256; diff --git a/android/jni/native_audio.h b/android/jni/native_audio.h index f00ae000ba..427f29ca36 100644 --- a/android/jni/native_audio.h +++ b/android/jni/native_audio.h @@ -5,14 +5,8 @@ struct AndroidAudioState; -// This is the file you should include from your program. It dynamically loads -// the native_audio.so shared object and sets up the function pointers. - -// Do not call this if you have detected that the android version is below -// 2.2, as it will fail miserably. - // It's okay for optimalFramesPerBuffer and optimalSampleRate to be 0. Defaults will be used. -AndroidAudioState *AndroidAudio_Init(AndroidAudioCallback cb, std::string libraryDir, int optimalFramesPerBuffer, int optimalSampleRate); +AndroidAudioState *AndroidAudio_Init(AndroidAudioCallback cb, int optimalFramesPerBuffer, int optimalSampleRate); bool AndroidAudio_Pause(AndroidAudioState *state); bool AndroidAudio_Resume(AndroidAudioState *state); bool AndroidAudio_Shutdown(AndroidAudioState *state); From f9bf1f96bd88315f0034fe0dbb86d2f3e9f068ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 17 Sep 2019 23:38:50 +0200 Subject: [PATCH 09/43] Android audio: Turns out the initial queue operation queued up too little data anyway (sizeof on dynamic buffer.. sigh). Anyway like I said, none of this really seems to matter. --- android/jni/native-audio-so.cpp | 40 +++++++++++++++++---------------- android/jni/native-audio-so.h | 9 ++++++-- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/android/jni/native-audio-so.cpp b/android/jni/native-audio-so.cpp index b2d684da00..63a3456395 100644 --- a/android/jni/native-audio-so.cpp +++ b/android/jni/native-audio-so.cpp @@ -56,7 +56,9 @@ void OpenSLContext::BqPlayerCallback(SLAndroidSimpleBufferQueueItf bq) { ELOG("OpenSL ES: Failed to enqueue! %i %i", renderedFrames, sizeInBytes); } - curBuffer ^= 1; // Switch buffer + curBuffer += 1; // Switch buffer + if (curBuffer == NUM_BUFFERS) + curBuffer = 0; } // create the engine and output mix objects @@ -83,7 +85,7 @@ bool OpenSLContext::Init() { // The constants, such as SL_SAMPLINGRATE_44_1, are just 44100000. SLuint32 sr = (SLuint32)sampleRate * 1000; - SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2}; + SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, NUM_BUFFERS}; SLDataFormat_PCM format_pcm = { SL_DATAFORMAT_PCM, 2, @@ -124,21 +126,20 @@ bool OpenSLContext::Init() { result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); assert(SL_RESULT_SUCCESS == result); - // Enqueue two empty buffers. - buffer[0] = new short[framesPerBuffer * 2]{}; - buffer[1] = new short[framesPerBuffer * 2]{}; + // Allocate and enqueue N empty buffers. + for (int i = 0; i < NUM_BUFFERS; i++) { + buffer[i] = new short[framesPerBuffer * 2]{}; + } + + int sizeInBytes = framesPerBuffer * 2 * sizeof(short); + for (int i = 0; i < NUM_BUFFERS; i++) { + result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[i], sizeInBytes); + if (SL_RESULT_SUCCESS != result) { + return false; + } + } curBuffer = 0; - result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[curBuffer])); - if (SL_RESULT_SUCCESS != result) { - return false; - } - curBuffer ^= 1; - result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[curBuffer])); - if (SL_RESULT_SUCCESS != result) { - return false; - } - curBuffer ^= 1; return true; } @@ -177,10 +178,11 @@ OpenSLContext::~OpenSLContext() { engineObject = nullptr; engineEngine = nullptr; } - delete [] buffer[0]; - delete [] buffer[1]; - buffer[0] = nullptr; - buffer[1] = nullptr; + + for (int i = 0; i < NUM_BUFFERS; i++) { + delete[] buffer[i]; + buffer[i] = nullptr; + } ILOG("OpenSLWrap_Shutdown - finished"); } diff --git a/android/jni/native-audio-so.h b/android/jni/native-audio-so.h index 286a3338eb..9623e51709 100644 --- a/android/jni/native-audio-so.h +++ b/android/jni/native-audio-so.h @@ -37,10 +37,15 @@ private: SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue = nullptr; SLVolumeItf bqPlayerVolume = nullptr; + // Should be no reason to need more than two buffers, but make it clear in the code. + enum { + NUM_BUFFERS = 2, + }; + // Double buffering. - short *buffer[2]{}; + short *buffer[NUM_BUFFERS]{}; int curBuffer = 0; static void bqPlayerCallbackWrap(SLAndroidSimpleBufferQueueItf bq, void *context); void BqPlayerCallback(SLAndroidSimpleBufferQueueItf bq); -}; \ No newline at end of file +}; From b5af797ca65ddb30fc5ae1a1d2a24d6d4173b6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 19 Sep 2019 10:39:12 +0200 Subject: [PATCH 10/43] Hacky workaround for #12339 (Amazon FireStick 4k issue) --- android/src/org/ppsspp/ppsspp/NativeActivity.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index c32d0321e3..a9059a98fe 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -524,13 +524,13 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C // http://grokbase.com/t/gg/android-developers/11bj40jm4w/fall-back // Needed to avoid banding on Ouya? - if (Build.MANUFACTURER == "OUYA") { + if (Build.MANUFACTURER.equals("OUYA")) { mGLSurfaceView.getHolder().setFormat(PixelFormat.RGBX_8888); mGLSurfaceView.setEGLConfigChooser(new NativeEGLConfigChooser()); } else { // Tried to mess around with config choosers (NativeEGLConfigChooser) here but fail completely on Xperia Play. // On the other hand, I think from ICS we should be safe to at least require 8888 and stencil... - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && !Build.MANUFACTURER.equals("AMAZON")) { mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 8); } } From 5a53570b38d7302ea9292ac56a907758b31327a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 19 Sep 2019 12:39:03 +0200 Subject: [PATCH 11/43] Case fix for previous commit --- android/src/org/ppsspp/ppsspp/NativeActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index a9059a98fe..0c67046bc0 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -530,7 +530,7 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C } else { // Tried to mess around with config choosers (NativeEGLConfigChooser) here but fail completely on Xperia Play. // On the other hand, I think from ICS we should be safe to at least require 8888 and stencil... - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && !Build.MANUFACTURER.equals("AMAZON")) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && !Build.MANUFACTURER.equals("Amazon")) { mGLSurfaceView.setEGLConfigChooser(8, 8, 8, 8, 16, 8); } } From 164593a5074ad4e092de5dc04c74a446801d9fc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 9 Aug 2019 12:21:51 +0200 Subject: [PATCH 12/43] Update README.md for 1.9.0 As usual I'm sure I'm missing a lot of good changes :) --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index 024ecdcaa4..b970c80bb3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,21 @@ For build instructions and other development tutorials, see [the wiki](https://g For game compatibility, see [community compatibility feedback](https://report.ppsspp.org/games). +What's new in 1.9.0 +------------------- +* Flicker fixed in God of War that appeared with newer drivers for Mali GPUs (#12224) +* Vertex range culling fixed on ARM Mali (#12227) +* Started to improve VFPU precision, resulting so far in a fix for the long standing Tekken 6 leg shaking problem (#12217) +* Fixed a VFPU precision snafu on ARM64, fixing disappearing officers in Warriors Orochi(#11299) +* Vulkan is the default again on newer Android versions. +* Fix various homebrew store issues +* GPU pause signal handling fixed, fixing some hangs (#12160). +* Audio sample rate conversion handling fixes (#12147) +* Some Vulkan optimizations (pre-rotation (#12216), perf fix in Metal Gear Acid, etc). +* Multiple fixes for the UWP build (#12036, others) +* MP3 playback fixes (#12005) +* Fixed audio in Motorstorm: Arctic Edge by returning errors correctly (#12121) + What's new in 1.8.0 ------------------- * Avoid crash when starting PPSSPP due to bad AMD Vulkan drivers (#11802) From 99326f3b82b83f67625c2e514bd6c1682b12ca6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 23 Aug 2019 17:23:41 +0200 Subject: [PATCH 13/43] Update README.md a bit more --- README.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b970c80bb3..52d3d44625 100644 --- a/README.md +++ b/README.md @@ -26,17 +26,19 @@ For game compatibility, see [community compatibility feedback](https://report.pp What's new in 1.9.0 ------------------- * Flicker fixed in God of War that appeared with newer drivers for Mali GPUs (#12224) +* Improve performance of God of War on Vulkan (#12242), implement built-in GPU profiler (#12262, #12266) * Vertex range culling fixed on ARM Mali (#12227) * Started to improve VFPU precision, resulting so far in a fix for the long standing Tekken 6 leg shaking problem (#12217) * Fixed a VFPU precision snafu on ARM64, fixing disappearing officers in Warriors Orochi(#11299) -* Vulkan is the default again on newer Android versions. +* Vulkan is the default again on Android versions newer than Pie * Fix various homebrew store issues -* GPU pause signal handling fixed, fixing some hangs (#12160). +* GPU pause signal handling fixed, fixing some hangs (#12160) * Audio sample rate conversion handling fixes (#12147) -* Some Vulkan optimizations (pre-rotation (#12216), perf fix in Metal Gear Acid, etc). +* Some Vulkan optimizations (pre-rotation (#12216), perf fix in Metal Gear Acid, etc) * Multiple fixes for the UWP build (#12036, others) * MP3 playback fixes (#12005) * Fixed audio in Motorstorm: Arctic Edge by returning errors correctly (#12121) +* Fixed audio glitches in Final Fantasy Tactics (#9956) What's new in 1.8.0 ------------------- From 48d79604b5c849591c04affb21e932ee9aecd303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 26 Aug 2019 23:56:26 +0200 Subject: [PATCH 14/43] More README.md updates --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 52d3d44625..2168bb4cd6 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,9 @@ What's new in 1.9.0 * Some Vulkan optimizations (pre-rotation (#12216), perf fix in Metal Gear Acid, etc) * Multiple fixes for the UWP build (#12036, others) * MP3 playback fixes (#12005) -* Fixed audio in Motorstorm: Arctic Edge by returning errors correctly (#12121) -* Fixed audio glitches in Final Fantasy Tactics (#9956) +* Audio in Motorstorm: Arctic Edge fixed by returning errors correctly (#12121) +* Audio glitches in Final Fantasy Tactics fixed (#9956) +* Camera display in Invizimals fixed What's new in 1.8.0 ------------------- From 909640adbc2264f0d6a3e971e1e08a3bd79050ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 27 Aug 2019 01:24:31 +0200 Subject: [PATCH 15/43] README.md: Lunamoo's additions --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2168bb4cd6..88e6f4e0fb 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,14 @@ What's new in 1.9.0 * MP3 playback fixes (#12005) * Audio in Motorstorm: Arctic Edge fixed by returning errors correctly (#12121) * Audio glitches in Final Fantasy Tactics fixed (#9956) -* Camera display in Invizimals fixed +* Camera display in Invizimals fixed (#12278) +* Added hotkeys for texture dump and replace (#11938) +* Added Visual Studio 2019 support. Windows XP is no longer supported (#11995, others) +* Fixes for video dumping (#12069) +* Added a separate sound volume for alternative speed (#12124) +* Improved mouse control (Windows only) (#12173, #12176) +* Support for installing texture packs and ISOs from zips (#12175) +* Right analog support for touch controls (only used by patched games and some HD remasters) (#12182) What's new in 1.8.0 ------------------- From b5b10e922b11081369c410d696ffbac449ca73ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 4 Sep 2019 23:59:22 +0200 Subject: [PATCH 16/43] More readme updates --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 88e6f4e0fb..b51750b791 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,10 @@ What's new in 1.9.0 * Improve performance of God of War on Vulkan (#12242), implement built-in GPU profiler (#12262, #12266) * Vertex range culling fixed on ARM Mali (#12227) * Started to improve VFPU precision, resulting so far in a fix for the long standing Tekken 6 leg shaking problem (#12217) -* Fixed a VFPU precision snafu on ARM64, fixing disappearing officers in Warriors Orochi(#11299) +* Fixed a VFPU precision snafu on ARM64, fixing disappearing officers in Warriors Orochi (#11299) and some problems in Tomb Raider (#11179). * Vulkan is the default again on Android versions newer than Pie * Fix various homebrew store issues -* GPU pause signal handling fixed, fixing some hangs (#12160) +* GPU pause signal handling fixed, fixing some hangs in Bleach and Armored Core games (#12160) * Audio sample rate conversion handling fixes (#12147) * Some Vulkan optimizations (pre-rotation (#12216), perf fix in Metal Gear Acid, etc) * Multiple fixes for the UWP build (#12036, others) From e1c2d72c108eb5dea818aa308e063c024fb51f19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 19 Sep 2019 22:56:13 +0200 Subject: [PATCH 17/43] Additional README updates --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b51750b791..395671a0fc 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,16 @@ What's new in 1.9.0 * MP3 playback fixes (#12005) * Audio in Motorstorm: Arctic Edge fixed by returning errors correctly (#12121) * Audio glitches in Final Fantasy Tactics fixed (#9956) -* Camera display in Invizimals fixed (#12278) +* Camera display in Invizimals fixed (#12278, #8521) * Added hotkeys for texture dump and replace (#11938) * Added Visual Studio 2019 support. Windows XP is no longer supported (#11995, others) -* Fixes for video dumping (#12069) +* Fixes for video capture (#12069) * Added a separate sound volume for alternative speed (#12124) * Improved mouse control (Windows only) (#12173, #12176) * Support for installing texture packs and ISOs from zips (#12175) * Right analog support for touch controls (only used by patched games and some HD remasters) (#12182) +* Android: Fix OpenSL initialization, possibly helps audio crackle a little. (#12333). +* Fix graphics on Amazon Fire TV Stick 4K What's new in 1.8.0 ------------------- From 1eb2ac372adb7327ce67ab6b32d7211037bbe492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 20 Sep 2019 13:51:11 +0200 Subject: [PATCH 18/43] Add patch note about MGS:PW as suggested by AkiraJkr --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 395671a0fc..4c48f5de18 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ What's new in 1.9.0 * Right analog support for touch controls (only used by patched games and some HD remasters) (#12182) * Android: Fix OpenSL initialization, possibly helps audio crackle a little. (#12333). * Fix graphics on Amazon Fire TV Stick 4K +* Fixed strange vehicle behavior in MGS:PW (somehow). What's new in 1.8.0 ------------------- From 91b41a11b7818b4e6eafd2aa19309a656a43a41b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 20 Sep 2019 15:07:48 +0200 Subject: [PATCH 19/43] Refer to AkiraJkr's new issue --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4c48f5de18..db53fa6a01 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ What's new in 1.9.0 * Right analog support for touch controls (only used by patched games and some HD remasters) (#12182) * Android: Fix OpenSL initialization, possibly helps audio crackle a little. (#12333). * Fix graphics on Amazon Fire TV Stick 4K -* Fixed strange vehicle behavior in MGS:PW (somehow). +* Fixed strange vehicle behavior in MGS:PW (somehow) (#12342) What's new in 1.8.0 ------------------- From 87ee8029a31d7f724a8775397321ef454b963922 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 22 Sep 2019 10:31:05 +0200 Subject: [PATCH 20/43] Another fix for AnalogTestScreen rendering (it broke again somehow?) --- UI/ControlMappingScreen.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/UI/ControlMappingScreen.cpp b/UI/ControlMappingScreen.cpp index f7985ba69b..b5575dbcae 100644 --- a/UI/ControlMappingScreen.cpp +++ b/UI/ControlMappingScreen.cpp @@ -466,6 +466,9 @@ void JoystickHistoryView::Draw(UIContext &dc) { if (xAxis_ > -1 && yAxis_ > -1) { const AtlasImage &image = dc.Draw()->GetAtlas()->images[I_CROSS]; float minRadius = std::min(bounds_.w, bounds_.h) * 0.5f - image.w; + dc.BeginNoTex(); + dc.Draw()->RectOutline(bounds_.centerX() - minRadius, bounds_.centerY() - minRadius, minRadius * 2.0f, minRadius * 2.0f, 0x80FFFFFF); + dc.Flush(); dc.Begin(); int a = maxCount_ - (int)locations_.size(); for (auto iter = locations_.begin(); iter != locations_.end(); ++iter) { @@ -479,11 +482,10 @@ void JoystickHistoryView::Draw(UIContext &dc) { a++; } dc.Flush(); - dc.BeginNoTex(); - dc.Draw()->RectOutline(bounds_.centerX() - minRadius, bounds_.centerY() - minRadius, minRadius * 2.0f, minRadius * 2.0f, 0x80FFFFFF); - dc.Flush(); } else { + dc.Begin(); dc.DrawText("N/A", bounds_.centerX(), bounds_.centerY(), 0xFFFFFFFF, ALIGN_CENTER); + dc.Flush(); } } From 58da4aa24bc564df2b77d503baddf57c7efa2d69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 23 Sep 2019 11:38:39 +0200 Subject: [PATCH 21/43] Update default adhoc server to one that works --- Core/Config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index ecb3a7612e..200c316029 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -926,7 +926,7 @@ static ConfigSetting systemParamSettings[] = { ReportedConfigSetting("PSPModel", &g_Config.iPSPModel, &DefaultPSPModel, true, true), ReportedConfigSetting("PSPFirmwareVersion", &g_Config.iFirmwareVersion, PSP_DEFAULT_FIRMWARE, true, true), ConfigSetting("NickName", &g_Config.sNickName, "PPSSPP", true, true), - ConfigSetting("proAdhocServer", &g_Config.proAdhocServer, "black-seraph.com", true, true), + ConfigSetting("proAdhocServer", &g_Config.proAdhocServer, "myneighborsushicat.com", true, true), ConfigSetting("MacAddress", &g_Config.sMACAddress, "", true, true), ConfigSetting("PortOffset", &g_Config.iPortOffset, 0, true, true), ReportedConfigSetting("Language", &g_Config.iLanguage, &DefaultSystemParamLanguage, true, true), From e6a76e2956b0eaf34980188bbb67cccd8259d3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 23 Sep 2019 23:37:45 +0200 Subject: [PATCH 22/43] Vulkan: Update API headers. Mostly to get VK_EXT_exclusive_fullscreen for later. --- ext/vulkan/vk_icd.h | 10 +- ext/vulkan/vulkan_android.h | 9 +- ext/vulkan/vulkan_core.h | 532 ++++++++++++++++++++++++++++---- ext/vulkan/vulkan_fuchsia.h | 9 +- ext/vulkan/vulkan_ggp.h | 9 +- ext/vulkan/vulkan_ios.h | 9 +- ext/vulkan/vulkan_macos.h | 9 +- ext/vulkan/vulkan_metal.h | 9 +- ext/vulkan/vulkan_vi.h | 9 +- ext/vulkan/vulkan_wayland.h | 9 +- ext/vulkan/vulkan_win32.h | 13 +- ext/vulkan/vulkan_xcb.h | 9 +- ext/vulkan/vulkan_xlib.h | 9 +- ext/vulkan/vulkan_xlib_xrandr.h | 9 +- 14 files changed, 538 insertions(+), 116 deletions(-) diff --git a/ext/vulkan/vk_icd.h b/ext/vulkan/vk_icd.h index a2d960a632..5dff59a16e 100644 --- a/ext/vulkan/vk_icd.h +++ b/ext/vulkan/vk_icd.h @@ -89,7 +89,8 @@ typedef enum { VK_ICD_WSI_PLATFORM_MACOS, VK_ICD_WSI_PLATFORM_IOS, VK_ICD_WSI_PLATFORM_DISPLAY, - VK_ICD_WSI_PLATFORM_HEADLESS + VK_ICD_WSI_PLATFORM_HEADLESS, + VK_ICD_WSI_PLATFORM_METAL, } VkIcdWsiPlatform; typedef struct { @@ -172,4 +173,11 @@ typedef struct { VkIcdSurfaceBase base; } VkIcdSurfaceHeadless; +#ifdef VK_USE_PLATFORM_METAL_EXT +typedef struct { + VkIcdSurfaceBase base; + const CAMetalLayer *pLayer; +} VkIcdSurfaceMetal; +#endif // VK_USE_PLATFORM_METAL_EXT + #endif // VKICD_H diff --git a/ext/vulkan/vulkan_android.h b/ext/vulkan/vulkan_android.h index 1861802411..9b8d3e276f 100644 --- a/ext/vulkan/vulkan_android.h +++ b/ext/vulkan/vulkan_android.h @@ -1,10 +1,6 @@ #ifndef VULKAN_ANDROID_H_ #define VULKAN_ANDROID_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_KHR_android_surface 1 struct ANativeWindow; diff --git a/ext/vulkan/vulkan_core.h b/ext/vulkan/vulkan_core.h index af35682621..01da6ede32 100644 --- a/ext/vulkan/vulkan_core.h +++ b/ext/vulkan/vulkan_core.h @@ -1,10 +1,6 @@ #ifndef VULKAN_CORE_H_ #define VULKAN_CORE_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_VERSION_1_0 1 #include "vk_platform.h" @@ -43,7 +44,7 @@ extern "C" { #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) // Version of this file -#define VK_HEADER_VERSION 111 +#define VK_HEADER_VERSION 123 #define VK_NULL_HANDLE 0 @@ -307,6 +308,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000, VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT = 1000066000, VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT = 1000067000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT = 1000067001, VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, @@ -327,7 +329,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT = 1000081000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT = 1000081001, VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT = 1000081002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR = 1000082000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR = 1000082000, VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000, VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001, @@ -351,6 +353,10 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT = 1000102000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT = 1000102001, VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES_KHR = 1000108000, + VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR = 1000108001, + VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO_KHR = 1000108002, + VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR = 1000108003, VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2_KHR = 1000109000, VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR = 1000109001, VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR = 1000109002, @@ -437,11 +443,13 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT = 1000170000, VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT = 1000170001, VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES_KHR = 1000175000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR = 1000177000, VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000, VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = 1000178001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR = 1000180000, + VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD = 1000183000, VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = 1000184000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = 1000185000, VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD = 1000189000, @@ -463,7 +471,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV = 1000205002, VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV = 1000206000, VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV = 1000206001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS2_FEATURES_INTEL = 1000209000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL = 1000209000, VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO_INTEL = 1000210000, VK_STRUCTURE_TYPE_INITIALIZE_PERFORMANCE_API_INFO_INTEL = 1000210001, VK_STRUCTURE_TYPE_PERFORMANCE_MARKER_INFO_INTEL = 1000210002, @@ -480,6 +488,11 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT = 1000218001, VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT = 1000218002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT = 1000221000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT = 1000225000, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT = 1000225001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT = 1000225002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD = 1000227000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD = 1000229000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT = 1000237000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT = 1000238000, VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT = 1000238001, @@ -503,7 +516,20 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT = 1000255002, VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT = 1000255001, VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT = 1000256000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT = 1000259000, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT = 1000259001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT = 1000259002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT = 1000261000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT = 1000265000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR = 1000269000, + VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR = 1000269001, + VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_PROPERTIES_KHR = 1000269002, + VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR = 1000269003, + VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR = 1000269004, + VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR = 1000269005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT = 1000276000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT = 1000281000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT = 1000281001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, @@ -539,6 +565,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES, VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES, VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO, VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT, @@ -823,6 +850,20 @@ typedef enum VkFormat { VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, + VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = 1000066000, + VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = 1000066001, + VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = 1000066002, + VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = 1000066003, + VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = 1000066004, + VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = 1000066005, + VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = 1000066006, + VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = 1000066007, + VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = 1000066008, + VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = 1000066009, + VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = 1000066010, + VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = 1000066011, + VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = 1000066012, + VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = 1000066013, VK_FORMAT_G8B8G8R8_422_UNORM_KHR = VK_FORMAT_G8B8G8R8_422_UNORM, VK_FORMAT_B8G8R8G8_422_UNORM_KHR = VK_FORMAT_B8G8R8G8_422_UNORM, VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM, @@ -1169,6 +1210,7 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004, VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006, VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001, + VK_DYNAMIC_STATE_LINE_STIPPLE_EXT = 1000259000, VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE, VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1), @@ -1201,6 +1243,7 @@ typedef enum VkSamplerAddressMode { VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE_KHR = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT, VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1), @@ -1282,6 +1325,7 @@ typedef enum VkIndexType { VK_INDEX_TYPE_UINT16 = 0, VK_INDEX_TYPE_UINT32 = 1, VK_INDEX_TYPE_NONE_NV = 1000165000, + VK_INDEX_TYPE_UINT8_EXT = 1000265000, VK_INDEX_TYPE_BEGIN_RANGE = VK_INDEX_TYPE_UINT16, VK_INDEX_TYPE_END_RANGE = VK_INDEX_TYPE_UINT32, VK_INDEX_TYPE_RANGE_SIZE = (VK_INDEX_TYPE_UINT32 - VK_INDEX_TYPE_UINT16 + 1), @@ -1466,6 +1510,8 @@ typedef enum VkMemoryPropertyFlagBits { VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, VK_MEMORY_PROPERTY_PROTECTED_BIT = 0x00000020, + VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD = 0x00000040, + VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD = 0x00000080, VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkMemoryPropertyFlagBits; typedef VkFlags VkMemoryPropertyFlags; @@ -1619,6 +1665,10 @@ typedef enum VkImageViewCreateFlagBits { VK_IMAGE_VIEW_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageViewCreateFlagBits; typedef VkFlags VkImageViewCreateFlags; + +typedef enum VkShaderModuleCreateFlagBits { + VK_SHADER_MODULE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkShaderModuleCreateFlagBits; typedef VkFlags VkShaderModuleCreateFlags; typedef VkFlags VkPipelineCacheCreateFlags; @@ -1629,11 +1679,19 @@ typedef enum VkPipelineCreateFlagBits { VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = 0x00000008, VK_PIPELINE_CREATE_DISPATCH_BASE = 0x00000010, VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV = 0x00000020, + VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR = 0x00000040, + VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080, VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT, VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = VK_PIPELINE_CREATE_DISPATCH_BASE, VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkPipelineCreateFlagBits; typedef VkFlags VkPipelineCreateFlags; + +typedef enum VkPipelineShaderStageCreateFlagBits { + VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT = 0x00000001, + VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT = 0x00000002, + VK_PIPELINE_SHADER_STAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineShaderStageCreateFlagBits; typedef VkFlags VkPipelineShaderStageCreateFlags; typedef enum VkShaderStageFlagBits { @@ -1706,7 +1764,16 @@ typedef enum VkDescriptorPoolCreateFlagBits { } VkDescriptorPoolCreateFlagBits; typedef VkFlags VkDescriptorPoolCreateFlags; typedef VkFlags VkDescriptorPoolResetFlags; + +typedef enum VkFramebufferCreateFlagBits { + VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR = 0x00000001, + VK_FRAMEBUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFramebufferCreateFlagBits; typedef VkFlags VkFramebufferCreateFlags; + +typedef enum VkRenderPassCreateFlagBits { + VK_RENDER_PASS_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkRenderPassCreateFlagBits; typedef VkFlags VkRenderPassCreateFlags; typedef enum VkAttachmentDescriptionFlagBits { @@ -1802,7 +1869,8 @@ typedef VkFlags VkCommandBufferResetFlags; typedef enum VkStencilFaceFlagBits { VK_STENCIL_FACE_FRONT_BIT = 0x00000001, VK_STENCIL_FACE_BACK_BIT = 0x00000002, - VK_STENCIL_FRONT_AND_BACK = 0x00000003, + VK_STENCIL_FACE_FRONT_AND_BACK = 0x00000003, + VK_STENCIL_FRONT_AND_BACK = VK_STENCIL_FACE_FRONT_AND_BACK, VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkStencilFaceFlagBits; typedef VkFlags VkStencilFaceFlags; @@ -5018,7 +5086,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR( #define VK_KHR_display 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) -#define VK_KHR_DISPLAY_SPEC_VERSION 21 +#define VK_KHR_DISPLAY_SPEC_VERSION 23 #define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display" typedef enum VkDisplayPlaneAlphaFlagBitsKHR { @@ -5141,7 +5209,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( #define VK_KHR_display_swapchain 1 -#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9 +#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 10 #define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" typedef struct VkDisplayPresentInfoKHR { VkStructureType sType; @@ -5164,7 +5232,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( #define VK_KHR_sampler_mirror_clamp_to_edge 1 -#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1 +#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 3 #define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" @@ -5180,7 +5248,7 @@ typedef VkPhysicalDeviceMultiviewProperties VkPhysicalDeviceMultiviewPropertiesK #define VK_KHR_get_physical_device_properties2 1 -#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 2 #define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" typedef VkPhysicalDeviceFeatures2 VkPhysicalDeviceFeatures2KHR; @@ -5245,7 +5313,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( #define VK_KHR_device_group 1 -#define VK_KHR_DEVICE_GROUP_SPEC_VERSION 3 +#define VK_KHR_DEVICE_GROUP_SPEC_VERSION 4 #define VK_KHR_DEVICE_GROUP_EXTENSION_NAME "VK_KHR_device_group" typedef VkPeerMemoryFeatureFlags VkPeerMemoryFeatureFlagsKHR; @@ -5523,12 +5591,14 @@ VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( #define VK_KHR_shader_float16_int8 1 #define VK_KHR_SHADER_FLOAT16_INT8_SPEC_VERSION 1 #define VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME "VK_KHR_shader_float16_int8" -typedef struct VkPhysicalDeviceFloat16Int8FeaturesKHR { +typedef struct VkPhysicalDeviceShaderFloat16Int8FeaturesKHR { VkStructureType sType; void* pNext; VkBool32 shaderFloat16; VkBool32 shaderInt8; -} VkPhysicalDeviceFloat16Int8FeaturesKHR; +} VkPhysicalDeviceShaderFloat16Int8FeaturesKHR; + +typedef VkPhysicalDeviceShaderFloat16Int8FeaturesKHR VkPhysicalDeviceFloat16Int8FeaturesKHR; @@ -5599,6 +5669,43 @@ VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR( #endif +#define VK_KHR_imageless_framebuffer 1 +#define VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION 1 +#define VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME "VK_KHR_imageless_framebuffer" +typedef struct VkPhysicalDeviceImagelessFramebufferFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 imagelessFramebuffer; +} VkPhysicalDeviceImagelessFramebufferFeaturesKHR; + +typedef struct VkFramebufferAttachmentImageInfoKHR { + VkStructureType sType; + const void* pNext; + VkImageCreateFlags flags; + VkImageUsageFlags usage; + uint32_t width; + uint32_t height; + uint32_t layerCount; + uint32_t viewFormatCount; + const VkFormat* pViewFormats; +} VkFramebufferAttachmentImageInfoKHR; + +typedef struct VkFramebufferAttachmentsCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t attachmentImageInfoCount; + const VkFramebufferAttachmentImageInfoKHR* pAttachmentImageInfos; +} VkFramebufferAttachmentsCreateInfoKHR; + +typedef struct VkRenderPassAttachmentBeginInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t attachmentCount; + const VkImageView* pAttachments; +} VkRenderPassAttachmentBeginInfoKHR; + + + #define VK_KHR_create_renderpass2 1 #define VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION 1 #define VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME "VK_KHR_create_renderpass2" @@ -5991,7 +6098,7 @@ typedef struct VkImageFormatListCreateInfoKHR { #define VK_KHR_sampler_ycbcr_conversion 1 typedef VkSamplerYcbcrConversion VkSamplerYcbcrConversionKHR; -#define VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION 1 +#define VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION 14 #define VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME "VK_KHR_sampler_ycbcr_conversion" typedef VkSamplerYcbcrModelConversion VkSamplerYcbcrModelConversionKHR; @@ -6095,6 +6202,17 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountKHR( #endif +#define VK_KHR_shader_subgroup_extended_types 1 +#define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION 1 +#define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME "VK_KHR_shader_subgroup_extended_types" +typedef struct VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 shaderSubgroupExtendedTypes; +} VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR; + + + #define VK_KHR_8bit_storage 1 #define VK_KHR_8BIT_STORAGE_SPEC_VERSION 1 #define VK_KHR_8BIT_STORAGE_EXTENSION_NAME "VK_KHR_8bit_storage" @@ -6138,9 +6256,10 @@ typedef enum VkDriverIdKHR { VK_DRIVER_ID_ARM_PROPRIETARY_KHR = 9, VK_DRIVER_ID_GOOGLE_SWIFTSHADER_KHR = 10, VK_DRIVER_ID_GGP_PROPRIETARY_KHR = 11, + VK_DRIVER_ID_BROADCOM_PROPRIETARY_KHR = 12, VK_DRIVER_ID_BEGIN_RANGE_KHR = VK_DRIVER_ID_AMD_PROPRIETARY_KHR, - VK_DRIVER_ID_END_RANGE_KHR = VK_DRIVER_ID_GGP_PROPRIETARY_KHR, - VK_DRIVER_ID_RANGE_SIZE_KHR = (VK_DRIVER_ID_GGP_PROPRIETARY_KHR - VK_DRIVER_ID_AMD_PROPRIETARY_KHR + 1), + VK_DRIVER_ID_END_RANGE_KHR = VK_DRIVER_ID_BROADCOM_PROPRIETARY_KHR, + VK_DRIVER_ID_RANGE_SIZE_KHR = (VK_DRIVER_ID_BROADCOM_PROPRIETARY_KHR - VK_DRIVER_ID_AMD_PROPRIETARY_KHR + 1), VK_DRIVER_ID_MAX_ENUM_KHR = 0x7FFFFFFF } VkDriverIdKHR; typedef struct VkConformanceVersionKHR { @@ -6162,28 +6281,38 @@ typedef struct VkPhysicalDeviceDriverPropertiesKHR { #define VK_KHR_shader_float_controls 1 -#define VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION 1 +#define VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION 4 #define VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME "VK_KHR_shader_float_controls" + +typedef enum VkShaderFloatControlsIndependenceKHR { + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR = 0, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR = 1, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR = 2, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_BEGIN_RANGE_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_END_RANGE_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR, + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_RANGE_SIZE_KHR = (VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR + 1), + VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkShaderFloatControlsIndependenceKHR; typedef struct VkPhysicalDeviceFloatControlsPropertiesKHR { - VkStructureType sType; - void* pNext; - VkBool32 separateDenormSettings; - VkBool32 separateRoundingModeSettings; - VkBool32 shaderSignedZeroInfNanPreserveFloat16; - VkBool32 shaderSignedZeroInfNanPreserveFloat32; - VkBool32 shaderSignedZeroInfNanPreserveFloat64; - VkBool32 shaderDenormPreserveFloat16; - VkBool32 shaderDenormPreserveFloat32; - VkBool32 shaderDenormPreserveFloat64; - VkBool32 shaderDenormFlushToZeroFloat16; - VkBool32 shaderDenormFlushToZeroFloat32; - VkBool32 shaderDenormFlushToZeroFloat64; - VkBool32 shaderRoundingModeRTEFloat16; - VkBool32 shaderRoundingModeRTEFloat32; - VkBool32 shaderRoundingModeRTEFloat64; - VkBool32 shaderRoundingModeRTZFloat16; - VkBool32 shaderRoundingModeRTZFloat32; - VkBool32 shaderRoundingModeRTZFloat64; + VkStructureType sType; + void* pNext; + VkShaderFloatControlsIndependenceKHR denormBehaviorIndependence; + VkShaderFloatControlsIndependenceKHR roundingModeIndependence; + VkBool32 shaderSignedZeroInfNanPreserveFloat16; + VkBool32 shaderSignedZeroInfNanPreserveFloat32; + VkBool32 shaderSignedZeroInfNanPreserveFloat64; + VkBool32 shaderDenormPreserveFloat16; + VkBool32 shaderDenormPreserveFloat32; + VkBool32 shaderDenormPreserveFloat64; + VkBool32 shaderDenormFlushToZeroFloat16; + VkBool32 shaderDenormFlushToZeroFloat32; + VkBool32 shaderDenormFlushToZeroFloat64; + VkBool32 shaderRoundingModeRTEFloat16; + VkBool32 shaderRoundingModeRTEFloat32; + VkBool32 shaderRoundingModeRTEFloat64; + VkBool32 shaderRoundingModeRTZFloat16; + VkBool32 shaderRoundingModeRTZFloat32; + VkBool32 shaderRoundingModeRTZFloat64; } VkPhysicalDeviceFloatControlsPropertiesKHR; @@ -6260,6 +6389,99 @@ typedef struct VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR { +#define VK_KHR_pipeline_executable_properties 1 +#define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION 1 +#define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME "VK_KHR_pipeline_executable_properties" + +typedef enum VkPipelineExecutableStatisticFormatKHR { + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR = 0, + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR = 1, + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR = 2, + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR = 3, + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BEGIN_RANGE_KHR = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR, + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_END_RANGE_KHR = VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR, + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_RANGE_SIZE_KHR = (VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR + 1), + VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_MAX_ENUM_KHR = 0x7FFFFFFF +} VkPipelineExecutableStatisticFormatKHR; +typedef struct VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 pipelineExecutableInfo; +} VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR; + +typedef struct VkPipelineInfoKHR { + VkStructureType sType; + const void* pNext; + VkPipeline pipeline; +} VkPipelineInfoKHR; + +typedef struct VkPipelineExecutablePropertiesKHR { + VkStructureType sType; + void* pNext; + VkShaderStageFlags stages; + char name[VK_MAX_DESCRIPTION_SIZE]; + char description[VK_MAX_DESCRIPTION_SIZE]; + uint32_t subgroupSize; +} VkPipelineExecutablePropertiesKHR; + +typedef struct VkPipelineExecutableInfoKHR { + VkStructureType sType; + const void* pNext; + VkPipeline pipeline; + uint32_t executableIndex; +} VkPipelineExecutableInfoKHR; + +typedef union VkPipelineExecutableStatisticValueKHR { + VkBool32 b32; + int64_t i64; + uint64_t u64; + double f64; +} VkPipelineExecutableStatisticValueKHR; + +typedef struct VkPipelineExecutableStatisticKHR { + VkStructureType sType; + void* pNext; + char name[VK_MAX_DESCRIPTION_SIZE]; + char description[VK_MAX_DESCRIPTION_SIZE]; + VkPipelineExecutableStatisticFormatKHR format; + VkPipelineExecutableStatisticValueKHR value; +} VkPipelineExecutableStatisticKHR; + +typedef struct VkPipelineExecutableInternalRepresentationKHR { + VkStructureType sType; + void* pNext; + char name[VK_MAX_DESCRIPTION_SIZE]; + char description[VK_MAX_DESCRIPTION_SIZE]; + VkBool32 isText; + size_t dataSize; + void* pData; +} VkPipelineExecutableInternalRepresentationKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutablePropertiesKHR)(VkDevice device, const VkPipelineInfoKHR* pPipelineInfo, uint32_t* pExecutableCount, VkPipelineExecutablePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutableStatisticsKHR)(VkDevice device, const VkPipelineExecutableInfoKHR* pExecutableInfo, uint32_t* pStatisticCount, VkPipelineExecutableStatisticKHR* pStatistics); +typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutableInternalRepresentationsKHR)(VkDevice device, const VkPipelineExecutableInfoKHR* pExecutableInfo, uint32_t* pInternalRepresentationCount, VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutablePropertiesKHR( + VkDevice device, + const VkPipelineInfoKHR* pPipelineInfo, + uint32_t* pExecutableCount, + VkPipelineExecutablePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableStatisticsKHR( + VkDevice device, + const VkPipelineExecutableInfoKHR* pExecutableInfo, + uint32_t* pStatisticCount, + VkPipelineExecutableStatisticKHR* pStatistics); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableInternalRepresentationsKHR( + VkDevice device, + const VkPipelineExecutableInfoKHR* pExecutableInfo, + uint32_t* pInternalRepresentationCount, + VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations); +#endif + + #define VK_EXT_debug_report 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) #define VK_EXT_DEBUG_REPORT_SPEC_VERSION 9 @@ -6379,7 +6601,7 @@ VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( #define VK_IMG_filter_cubic 1 -#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 2 +#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 #define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" @@ -6606,7 +6828,7 @@ VKAPI_ATTR uint32_t VKAPI_CALL vkGetImageViewHandleNVX( #define VK_AMD_draw_indirect_count 1 -#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 +#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 2 #define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); @@ -6783,7 +7005,7 @@ typedef struct VkExportMemoryAllocateInfoNV { #define VK_EXT_validation_flags 1 -#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1 +#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 2 #define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" typedef enum VkValidationCheckEXT { @@ -6813,6 +7035,17 @@ typedef struct VkValidationFlagsEXT { #define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" +#define VK_EXT_texture_compression_astc_hdr 1 +#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION 1 +#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME "VK_EXT_texture_compression_astc_hdr" +typedef struct VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT { + VkStructureType sType; + const void* pNext; + VkBool32 textureCompressionASTC_HDR; +} VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT; + + + #define VK_EXT_astc_decode_mode 1 #define VK_EXT_ASTC_DECODE_MODE_SPEC_VERSION 1 #define VK_EXT_ASTC_DECODE_MODE_EXTENSION_NAME "VK_EXT_astc_decode_mode" @@ -6831,7 +7064,7 @@ typedef struct VkPhysicalDeviceASTCDecodeFeaturesEXT { #define VK_EXT_conditional_rendering 1 -#define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 1 +#define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 2 #define VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME "VK_EXT_conditional_rendering" typedef enum VkConditionalRenderingFlagBitsEXT { @@ -7463,7 +7696,7 @@ typedef struct VkPipelineRasterizationDepthClipStateCreateInfoEXT { #define VK_EXT_hdr_metadata 1 -#define VK_EXT_HDR_METADATA_SPEC_VERSION 1 +#define VK_EXT_HDR_METADATA_SPEC_VERSION 2 #define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" typedef struct VkXYColorEXT { float x; @@ -7647,7 +7880,7 @@ VKAPI_ATTR void VKAPI_CALL vkSubmitDebugUtilsMessageEXT( #define VK_EXT_sampler_filter_minmax 1 -#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 2 #define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" typedef enum VkSamplerReductionModeEXT { @@ -8230,6 +8463,15 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV) #define VK_NV_RAY_TRACING_EXTENSION_NAME "VK_NV_ray_tracing" #define VK_SHADER_UNUSED_NV (~0U) +typedef enum VkAccelerationStructureTypeNV { + VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV = 0, + VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV = 1, + VK_ACCELERATION_STRUCTURE_TYPE_BEGIN_RANGE_NV = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV, + VK_ACCELERATION_STRUCTURE_TYPE_END_RANGE_NV = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV, + VK_ACCELERATION_STRUCTURE_TYPE_RANGE_SIZE_NV = (VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV + 1), + VK_ACCELERATION_STRUCTURE_TYPE_MAX_ENUM_NV = 0x7FFFFFFF +} VkAccelerationStructureTypeNV; + typedef enum VkRayTracingShaderGroupTypeNV { VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV = 0, VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV = 1, @@ -8249,15 +8491,6 @@ typedef enum VkGeometryTypeNV { VK_GEOMETRY_TYPE_MAX_ENUM_NV = 0x7FFFFFFF } VkGeometryTypeNV; -typedef enum VkAccelerationStructureTypeNV { - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV = 0, - VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV = 1, - VK_ACCELERATION_STRUCTURE_TYPE_BEGIN_RANGE_NV = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV, - VK_ACCELERATION_STRUCTURE_TYPE_END_RANGE_NV = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV, - VK_ACCELERATION_STRUCTURE_TYPE_RANGE_SIZE_NV = (VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV + 1), - VK_ACCELERATION_STRUCTURE_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkAccelerationStructureTypeNV; - typedef enum VkCopyAccelerationStructureModeNV { VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV = 0, VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV = 1, @@ -8525,7 +8758,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCompileDeferredNV( #define VK_NV_representative_fragment_test 1 -#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 1 +#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 2 #define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME "VK_NV_representative_fragment_test" typedef struct VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV { VkStructureType sType; @@ -8542,7 +8775,7 @@ typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV { #define VK_EXT_filter_cubic 1 -#define VK_EXT_FILTER_CUBIC_SPEC_VERSION 1 +#define VK_EXT_FILTER_CUBIC_SPEC_VERSION 2 #define VK_EXT_FILTER_CUBIC_EXTENSION_NAME "VK_EXT_filter_cubic" typedef struct VkPhysicalDeviceImageViewImageFormatInfoEXT { VkStructureType sType; @@ -8629,6 +8862,22 @@ VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarkerAMD( #endif +#define VK_AMD_pipeline_compiler_control 1 +#define VK_AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION 1 +#define VK_AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME "VK_AMD_pipeline_compiler_control" + +typedef enum VkPipelineCompilerControlFlagBitsAMD { + VK_PIPELINE_COMPILER_CONTROL_FLAG_BITS_MAX_ENUM_AMD = 0x7FFFFFFF +} VkPipelineCompilerControlFlagBitsAMD; +typedef VkFlags VkPipelineCompilerControlFlagsAMD; +typedef struct VkPipelineCompilerControlCreateInfoAMD { + VkStructureType sType; + const void* pNext; + VkPipelineCompilerControlFlagsAMD compilerControlFlags; +} VkPipelineCompilerControlCreateInfoAMD; + + + #define VK_EXT_calibrated_timestamps 1 #define VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION 1 #define VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME "VK_EXT_calibrated_timestamps" @@ -8668,7 +8917,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetCalibratedTimestampsEXT( #define VK_AMD_shader_core_properties 1 -#define VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION 1 +#define VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION 2 #define VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_AMD_shader_core_properties" typedef struct VkPhysicalDeviceShaderCorePropertiesAMD { VkStructureType sType; @@ -8858,7 +9107,7 @@ typedef struct VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV { #define VK_NV_shader_image_footprint 1 -#define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 1 +#define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 2 #define VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME "VK_NV_shader_image_footprint" typedef struct VkPhysicalDeviceShaderImageFootprintFeaturesNV { VkStructureType sType; @@ -8927,13 +9176,13 @@ VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointDataNV( #define VK_INTEL_shader_integer_functions2 1 -#define VK_INTEL_SHADER_INTEGER_FUNCTIONS2_SPEC_VERSION 1 -#define VK_INTEL_SHADER_INTEGER_FUNCTIONS2_EXTENSION_NAME "VK_INTEL_shader_integer_functions2" -typedef struct VkPhysicalDeviceShaderIntegerFunctions2INTEL { +#define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION 1 +#define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME "VK_INTEL_shader_integer_functions2" +typedef struct VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL { VkStructureType sType; void* pNext; VkBool32 shaderIntegerFunctions2; -} VkPhysicalDeviceShaderIntegerFunctions2INTEL; +} VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL; @@ -9175,6 +9424,61 @@ typedef struct VkPhysicalDeviceScalarBlockLayoutFeaturesEXT { #define VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME "VK_GOOGLE_decorate_string" +#define VK_EXT_subgroup_size_control 1 +#define VK_EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION 2 +#define VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME "VK_EXT_subgroup_size_control" +typedef struct VkPhysicalDeviceSubgroupSizeControlFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 subgroupSizeControl; + VkBool32 computeFullSubgroups; +} VkPhysicalDeviceSubgroupSizeControlFeaturesEXT; + +typedef struct VkPhysicalDeviceSubgroupSizeControlPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t minSubgroupSize; + uint32_t maxSubgroupSize; + uint32_t maxComputeWorkgroupSubgroups; + VkShaderStageFlags requiredSubgroupSizeStages; +} VkPhysicalDeviceSubgroupSizeControlPropertiesEXT; + +typedef struct VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT { + VkStructureType sType; + void* pNext; + uint32_t requiredSubgroupSize; +} VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT; + + + +#define VK_AMD_shader_core_properties2 1 +#define VK_AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION 1 +#define VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME "VK_AMD_shader_core_properties2" + +typedef enum VkShaderCorePropertiesFlagBitsAMD { + VK_SHADER_CORE_PROPERTIES_FLAG_BITS_MAX_ENUM_AMD = 0x7FFFFFFF +} VkShaderCorePropertiesFlagBitsAMD; +typedef VkFlags VkShaderCorePropertiesFlagsAMD; +typedef struct VkPhysicalDeviceShaderCoreProperties2AMD { + VkStructureType sType; + void* pNext; + VkShaderCorePropertiesFlagsAMD shaderCoreFeatures; + uint32_t activeComputeUnitCount; +} VkPhysicalDeviceShaderCoreProperties2AMD; + + + +#define VK_AMD_device_coherent_memory 1 +#define VK_AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION 1 +#define VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME "VK_AMD_device_coherent_memory" +typedef struct VkPhysicalDeviceCoherentMemoryFeaturesAMD { + VkStructureType sType; + void* pNext; + VkBool32 deviceCoherentMemory; +} VkPhysicalDeviceCoherentMemoryFeaturesAMD; + + + #define VK_EXT_memory_budget 1 #define VK_EXT_MEMORY_BUDGET_SPEC_VERSION 1 #define VK_EXT_MEMORY_BUDGET_EXTENSION_NAME "VK_EXT_memory_budget" @@ -9262,15 +9566,16 @@ typedef struct VkImageStencilUsageCreateInfoEXT { #define VK_EXT_validation_features 1 -#define VK_EXT_VALIDATION_FEATURES_SPEC_VERSION 1 +#define VK_EXT_VALIDATION_FEATURES_SPEC_VERSION 2 #define VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME "VK_EXT_validation_features" typedef enum VkValidationFeatureEnableEXT { VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT = 0, VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT = 1, + VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT = 2, VK_VALIDATION_FEATURE_ENABLE_BEGIN_RANGE_EXT = VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT, - VK_VALIDATION_FEATURE_ENABLE_END_RANGE_EXT = VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT, - VK_VALIDATION_FEATURE_ENABLE_RANGE_SIZE_EXT = (VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT - VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT + 1), + VK_VALIDATION_FEATURE_ENABLE_END_RANGE_EXT = VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT, + VK_VALIDATION_FEATURE_ENABLE_RANGE_SIZE_EXT = (VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT - VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT + 1), VK_VALIDATION_FEATURE_ENABLE_MAX_ENUM_EXT = 0x7FFFFFFF } VkValidationFeatureEnableEXT; @@ -9436,7 +9741,7 @@ typedef struct VkPhysicalDeviceYcbcrImageArraysFeaturesEXT { #define VK_EXT_headless_surface 1 -#define VK_EXT_HEADLESS_SURFACE_SPEC_VERSION 0 +#define VK_EXT_HEADLESS_SURFACE_SPEC_VERSION 1 #define VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME "VK_EXT_headless_surface" typedef VkFlags VkHeadlessSurfaceCreateFlagsEXT; typedef struct VkHeadlessSurfaceCreateInfoEXT { @@ -9456,6 +9761,56 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateHeadlessSurfaceEXT( #endif +#define VK_EXT_line_rasterization 1 +#define VK_EXT_LINE_RASTERIZATION_SPEC_VERSION 1 +#define VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME "VK_EXT_line_rasterization" + +typedef enum VkLineRasterizationModeEXT { + VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT = 0, + VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT = 1, + VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT = 2, + VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT = 3, + VK_LINE_RASTERIZATION_MODE_BEGIN_RANGE_EXT = VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT, + VK_LINE_RASTERIZATION_MODE_END_RANGE_EXT = VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT, + VK_LINE_RASTERIZATION_MODE_RANGE_SIZE_EXT = (VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT - VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT + 1), + VK_LINE_RASTERIZATION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkLineRasterizationModeEXT; +typedef struct VkPhysicalDeviceLineRasterizationFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 rectangularLines; + VkBool32 bresenhamLines; + VkBool32 smoothLines; + VkBool32 stippledRectangularLines; + VkBool32 stippledBresenhamLines; + VkBool32 stippledSmoothLines; +} VkPhysicalDeviceLineRasterizationFeaturesEXT; + +typedef struct VkPhysicalDeviceLineRasterizationPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t lineSubPixelPrecisionBits; +} VkPhysicalDeviceLineRasterizationPropertiesEXT; + +typedef struct VkPipelineRasterizationLineStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkLineRasterizationModeEXT lineRasterizationMode; + VkBool32 stippledLineEnable; + uint32_t lineStippleFactor; + uint16_t lineStipplePattern; +} VkPipelineRasterizationLineStateCreateInfoEXT; + +typedef void (VKAPI_PTR *PFN_vkCmdSetLineStippleEXT)(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetLineStippleEXT( + VkCommandBuffer commandBuffer, + uint32_t lineStippleFactor, + uint16_t lineStipplePattern); +#endif + + #define VK_EXT_host_query_reset 1 #define VK_EXT_HOST_QUERY_RESET_SPEC_VERSION 1 #define VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME "VK_EXT_host_query_reset" @@ -9475,6 +9830,53 @@ VKAPI_ATTR void VKAPI_CALL vkResetQueryPoolEXT( uint32_t queryCount); #endif + +#define VK_EXT_index_type_uint8 1 +#define VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION 1 +#define VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME "VK_EXT_index_type_uint8" +typedef struct VkPhysicalDeviceIndexTypeUint8FeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 indexTypeUint8; +} VkPhysicalDeviceIndexTypeUint8FeaturesEXT; + + + +#define VK_EXT_shader_demote_to_helper_invocation 1 +#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION 1 +#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME "VK_EXT_shader_demote_to_helper_invocation" +typedef struct VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderDemoteToHelperInvocation; +} VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT; + + + +#define VK_EXT_texel_buffer_alignment 1 +#define VK_EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION 1 +#define VK_EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME "VK_EXT_texel_buffer_alignment" +typedef struct VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 texelBufferAlignment; +} VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT; + +typedef struct VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT { + VkStructureType sType; + void* pNext; + VkDeviceSize storageTexelBufferOffsetAlignmentBytes; + VkBool32 storageTexelBufferOffsetSingleTexelAlignment; + VkDeviceSize uniformTexelBufferOffsetAlignmentBytes; + VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; +} VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT; + + + +#define VK_GOOGLE_user_type 1 +#define VK_GOOGLE_USER_TYPE_SPEC_VERSION 1 +#define VK_GOOGLE_USER_TYPE_EXTENSION_NAME "VK_GOOGLE_user_type" + #ifdef __cplusplus } #endif diff --git a/ext/vulkan/vulkan_fuchsia.h b/ext/vulkan/vulkan_fuchsia.h index 4c62a7c2f7..81ebe55d31 100644 --- a/ext/vulkan/vulkan_fuchsia.h +++ b/ext/vulkan/vulkan_fuchsia.h @@ -1,10 +1,6 @@ #ifndef VULKAN_FUCHSIA_H_ #define VULKAN_FUCHSIA_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_FUCHSIA_imagepipe_surface 1 #define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1 diff --git a/ext/vulkan/vulkan_ggp.h b/ext/vulkan/vulkan_ggp.h index 3d67c4b8c1..fd306131c3 100644 --- a/ext/vulkan/vulkan_ggp.h +++ b/ext/vulkan/vulkan_ggp.h @@ -1,10 +1,6 @@ #ifndef VULKAN_GGP_H_ #define VULKAN_GGP_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_GGP_stream_descriptor_surface 1 #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 diff --git a/ext/vulkan/vulkan_ios.h b/ext/vulkan/vulkan_ios.h index 1846df52d5..72ef1a8a82 100644 --- a/ext/vulkan/vulkan_ios.h +++ b/ext/vulkan/vulkan_ios.h @@ -1,10 +1,6 @@ #ifndef VULKAN_IOS_H_ #define VULKAN_IOS_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_MVK_ios_surface 1 #define VK_MVK_IOS_SURFACE_SPEC_VERSION 2 diff --git a/ext/vulkan/vulkan_macos.h b/ext/vulkan/vulkan_macos.h index dca623b042..e6e5deaa36 100644 --- a/ext/vulkan/vulkan_macos.h +++ b/ext/vulkan/vulkan_macos.h @@ -1,10 +1,6 @@ #ifndef VULKAN_MACOS_H_ #define VULKAN_MACOS_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_MVK_macos_surface 1 #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2 diff --git a/ext/vulkan/vulkan_metal.h b/ext/vulkan/vulkan_metal.h index 16505237df..3dec68c771 100644 --- a/ext/vulkan/vulkan_metal.h +++ b/ext/vulkan/vulkan_metal.h @@ -1,10 +1,6 @@ #ifndef VULKAN_METAL_H_ #define VULKAN_METAL_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_EXT_metal_surface 1 diff --git a/ext/vulkan/vulkan_vi.h b/ext/vulkan/vulkan_vi.h index 50aa27dfb9..6fb66f9dd2 100644 --- a/ext/vulkan/vulkan_vi.h +++ b/ext/vulkan/vulkan_vi.h @@ -1,10 +1,6 @@ #ifndef VULKAN_VI_H_ #define VULKAN_VI_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_NN_vi_surface 1 #define VK_NN_VI_SURFACE_SPEC_VERSION 1 diff --git a/ext/vulkan/vulkan_wayland.h b/ext/vulkan/vulkan_wayland.h index 12a5f045c1..599d05b24a 100644 --- a/ext/vulkan/vulkan_wayland.h +++ b/ext/vulkan/vulkan_wayland.h @@ -1,10 +1,6 @@ #ifndef VULKAN_WAYLAND_H_ #define VULKAN_WAYLAND_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_KHR_wayland_surface 1 #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 diff --git a/ext/vulkan/vulkan_win32.h b/ext/vulkan/vulkan_win32.h index a61a7d885c..20a1dc0e58 100644 --- a/ext/vulkan/vulkan_win32.h +++ b/ext/vulkan/vulkan_win32.h @@ -1,10 +1,6 @@ #ifndef VULKAN_WIN32_H_ #define VULKAN_WIN32_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_KHR_win32_surface 1 #define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 @@ -246,7 +247,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( #define VK_NV_win32_keyed_mutex 1 -#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2 #define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { VkStructureType sType; @@ -263,7 +264,7 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { #define VK_EXT_full_screen_exclusive 1 -#define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 3 +#define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4 #define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive" typedef enum VkFullScreenExclusiveEXT { diff --git a/ext/vulkan/vulkan_xcb.h b/ext/vulkan/vulkan_xcb.h index 7d6905d2d6..4cc0bc0cec 100644 --- a/ext/vulkan/vulkan_xcb.h +++ b/ext/vulkan/vulkan_xcb.h @@ -1,10 +1,6 @@ #ifndef VULKAN_XCB_H_ #define VULKAN_XCB_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_KHR_xcb_surface 1 #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 diff --git a/ext/vulkan/vulkan_xlib.h b/ext/vulkan/vulkan_xlib.h index 7a05d297df..ee2b48accb 100644 --- a/ext/vulkan/vulkan_xlib.h +++ b/ext/vulkan/vulkan_xlib.h @@ -1,10 +1,6 @@ #ifndef VULKAN_XLIB_H_ #define VULKAN_XLIB_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_KHR_xlib_surface 1 #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 diff --git a/ext/vulkan/vulkan_xlib_xrandr.h b/ext/vulkan/vulkan_xlib_xrandr.h index 3a20953083..08c4fd729c 100644 --- a/ext/vulkan/vulkan_xlib_xrandr.h +++ b/ext/vulkan/vulkan_xlib_xrandr.h @@ -1,10 +1,6 @@ #ifndef VULKAN_XLIB_XRANDR_H_ #define VULKAN_XLIB_XRANDR_H_ 1 -#ifdef __cplusplus -extern "C" { -#endif - /* ** Copyright (c) 2015-2019 The Khronos Group Inc. ** @@ -27,6 +23,11 @@ extern "C" { */ +#ifdef __cplusplus +extern "C" { +#endif + + #define VK_EXT_acquire_xlib_display 1 #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 From 7481a5e810ae3941bafb3f82a3a09a0be6df8bfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 24 Sep 2019 23:07:54 +0200 Subject: [PATCH 23/43] Update lang submodule --- assets/lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/lang b/assets/lang index 8ded8b378c..bfc3a511f6 160000 --- a/assets/lang +++ b/assets/lang @@ -1 +1 @@ -Subproject commit 8ded8b378ca86ce9509a9bdfb3ab19290a980048 +Subproject commit bfc3a511f60e84de4d49170e2c442ac36b09cdfd From 9d65ff8873d6120987ddb022b6728b7d8b8f900f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 24 Sep 2019 23:10:18 +0200 Subject: [PATCH 24/43] Silence a few warnings. --- GPU/Common/FramebufferCommon.cpp | 2 ++ android/AndroidManifest.xml | 1 + ext/native/thin3d/thin3d_gl.cpp | 19 ++++++++++--------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index 337bdd9646..e353835bcb 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -1381,6 +1381,8 @@ VirtualFramebuffer *FramebufferManagerCommon::CreateRAMFramebuffer(uint32_t fbAd float renderWidthFactor = renderWidth_ / 480.0f; float renderHeightFactor = renderHeight_ / 272.0f; + DEBUG_LOG(G3D, "Creating RAM framebuffer at %08x (%dx%d, stride %d, format %d)", fbAddress, width, height, stride, format); + // A target for the destination is missing - so just create one! // Make sure this one would be found by the algorithm above so we wouldn't // create a new one each frame. diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 246814efd8..e62d075e4b 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -6,6 +6,7 @@ android:versionName="1.8.0.0"> + diff --git a/ext/native/thin3d/thin3d_gl.cpp b/ext/native/thin3d/thin3d_gl.cpp index a94b318bbb..c570611fcd 100644 --- a/ext/native/thin3d/thin3d_gl.cpp +++ b/ext/native/thin3d/thin3d_gl.cpp @@ -256,7 +256,7 @@ public: private: GLRenderManager *render_; ShaderStage stage_; - ShaderLanguage language_; + ShaderLanguage language_ = ShaderLanguage::GLSL_ES_200; GLRShader *shader_ = nullptr; GLuint glstage_ = 0; std::string source_; // So we can recompile in case of context loss. @@ -277,7 +277,7 @@ bool OpenGLShaderModule::Compile(GLRenderManager *render, ShaderLanguage languag class OpenGLInputLayout : public InputLayout { public: - OpenGLInputLayout(GLRenderManager *render) : render_(render) {} + OpenGLInputLayout(GLRenderManager *render) : render_(render), stride(0) {} ~OpenGLInputLayout(); void Compile(const InputLayoutDesc &desc); @@ -285,7 +285,7 @@ public: return false; } - GLRInputLayout *inputLayout_; + GLRInputLayout *inputLayout_ = nullptr; int stride; private: GLRenderManager *render_; @@ -313,7 +313,7 @@ public: return inputLayout->RequiresBuffer(); } - GLuint prim; + GLuint prim = 0; std::vector shaders; OpenGLInputLayout *inputLayout = nullptr; OpenGLDepthStencilState *depthStencil = nullptr; @@ -322,8 +322,8 @@ public: // TODO: Optimize by getting the locations first and putting in a custom struct UniformBufferDesc dynamicUniforms; - GLRProgram *program_ = nullptr; + private: GLRenderManager *render_; }; @@ -501,7 +501,7 @@ private: struct FrameData { GLPushBuffer *push; }; - FrameData frameData_[GLRenderManager::MAX_INFLIGHT_FRAMES]; + FrameData frameData_[GLRenderManager::MAX_INFLIGHT_FRAMES]{}; }; static constexpr int MakeIntelSimpleVer(int v1, int v2, int v3) { @@ -713,9 +713,9 @@ public: } GLRenderManager *render_; - GLRFramebuffer *framebuffer; + GLRFramebuffer *framebuffer = nullptr; - FBColorDepth colorDepth; + FBColorDepth colorDepth = FBO_8888; }; void OpenGLTexture::SetImageData(int x, int y, int z, int width, int height, int depth, int level, int stride, const uint8_t *data) { @@ -738,7 +738,7 @@ void OpenGLTexture::SetImageData(int x, int y, int z, int width, int height, int stride = width; // Make a copy of data with stride eliminated. - uint8_t *texData = new uint8_t[width * height * alignment]; + uint8_t *texData = new uint8_t[(size_t)(width * height * alignment)]; for (int y = 0; y < height; y++) { memcpy(texData + y * width * alignment, data + y * stride * alignment, width * alignment); } @@ -932,6 +932,7 @@ Pipeline *OpenGLContext::CreateGraphicsPipeline(const PipelineDesc &desc) { return nullptr; } } + ILOG("Linking shaders."); if (pipeline->LinkShaders()) { // Build the rest of the virtual pipeline object. pipeline->prim = primToGL[(int)desc.prim]; From f3b84fd8a4e997936f9e6ef7368626654c694d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 24 Sep 2019 23:43:59 +0200 Subject: [PATCH 25/43] Android: Fix crashes on Android versions < 11 due to mCameraHelper being null --- android/src/org/ppsspp/ppsspp/NativeActivity.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/android/src/org/ppsspp/ppsspp/NativeActivity.java b/android/src/org/ppsspp/ppsspp/NativeActivity.java index 0c67046bc0..2a70b05e56 100644 --- a/android/src/org/ppsspp/ppsspp/NativeActivity.java +++ b/android/src/org/ppsspp/ppsspp/NativeActivity.java @@ -740,7 +740,9 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C Log.e(TAG, "mGLSurfaceView really shouldn't be null in onPause"); } } - mCameraHelper.pause(); + if (mCameraHelper != null) { + mCameraHelper.pause(); + } Log.i(TAG, "onPause completed"); } @@ -780,7 +782,9 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C mSurfaceView.onResume(); } } - mCameraHelper.resume(); + if (mCameraHelper != null) { + mCameraHelper.resume(); + } gainAudioFocus(this.audioManager, this.audioFocusChangeListener); NativeApp.resume(); @@ -1339,7 +1343,9 @@ public abstract class NativeActivity extends Activity implements SurfaceHolder.C } } else if (command.equals("event")) { if (params.equals("exitgame")) { - mCameraHelper.stopCamera(); + if (mCameraHelper != null) { + mCameraHelper.stopCamera(); + } } } return false; From 4f07db87d8b8e9386c59fd7384f433e5fd137ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 25 Sep 2019 20:21:46 +0200 Subject: [PATCH 26/43] Symbolic 1.9.0 commit --- android/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index e62d075e4b..5db57481f8 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="19000000" + android:versionName="1.9.0.0"> From 97194ee642965fac7619d3d3101540e48c7acdd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 25 Sep 2019 22:47:46 +0200 Subject: [PATCH 27/43] Symbolic commit for 1.9.1. This one is only to get around a Google Play issue. --- README.md | 4 ++-- android/AndroidManifest.xml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index db53fa6a01..a9fe7f9dd2 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ For build instructions and other development tutorials, see [the wiki](https://g For game compatibility, see [community compatibility feedback](https://report.ppsspp.org/games). -What's new in 1.9.0 -------------------- +What's new in 1.9.0/1.9.1 +------------------------- * Flicker fixed in God of War that appeared with newer drivers for Mali GPUs (#12224) * Improve performance of God of War on Vulkan (#12242), implement built-in GPU profiler (#12262, #12266) * Vertex range culling fixed on ARM Mali (#12227) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 5db57481f8..9d91ae39d0 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="19010000" + android:versionName="1.9.1.0"> From bc492672b9bfc34e7e1ed65f29e4daa14e44a406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tam=C3=A1s?= Date: Wed, 25 Sep 2019 23:20:46 +0200 Subject: [PATCH 28/43] Listed additional UMD serials for GTA titles --- assets/compat.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/compat.ini b/assets/compat.ini index 301869bcf0..662e3b0e25 100644 --- a/assets/compat.ini +++ b/assets/compat.ini @@ -266,6 +266,7 @@ ULES00108 = true # GTA : VCS ULUS10160 = true ULES00502 = true +ULES00503 = true ULJM05297 = true ULJM05395 = true ULJM05884 = true @@ -273,10 +274,12 @@ NPJH50827 = true # GTA : LCS ULUS10041 = true ULES00151 = true +ULES00182 = true ULJM05255 = true ULJM05359 = true ULJM05885 = true NPJH50825 = true +ULKS46157 = true # GOW : JP/Korean UCJS10114 = true UCKS45084 = true From f74e4289eef72a76bb2752b6534a27200b29c9fb Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Wed, 25 Sep 2019 23:36:01 -0700 Subject: [PATCH 29/43] Debugger: reset step counter on game stop. This way we ensure that a game reset will retrigger a stepping notification. --- Core/Debugger/WebSocket/SteppingBroadcaster.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/Debugger/WebSocket/SteppingBroadcaster.cpp b/Core/Debugger/WebSocket/SteppingBroadcaster.cpp index bde51e1f2f..7d9b224928 100644 --- a/Core/Debugger/WebSocket/SteppingBroadcaster.cpp +++ b/Core/Debugger/WebSocket/SteppingBroadcaster.cpp @@ -56,6 +56,7 @@ void SteppingBroadcaster::Broadcast(net::WebSocketServer *ws) { lastCounter_ = steppingCounter; prevState_ = coreState; } else { + lastCounter_ = -1; prevState_ = CORE_POWERDOWN; } } From a484fab91961b669435b0f3c8845994885c48daf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 26 Sep 2019 18:26:50 +0200 Subject: [PATCH 30/43] Symbolic commit for 1.9.2. Making another submission attempt to Google play so have to increment the version. --- android/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml index 9d91ae39d0..29b3bd3f75 100644 --- a/android/AndroidManifest.xml +++ b/android/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="19020000" + android:versionName="1.9.2.0"> From ccf63ef5443031b8aa86eb8600ec2ad497ba41c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2019 22:55:39 +0200 Subject: [PATCH 31/43] Fix crash in zip handling --- Core/Util/GameManager.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Core/Util/GameManager.cpp b/Core/Util/GameManager.cpp index b2fc34767e..f73fe3f316 100644 --- a/Core/Util/GameManager.cpp +++ b/Core/Util/GameManager.cpp @@ -431,6 +431,11 @@ bool GameManager::ExtractFile(struct zip *z, int file_index, std::string outFile } zip_file *zf = zip_fopen_index(z, file_index, 0); + if (!zf) { + ERROR_LOG(HLE, "Failed to open file by index (%d) (%s)", file_index, outFilename.c_str()); + return false; + } + FILE *f = File::OpenCFile(outFilename, "wb"); if (f) { size_t pos = 0; From a461dbeecb557af2f99413873595275c585e7e37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2019 22:56:06 +0200 Subject: [PATCH 32/43] Fix crash in Zip UI. Make another crash happen earlier. --- Core/SaveState.cpp | 4 ++-- UI/InstallZipScreen.cpp | 9 ++++++--- UI/NativeApp.cpp | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Core/SaveState.cpp b/Core/SaveState.cpp index 94595f432c..eaca6b42df 100644 --- a/Core/SaveState.cpp +++ b/Core/SaveState.cpp @@ -630,9 +630,9 @@ namespace SaveState // Okay, first, let's give the rewind state a shot - maybe we can at least not reset entirely. // Even if this was a rewind, maybe we can still load a previous one. CChunkFileReader::Error result; - do + do { result = rewindStates.Restore(); - while (result == CChunkFileReader::ERROR_BROKEN_STATE); + } while (result == CChunkFileReader::ERROR_BROKEN_STATE); if (result == CChunkFileReader::ERROR_NONE) { return true; diff --git a/UI/InstallZipScreen.cpp b/UI/InstallZipScreen.cpp index 79908e8ac6..1af1e85dc7 100644 --- a/UI/InstallZipScreen.cpp +++ b/UI/InstallZipScreen.cpp @@ -110,12 +110,15 @@ void InstallZipScreen::update() { using namespace UI; if (g_GameManager.GetState() != GameManagerState::IDLE) { - progressBar_->SetVisibility(V_VISIBLE); - progressBar_->SetProgress(g_GameManager.GetCurrentInstallProgressPercentage()); + if (progressBar_) { + progressBar_->SetVisibility(V_VISIBLE); + progressBar_->SetProgress(g_GameManager.GetCurrentInstallProgressPercentage()); + } backChoice_->SetEnabled(false); } else { - if (progressBar_) + if (progressBar_) { progressBar_->SetVisibility(V_GONE); + } backChoice_->SetEnabled(true); std::string err = g_GameManager.GetInstallError(); if (!err.empty()) { diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 392da5b128..da9d928766 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -780,6 +780,7 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { using namespace Draw; Core_SetGraphicsContext(graphicsContext); g_draw = graphicsContext->GetDrawContext(); + _assert_msg_(G3D, g_draw->GetVshaderPreset(VS_COLOR_2D) != nullptr, "Failed to compile presets"); _assert_msg_(G3D, g_draw, "No draw context available!"); ui_draw2d.SetAtlas(&ui_atlas); From 553ea23c34b5430d896238981db0855d87c52a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2019 22:58:18 +0200 Subject: [PATCH 33/43] Add memory range checks to a few little-used sysclib functions. Might help #12359. --- Core/HLE/sceKernelInterrupt.cpp | 41 ++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/Core/HLE/sceKernelInterrupt.cpp b/Core/HLE/sceKernelInterrupt.cpp index 862e9eeb8d..2674a7b2fa 100644 --- a/Core/HLE/sceKernelInterrupt.cpp +++ b/Core/HLE/sceKernelInterrupt.cpp @@ -692,41 +692,66 @@ static u32 sysclib_memcpy(u32 dst, u32 src, u32 size) { static u32 sysclib_strcat(u32 dst, u32 src) { ERROR_LOG(SCEKERNEL, "Untested sysclib_strcat(dest=%08x, src=%08x)", dst, src); - strcat((char *)Memory::GetPointer(dst), (char *)Memory::GetPointer(src)); + if (Memory::IsValidAddress(dst) && Memory::IsValidAddress(src)) { + strcat((char *)Memory::GetPointer(dst), (char *)Memory::GetPointer(src)); + } return dst; } static int sysclib_strcmp(u32 dst, u32 src) { ERROR_LOG(SCEKERNEL, "Untested sysclib_strcmp(dest=%08x, src=%08x)", dst, src); - return strcmp((char *)Memory::GetPointer(dst), (char *)Memory::GetPointer(src)); + if (Memory::IsValidAddress(dst) && Memory::IsValidAddress(src)) { + return strcmp((char *)Memory::GetPointer(dst), (char *)Memory::GetPointer(src)); + } else { + // What to do? Crash, probably. + return 0; + } } static u32 sysclib_strcpy(u32 dst, u32 src) { ERROR_LOG(SCEKERNEL, "Untested sysclib_strcpy(dest=%08x, src=%08x)", dst, src); - strcpy((char *)Memory::GetPointer(dst), (char *)Memory::GetPointer(src)); + if (Memory::IsValidAddress(dst) && Memory::IsValidAddress(src)) { + strcpy((char *)Memory::GetPointer(dst), (char *)Memory::GetPointer(src)); + } return dst; } static u32 sysclib_strlen(u32 src) { ERROR_LOG(SCEKERNEL, "Untested sysclib_strlen(src=%08x)", src); - return (u32)strlen(Memory::GetCharPointer(src)); + if (Memory::IsValidAddress(src)) { + return (u32)strlen(Memory::GetCharPointer(src)); + } else { + // What to do? Crash, probably. + return 0; + } } static int sysclib_memcmp(u32 dst, u32 src, u32 size) { ERROR_LOG(SCEKERNEL, "Untested sysclib_memcmp(dest=%08x, src=%08x, size=%i)", dst, src, size); - return memcmp(Memory::GetCharPointer(dst), Memory::GetCharPointer(src), size); + if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) { + return memcmp(Memory::GetCharPointer(dst), Memory::GetCharPointer(src), size); + } else { + // What to do? Crash, probably. + return 0; + } } static int sysclib_sprintf(u32 dst, u32 fmt) { ERROR_LOG(SCEKERNEL, "Unimpl sysclib_sprintf(dest=%08x, src=%08x)", dst, fmt); - // TODO - return sprintf((char *)Memory::GetPointer(dst), "%s", Memory::GetCharPointer(fmt)); + if (Memory::IsValidAddress(dst) && Memory::IsValidAddress(fmt)) { + // TODO: Properly use the format string with more parameters. + return sprintf((char *)Memory::GetPointer(dst), "%s", Memory::GetCharPointer(fmt)); + } else { + // What to do? Crash, probably. + return 0; + } } static u32 sysclib_memset(u32 destAddr, int data, int size) { ERROR_LOG(SCEKERNEL, "Untested sysclib_memset(dest=%08x, data=%d ,size=%d)", destAddr, data, size); - if (Memory::IsValidAddress(destAddr)) + if (Memory::IsValidRange(destAddr, size)) { memset(Memory::GetPointer(destAddr), data, size); + } return 0; } From 382d5a6b954d1b39b583890edb385d8698fed9ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2019 23:08:35 +0200 Subject: [PATCH 34/43] Blind attempt at fixing an OpenSL ES crash --- android/jni/native-audio-so.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/android/jni/native-audio-so.cpp b/android/jni/native-audio-so.cpp index 63a3456395..e27e779329 100644 --- a/android/jni/native-audio-so.cpp +++ b/android/jni/native-audio-so.cpp @@ -71,6 +71,7 @@ bool OpenSLContext::Init() { result = slCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL); if (result != SL_RESULT_SUCCESS) { ELOG("OpenSL ES: Failed to create the engine: %d", (int)result); + engineObject = nullptr; return false; } result = (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); @@ -78,7 +79,13 @@ bool OpenSLContext::Init() { result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); assert(SL_RESULT_SUCCESS == result); result = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, 0, 0); - assert(SL_RESULT_SUCCESS == result); + if (result != SL_RESULT_SUCCESS) { + ELOG("OpenSL ES: Failed to create output mix: %d", (int)result); + (*engineObject)->Destroy(engineObject); + engineEngine = nullptr; + engineObject = nullptr; + return false; + } result = (*outputMixObject)->Realize(outputMixObject, SL_BOOLEAN_FALSE); assert(SL_RESULT_SUCCESS == result); @@ -108,7 +115,13 @@ bool OpenSLContext::Init() { result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req); if (result != SL_RESULT_SUCCESS) { ELOG("OpenSL ES: CreateAudioPlayer failed: %d", (int)result); + (*outputMixObject)->Destroy(outputMixObject); + outputMixObject = nullptr; + // Should really tear everything down here. Sigh. + (*engineObject)->Destroy(engineObject); + engineEngine = nullptr; + engineObject = nullptr; return false; } From 9c4649d3ac129e4d4c0d3993d6c30d83dec396dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2019 23:25:30 +0200 Subject: [PATCH 35/43] Assorted cleanup --- GPU/Common/TextureCacheCommon.cpp | 2 +- UI/GameInfoCache.h | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index a5e6951559..ce9c8fbe23 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -1219,7 +1219,6 @@ void TextureCacheCommon::DecodeTextureLevel(u8 *out, int outPitch, GETextureForm case GE_CMODE_16BIT_ABGR5551: case GE_CMODE_16BIT_ABGR4444: { - const u16 *clut = GetCurrentClut() + clutSharingOffset; if (clutAlphaLinear_ && mipmapShareClut && !expandTo32bit) { // Here, reverseColors means the CLUT is already reversed. if (reverseColors) { @@ -1232,6 +1231,7 @@ void TextureCacheCommon::DecodeTextureLevel(u8 *out, int outPitch, GETextureForm } } } else { + const u16 *clut = GetCurrentClut() + clutSharingOffset; if (expandTo32bit && !reverseColors) { // We simply expand the CLUT to 32-bit, then we deindex as usual. Probably the fastest way. ConvertFormatToRGBA8888(clutformat, expandClut_, clut, 16); diff --git a/UI/GameInfoCache.h b/UI/GameInfoCache.h index 90419444fd..236d680595 100644 --- a/UI/GameInfoCache.h +++ b/UI/GameInfoCache.h @@ -61,12 +61,6 @@ class FileLoader; enum class IdentifiedFileType; struct GameInfoTex { - GameInfoTex() {} - ~GameInfoTex() { - if (texture) { - ELOG("LEAKED GameInfoTex"); - } - } std::string data; std::unique_ptr texture; // The time at which the Icon and the BG were loaded. @@ -81,8 +75,6 @@ struct GameInfoTex { } texture.reset(nullptr); } -private: - DISALLOW_COPY_AND_ASSIGN(GameInfoTex); }; class GameInfo { From 701d740207985ec8c4cf2818311a0d5cc7901414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2019 23:34:36 +0200 Subject: [PATCH 36/43] Add a comment. See issue #12365 --- UI/BackgroundAudio.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index 53c5b9103f..fb4ec84478 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -288,6 +288,7 @@ int PlayBackgroundAudio() { if (!g_gameInfoCache) return 0; // race condition? + // This is very unsafe! TODO: Get rid of this somehow or make threadsafe! std::shared_ptr gameInfo = g_gameInfoCache->GetInfo(NULL, bgGamePath, GAMEINFO_WANTSND); if (!gameInfo) return 0; From 22ee875ffc2fa5d6789ca512bd5b9208b919818d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 27 Sep 2019 23:53:31 +0200 Subject: [PATCH 37/43] Fix nasty race condition with menu background audio. Fixes #12365 --- UI/BackgroundAudio.cpp | 60 +++++++++++++++++++++++------------------- UI/BackgroundAudio.h | 1 + UI/GameInfoCache.cpp | 1 + UI/NativeApp.cpp | 6 +++++ 4 files changed, 41 insertions(+), 27 deletions(-) diff --git a/UI/BackgroundAudio.cpp b/UI/BackgroundAudio.cpp index fb4ec84478..f5bdd81da4 100644 --- a/UI/BackgroundAudio.cpp +++ b/UI/BackgroundAudio.cpp @@ -223,7 +223,7 @@ private: SimpleAudio *decoder_ = nullptr; }; -static std::mutex bgMutex; +static std::mutex g_bgMutex; static std::string bgGamePath; static int playbackOffset; static AT3PlusReader *at3Reader; @@ -251,7 +251,7 @@ static void ClearBackgroundAudio(bool hard) { void SetBackgroundAudioGame(const std::string &path) { time_update(); - std::lock_guard lock(bgMutex); + std::lock_guard lock(g_bgMutex); if (path == bgGamePath) { // Do nothing return; @@ -272,7 +272,7 @@ void SetBackgroundAudioGame(const std::string &path) { int PlayBackgroundAudio() { time_update(); - std::lock_guard lock(bgMutex); + std::lock_guard lock(g_bgMutex); // Immediately stop the sound if it is turned off while playing. if (!g_Config.bEnableSound) { @@ -281,30 +281,6 @@ int PlayBackgroundAudio() { return 0; } - // If there's a game, and some time has passed since the selected game - // last changed... (to prevent crazy amount of reads when skipping through a list) - if (!at3Reader && bgGamePath.size() && (time_now_d() - gameLastChanged > 0.5)) { - // Grab some audio from the current game and play it. - if (!g_gameInfoCache) - return 0; // race condition? - - // This is very unsafe! TODO: Get rid of this somehow or make threadsafe! - std::shared_ptr gameInfo = g_gameInfoCache->GetInfo(NULL, bgGamePath, GAMEINFO_WANTSND); - if (!gameInfo) - return 0; - - if (gameInfo->pending) { - // Should try again shortly.. - return 0; - } - - if (gameInfo->sndFileData.size()) { - const std::string &data = gameInfo->sndFileData; - at3Reader = new AT3PlusReader(data); - lastPlaybackTime = 0.0; - } - } - double now = time_now(); if (at3Reader) { int sz = lastPlaybackTime <= 0.0 ? 44100 / 60 : (int)((now - lastPlaybackTime) * 44100); @@ -336,3 +312,33 @@ int PlayBackgroundAudio() { return 0; } + +// Stuff that should be on the UI thread only, like anything to do with +// g_gameInfoCache. +void UpdateBackgroundAudio() { + // If there's a game, and some time has passed since the selected game + // last changed... (to prevent crazy amount of reads when skipping through a list) + if (bgGamePath.size() && (time_now_d() - gameLastChanged > 0.5)) { + std::lock_guard lock(g_bgMutex); + if (!at3Reader) { + // Grab some audio from the current game and play it. + if (!g_gameInfoCache) + return; + + std::shared_ptr gameInfo = g_gameInfoCache->GetInfo(NULL, bgGamePath, GAMEINFO_WANTSND); + if (!gameInfo) + return; + + if (gameInfo->pending) { + // Should try again shortly.. + return; + } + + if (gameInfo->sndFileData.size()) { + const std::string &data = gameInfo->sndFileData; + at3Reader = new AT3PlusReader(data); + lastPlaybackTime = 0.0; + } + } + } +} diff --git a/UI/BackgroundAudio.h b/UI/BackgroundAudio.h index 34b5dbd04a..5d9ae1e040 100644 --- a/UI/BackgroundAudio.h +++ b/UI/BackgroundAudio.h @@ -4,3 +4,4 @@ void SetBackgroundAudioGame(const std::string &path); int PlayBackgroundAudio(); +void UpdateBackgroundAudio(); diff --git a/UI/GameInfoCache.cpp b/UI/GameInfoCache.cpp index 2ccdd7f6ed..8402eea6ee 100644 --- a/UI/GameInfoCache.cpp +++ b/UI/GameInfoCache.cpp @@ -734,6 +734,7 @@ void GameInfoCache::WaitUntilDone(std::shared_ptr &info) { // Runs on the main thread. Only call from render() and similar, not update()! +// Can also be called from the audio thread for menu background music. std::shared_ptr GameInfoCache::GetInfo(Draw::DrawContext *draw, const std::string &gamePath, int wantFlags) { std::shared_ptr info; diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index da9d928766..03c920bee9 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -959,6 +959,12 @@ void RenderOverlays(UIContext *dc, void *userdata) { void NativeRender(GraphicsContext *graphicsContext) { g_GameManager.Update(); + if (GetUIState() != UISTATE_INGAME) { + // Note: We do this from NativeRender so that the graphics context is + // guaranteed valid, to be safe - g_gameInfoCache messes around with textures. + UpdateBackgroundAudio(); + } + float xres = dp_xres; float yres = dp_yres; From 9e7625c74b8394efb370802b433cbd969f9642e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sat, 28 Sep 2019 01:11:06 +0200 Subject: [PATCH 38/43] Workaround for a crash found in #12358 on older devices --- GPU/GLES/FramebufferManagerGLES.cpp | 13 +++++++++---- ext/native/thin3d/GLRenderManager.h | 4 ++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/GPU/GLES/FramebufferManagerGLES.cpp b/GPU/GLES/FramebufferManagerGLES.cpp index b34c4b5572..b2d814bb05 100644 --- a/GPU/GLES/FramebufferManagerGLES.cpp +++ b/GPU/GLES/FramebufferManagerGLES.cpp @@ -458,10 +458,15 @@ void FramebufferManagerGLES::DrawActiveTexture(float x, float y, float w, float uint32_t bindOffset; GLRBuffer *buffer; - void *dest = drawEngineGL_->GetPushVertexBuffer()->Push(sizeof(verts), &bindOffset, &buffer); - memcpy(dest, verts, sizeof(verts)); - render_->BindVertexBuffer(simple2DInputLayout_, buffer, bindOffset); - render_->Draw(GL_TRIANGLE_STRIP, 0, 4); + + // Workaround: This might accidentally get called from ReportScreen screenshot-taking, and in that case + // the push buffer is not mapped. This only happens if framebuffer blit support is not available. + if (drawEngineGL_->GetPushVertexBuffer()->IsReady()) { + void *dest = drawEngineGL_->GetPushVertexBuffer()->Push(sizeof(verts), &bindOffset, &buffer); + memcpy(dest, verts, sizeof(verts)); + render_->BindVertexBuffer(simple2DInputLayout_, buffer, bindOffset); + render_->Draw(GL_TRIANGLE_STRIP, 0, 4); + } } void FramebufferManagerGLES::ReformatFramebufferFrom(VirtualFramebuffer *vfb, GEBufferFormat old) { diff --git a/ext/native/thin3d/GLRenderManager.h b/ext/native/thin3d/GLRenderManager.h index 7b38c024e8..7fa35e8231 100644 --- a/ext/native/thin3d/GLRenderManager.h +++ b/ext/native/thin3d/GLRenderManager.h @@ -232,6 +232,10 @@ public: void Map(); void Unmap(); + bool IsReady() const { + return writePtr_ != nullptr; + } + // When using the returned memory, make sure to bind the returned vkbuf. // This will later allow for handling overflow correctly. size_t Allocate(size_t numBytes, GLRBuffer **vkbuf) { From bdd20296238b0bcc94b50847a44795733beb0dcc Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 28 Sep 2019 08:40:41 -0700 Subject: [PATCH 39/43] Core: Fix memory range guard check. Was allowing sizes with the high bits set, which could cause all kinds of weird issues and crashes. --- Core/MemMap.h | 17 ++++------ GPU/Common/FramebufferCommon.cpp | 2 +- unittest/UnitTest.cpp | 57 +++++++++++++++++++++++++++++--- 3 files changed, 60 insertions(+), 16 deletions(-) diff --git a/Core/MemMap.h b/Core/MemMap.h index 39cb86109f..28c635c181 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -306,16 +306,13 @@ inline bool IsValidAddress(const u32 address) { inline u32 ValidSize(const u32 address, const u32 requested_size) { u32 max_size; if ((address & 0x3E000000) == 0x08000000) { - max_size = 0x08000000 + g_MemorySize - address; - } - else if ((address & 0x3F800000) == 0x04000000) { - max_size = 0x04800000 - address; - } - else if ((address & 0xBFFF0000) == 0x00010000) { - max_size = 0x00014000 - address; - } - else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { - max_size = 0x08000000 + g_MemorySize - address; + max_size = 0x08000000 + g_MemorySize - (address & 0x3E000000); + } else if ((address & 0x3F800000) == 0x04000000) { + max_size = 0x04800000 - (address & 0x3F800000); + } else if ((address & 0xBFFF0000) == 0x00010000) { + max_size = 0x00014000 - (address & 0xBFFF0000); + } else if ((address & 0x3F000000) >= 0x08000000 && (address & 0x3F000000) < 0x08000000 + g_MemorySize) { + max_size = 0x08000000 + g_MemorySize - (address & 0x3F000000); } else { max_size = 0; } diff --git a/GPU/Common/FramebufferCommon.cpp b/GPU/Common/FramebufferCommon.cpp index e353835bcb..696dbbc2cb 100644 --- a/GPU/Common/FramebufferCommon.cpp +++ b/GPU/Common/FramebufferCommon.cpp @@ -1409,7 +1409,7 @@ VirtualFramebuffer *FramebufferManagerCommon::CreateRAMFramebuffer(uint32_t fbAd vfb->fbo = draw_->CreateFramebuffer({ vfb->renderWidth, vfb->renderHeight, 1, 1, true, (Draw::FBColorDepth)vfb->colorDepth }); vfbs_.push_back(vfb); - size_t byteSize = ColorBufferByteSize(vfb); + u32 byteSize = ColorBufferByteSize(vfb); if (fbAddress + byteSize > framebufRangeEnd_) { framebufRangeEnd_ = fbAddress + byteSize; } diff --git a/unittest/UnitTest.cpp b/unittest/UnitTest.cpp index b07feb5bb2..8e0d47f122 100644 --- a/unittest/UnitTest.cpp +++ b/unittest/UnitTest.cpp @@ -31,9 +31,6 @@ #include #include -#include "Common/BitScan.h" -#include "Core/MIPS/MIPSVFPUUtils.h" - #include "base/NativeApp.h" #include "base/logging.h" #include "input/input_state.h" @@ -41,11 +38,13 @@ #include "math/math_util.h" #include "util/text/parsers.h" -#include "Common/CPUDetect.h" #include "Common/ArmEmitter.h" +#include "Common/BitScan.h" +#include "Common/CPUDetect.h" #include "Core/Config.h" -#include "Core/MIPS/MIPSVFPUUtils.h" #include "Core/FileSystems/ISOFileSystem.h" +#include "Core/MemMap.h" +#include "Core/MIPS/MIPSVFPUUtils.h" #include "GPU/Common/TextureDecoder.h" #include "unittest/JitHarness.h" @@ -485,6 +484,53 @@ bool TestCLZ() { return true; } +static bool TestMemMap() { + Memory::g_MemorySize = Memory::RAM_DOUBLE_SIZE; + + enum class Flags { + NO_KERNEL = 0, + ALLOW_KERNEL = 1, + }; + struct Range { + uint32_t base; + uint32_t size; + Flags flags; + }; + static const Range ranges[] = { + { 0x08000000, Memory::RAM_DOUBLE_SIZE, Flags::ALLOW_KERNEL }, + { 0x00010000, Memory::SCRATCHPAD_SIZE, Flags::NO_KERNEL }, + { 0x04000000, 0x00800000, Flags::NO_KERNEL }, + }; + static const uint32_t extraBits[] = { + 0x00000000, + 0x40000000, + 0x80000000, + }; + + for (const auto &range : ranges) { + size_t testBits = range.flags == Flags::ALLOW_KERNEL ? 3 : 2; + for (size_t i = 0; i < testBits; ++i) { + uint32_t base = range.base | extraBits[i]; + + EXPECT_TRUE(Memory::IsValidAddress(base)); + EXPECT_TRUE(Memory::IsValidAddress(base + range.size - 1)); + EXPECT_FALSE(Memory::IsValidAddress(base + range.size)); + EXPECT_FALSE(Memory::IsValidAddress(base - 1)); + + EXPECT_EQ_HEX(Memory::ValidSize(base, range.size), range.size); + EXPECT_EQ_HEX(Memory::ValidSize(base, range.size + 1), range.size); + EXPECT_EQ_HEX(Memory::ValidSize(base, range.size - 1), range.size - 1); + EXPECT_EQ_HEX(Memory::ValidSize(base, 0), 0); + EXPECT_EQ_HEX(Memory::ValidSize(base, 0x80000001), range.size); + EXPECT_EQ_HEX(Memory::ValidSize(base, 0x40000001), range.size); + EXPECT_EQ_HEX(Memory::ValidSize(base, 0x20000001), range.size); + EXPECT_EQ_HEX(Memory::ValidSize(base, 0x10000001), range.size); + } + } + + return true; +} + typedef bool (*TestFunc)(); struct TestItem { const char *name; @@ -518,6 +564,7 @@ TestItem availableTests[] = { TEST_ITEM(ParseLBN), TEST_ITEM(QuickTexHash), TEST_ITEM(CLZ), + TEST_ITEM(MemMap), }; int main(int argc, const char *argv[]) { From cba6a63058dbfb067650f136a0556519d1072107 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 28 Sep 2019 15:08:37 -0700 Subject: [PATCH 40/43] GPU: Generate normals for curves with lighting. Improves #12354. This needs to happen even if the vertex has no normals. --- GPU/Common/ShaderId.cpp | 13 ++++++------- GPU/Common/SplineCommon.cpp | 3 ++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/GPU/Common/ShaderId.cpp b/GPU/Common/ShaderId.cpp index 21b4519af9..e7a0d47cd2 100644 --- a/GPU/Common/ShaderId.cpp +++ b/GPU/Common/ShaderId.cpp @@ -73,10 +73,6 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform) bool doBezier = gstate_c.bezier; bool doSpline = gstate_c.spline; - // These are the original vertType's values (normalized will always have colors, etc.) - bool hasColorTess = (gstate.vertType & GE_VTYPE_COL_MASK) != 0 && (doBezier || doSpline); - bool hasTexcoordTess = (gstate.vertType & GE_VTYPE_TC_MASK) != 0 && (doBezier || doSpline); - bool hasNormalTess = (gstate.vertType & GE_VTYPE_NRM_MASK) != 0 && (doBezier || doSpline); bool enableFog = gstate.isFogEnabled() && !isModeThrough && !gstate.isModeClear(); bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled() && !isModeThrough; @@ -138,9 +134,12 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform) if (g_Config.bHardwareTessellation) { id.SetBit(VS_BIT_BEZIER, doBezier); id.SetBit(VS_BIT_SPLINE, doSpline); - id.SetBit(VS_BIT_HAS_COLOR_TESS, hasColorTess); - id.SetBit(VS_BIT_HAS_TEXCOORD_TESS, hasTexcoordTess); - id.SetBit(VS_BIT_HAS_NORMAL_TESS, hasNormalTess); + if (doBezier || doSpline) { + // These are the original vertType's values (normalized will always have colors, etc.) + id.SetBit(VS_BIT_HAS_COLOR_TESS, (gstate.vertType & GE_VTYPE_COL_MASK) != 0); + id.SetBit(VS_BIT_HAS_TEXCOORD_TESS, (gstate.vertType & GE_VTYPE_TC_MASK) != 0); + id.SetBit(VS_BIT_HAS_NORMAL_TESS, (gstate.vertType & GE_VTYPE_NRM_MASK) != 0 || gstate.isLightingEnabled()); + } id.SetBit(VS_BIT_NORM_REVERSE_TESS, gstate.isPatchNormalsReversed()); } } diff --git a/GPU/Common/SplineCommon.cpp b/GPU/Common/SplineCommon.cpp index 436e7d87c2..75df89ea47 100644 --- a/GPU/Common/SplineCommon.cpp +++ b/GPU/Common/SplineCommon.cpp @@ -403,6 +403,7 @@ public: vert.nrm *= -1.0f; } else { vert.nrm.SetZero(); + vert.nrm.z = 1.0f; } } } @@ -417,7 +418,7 @@ public: static void Tessellate(OutputBuffers &output, const Surface &surface, const ControlPoints &points, const Weight2D &weights, u32 origVertType) { const bool params[] = { - (origVertType & GE_VTYPE_NRM_MASK) != 0, + (origVertType & GE_VTYPE_NRM_MASK) != 0 || gstate.isLightingEnabled(), (origVertType & GE_VTYPE_COL_MASK) != 0, (origVertType & GE_VTYPE_TC_MASK) != 0, cpu_info.bSSE4_1, From 029dd07c8ea518fe599ae649fe92f4f052ee9e1a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 28 Sep 2019 21:09:47 -0700 Subject: [PATCH 41/43] UI: Minor assert fix. --- UI/NativeApp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 03c920bee9..78ff472892 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -780,8 +780,8 @@ bool NativeInitGraphics(GraphicsContext *graphicsContext) { using namespace Draw; Core_SetGraphicsContext(graphicsContext); g_draw = graphicsContext->GetDrawContext(); - _assert_msg_(G3D, g_draw->GetVshaderPreset(VS_COLOR_2D) != nullptr, "Failed to compile presets"); _assert_msg_(G3D, g_draw, "No draw context available!"); + _assert_msg_(G3D, g_draw->GetVshaderPreset(VS_COLOR_2D) != nullptr, "Failed to compile presets"); ui_draw2d.SetAtlas(&ui_atlas); ui_draw2d_front.SetAtlas(&ui_atlas); From 5871ab0538b9727b88b1839810717ce7f6b3c85c Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 28 Sep 2019 21:36:03 -0700 Subject: [PATCH 42/43] UI: Stop caching the draw context in coreParam. This is possibly getting outdated in some paths of graphics reinit, and then causing crashes. Let's just always get it from the graphicsContext. --- Core/CoreParameter.h | 1 - Core/System.cpp | 8 ++++---- GPU/GPU.h | 2 +- GPU/Software/SoftGpu.h | 2 +- UI/EmuScreen.cpp | 1 - headless/Headless.cpp | 9 ++++----- libretro/LibretroGraphicsContext.cpp | 1 - libretro/LibretroGraphicsContext.h | 1 - 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Core/CoreParameter.h b/Core/CoreParameter.h index 736ecd9797..a4e542bf02 100644 --- a/Core/CoreParameter.h +++ b/Core/CoreParameter.h @@ -54,7 +54,6 @@ struct CoreParameter { GPUCore gpuCore; GraphicsContext *graphicsContext = nullptr; // TODO: Find a better place. - Draw::DrawContext *thin3d = nullptr; bool enableSound; // there aren't multiple sound cores. std::string fileToStart; diff --git a/Core/System.cpp b/Core/System.cpp index 67a4e6fd85..3b32f3f56a 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -35,13 +35,12 @@ #include "thread/threadutil.h" #include "util/text/utf8.h" +#include "Common/GraphicsContext.h" #include "Core/MemMap.h" #include "Core/HDRemaster.h" - #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSAnalyst.h" - -#include "Debugger/SymbolMap.h" +#include "Core/Debugger/SymbolMap.h" #include "Core/Host.h" #include "Core/System.h" #include "Core/HLE/HLE.h" @@ -371,7 +370,8 @@ bool PSP_InitUpdate(std::string *error_string) { *error_string = coreParameter.errorString; if (success && gpu == nullptr) { PSP_SetLoading("Starting graphics..."); - success = GPU_Init(coreParameter.graphicsContext, coreParameter.thin3d); + Draw::DrawContext *draw = coreParameter.graphicsContext ? coreParameter.graphicsContext->GetDrawContext() : nullptr; + success = GPU_Init(coreParameter.graphicsContext, draw); if (!success) { *error_string = "Unable to initialize rendering engine."; } diff --git a/GPU/GPU.h b/GPU/GPU.h index 08d036560c..2c2fa9cc70 100644 --- a/GPU/GPU.h +++ b/GPU/GPU.h @@ -108,6 +108,6 @@ namespace Draw { class DrawContext; } -bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *thin3d); +bool GPU_Init(GraphicsContext *ctx, Draw::DrawContext *draw); bool GPU_IsReady(); void GPU_Shutdown(); diff --git a/GPU/Software/SoftGpu.h b/GPU/Software/SoftGpu.h index 92762a487f..f92344742e 100644 --- a/GPU/Software/SoftGpu.h +++ b/GPU/Software/SoftGpu.h @@ -50,7 +50,7 @@ class SoftwareDrawEngine; class SoftGPU : public GPUCommon { public: - SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *_thin3D); + SoftGPU(GraphicsContext *gfxCtx, Draw::DrawContext *draw); ~SoftGPU(); void CheckGPUFeatures() override {} diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 81a008e095..825bf43912 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -238,7 +238,6 @@ void EmuScreen::bootGame(const std::string &filename) { // Preserve the existing graphics context. coreParam.graphicsContext = PSP_CoreParameter().graphicsContext; - coreParam.thin3d = screenManager()->getDrawContext(); coreParam.enableSound = g_Config.bEnableSound; coreParam.fileToStart = filename; coreParam.mountIso = ""; diff --git a/headless/Headless.cpp b/headless/Headless.cpp index 77e136baf5..ed8d7cf917 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -163,8 +163,8 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool Core_UpdateDebugStats(g_Config.bShowDebugStats || g_Config.bLogFrameDrops); PSP_BeginHostFrame(); - if (coreParameter.thin3d) - coreParameter.thin3d->BeginFrame(); + if (coreParameter.graphicsContext && coreParameter.graphicsContext->GetDrawContext()) + coreParameter.graphicsContext->GetDrawContext()->BeginFrame(); coreState = CORE_RUNNING; while (coreState == CORE_RUNNING) @@ -190,8 +190,8 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool } PSP_EndHostFrame(); - if (coreParameter.thin3d) - coreParameter.thin3d->EndFrame(); + if (coreParameter.graphicsContext && coreParameter.graphicsContext->GetDrawContext()) + coreParameter.graphicsContext->GetDrawContext()->EndFrame(); PSP_Shutdown(); @@ -335,7 +335,6 @@ int main(int argc, const char* argv[]) coreParameter.cpuCore = cpuCore; coreParameter.gpuCore = glWorking ? gpuCore : GPUCORE_NULL; coreParameter.graphicsContext = graphicsContext; - coreParameter.thin3d = graphicsContext ? graphicsContext->GetDrawContext() : nullptr; coreParameter.enableSound = false; coreParameter.mountIso = mountIso ? mountIso : ""; coreParameter.mountRoot = mountRoot ? mountRoot : ""; diff --git a/libretro/LibretroGraphicsContext.cpp b/libretro/LibretroGraphicsContext.cpp index 1b908fbb83..508353f6bb 100644 --- a/libretro/LibretroGraphicsContext.cpp +++ b/libretro/LibretroGraphicsContext.cpp @@ -43,7 +43,6 @@ void LibretroHWRenderContext::ContextReset() { if (!draw_) { CreateDrawContext(); - PSP_CoreParameter().thin3d = draw_; bool success = draw_->CreatePresets(); assert(success); } diff --git a/libretro/LibretroGraphicsContext.h b/libretro/LibretroGraphicsContext.h index c816fda376..682adc0f7e 100644 --- a/libretro/LibretroGraphicsContext.h +++ b/libretro/LibretroGraphicsContext.h @@ -20,7 +20,6 @@ public: void Shutdown() override { DestroyDrawContext(); - PSP_CoreParameter().thin3d = nullptr; } void SwapInterval(int interval) override {} void Resize() override {} From 6a1676413ee8bdbb53e0c133e02cf74a8950a13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Mon, 30 Sep 2019 09:56:57 +0200 Subject: [PATCH 43/43] Don't assert if Discord not shut down properly. Possible workaround for #12140. --- UI/DiscordIntegration.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/UI/DiscordIntegration.cpp b/UI/DiscordIntegration.cpp index 41784abd17..442a14b763 100644 --- a/UI/DiscordIntegration.cpp +++ b/UI/DiscordIntegration.cpp @@ -1,3 +1,4 @@ + #include #include @@ -39,7 +40,9 @@ static void handleDiscordError(int errCode, const char *message) { #endif Discord::~Discord() { - assert(!initialized_); + if (initialized_) { + ERROR_LOG(SYSTEM, "Discord destructor running though g_Discord.Shutdown() has not been called."); + } } bool Discord::IsEnabled() const {