diff --git a/native/cocos/renderer/GFXDeviceManager.h b/native/cocos/renderer/GFXDeviceManager.h index 71b2ba4a10..d1f62696ca 100644 --- a/native/cocos/renderer/GFXDeviceManager.h +++ b/native/cocos/renderer/GFXDeviceManager.h @@ -32,7 +32,7 @@ #include "gfx-empty/EmptyDevice.h" #include "gfx-validator/DeviceValidator.h" -#undef CC_USE_VULKAN +//#undef CC_USE_VULKAN //#undef CC_USE_METAL //#undef CC_USE_GLES3 //#undef CC_USE_GLES2 @@ -57,7 +57,7 @@ namespace cc { namespace gfx { class CC_DLL DeviceManager final { - static constexpr bool DETACH_DEVICE_THREAD{0}; + static constexpr bool DETACH_DEVICE_THREAD{true}; static constexpr bool FORCE_DISABLE_VALIDATION{false}; static constexpr bool FORCE_ENABLE_VALIDATION{false}; diff --git a/native/cocos/renderer/gfx-base/GFXDef-common.h b/native/cocos/renderer/gfx-base/GFXDef-common.h index ef4c4e41b7..27939a9ee2 100644 --- a/native/cocos/renderer/gfx-base/GFXDef-common.h +++ b/native/cocos/renderer/gfx-base/GFXDef-common.h @@ -165,7 +165,7 @@ enum class Feature : uint32_t { // to the last attachment (taking advantage of 'inout' property), and a separate // blit operation (if needed) will be added for you afterwards to transfer the // rendering result to the corrent subpass output texture. This is to ameliorate - // the maxnumber of attachment limit(4) situation for many devices, and shader + // the max number of attachment limit(4) situation for many devices, and shader // sources inside this kind of subpass must match this behavior. INPUT_ATTACHMENT_BENEFIT, COUNT, diff --git a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp index e08660c215..5cb492b077 100644 --- a/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp +++ b/native/cocos/renderer/gfx-gles2/GLES2Commands.cpp @@ -1670,7 +1670,8 @@ void cmdFuncGLES2BeginRenderPass(GLES2Device *device, uint32_t subpassIdx, GLES2 performLoadOp(attachmentIndex, glAttachmentIndex++); } auto depthIndex = gpuRenderPass->subpasses[subpassIdx].depthStencil; - performDepthStencilLoadOp(depthIndex, gpuRenderPass->statistics[depthIndex].loadSubpass != subpassIdx); + bool skipLoad = depthIndex == INVALID_BINDING || gpuRenderPass->statistics[depthIndex].loadSubpass != subpassIdx; + performDepthStencilLoadOp(depthIndex, skipLoad); } } } @@ -1806,7 +1807,9 @@ void cmdFuncGLES2EndRenderPass(GLES2Device *device) { if (gpuRenderPass->statistics[attachmentIndex].storeSubpass != gfxStateCache.subpassIdx) continue; performStoreOp(attachmentIndex, glAttachmentIndex++); } - performDepthStencilStoreOp(subpass.depthStencil, gpuRenderPass->statistics[subpass.depthStencil].loadSubpass != gfxStateCache.subpassIdx); + bool skipStore = subpass.depthStencil == INVALID_BINDING || + gpuRenderPass->statistics[subpass.depthStencil].loadSubpass != gfxStateCache.subpassIdx; + performDepthStencilStoreOp(subpass.depthStencil, skipStore); } } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp index 89a1eb1433..31bc5a8adc 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp @@ -2049,7 +2049,8 @@ void cmdFuncGLES3BeginRenderPass(GLES3Device *device, uint32_t subpassIdx, GLES3 performLoadOp(attachmentIndex, glAttachmentIndex++); } auto depthIndex = gpuRenderPass->subpasses[subpassIdx].depthStencil; - performDepthStencilLoadOp(depthIndex, gpuRenderPass->statistics[depthIndex].loadSubpass != subpassIdx); + bool skipLoad = depthIndex == INVALID_BINDING || gpuRenderPass->statistics[depthIndex].loadSubpass != subpassIdx; + performDepthStencilLoadOp(depthIndex, skipLoad); } } } @@ -2208,7 +2209,9 @@ void cmdFuncGLES3EndRenderPass(GLES3Device *device) { if (gpuRenderPass->statistics[attachmentIndex].storeSubpass != gfxStateCache.subpassIdx) continue; performStoreOp(attachmentIndex, glAttachmentIndex++); } - performDepthStencilStoreOp(subpass.depthStencil, gpuRenderPass->statistics[subpass.depthStencil].loadSubpass != gfxStateCache.subpassIdx); + bool skipStore = subpass.depthStencil == INVALID_BINDING || + gpuRenderPass->statistics[subpass.depthStencil].loadSubpass != gfxStateCache.subpassIdx; + performDepthStencilStoreOp(subpass.depthStencil, skipStore); cmdFuncGLES3MemoryBarrier(device, gpuRenderPass->barriers.back().glBarriers, gpuRenderPass->barriers.back().glBarriersByRegion); } diff --git a/native/cocos/renderer/gfx-validator/PipelineStateValidator.cpp b/native/cocos/renderer/gfx-validator/PipelineStateValidator.cpp index df2d4a1df6..5314707d35 100644 --- a/native/cocos/renderer/gfx-validator/PipelineStateValidator.cpp +++ b/native/cocos/renderer/gfx-validator/PipelineStateValidator.cpp @@ -51,12 +51,14 @@ void PipelineStateValidator::doInit(const PipelineStateInfo &info) { _inited = true; CCASSERT(static_cast(info.shader)->isInited(), "already destroyed?"); CCASSERT(static_cast(info.pipelineLayout)->isInited(), "already destroyed?"); + CCASSERT(!info.renderPass || static_cast(info.renderPass)->isInited(), "already destroyed?"); /////////// execute /////////// PipelineStateInfo actorInfo = info; actorInfo.shader = static_cast(info.shader)->getActor(); actorInfo.pipelineLayout = static_cast(info.pipelineLayout)->getActor(); + if (info.renderPass) actorInfo.renderPass = static_cast(info.renderPass)->getActor(); _actor->initialize(actorInfo); } diff --git a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp index 9ea5efdf08..3e8c5dbeef 100644 --- a/native/cocos/renderer/gfx-vulkan/VKCommands.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKCommands.cpp @@ -616,7 +616,7 @@ void cmdFuncCCVKCreateRenderPass(CCVKDevice *device, CCVKGPURenderPass *gpuRende updateLifeCycle(statistics, j, subpass.pInputAttachments[k].layout, AttachmentStatistics::SubpassUsage::INPUT); } } - if (subpass.pDepthStencilAttachment->attachment == targetAttachment) { + if (subpass.pDepthStencilAttachment && subpass.pDepthStencilAttachment->attachment == targetAttachment) { updateLifeCycle(statistics, j, subpass.pDepthStencilAttachment->layout, AttachmentStatistics::SubpassUsage::DEPTH); } if (depthStencilResolves[j].pDepthStencilResolveAttachment && diff --git a/native/cocos/renderer/gfx-vulkan/VKGPUContext.cpp b/native/cocos/renderer/gfx-vulkan/VKGPUContext.cpp index 64aebf978d..79e4a72a3c 100644 --- a/native/cocos/renderer/gfx-vulkan/VKGPUContext.cpp +++ b/native/cocos/renderer/gfx-vulkan/VKGPUContext.cpp @@ -36,7 +36,7 @@ constexpr uint32_t FORCE_MINOR_VERSION = 0; // 0 for default version, constexpr uint32_t DISABLE_VALIDATION_ASSERTIONS = 1; // 0 for default behavior, otherwise assertions will be disabled #define FORCE_ENABLE_VALIDATION 0 -#define FORCE_DISABLE_VALIDATION 0 +#define FORCE_DISABLE_VALIDATION 1 #if CC_DEBUG > 0 && !FORCE_DISABLE_VALIDATION || FORCE_ENABLE_VALIDATION VKAPI_ATTR VkBool32 VKAPI_CALL debugUtilsMessengerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity,