misc fixes (#3895)

This commit is contained in:
Yun Hsiao Wu
2021-09-17 11:42:19 +08:00
committed by GitHub
parent fa210fa955
commit 3d1b6f9835
7 changed files with 17 additions and 9 deletions
+2 -2
View File
@@ -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};
@@ -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,
@@ -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);
}
}
@@ -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);
}
@@ -51,12 +51,14 @@ void PipelineStateValidator::doInit(const PipelineStateInfo &info) {
_inited = true;
CCASSERT(static_cast<ShaderValidator *>(info.shader)->isInited(), "already destroyed?");
CCASSERT(static_cast<PipelineLayoutValidator *>(info.pipelineLayout)->isInited(), "already destroyed?");
CCASSERT(!info.renderPass || static_cast<RenderPassValidator *>(info.renderPass)->isInited(), "already destroyed?");
/////////// execute ///////////
PipelineStateInfo actorInfo = info;
actorInfo.shader = static_cast<ShaderValidator *>(info.shader)->getActor();
actorInfo.pipelineLayout = static_cast<PipelineLayoutValidator *>(info.pipelineLayout)->getActor();
if (info.renderPass) actorInfo.renderPass = static_cast<RenderPassValidator *>(info.renderPass)->getActor();
_actor->initialize(actorInfo);
}
@@ -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 &&
@@ -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,