A declarative visual assertion method based on visual language model determination

By adopting a declarative visual assertion method based on a visual language model, the problem of the inability to automatically assert the visual correctness of AI-generated games is solved. This enables fast and accurate visual testing in a headless testing environment, adapts to a massive number of AI-generated games, and avoids the bottlenecks of false alarms and manual verification.

CN123178277APending Publication Date: 2026-11-27BEIJING WAZIDA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611492563.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-23
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies cannot effectively solve the problem of visual accuracy in AI-generated games. Traditional testing cannot automatically assert the overall visual quality of the rendering results, and manual verification is not scalable and cannot be incorporated into continuous integration environments.

Method used

A declarative visual assertion method based on a visual language model is adopted. By declaring natural language judgment criteria in the test scene, it is determined whether to launch real rendering. Under real rendering, the viewport texture is read and input into the visual language model for judgment.

Benefits of technology

It enables automatic assertion of visual correctness in a headless default test environment, avoiding reliance on manual benchmarks, reducing false alarms, and enabling unattended operation in CI environments, balancing the speed of logic testing with the accuracy of visual testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178277A_ABST
    Figure CN123178277A_ABST
Patent Text Reader

Abstract

The application discloses a declarative visual assertion method based on visual language model determination, relates to the technical field of computer software testing and game engine rendering verification, and comprises the following steps: declaring a visual assertion in a test scene, wherein the visual assertion contains a natural language determination criterion; determining whether to start real rendering according to a test configuration item; reading a current viewport map under real rendering to obtain a rendering image; and inputting the natural language determination criterion and the rendering image into a visual language model to obtain a visual determination result. The application can start real rendering on demand in a headless default test running environment, automatically asserts visual correctness by a declarative step, does not require manual reference, is suitable for a large number of games generated by artificial intelligence, and avoids a large number of false positives in pixel-by-pixel comparison.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer software testing and game engine rendering verification technology, and specifically to a declarative visual assertion method based on visual language model determination. Background Technology

[0002] Whether AI-generated games look correct and how to automatically assert this correctness is a long-standing technical problem. Specifically, visual correctness cannot be detected by logical state assertions. In an AI-generated game, the correctness of features like whether the camera frames the entire scene, whether a special effect is visible, whether a billboard faces the camera, and whether colors read correctly, pertains to the overall visual appearance of the rendered result and is not reflected in the attribute values ​​or component fields of any entity. Traditional testing can only assert logical states such as the number of entities equaling a certain value or the y-coordinate of a billboard position exceeding a threshold. Even when all these logical states are true, the screen may still be black, the camera pointing upwards, or special effects not triggered. There is a structural gap between logical assertions and visual correctness. Manual screenshot verification is not scalable and cannot be incorporated into Continuous Integration (CI). In AI-generated scenarios, there are thousands of games, and every engine change can affect the appearance of all generated games. Manually taking screenshots one by one is neither scalable nor can it be integrated into automated pipelines. CI cannot determine pass or fail based on a single image. Furthermore, the default test environment without a head has no pixels. To ensure fast logic testing and run on CI machines without GPUs, the game engine's test environment uses a dummy rasterizer by default. The dummy rasterizer simulates the entire world, with physics, collision, and scene graph nodes all functioning, but without producing any pixels. Visual assertions require realistic pixels, but enabling realistic rendering throughout would slow down the majority of pure logic tests. There is a race condition between asynchronous GPU particle computation and single-frame capture. The GPU particle system simulates its progress on the asynchronous computation path of the rendering server, which is not in sync with the scene tree processing loop driving the logic frames. The capture path typically only pauses for one frame of logic before reading the viewport texture. This is sufficient for meshes and CPU particles, but it preempts GPU particle computations that haven't finished firing, resulting in blank particle effects in the captured frames.

[0003] To address the aforementioned technical issues, several solutions exist in the existing technology. One existing solution involves pixel comparison and golden image testing (e.g., Percy, Applitools, reg-suit). In the web and UI fields, a golden image plus pixel diffing is commonly used. The current rendered screenshot is compared pixel-by-pixel with a manually verified golden image; a comparison exceeding a threshold results in a failure. The drawbacks are that a manual generation and maintenance of the golden image is required, and AI-generated games are highly variable, making a stable golden image for comparison impossible. Pixel diffing can generate numerous false positives for semantically equivalent but slightly shifted layouts (e.g., slight differences in camera position or random particle distribution). It cannot answer semantic questions like whether the image appears to be a deck of cards framed by the camera; it can only indicate the pixel difference from the golden image. Another existing solution is snapshot testing. Jest snapshots, component tree serialization snapshots, etc., serialize the rendering results into text for comparison. The drawback is that it compares the structural serialization rather than actual pixels, offering no coverage of the visual experience of the 3D scene, and also relies on the initial manually verified golden image. The existing solution three involves manual Quality Assurance (QA) screenshots, where testers run the game, manually take screenshots, and visually evaluate them. The drawbacks are that it's not scalable, cannot be incorporated into CI (Computer Intervention), and cannot perform full regression testing for every engine change. When AI generates thousands of games, manual verification becomes a significant bottleneck. The existing solution four uses a headless CI that only checks the logic. The headless test environment for the game engine can run the entire world and assert states on machines without GPUs. The drawback is the lack of pixel coverage, resulting in zero coverage for any visual correctness issues. Defects such as black screens, cameras pointing upwards, and effects not triggering—where the logic is correct but the visuals are completely wrong—are all allowed in the existing solution four.

[0004] The existing technology has the following drawbacks. First, visual blind spots. Logical assertions cannot cover the overall visual experience, allowing black screens, upward-facing cameras, and invisible effects to pass. Second, reliance on manual benchmarks. Pixel comparison and snapshot testing both require manual confirmation of a golden benchmark, and there is no stable benchmark to rely on for the massive number of games generated by artificial intelligence. Third, rampant false positives. Pixel-by-pixel comparison judges frames with semantic equivalence but minor layout shifts as failures. Fourth, lack of scalability. Screenshots taken by manual QA cannot be used for CI or full regression. Fifth, headless and pixel-less. While headless CI is fast and economical, it provides zero visual coverage. Sixth, asynchronous race conditions. Single-frame capture preempts asynchronous GPU particle calculations, resulting in blank effect frames and unreliable visual assertions for effects.

[0005] In summary, within the verification loop of AI-generated games, logical correctness can be covered, but visual correctness remains a long-standing gap. Visual correctness crosses object, whole, and semantic dimensions, making it impossible to write it as a field comparison. Existing visual testing solutions are either pixel-based comparisons for web front-ends or independent services detached from the game engine testing container, neither providing semantic-level judgments within the game engine testing runtime environment. Therefore, existing technologies lack technical means to address issues such as visual correctness not being detectable by logical state assertions, the lack of scalability and CI limitations for manual screenshot verification, the absence of pixels in the default headless environment, and race conditions between asynchronous GPU particle computation and single-frame capture. Summary of the Invention

[0006] To address at least some of the technical problems in the prior art, this invention provides a declarative visual assertion method based on visual language model determination. Specifically, this invention includes the following:

[0007] In a first aspect, the present invention provides a declarative visual assertion method based on visual language model determination, the specific technical solution of which is as follows: S1, declare a visual assertion in the test scenario, the visual assertion including natural language judgment criteria; S2, based on the test configuration items, determines whether to start real rendering; under real rendering, reads the current viewport texture to obtain the rendered image; S3, input the natural language judgment criteria and the rendered image into the visual language model to obtain the visual judgment result.

[0008] The beneficial effects of the declarative visual assertion method based on visual language model determination provided by this invention are as follows: By declaring visual assertions carrying natural language judgment criteria in the test scenario, the system determines whether to initiate real rendering based on test configuration items. Under real rendering, it reads the current viewport texture to obtain the rendered image, and then inputs the natural language judgment criteria and the rendered image into the visual language model to obtain the visual judgment result. This allows for real rendering to be initiated only when a visual assertion occurs, even in a headless test environment where the default setting is to use real rendering. This ensures that the majority of pure logic tests are fast, have zero GPU cost, and can run on CI machines without GPUs, while also allowing visual correctness to be automatically determined by a single declarative step. Visual assertions require no runtime code; moreover, since the judgment criteria are based on natural language judgment standards and rendered images, there is no need for manual confirmation and maintenance of baseline images. This allows it to adapt to a large number of games generated by artificial intelligence, avoiding a large number of false alarms in semantically equivalent but slightly shifted layouts through pixel-by-pixel comparisons. Furthermore, visual assertions and logical state assertions run side by side in the same test environment and share the same execution cycle, enabling unattended execution of judgments in CI. This solves the problems that visual correctness cannot be detected by logical state assertions, manual screenshot verification is not scalable and cannot be included in CI, and the headless default test environment has no pixels.

[0009] Furthermore, determining whether to initiate real rendering based on the test configuration items includes: Based on the rendering switch of the test environment in which the test scenario is located, determine whether to start real rendering; when the rendering switch is turned on, determine whether to start real rendering. When the test scenario contains the visual assertion, it is determined that realistic rendering should be initiated. When there is a requirement for asset preheating, a realistic rendering will be initiated.

[0010] Furthermore, before reading the current viewport texture, the process also includes: In realistic rendering, a logical frame is advanced to submit the scene graph of the test scene to the current drawing, and deterministic preheating and refresh are performed on the GPU particles. Then, the current viewport texture is read to obtain the rendered image. The current viewport texture is provided by the viewport mounted in the scene graph. It is obtained by locating scene nodes that can reach the viewport from the scene graph and obtaining the image data of the texture corresponding to the viewport. The GPU particles are rendered in the current viewport texture. The deterministic warm-up and refresh process allows the emitted particles to be synthesized into the frame buffer before being acquired as the rendered image, thereby avoiding blank particle effects in the current viewport texture. The deterministic warm-up and refresh include: requesting particle advancement by a fixed time step to make particle simulation results reproducible; initiating the first forced rendering to dispatch or advance particle computation; initiating forced synchronization to wait for dispatched but not yet completed GPU work to finish; and initiating the second forced rendering to synthesize the emitted particles into the frame buffer so that particle effects are stably visible in the rendered image.

[0011] Furthermore, when the viewport is unreachable, the viewport is empty, the rendered image is empty, or the size of the rendered image is zero, a placeholder image is generated, and the corresponding rendering flag is set to unrendered and not input into the visual language model.

[0012] Furthermore, after obtaining the rendered image, the process also includes: Write metadata to the append list; the metadata includes the capture name corresponding to the rendered image, the path information corresponding to the rendered image, the step number of the rendered image in the test scene, the scene name of the test scene, the simulation time when the rendered image was obtained, the size of the rendered image, and the rendering identifier corresponding to the rendered image. The root directory for storing the rendered image is determined based on the capture directory path. When the capture directory path is not set, the default path under the temporary directory is used as the root directory for storage. When the capture directory path is not empty, the capture directory path is used as the root directory for storage. When the capture directory path is empty, the generation of the rendered image is prohibited and the writing of metadata to the append manifest is skipped.

[0013] Furthermore, after obtaining the visual determination result, the process also includes: When the visual judgment result is successful, the visual assertion is deemed successful and the cursor is advanced; when the visual judgment result is unsuccessful, transmission fails, or the rendered image is not obtained, the visual assertion is deemed unsuccessful, and the failure reason given by the visual language model and the path information corresponding to the rendered image are combined to form failure information and returned.

[0014] Furthermore, it also includes: In the test scenario, a canvas pixel assertion is declared, which is used to perform deterministic pixel comparisons on the CPU canvas when real rendering is not initiated. The deterministic pixel comparison includes: parsing the CPU canvas associated with the target entity in the scene graph of the test scene based on the target entity in the canvas pixel assertion; determining the target pixel coordinates based on the UV coordinates in the canvas pixel assertion and the size of the CPU canvas; reading the pixel value at the target pixel coordinates and comparing it with a preset pixel threshold to obtain the canvas determination result.

[0015] In a second aspect, the present invention provides a declarative visual assertion system based on visual language model determination, the specific technical solution of which includes: an assertion declaration module, a rendering determination module, and a model determination module; The assertion declaration module is used to declare visual assertions in the test scenario, and the visual assertions include natural language judgment criteria. The rendering determination module is used to determine whether to start real rendering based on the test configuration items; under real rendering, it reads the current viewport texture to obtain the rendered image; The model determination module is used to input the natural language determination criteria and the rendered image into the visual language model to obtain the visual determination result.

[0016] Furthermore, determining whether to initiate real rendering based on the test configuration items includes: Based on the rendering switch of the test environment in which the test scenario is located, determine whether to start real rendering; when the rendering switch is turned on, determine whether to start real rendering. When the test scenario contains the visual assertion, it is determined that realistic rendering should be initiated. When there is a requirement for asset preheating, a realistic rendering will be initiated.

[0017] Furthermore, before reading the current viewport texture, the process also includes: In realistic rendering, a logical frame is advanced to submit the scene graph of the test scene to the current drawing, and deterministic preheating and refresh are performed on the GPU particles. Then, the current viewport texture is read to obtain the rendered image. The current viewport texture is provided by the viewport mounted in the scene graph. It is obtained by locating scene nodes that can reach the viewport from the scene graph and obtaining the image data of the texture corresponding to the viewport. The GPU particles are rendered in the current viewport texture. The deterministic warm-up and refresh process allows the emitted particles to be synthesized into the frame buffer before being acquired as the rendered image, thereby avoiding blank particle effects in the current viewport texture. The deterministic warm-up and refresh include: requesting particle advancement by a fixed time step to make particle simulation results reproducible; initiating the first forced rendering to dispatch or advance particle computation; initiating forced synchronization to wait for dispatched but not yet completed GPU work to finish; and initiating the second forced rendering to synthesize the emitted particles into the frame buffer so that particle effects are stably visible in the rendered image.

[0018] Furthermore, when the viewport is unreachable, the viewport is empty, the rendered image is empty, or the size of the rendered image is zero, a placeholder image is generated, and the corresponding rendering flag is set to unrendered and not input into the visual language model.

[0019] Furthermore, after obtaining the rendered image, the process also includes: Write metadata to the append list; the metadata includes the capture name corresponding to the rendered image, the path information corresponding to the rendered image, the step number of the rendered image in the test scene, the scene name of the test scene, the simulation time when the rendered image was obtained, the size of the rendered image, and the rendering identifier corresponding to the rendered image. The root directory for storing the rendered image is determined based on the capture directory path. When the capture directory path is not set, the default path under the temporary directory is used as the root directory for storage. When the capture directory path is not empty, the capture directory path is used as the root directory for storage. When the capture directory path is empty, the generation of the rendered image is prohibited and the writing of metadata to the append manifest is skipped.

[0020] Furthermore, after obtaining the visual determination result, the process also includes: When the visual judgment result is successful, the visual assertion is deemed successful and the cursor is advanced; when the visual judgment result is unsuccessful, transmission fails, or the rendered image is not obtained, the visual assertion is deemed unsuccessful, and the failure reason given by the visual language model and the path information corresponding to the rendered image are combined to form failure information and returned.

[0021] Furthermore, it also includes: In the test scenario, a canvas pixel assertion is declared, which is used to perform deterministic pixel comparisons on the CPU canvas when real rendering is not initiated. The deterministic pixel comparison includes: parsing the CPU canvas associated with the target entity in the scene graph of the test scene based on the target entity in the canvas pixel assertion; determining the target pixel coordinates based on the UV coordinates in the canvas pixel assertion and the size of the CPU canvas; reading the pixel value at the target pixel coordinates and comparing it with a preset pixel threshold to obtain the canvas determination result.

[0022] A third aspect of the present invention provides a computer device including a processor coupled to a memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to enable the computer device to perform any of the methods described above.

[0023] A fourth aspect of the present invention provides a computer-readable storage medium storing at least one computer program, the at least one computer program being loaded and executed by a processor to enable a computer to perform any of the methods described above.

[0024] It should be noted that the beneficial effects of the technical solutions of the second to fourth aspects of the present invention and their corresponding possible implementations can be found in the above description of the technical effects of the first aspect and its corresponding possible implementations, and will not be repeated here. Attached Figure Description

[0025] Figure 1 This is a schematic diagram of the overall architecture of a declarative visual assertion method based on visual language model determination according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the execution flow of the visual assertion steps in a declarative visual assertion method based on visual language model determination according to an embodiment of the present invention. Figure 3 This is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.

[0027] Whether AI-generated games look correct and how to automatically assert this correctness are current technical problems that need to be solved. Visual correctness cannot be detected by logical state assertions; it pertains to the overall appearance of the rendered result and is not reflected in the attribute values ​​or component fields of any entity. Traditional testing can only assert logical states such as the number of entities and coordinate thresholds. Even when all these logical states are true, the screen may still be black, the camera may be pointing upwards, and special effects may not be triggered. At the same time, for testing to enter Continuous Integration (CI), it must be headless and fast. Headless means no pixels, creating a natural conflict between asserting visual correctness and achieving headless speed. Headless mode refers to running the program without a graphical display interface, simulating a complete world in the runtime environment, but the viewport does not produce any pixels. Therefore, this invention provides a declarative visual assertion method based on a Vision Language Model (VLM) judgment. This method makes visual judgments on the rendered frames through declarative assertion steps, enabling unattended operation in CI and on-demand realistic rendering in the default headless test environment.

[0028] Figure 1 This is a schematic diagram of the overall architecture of a declarative visual assertion method based on visual language model determination, provided in an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the execution flow of the visual assertion step in an embodiment of the present invention. Figure 1 as well as Figure 2As shown, an embodiment of the present invention provides a declarative visual assertion method based on visual language model determination, comprising the following steps: S1 declares visual assertions in the test scenario, which include natural language judgment criteria. The specific implementation is as follows.

[0029] Test scenarios (corresponding) Figure 1 The "declarative test scenario" refers to a set of test steps written in declarative data, i.e., a declarative test scenario, which includes logical state assertion steps (corresponding to...). Figure 1 The "logical assertion step" and the visual assertion step (corresponding to) Figure 1 The steps include the "visual assertion step" and the canvas pixel assertion step (corresponding to...). Figure 1 The "canvas pixel assertion step" in the declarative test scenario contains no runtime code. Visual assertions are declared in the same test environment as logical state assertions, sharing the same execution cycle. Visual assertions include natural language criteria, which are judgment criteria described in natural language, such as "The camera captured the entire deck of cards; the deck is completely within the frame and has not been cropped." Natural language criteria replace the gold standard map in traditional pixel comparison, eliminating the need for manual confirmation and maintenance of the standard map. Since the declarative test scenario itself is pure data and contains no runtime code, visual assertions can be declared without any runtime code. Visual assertions can also include a capture name and a failure prefix defined by the test developer. The capture name is the base file name after the rendered image is written to disk, and the failure prefix is ​​a prefix text defined by the test developer for the failure information corresponding to the visual assertion. Writing to disk involves writing the data in memory to the disk and saving it as a file.

[0030] This step enables visual correctness to be automatically asserted by a single declarative step, without runtime code, and the judgment standard is natural language, requiring no human benchmarks, making it adaptable to a vast number of AI-generated games.

[0031] S2, based on the test configuration items, determines whether to initiate real rendering; under real rendering, it reads the current viewport texture to obtain the rendered image. The specific implementation method is as follows.

[0032] The test runtime environment starts in headless mode by default (corresponding to...) Figure 1 The "headless" setting (default) indicates that the display service uses a dummy rasterizer. The dummy rasterizer simulates the complete world (corresponding to...). Figure 1 In the "Real Engine World" (as defined in the test), physics, collision, and scene graph nodes all function, but the viewport does not produce any pixels. The dummy rasterizer is the empty rasterizer used in headless mode. (Based on the test configuration items (corresponding to...)) Figure 1The "Rendering Mode Decision Maker" determines whether to initiate real rendering. The test configuration items are the basis for determining the rendering mode. In real rendering (corresponding to...) Figure 1 The "off-screen framebuffer real rendering driver + off-screen window" reads the current viewport texture to obtain the rendered image (corresponding to...). Figure 1 (This refers to "reading back the viewport texture as a CPU image"). The viewport texture is the rendering result corresponding to the viewport, which is the rendering target attached to a scene graph node. The rendered image is the CPU image obtained after reading back the viewport texture and writing it to disk. For example... Figure 1 As shown, the off-screen frame buffer node contains the real rendering driver and the off-screen window, while the dummy rasterizer node is used for pixel-free logic testing. Both are selected by the rasterizer path judgment node based on the presence or absence of visual assertions.

[0033] This step enables the test environment to use a headless mode by default. This mode is fast for most pure logic tests, has zero graphics processing unit (GPU) cost, can run on CI machines without graphics cards, and only starts real rendering when visual assertions are needed, thus balancing the speed and cost-effectiveness of pure logic tests with the real pixel requirements of visual assertions.

[0034] In a preferred implementation, determining whether to initiate real rendering is based on test configuration items, including: determining whether to initiate real rendering based on the rendering switch of the test runtime environment where the test scene is located; determining to initiate real rendering when the rendering switch is on; determining to initiate real rendering when the test scene contains visual assertions; and determining to initiate real rendering when there is an asset preheating requirement. The specific implementation method is as follows.

[0035] The decision to initiate real rendering is based on the test configuration options, including the following three decision criteria.

[0036] The first criterion is to determine whether to initiate real rendering based on the rendering switch of the test environment in which the test scenario is located. This setting is used when the rendering switch is explicitly configured. The rendering switch is an environment switch with a value of 1 or 0. When the rendering switch is on (a value of 1), real rendering is initiated; when the rendering switch is off (a value of 0), headless mode is used. The rendering switch has the highest priority, overriding all other test configuration options (corresponding to...). Figure 1 ("Environmental switch forced coverage" in the text).

[0037] The second approach is to trigger realistic rendering when the test scene contains visual assertions. The motivation is that any step of reading the viewport requires real pixels, thus eliminating the need for test developers and probe containers to remember manual on / off switching. Specifically, a lightweight text scan of the test scene is performed. If the test scene text contains keywords related to visual assertions or frame captures (corresponding to...), the rendering is triggered. Figure 1The "detecting visual assertion step" in the code automatically initiates real rendering. Frame capture is a set of disk-writing logic reused by visual assertions during execution. Both share the same disk-writing logic, but the semantic difference lies in the fact that visual assertions ultimately identify unrendered content as a failure, while passive frame capture identifies it as a non-failure. The frame capture process involves locating scene nodes accessible to the viewport and capturing the viewport, reading back the viewport texture as a CPU image and writing it to disk to obtain the rendered image, and writing a line of metadata to the append list. If the rendered image cannot be read, a placeholder image is written and marked as unrendered in the append list, without throwing an error.

[0038] In one alternative, instead of using text-based keyword scanning to determine whether a test scenario contains visual assertions, the abstract syntax tree of the test scenario is parsed to precisely determine whether to initiate real rendering based on the step type, avoiding false keyword hits. In another alternative, pure logic test speed is sacrificed to always initiate real rendering. Yet another alternative determines whether to initiate real rendering based on test tags or manifest declarations.

[0039] The third criterion is to trigger realistic rendering when there is a requirement for asset preheating. Assets refer to resources in the game that need to be prepared or baked in advance, such as GPU assets. Asset preheating requirements force realistic rendering to be triggered so that the server can bake the corresponding GPU assets.

[0040] With this preferred implementation scheme, the rendering mode decision takes into account both automatic detection and manual coverage, so that test developers do not need to remember the manual switch, while retaining the entry point for manual enforcement.

[0041] When initiating realistic rendering, configure the realistic display driver and realistic rendering driver for the child process, open an off-screen window to avoid preempting focus, and set the audio driver as a stand-in. The realistic display driver and realistic rendering driver are selected according to the platform, choosing the native display driver and the corresponding graphics API, respectively. The child process is an independent process started by the test runtime environment to initiate realistic rendering, used to configure the realistic display driver and realistic rendering driver and run realistic off-screen rendering.

[0042] The rendering method selector defaults to using the mobile rendering method consistent with the deployment target, because the deployment end (i.e., the player-facing runtime) uses the mobile rendering method. If the default is changed to the desktop forward rendering method, shaders that the mobile rendering method cannot render may be produced, resulting in a visually acceptable result but a blank screen on the player's end. This path can be detected by overriding the rendering method selector to use the forward method.

[0043] The capture resolution selector defaults to a lower resolution to keep the smoke probe lightweight; the capture resolution switch can be overridden to a higher resolution, with values ​​in the form of width × height or a single-value matrix abbreviation, to improve the accuracy of interpretation when debugging spatial defects.

[0044] In a preferred implementation, before reading the current viewport texture, the method further includes: advancing a logical frame in real rendering to submit the scene graph of the test scene to the current drawing (corresponding to...). Figure 2 The "stop one frame logic" in the code, and perform deterministic preheating and refresh on GPU particles (corresponding to...). Figure 1 "Particle preheating and refresh" and Figure 2 The process involves "particle preheating and refresh" and then reading the current viewport texture to obtain the rendered image (corresponding to...). Figure 2 (The "read back viewport texture as CPU image" part). The specific implementation method is as follows.

[0045] Advancing a logical frame involves having the scene tree process loop through the current frame and then having the scene graph submit the current drawing. This captures the image corresponding to the logical frame, rather than an intermediate state where the logic has not yet been completed.

[0046] The current viewport texture is provided by the viewport mounted in the scene graph. It is obtained by locating scene nodes accessible to the viewport from the scene graph and retrieving the image data of the corresponding texture for the viewport. When locating scene nodes accessible to the viewport, the scene root of the currently focused world is retrieved first; otherwise, the world node of the test environment is retrieved.

[0047] GPU particles are rendered onto the current viewport texture. Through deterministic warm-up and refresh, emitted particles are composited into the frame buffer before being captured as the rendered image, avoiding blank particle effects in the current viewport texture. GPU particles are simulated and advanced on the asynchronous computation channel of the rendering server, with a different rhythm than the scene tree processing loop that drives CPU particles and physics. The scene tree is the scene graph structure that drives logical frames and advances physics and collisions during engine runtime; it is not an abstract syntax tree for testing the scene. If the capture path only advances one logical frame before reading the viewport, it will preempt the computation of particles that have not yet finished emitting, capturing blank effects. All GPU particle nodes are recursively collected from the scene root.

[0048] Deterministic warm-up and refresh include the following four steps.

[0049] The first step is to request the particle to advance by a fixed time step (corresponding to...) Figure 2 The "fixed time step" in the simulation makes the particle simulation results reproducible. A fixed time step is key; it ensures that each run advances the simulation time by the same amount, resulting in reproducible results without jittering with the machine frame rate. The fixed time step value ensures that burst-type particles have passed their emission phase and are visibly filling the frame, while short-duration spark-type particles are still in the middle of their lifecycle.

[0050] The second step is to initiate the first forced drawing (which corresponds to the second forced drawing). Figure 2 The "forced drawing" function is used to dispatch or advance particle calculations.

[0051] The third step is to initiate a forced synchronization (corresponding to...) Figure 2 The "forced synchronization" parameter is used to wait for dispatched but incomplete GPU jobs to finish. In multi-threaded rendering builds, it ensures that GPU jobs still in transit after a forced draw return are completed.

[0052] The fourth step is to initiate a second forced rendering to synthesize the emitted particles into the frame buffer, making the particle effects stably visible in the rendered image.

[0053] As a result, particle effects are consistently visible and progressively consistent in the rendered image, making visual assertions about particle effects credible. "In transit" refers to GPU work that has been dispatched but not yet completed; "progression" refers to moving the particle simulation forward at fixed time steps; "emission" refers to particles leaving the emitter; and "dispatch" refers to submitting the particle computation task to the GPU for processing.

[0054] In one alternative, particles are polled from their emitted state until they stabilize before being captured and rendered. In another alternative, particle capture is delayed by a fixed number of frames, ensuring the effect is consistently visible in the rendered image.

[0055] Through this preferred implementation scheme, asynchronous GPU particle computation is deterministically warmed up and refreshed, single-frame capture no longer preempts particle emission, special effects are stably visible in the captured frame, and the results of successive runs are consistent, making visual assertions about special effects credible.

[0056] To ensure robustness, a descending order of reading is used when capturing and rendering images. In a preferred embodiment, when the viewport is unreachable, empty, the rendered image is empty, or the size of the rendered image is zero, a placeholder image is generated, and the corresponding rendering flag is set to unrendered and not input into the visual language model. The specific implementation is as follows.

[0057] Generating a placeholder image refers to writing a minimum placeholder PNG. The render flag is a Boolean flag used to indicate whether the rendered image is a real frame or a placeholder image. Setting the render flag to not render indicates that the rendered image is a placeholder image.

[0058] "Viewport unreachable" means that scene nodes that can be located within the viewport are unreachable. A placeholder image is generated and returned. When locating scene nodes that can be located within the viewport, the scene root of the currently focused world is retrieved first; otherwise, world nodes from the test environment are retrieved.

[0059] An empty viewport means there is no available viewport on the scene node; a placeholder image is generated and returned.

[0060] An empty rendered image or a rendered image with a size of zero indicates that the image is in dumb rasterizer mode, or that the server constructs a placeholder image in a no-rendering manner and sets the corresponding rendering flag to unrendered.

[0061] When the rendered image is valid, save the actual rendered image and set the corresponding rendering flag to rendered.

[0062] Please continue reading. Figure 2 , Figure 2 The process involves obtaining the actual frame (i.e., the real rendered image), determining whether a node is unrendered, and then proceeding to the next branch. Figure 2 The loud failure node in the middle, the reason for the rollback is no real frame buffer, and it does not enter. Figure 2 The visual decision maker node (i.e., the visual language model) is invoked in the process.

[0063] When capturing and rendering images, errors are never thrown due to missing pixels; instead, an auditable record of unrendered images is left. After generating placeholder images, they are not input into the visual language model; instead, the visual assertion is directly deemed a failure. The visual assertion identifies unrendered images as failures because it requires real frames; the passive capture and rendering of images identifies unrendered images as non-failures because it only performs passive observation. Both share the same disk-based logic, and semantic differences are only reflected in the final visual judgment result.

[0064] With this preferred implementation, the captured and rendered image never throws an error due to missing pixels, but leaves an auditable unrendered record. Furthermore, the placeholder image does not enter the visual language model, thus avoiding meaningless judgments and wasting resources by asking the visual language model with the placeholder image.

[0065] To allow test developers to visually review the same frame afterward and to establish a stable, auditable, and reliably verifiable data contract, captures corresponding to the rendered images are provided. Each capture is a disk archive generated from capturing a rendered image, including the rendered image itself and an append-only list that adds a line for each capture. Specifically, in a preferred embodiment, after obtaining the rendered image, the process further includes: writing metadata to the append-only list; the metadata includes the capture name corresponding to the rendered image, the path information corresponding to the rendered image, the step number of the rendered image in the test scene, the scene name of the test scene, the simulation time when the rendered image was obtained, the size of the rendered image, and the rendering identifier corresponding to the rendered image. The specific implementation is as follows.

[0066] Additional list (corresponding) Figure 1The "Append List Lines" in the file are a list file that adds a line for each captured and rendered image (i.e., each captured image is a JSON object). The capture name is the base file name of the rendered image; the path information for the rendered image is its file path; the step number of the rendered image in the test scene is the sequence number of the step that generated this capture in the test scene, starting from 1; the scene name of the test scene is its original, unsaved name; the simulation time when the rendered image was captured is the simulation time when the captured and rendered image occurred; the dimensions of the rendered image are its width and height; and the rendering identifier for the rendered image is a boolean indicating whether it has been rendered or not. "Rendered" indicates a real rendered image, while "unrendered" indicates a placeholder image, i.e., no header or no rendering. The original, unsaved name refers to the original form of the test scene name before it was written to disk; it may contain arbitrary characters, including non-Latin characters, and unsafe path characters have not yet been replaced with underscores.

[0067] The captured data is organized on disk with the root directory containing the rendered images at the top. Subdirectories are then created based on the cleaned-up scene names. Each subdirectory contains the rendered images and an append-only list, with one line added for each captured rendered image, containing one JSON object per line. The cleaned-up scene names are those that may contain any characters, including non-Latin characters. Before being written to disk, unsafe path characters are replaced with underscores, while valid non-Latin bytes are retained to prevent collisions caused by different scene names collapsing.

[0068] The root directory for storing rendered images is determined based on the capture directory path. The capture directory path is a switch used to resolve the root directory. When no capture directory path is set, the default path under the temporary directory is used as the root directory for archiving during independent runtime. When the capture directory path is not empty, it is used as the root directory. When the capture directory path is empty, generating rendered images is prohibited, and writing metadata to the append manifest (corresponding to...) is skipped. Figure 2 The phrase "Capture directory is disabled" indicates that capture is disabled (corresponding to...). Figure 2 The message "Capture disabled?" indicates that capturing is an explicit signal not to produce any captures, unlike the temporary default of not setting a capture path. It's important to note that the capture directory path is an environment switch determined when the test environment starts or before the test scenario is executed. It only determines where the rendered image and append manifest file are stored, not that they are generated after the rendered image is obtained. Therefore, there is no conflict between disabling capture after obtaining the rendered image and when the capture directory path is empty.

[0069] In one alternative, the image is read back in a different format to balance file size; that is, the viewport texture is stored in a lossless or lossy format other than PNG, and the choice of format controls the disk space occupied by the captured image. In another alternative, the framebuffered byte stream is sent directly to the visual language model, skipping disk writes and saving I / O overhead but sacrificing post-capture verifiability. Yet another alternative involves capturing multiple images at once using multiple viewports or multiple cameras, allowing the visual language model to synthesize these multiple images for decision-making.

[0070] Through this preferred implementation scheme, the captured data is archived in a structured manner according to the disk layout, forming a stable data contract that is auditable and can be visually verified afterward. The test developer can then open the rendered image and visually verify the same frame.

[0071] S3 inputs the natural language judgment criteria and the rendered image into the visual language model to obtain the visual judgment result. The specific implementation method is as follows.

[0072] A visual language model is a multimodal model that accepts images and text and outputs judgments. Natural language judgment criteria and rendered images are input into the visual language model (corresponding to...). Figure 2 The "PNG + Natural Language Standard" (PNG+) is used to return visual judgment results from the visual language model. These results include pass or fail (corresponding to...). Figure 1 The visual judgment result is used for subsequent rulings, including the "pass / fail ruling" and the corresponding reasons.

[0073] In this embodiment, the visual language model is a cloud-hosted Bedrock VLM. In an alternative, the visual language model could be another cloud-based multimodal model (e.g., the visual interface of ChatGPT or Gemini); it could also be a locally deployed open-source multimodal model (non-externalized, suitable for privacy-sensitive scenarios); or it could be edge-side inference (running the multimodal model via the device's NPU). As long as it accepts the image and natural language standards and returns a pass / fail result with a reason, it falls within the protection scope.

[0074] In an alternative approach, the visual decision result can be a scoring system, which returns a confidence level of 0 to 1, and a threshold is set for passing; it can also be a multi-criteria item-by-item decision, which carries multiple criteria in a single assertion and gives a conclusion for each criterion; or it can be a structured decision, which returns the position or bounding box of the element being judged for further assertion.

[0075] Through this step, the visual judgment result is given by the visual language model, which does not require a human benchmark. It can answer semantic questions such as "Does this image look like a pile of cards framed by the camera?", avoiding a large number of false alarms generated by pixel-by-pixel comparison on semantically equivalent but slightly shifted images.

[0076] In a preferred embodiment, after obtaining the visual determination result, the method further includes: when the visual determination result is successful, determining that the visual assertion is successful and advancing the cursor; when the visual determination result is unsuccessful, transmission fails, or no rendered image is obtained, determining that the visual assertion fails, and combining the failure reason given by the visual language model and the path information corresponding to the rendered image into a failure message and returning it. The specific implementation method is as follows.

[0077] After obtaining the visual judgment result, if the visual judgment result is passed, the visual assertion is deemed to have passed and the cursor is advanced (corresponding to...). Figure 2 (The "advancing cursor" part of the test case). The cursor is a pointer to the execution progress of steps in a declarative test scenario. Advancing the cursor indicates that the current step has passed and points to the next step to be executed. When the visual judgment result is "failure," "transmission failure," or "no rendered image received," the visual assertion is deemed to have failed. The failure message is composed of the failure reason given by the visual language model and the path information corresponding to the rendered image, and is returned. "Transmission failure" means that the network failed or lacked credentials when calling the visual language model, and "no rendered image received" means that the rendered image was not rendered. The failure message is a loud failure message; a loud failure is intentionally designed, as a silent pass would render the visual assertion meaningless. The failure message can also embed a failure prefix customized by the test developer. Regardless of the visual judgment result, the rendered image has been written to disk, and the append list has been appended, making it convenient for the test developer to visually review the same frame afterward.

[0078] To ensure the environment without model access rights can still function, two degradation mechanisms are provided: an optional VLM switch and a validator stub. Specifically, when determining that the visual language model is unreachable (corresponding to...),... Figure 2 The "Determiner reachable?" option in the code indicates "No", for example, network failure or missing credentials, and the optional VLM switch can be enabled (corresponding to...). Figure 2 When the "Optional VLM switch is on?" option is "Yes", the transmission failure that should have occurred will be downgraded to automatic pass and an alarm will be output (corresponding to...). Figure 2 The "downgrade to automatic pass output alarm" option allows CIs without model access rights to still run the complete suite without being blocked; when the optional VLM switch is off, transmission failures are treated as loud failures (corresponding to...). Figure 2 (The "loud failure checker unreachable with transport error" message appears in the code). In command-line or validator builds that only perform validation (without viewport or network), visual assertions are replaced with a stub that only advances the cursor and does not initiate any model calls. However, the validator still validates the validity of the visual assertions (e.g., field names and values) according to the step-by-step specifications. Validator stubs follow the same pattern as other rendering-dependent steps: runtime behavior is implemented in the full runtime environment, and validity checks are performed before runtime within the validator.

[0079] With this preferred implementation scheme, the visual assertion is only successful when the visual judgment result is successful. If the result is unsuccessful, transmission fails, or no rendered image is obtained, a loud failure is announced. The failure message includes the reason for the failure and path information, allowing the test developer to open the rendered image for review by following the path information.

[0080] Visual assertions are determined by a visual language model and are suitable for semantic problems such as overall perception. As a deterministic complement to semantic visual judgment, canvas pixel assertions are declared in the test scenario. Canvas pixel assertions are used to perform deterministic pixel comparisons on the CPU canvas when real rendering is not enabled.

[0081] Therefore, in a preferred embodiment, the method further includes: declaring a canvas pixel assertion in the test scene, wherein the canvas pixel assertion is used to perform deterministic pixel comparison on the CPU canvas when real rendering is not initiated; the deterministic pixel comparison includes: parsing the CPU canvas associated with the target entity in the scene graph of the test scene based on the target entity in the canvas pixel assertion; determining the target pixel coordinates based on the UV coordinates in the canvas pixel assertion and the size of the CPU canvas; reading the pixel value at the target pixel coordinates and comparing it with a preset pixel threshold to obtain the canvas determination result. The specific implementation is as follows.

[0082] Declare canvas pixel assertions in the test scenario (corresponding to) Figure 1 The "canvas pixel assertion step" is another declarative test step alongside visual assertions. It is used to perform deterministic pixel comparisons on the CPU canvas without real rendering. Figure 1 (The "Canvas Pixel Probe" branch in the text). The CPU canvas is a CPU-resident RGBA canvas. RGBA consists of four channels: red, green, blue, and transparency. The image of the CPU canvas is produced by vector raster and pixel operations on the CPU side. Because the canvas image is resident on the CPU, its texels can be read under the default dummy rasterizer without the need to start real rendering.

[0083] Deterministic pixel comparison includes the following steps.

[0084] The first step is to parse the CPU canvas associated with the target entity in the scene graph of the test scenario, based on the target entity in the canvas pixel assertion. The CPU canvas is registered with a handle named after its instance identifier. If the canvas pixel assertion provides a target entity, the CPU canvas handle of the target entity is parsed for disambiguation when multiple instances share the same name; otherwise, the first handle is matched based on the name. If the CPU canvas is not found or has not yet been drawn, the canvas pixel assertion is considered to have failed, and a clear reason is given.

[0085] The second step is to determine the target pixel coordinates (corresponding to) based on the UV coordinates in the canvas pixel assertion and the size of the CPU canvas. Figure 1(This refers to "CPU Canvas UV Sampling"). UV coordinates are normalized texture sampling coordinates. The target pixel coordinates are obtained by multiplying the UV coordinates by the width and height of the CPU canvas, rounding them, and squeezing them within the boundaries. Squeezing them within the boundaries means that the calculated coordinates are limited to the effective area of ​​the CPU canvas; if they exceed the range, the boundary values ​​are used.

[0086] The third step is to read the pixel value at the target pixel coordinates and compare it with a preset pixel threshold (corresponding to...). Figure 1 The "RGBA tolerance comparison" in the image yields the canvas determination result (corresponding to...). Figure 1 (The "Pass / Fail" decision is in the code). The red, green, and blue channels are compared one by one with a preset pixel threshold. Failure occurs if the difference between any channel exceeds the tolerance. If transparency verification is required, the transparency channel is also compared. The preset pixel threshold can be given as a hexadecimal string, carrying the transparency in eight bits. The tolerance is configurable. The tolerance refers to the maximum channel difference allowed between the actual pixel value and the preset pixel threshold; failure occurs if the difference between any channel exceeds the tolerance. When a pixel comparison fails, the preset pixel threshold, the measured values ​​of each channel, the target pixel coordinates, and the tolerance are returned.

[0087] Canvas pixel assertions, whether in the command line or validator build, exist as stubs that only advance the cursor and do not initiate pixel reads. The actual pixel comparison is performed in the full runtime environment, and the validator still verifies the step specification of the canvas pixel assertion.

[0088] In one alternative, all options can be based on visual language models, which have the strongest judgment but the highest cost and are non-deterministic; all options can be based on deterministic pixel comparison, which has the lowest cost but the narrowest coverage; alternatively, deterministic fast screening can be performed first, and then visual language models can be used to re-judge suspicious frames, which is a compromise between cost and coverage.

[0089] Through this preferred implementation scheme, canvas pixel assertions, which do not require a visual language model or a GPU, serve as the deterministic complement for semantic visual judgments. They can run under the default dummy rasterizer, using deterministic judgments where certainty is possible and visual language models where uncertainty is not possible, with both coexisting in the same container.

[0090] Example 1: A card game generated by artificial intelligence.

[0091] The input is a declarative test scenario. First, use logical steps to wait for the vertical coordinate of a certain card position to cross a threshold to prove that the layout is stable (instead of just waiting for the number of cards to equal 52, the latter may capture the pre-layout frame where the entity is still generating the origin). Then, write a visual assertion with a natural language judgment criterion: "The camera captured the entire card pile, the card pile is completely in the frame and has not been cropped."

[0092] The test environment decision is that the scene contains visual assertions, automatically launches real rendering, the rendering method defaults to the move method of the deployment target, and the capture resolution is set to a size sufficient to judge the layout.

[0093] The process involves entering a visual assertion, advancing a logical frame to submit the scene graph for rendering, performing a fixed-time-step deterministic warm-up and refresh on GPU particles (skipping the actual advance if there are no particles in this example), reading back the viewport texture as a CPU image and using it as the rendered image, writing the rendered image to disk and adding it to an append list with the rendering flag set to rendered, and inputting the rendered image and natural language judgment criteria into the visual language model.

[0094] The decision is divided into three scenarios: If the camera position is incorrect and the deck is off-screen, the visual language model returns a failure with a reason, stating that the left half of the deck is cropped. The visual assertion fails loudly, and the failure information embeds the reason and the path information corresponding to the rendered image. Test developers can open the image for review. If the image is correct, the visual language model returns a pass, and the visual assertion passes. If running on a CI without model access rights and with the optional VLM switch enabled, the decision to be unreachable is downgraded to automatic pass with an alarm output, and is not blocked.

[0095] A deterministic example of this is that if a CPU canvas is used to draw the scoreboard background in the same game, a separate canvas pixel assertion is written. The criterion is that the color of the canvas at the normalized texture sampling coordinates (0.5, 0.5) (i.e., the target pixel coordinates) is equal to a certain hexadecimal color (i.e., a preset pixel threshold) within the tolerance. This canvas pixel assertion can run under the default dummy rasterizer without needing to enable realistic rendering or a visual language model.

[0096] In the above embodiments, although the steps are numbered S1, S2, etc., they are only specific embodiments given by the present invention. Those skilled in the art can adjust the execution order of S1, S2, etc. according to the actual situation, and these situations are also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.

[0097] Furthermore, the acquisition process of the data involved in this application follows the principles of legality, legitimacy, and necessity. Based on obtaining the explicit authorization and consent of the user, only the minimum necessary information required to achieve the purpose is collected, and data security protection obligations are fulfilled in accordance with the law.

[0098] The present invention also provides a declarative visual assertion system based on visual language model determination, the specific technical solution of which is as follows: an assertion declaration module, a rendering determination module and a model determination module; The assertion declaration module is used to declare visual assertions in the test scenario. The visual assertions include natural language judgment criteria. The rendering determination module is used to determine whether to start real rendering based on the test configuration items; under real rendering, it reads the current viewport texture to obtain the rendered image; The model judgment module is used to input natural language judgment criteria and rendered images into the visual language model to obtain visual judgment results.

[0099] It should be noted that the beneficial effects of the declarative visual assertion system based on visual language model determination provided in the above embodiments are the same as those of the declarative visual assertion method based on visual language model determination, and will not be repeated here. Furthermore, the system provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to the actual situation to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiments, and will not be repeated here.

[0100] like Figure 3 As shown, an embodiment of the present invention provides a computer device 300, which includes a processor 320 coupled to a memory 310. The memory 310 stores at least one computer program 330, which is loaded and executed by the processor 320 to enable the computer device 300 to implement any of the above-described methods. Specifically: The computer device 300 can vary considerably due to differences in configuration or performance. It may include one or more processors 320 (Central Processing Units, CPUs) and one or more memories 310. The one or more memories 310 store at least one computer program 330, which is loaded and executed by the one or more processors 320 to enable the computer device 300 to implement the declarative visual assertion method based on visual language model determination provided in the above embodiments. Of course, the computer device 300 may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The computer device 300 may also include other components for implementing device functions, which will not be elaborated upon here.

[0101] An embodiment of the present invention provides a computer-readable storage medium storing at least one computer program, which is loaded and executed by a processor to enable a computer to implement any of the above-described methods.

[0102] Alternatively, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), magnetic tape, a floppy disk, and an optical data storage device, etc.

[0103] In an exemplary embodiment, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform any of the above-described declarative visual assertion methods based on visual language model determination.

[0104] It should be noted that the terms "first," "second," etc., used in the specification of this application are used to distinguish similar objects and do not imply a specific order or sequence. Where appropriate, the order of use for similar objects can be interchanged so that the embodiments of this application described herein can be implemented in an order other than that shown in the figures or description.

[0105] Those skilled in the art will recognize that this invention can be implemented as a system, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: it can be entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software, generally referred to herein as a "circuit," "module," or "system." Furthermore, in some embodiments, the invention can also be implemented as a computer program product contained in one or more computer-readable media, which includes computer-readable program code.

[0106] Any combination of one or more computer-readable media may be used. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.

[0107] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present invention.

Claims

1. A declarative visual assertion method based on visual language model determination, characterized in that, include: S1, declare a visual assertion in the test scenario, the visual assertion including natural language judgment criteria; S2 determines whether to initiate real rendering based on the test configuration items; In realistic rendering, the current viewport texture is read to obtain the rendered image; S3, input the natural language judgment criteria and the rendered image into the visual language model to obtain the visual judgment result.

2. The declarative visual assertion method based on visual language model determination according to claim 1, characterized in that, The process of determining whether to initiate real rendering based on the test configuration items includes: Based on the rendering switch of the test environment in which the test scenario is located, determine whether to start real rendering; when the rendering switch is turned on, determine whether to start real rendering. When the test scenario contains the visual assertion, it is determined that realistic rendering should be initiated. When there is a requirement for asset preheating, a realistic rendering will be initiated.

3. The declarative visual assertion method based on visual language model determination according to claim 1, characterized in that, Before reading the current viewport texture, the process also includes: In realistic rendering, a logical frame is advanced to submit the scene graph of the test scene to the current drawing, and deterministic preheating and refresh are performed on the GPU particles. Then, the current viewport texture is read to obtain the rendered image. The current viewport texture is provided by the viewport mounted in the scene graph. It is obtained by locating scene nodes that can reach the viewport from the scene graph and obtaining the image data of the texture corresponding to the viewport. The GPU particles are rendered in the current viewport texture. The deterministic warm-up and refresh process allows the emitted particles to be synthesized into the frame buffer before being acquired as the rendered image, thereby avoiding blank particle effects in the current viewport texture. The deterministic warm-up and refresh include: requesting particle advancement by a fixed time step to make particle simulation results reproducible; initiating the first forced rendering to dispatch or advance particle computation; initiating forced synchronization to wait for dispatched but not yet completed GPU work to finish; and initiating the second forced rendering to synthesize the emitted particles into the frame buffer so that particle effects are stably visible in the rendered image.

4. The declarative visual assertion method based on visual language model determination according to claim 3, characterized in that, When the viewport is unreachable, the viewport is empty, the rendered image is empty, or the size of the rendered image is zero, a placeholder image is generated, and the corresponding rendering flag is set to unrendered and not input into the visual language model.

5. The declarative visual assertion method based on visual language model determination according to claim 1, characterized in that, After obtaining the rendered image, the process also includes: Write metadata to the append list; the metadata includes the capture name corresponding to the rendered image, the path information corresponding to the rendered image, the step number of the rendered image in the test scene, the scene name of the test scene, the simulation time when the rendered image was obtained, the size of the rendered image, and the rendering identifier corresponding to the rendered image. The root directory for storing the rendered image is determined based on the capture directory path. When the capture directory path is not set, the default path under the temporary directory is used as the root directory for storage. When the capture directory path is not empty, the capture directory path is used as the root directory for storage. When the capture directory path is empty, the generation of the rendered image is prohibited and the writing of metadata to the append manifest is skipped.

6. The declarative visual assertion method based on visual language model determination according to claim 1, characterized in that, After obtaining the visual determination result, the process also includes: When the visual judgment result is successful, the visual assertion is deemed successful and the cursor is advanced; when the visual judgment result is unsuccessful, transmission fails, or the rendered image is not obtained, the visual assertion is deemed unsuccessful, and the failure reason given by the visual language model and the path information corresponding to the rendered image are combined to form failure information and returned.

7. The declarative visual assertion method based on visual language model determination according to claim 1, characterized in that, Also includes: In the test scenario, a canvas pixel assertion is declared, which is used to perform deterministic pixel comparisons on the CPU canvas when real rendering is not initiated. The deterministic pixel comparison includes: parsing the CPU canvas associated with the target entity in the scene graph of the test scene based on the target entity in the canvas pixel assertion; The target pixel coordinates are determined based on the UV coordinates in the canvas pixel assertion and the size of the CPU canvas; the pixel value at the target pixel coordinates is read and compared with a preset pixel threshold to obtain the canvas determination result.

8. A declarative visual assertion system based on visual language model determination, characterized in that, include: Assertion declaration module, rendering determination module, and model determination module; The assertion declaration module is used to declare visual assertions in the test scenario, and the visual assertions include natural language judgment criteria. The rendering determination module is used to determine whether to start real rendering based on the test configuration items; In realistic rendering, the current viewport texture is read to obtain the rendered image; The model determination module is used to input the natural language determination criteria and the rendered image into the visual language model to obtain the visual determination result.

9. A computer device, characterized in that, The computer device includes a processor coupled to a memory storing at least one computer program, which is loaded and executed by the processor to enable the computer device to implement a declarative visual assertion method based on visual language model determination as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one computer program, which is loaded and executed by a processor to enable the computer to implement a declarative visual assertion method based on visual language model determination as described in any one of claims 1 to 7.