Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gpu profiler. #16319

Closed
wants to merge 2 commits into from
Closed

gpu profiler. #16319

wants to merge 2 commits into from

Conversation

bluesky013
Copy link
Contributor

@bluesky013 bluesky013 commented Sep 22, 2023

Re: #
企业微信截图_16969268225919

Changelog

  • deprecate occlusion query.
  • gpu profiler.

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@github-actions
Copy link

github-actions bot commented Sep 22, 2023

Interface Check Report

! WARNING this pull request has changed these public interfaces:

@@ -8738,8 +8738,19 @@
             MOVE = 3,
             RAYTRACE = 4,
             PRESENT = 5
         }
+        export enum PipelineStatisticFlagBit {
+            NONE = 0,
+            IA_VERTICES = 1,
+            IA_PRIMITIVES = 2,
+            VS_INVOCATIONS = 4,
+            CLIP_INVOCATIONS = 8,
+            CLIP_PRIMITIVES = 16,
+            FS_INVOCATIONS = 32,
+            CS_INVOCATIONS = 64,
+            ALL = 127
+        }
         export type BufferUsage = BufferUsageBit;
         export type BufferFlags = BufferFlagBit;
         export type MemoryAccess = MemoryAccessBit;
         export type MemoryUsage = MemoryUsageBit;
@@ -8749,8 +8760,9 @@
         export type ShaderStageFlags = ShaderStageFlagBit;
         export type AccessFlags = AccessFlagBit;
         export type DynamicStateFlags = DynamicStateFlagBit;
         export type ClearFlags = ClearFlagBit;
+        export type PipelineStatisticFlags = PipelineStatisticFlagBit;
         export class Size {
             x: number;
             y: number;
             z: number;
@@ -8777,13 +8789,14 @@
             maxComputeSharedMemorySize: number;
             maxComputeWorkGroupInvocations: number;
             maxComputeWorkGroupSize: Size;
             maxComputeWorkGroupCount: Size;
+            timestampPeriod: number;
             supportQuery: boolean;
             clipSpaceMinZ: number;
             screenSpaceSignY: number;
             clipSpaceSignY: number;
-            constructor(maxVertexAttributes?: number, maxVertexUniformVectors?: number, maxFragmentUniformVectors?: number, maxTextureUnits?: number, maxImageUnits?: number, maxVertexTextureUnits?: number, maxColorRenderTargets?: number, maxShaderStorageBufferBindings?: number, maxShaderStorageBlockSize?: number, maxUniformBufferBindings?: number, maxUniformBlockSize?: number, maxTextureSize?: number, maxCubeMapTextureSize?: number, maxArrayTextureLayers?: number, max3DTextureSize?: number, uboOffsetAlignment?: number, maxComputeSharedMemorySize?: number, maxComputeWorkGroupInvocations?: number, maxComputeWorkGroupSize?: Size, maxComputeWorkGroupCount?: Size, supportQuery?: boolean, clipSpaceMinZ?: number, screenSpaceSignY?: number, clipSpaceSignY?: number);
+            constructor(maxVertexAttributes?: number, maxVertexUniformVectors?: number, maxFragmentUniformVectors?: number, maxTextureUnits?: number, maxImageUnits?: number, maxVertexTextureUnits?: number, maxColorRenderTargets?: number, maxShaderStorageBufferBindings?: number, maxShaderStorageBlockSize?: number, maxUniformBufferBindings?: number, maxUniformBlockSize?: number, maxTextureSize?: number, maxCubeMapTextureSize?: number, maxArrayTextureLayers?: number, max3DTextureSize?: number, uboOffsetAlignment?: number, maxComputeSharedMemorySize?: number, maxComputeWorkGroupInvocations?: number, maxComputeWorkGroupSize?: Size, maxComputeWorkGroupCount?: Size, timestampPeriod?: number, supportQuery?: boolean, clipSpaceMinZ?: number, screenSpaceSignY?: number, clipSpaceSignY?: number);
             copy(info: Readonly<DeviceCaps>): DeviceCaps;
         }
         export class DeviceOptions {
             enableBarrierDeduce: boolean;
@@ -9568,8 +9581,15 @@
              * @param usage The GFX texture usage.
              * @param flags The GFX texture create flags.
              */
             getMaxSampleCount(format: Format, usage: TextureUsage, flags: TextureFlags): SampleCount;
+            /**
+             * @en Get supported pipeline statistic flags by device query.
+             * @zh 获取可通过设备查询获取的管线硬件数据类型
+             * @param flags Pipeline statistic flag to be tested.
+             * @param outFlags Pipeline statistic flag test result.
+             */
+            getSupportedPipelineStatisticFlags(flags: Readonly<PipelineStatisticFlags>, outFlags: PipelineStatisticFlags): number;
         }
         export class DefaultResource {
             constructor(device: Device);
             getTexture(type: TextureType): Texture | null;

@bluesky013 bluesky013 force-pushed the v3.8.2_profiler branch 2 times, most recently from fc8eeff to 83c385a Compare September 27, 2023 08:57
@github-actions
Copy link

@bluesky013, Please check the result of run test cases:

Task Details

@github-actions
Copy link

@bluesky013, Please check the result of run test cases:

Task Details

Comment on lines +1475 to +1480
cocos/renderer/pipeline/profile/GPUTimeQuery.cpp
cocos/renderer/pipeline/profile/GPUTimeQuery.h
cocos/renderer/pipeline/profile/GPUStatisticsQuery.cpp
cocos/renderer/pipeline/profile/GPUStatisticsQuery.h
cocos/renderer/pipeline/profile/PipelineProfiler.cpp
cocos/renderer/pipeline/profile/PipelineProfiler.h
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might rename folder profile to profiler. Profile as noun has different meaning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this should be the profiler.

void BufferAgent::readBack(void *dst, uint32_t offset, uint32_t size) {
auto *mq = DeviceAgent::getInstance()->getMessageQueue();
ENQUEUE_MESSAGE_4(
mq, BufferUpdate,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use readBack instead of BufferUpdate here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to modify the label.

@@ -33,7 +33,7 @@ namespace {

constexpr uint32_t FORCE_MINOR_VERSION = 0; // 0 for default version, otherwise minorVersion = (FORCE_MINOR_VERSION - 1)

#define FORCE_ENABLE_VALIDATION 0
#define FORCE_ENABLE_VALIDATION 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitted code should have validation turned off

@@ -388,7 +388,7 @@ void CommandBufferValidator::draw(const DrawInfo &info) {
if (!_curStates.descriptorSets[i]) continue; // there may be inactive sets
const auto &dsBindings = _curStates.descriptorSets[i]->getLayout()->getBindings();
const auto &psoBindings = psoLayouts[i]->getBindings();
CC_ASSERT(psoBindings.size() == dsBindings.size());
// CC_ASSERT(psoBindings.size() == dsBindings.size());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is builtin per-pass binding of [0: CCCamera , 1: CCConst] failed this validation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to roll back here.

@star-e star-e changed the base branch from v3.8.2 to v3.8.3 December 19, 2023 03:38
@minggo minggo deleted the branch cocos:v3.8.3 May 16, 2024 02:51
@minggo minggo closed this May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants