Rendering anomaly detection method, device, storage medium and electronic device
By obtaining rendering detection instructions and generating target images and status information, the problem in the existing technology of being unable to obtain rendering layer information when the application crashes is solved, and detection and analysis of rendering anomalies are realized without relying on Xcode.
Patent Information
- Application Number
- CN202310710682.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-14
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2043-06-14
AI Technical Summary
The existing technology cannot obtain the information of the rendering layer when the application crashes, and cannot use the rendering information acquisition function when Xcode is disconnected, making it difficult to detect and analyze rendering anomalies.
By obtaining rendering detection instructions, the target image and status information, including texture data, vertex data, fragment data and position coordinate data, are generated, the image is converted and stored in a preset storage unit, and rendering anomaly detection is implemented.
Even when the application crashes, the last rendering effect can be saved, and the method of obtaining rendering information and the saving location are controllable. It does not rely on Xcode to realize the detection and analysis of rendering anomalies.
Smart Images

Figure CN116824018B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a rendering anomaly detection method, device, storage medium and electronic device. Background Art
[0002] With the development of science and technology and the improvement of social productivity, computer graphics technology has been widely used in animation, visual effects, games, advertising, digital content visualization and virtual reality, and has gradually become a new field of science and technology. As the core part of computer graphics, graphics engines are widely used in 3D content creation, interactive digital content and other scenarios with their inherent characteristics. As a basic industrial software, its attributes are getting stronger and stronger, and it has become a supporting force for the development of technology and product iteration in many industries. Summary of the invention
[0003] In order to achieve the above objectives, the present disclosure provides a rendering anomaly detection method, device, storage medium and electronic device to solve the technical problems in the prior art.
[0004] According to a first aspect of the present disclosure, a rendering anomaly detection method is provided, comprising:
[0005] In response to the rendering detection instruction, acquiring target rendering data, the target rendering data including texture data, vertex data, fragment data, and position coordinate data corresponding to the current rendering frame;
[0006] Generate a target image according to the target rendering data by a preset image conversion method, wherein the target image is a recognizable image;
[0007] Acquire status information corresponding to the target image, the status information including shader running status information, rendering instruction status information and a rendering channel identifier;
[0008] Storing the target image and the status information in a preset storage unit;
[0009] Anomaly detection is performed based on the image information and state information in the storage unit to determine an abnormality detection result.
[0010] Optionally, calling a preset image conversion method to generate a target image according to the target rendering data, wherein the target image is a recognizable image, includes:
[0011] According to the pixel format of the texture data, when it is determined that a recognizable image can be generated according to the target rendering data, obtaining a preset image conversion method;
[0012] By means of the image conversion method, the texture data in the target rendering data is converted into the target image.
[0013] Optionally, it also includes:
[0014] According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, the vertex data, the fragment data and the position coordinate data are stored in a preset storage unit.
[0015] Optionally, the calling of a preset image conversion method to generate a target image according to the target rendering data, wherein the target image is a recognizable image, further comprises:
[0016] According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, determining the target rendering area according to the vertex data, the fragment data and the position coordinate data;
[0017] Determine whether the target rendering area is smaller than a preset area threshold;
[0018] When it is determined that the target rendering area is smaller than the area threshold, performing pixel format conversion on the texture data to obtain texture data in a target pixel format, wherein the target pixel format is a pixel format that can generate a target image;
[0019] The texture data in the target pixel format is converted into the target image by the image conversion method.
[0020] Optionally, the acquiring target rendering data in response to the rendering detection instruction includes:
[0021] In case of rendering anomalies, generating rendering detection instructions;
[0022] In response to the rendering detection instruction, acquiring historical rendering data;
[0023] Determine, according to the historical rendering data, initial rendering data corresponding to the current rendering frame, wherein the initial rendering data includes vertex data and fragment functions of a shader;
[0024] The initial rendering data is processed to obtain the target rendering data.
[0025] Optionally, storing the target image and the state information in a preset storage unit includes:
[0026] When it is determined that the storage unit is capable of storing the target image and the state information, storing the target image and the state information in the storage unit according to a preset storage rule;
[0027] When it is determined that the storage unit cannot store the target image and the status information, the target image and the status information are stored in a preset program sandbox according to the storage rule.
[0028] According to a second aspect of the present disclosure, a rendering detection device is provided, comprising:
[0029] A first acquisition module, configured to acquire target rendering data in response to a rendering detection instruction, wherein the target rendering data includes texture data, vertex data, fragment data, and position coordinate data corresponding to a current rendering frame;
[0030] A generating module, configured to generate a target image according to the target rendering data by a preset image conversion method, wherein the target image is a recognizable image;
[0031] A second acquisition module, used to acquire status information corresponding to the target image, wherein the status information includes shader running status information, rendering instruction status information and a rendering channel identifier;
[0032] A storage module, storing the target image and the state information in a preset storage unit;
[0033] The detection module is used to perform rendering detection according to the image information and state information in the storage unit to determine the rendering detection result.
[0034] Optionally, the generating module is used to:
[0035] Determining, according to a pixel format of the texture data, whether a target image can be generated according to the target rendering data;
[0036] In the case where a target image can be generated according to the target rendering data, obtaining a preset image conversion method;
[0037] By means of the image conversion method, the texture data in the target rendering data is converted into the target image.
[0038] According to a third aspect of the present disclosure, there is provided a non-temporary computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0039] According to a fourth aspect of the present disclosure, there is provided an electronic device, including:
[0040] a memory having a computer program stored thereon;
[0041] A processor is used to execute the computer program in the memory to implement the steps of the method described in the first aspect.
[0042] Through the above technical solution, the texture data corresponding to the current rendering frame is converted to generate a recognizable target image through a preset image conversion method, and the status information corresponding to the target image, including shader running status information, rendering instruction status information, and rendering channel identifier, etc., is obtained, and then the target image and status information are stored in a preset storage unit, so that anomaly detection can be performed based on the image information and status information in the storage unit to determine the anomaly detection result. In this way, by generating a readable file object from the shader code, generating a readable file object from the attributes in Metal, and generating a readable file object from the rendering anomaly caused by the application, the last rendering effect can be saved even when the application crashes, and the way to obtain the rendering information and the location of the storage are controllable, and the detection and analysis of rendering anomalies can be performed without the help of Xcode.
[0043] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0045] Figure 1 The figure is a flow chart of a rendering detection method according to an exemplary embodiment.
[0046] Figure 2 The figure is a flowchart of a rendering detection method according to another exemplary embodiment.
[0047] Figure 3 The figure is a block diagram of a rendering detection device according to an exemplary embodiment.
[0048] Figure 4 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0049] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0050] First of all, it should be understood that at present, mainstream platforms have developed their own rendering libraries, such as Metal in Apple, Vulkan in Android, and cross-platform OpenGL, etc. However, as the scale of 3D rendering scenes becomes more and more complex, the single-threaded rendering architecture can hardly meet the high-difficulty business needs, so multi-threaded rendering libraries become more and more important.
[0051] The inventors found that Metal, as a new generation of graphics API, has a lower-level and finer-grained interface compared to OpenGL (ES). Currently, Apple officially provides a way to obtain rendering information in Xcode, but this method still has many shortcomings. For example, this method can only be used to obtain information from programs running through Xcode, and it is impossible to obtain rendering layer information when the application crashes. This function cannot be used when the Xcode connection is disconnected.
[0052] In view of this, the present disclosure provides a rendering anomaly detection method, device, storage medium and electronic device to solve the above technical problems.
[0053] Figure 1 FIG. 1 is a flowchart of a rendering detection method according to an exemplary embodiment. Figure 1 As shown, the rendering detection method may include the following steps:
[0054] Step S11, in response to the rendering detection instruction, obtaining target rendering data, the target rendering data including texture data, vertex data, fragment data and position coordinate data corresponding to the current rendering frame;
[0055] Step S12, generating a target image according to the target rendering data by a preset image conversion method, wherein the target image is a recognizable image;
[0056] Step S13, obtaining status information corresponding to the target image, the status information including shader running status information, rendering instruction status information and a rendering channel identifier;
[0057] Step S14, storing the target image and state information in a preset storage unit;
[0058] Step S15, performing abnormality detection based on the image information and state information in the storage unit to determine the abnormality detection result.
[0059] First of all, it should be understood that the present disclosure can be applied to rendering scenarios of Metal in the iOS system, and can also be applied to other rendering scenarios, which is not limited in the embodiments of the present disclosure.
[0060] For example, you can first register active calls and listening events for rendering exceptions in the main function, analyze the cause of the exception in the method and hold the main thread to prevent the application from ending, call the interface provided by the rendering to save the current rendering content and instructions, and finally actively end the application based on the return of a successful save flag.
[0061] Specifically, first, the active call and rendering exception listener can be registered in the main function, and a judgment can be made when the application crashes. If the exception occurs during graphics rendering, the rendering exception save operation is performed, and the main thread is held forcefully to wait for the completion of the rendering save instruction. When the rendering detection instruction is received, the image conversion method that provides texture data to an image is waited for to be called. After obtaining the target rendering data, the texture data corresponding to the current rendering frame is converted into an image, and the corresponding status information is obtained, and then the target image and status information are saved in a preset storage unit. Among them, the converted target image and status information can be classified and stored according to the type of exception, and then the listener is informed whether the saving is successful. After the listener receives the message that the image is saved successfully, the forced holding of the main thread is interrupted, and the application life cycle is ended. At this time, the data conversion and storage of the rendering exception have been completed, so that the exception detection can be performed according to the stored information later to determine the exception detection result.
[0062] For example, in order to improve the accuracy of rendering detection, provide sufficiently rich diagnostic information, and reduce the performance loss of the detection algorithm, you can create an identification bit during rendering so that when rendering is normal, data acquisition, image conversion, and strong holding of Metal objects will not be performed, thereby reducing the overhead on system memory and CPU, and only making a weak reference to the Metal object once, so that when a problem occurs in the application rendering, accurate and sufficient diagnostic information can be obtained to determine the cause of the problem.
[0063] Through the above technical solution, the texture data corresponding to the current rendering frame is converted to generate a recognizable target image through a preset image conversion method, and the status information corresponding to the target image, including shader running status information, rendering instruction status information, and rendering channel identifier, etc., is obtained, and then the target image and status information are stored in a preset storage unit, so that anomaly detection can be performed based on the image information and status information in the storage unit to determine the anomaly detection result. In this way, by generating a readable file object from the shader code, generating a readable file object from the attributes in Metal, and generating a readable file object from the rendering anomaly caused by the application, the last rendering effect can be saved even when the application crashes, and the way to obtain the rendering information and the location of the storage are controllable, and the detection and analysis of rendering anomalies can be performed without the help of Xcode.
[0064] In a possible manner, in response to the rendering detection instruction, obtaining the target rendering data may be:
[0065] In case of rendering anomalies, generating rendering detection instructions;
[0066] In response to the rendering detection instruction, obtaining historical rendering data;
[0067] Determine the initial rendering data corresponding to the current rendering frame according to the historical rendering data, the initial rendering data including vertex data and fragment function of the shader;
[0068] The initial rendering data is processed to obtain target rendering data.
[0069] It should be understood that the present disclosure can be applied to the rendering process for real-time detection, that is, generating a rendering detection instruction at a preset time point or a preset time interval for abnormality detection, or generating a rendering detection instruction for abnormality detection when a rendering abnormality occurs, which is not limited in the embodiments of the present disclosure. Among them, the rendering detection instruction may include a rendering detection time point and a rendering detection object, etc., which is not limited in the embodiments of the present disclosure.
[0070] For example, after receiving a rendering detection instruction, historical rendering data can be obtained, wherein the historical rendering data may include the time point corresponding to the rendering detection instruction, or the historical rendering data before the time point when the rendering detection instruction is received, and the initial rendering data of the current rendering frame corresponding to the rendering detection instruction is determined, and the initial rendering data includes the vertex data and fragment function of the shader. Then, data processing is performed on the initial rendering data to obtain target rendering data. Among them, data processing on the initial rendering data can be to convert the vertex data and fragment function of the shader to generate texture data and vertex data corresponding to the current rendering frame.
[0071] In a possible manner, a preset image conversion method is called to generate a target image according to the target rendering data. The target image is a recognizable image, which may be:
[0072] According to the pixel format of the texture data, when it is determined that a recognizable image can be generated according to the target rendering data, a preset image conversion method is obtained;
[0073] The texture data in the target rendering data is converted into a target image through an image conversion method.
[0074] It should be understood that different pixel formats may be set when rendering on the iOS platform, and different conversions can be performed on texture data for different pixel formats. When the pixel format of the texture data supports generating images, the preset image conversion method can be called to convert the texture data in the target rendering data into the target image.
[0075] For example, it is possible to determine whether a recognizable image can be generated according to the target rendering data based on the pixel format of the texture data corresponding to the current rendering frame. If it is determined that a recognizable image can be generated according to the target rendering data, a preset image conversion method is obtained, and the texture data in the target rendering data is converted into the target image through the image conversion method. Of course, other methods can also be used to determine whether a recognizable image can be generated according to the target rendering data, and the embodiments of the present disclosure are not specifically limited to this.
[0076] In another possible way, you can also:
[0077] According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, the vertex data, the fragment data and the position coordinate data are stored in a preset storage unit.
[0078] For example, if it is determined that the target image cannot be generated according to the target rendering data based on the pixel format of the texture data, the image conversion of the texture data may not be performed, and the vertex data, fragment data, and position coordinate data corresponding to the current rendering frame may be directly stored in a preset storage unit, so that anomaly detection can be performed based on the data in the storage unit to determine the anomaly detection result.
[0079] In a possible manner, a preset image conversion method is called to generate a target image according to the target rendering data, where the target image is a recognizable image. It is also possible to:
[0080] According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, the target rendering area is determined according to the vertex data, the fragment data and the position coordinate data;
[0081] Determine whether the target rendering area is smaller than a preset area threshold;
[0082] When it is determined that the target rendering area is smaller than the area threshold, performing pixel format conversion on the texture data to obtain texture data in a target pixel format, wherein the target pixel format is a pixel format that can generate a target image;
[0083] The texture data in the target pixel format is converted into the target image through the image conversion method.
[0084] For example, when it is determined that the target image cannot be generated according to the target rendering data based on the pixel format of the texture data, the texture data can be first converted into a pixel format that can generate an image, so as to generate the target image according to the texture data after the pixel format conversion.
[0085] It is worth noting that when the rendering area is large and the number of pixels is large, pixel format conversion requires a long wait time, which affects the efficiency of rendering detection. Therefore, if it is determined that the target image cannot be generated according to the target rendering data based on the pixel format of the texture data, it can be determined whether to wait for pixel format conversion based on the size of the target rendering area. Specifically, the target rendering area can be first determined based on the vertex data, fragment data, and position coordinate data, and then it can be determined whether the target rendering area is smaller than a preset area threshold. When the target rendering area is smaller than the area threshold, the texture data is converted in pixel format to obtain texture data in a target pixel format that can generate a target image. Finally, the texture data in the target pixel format is converted into the target image through an image conversion method.
[0086] For example, in the texture data conversion stage, when it is determined that the pixel format of the texture data cannot be directly converted into an image, a 2D image can be generated through MTLRegion, and then the image size and pixels can be obtained for conversion, thereby greatly reducing memory usage and saving memory space, thereby continuously monitoring rendering failures.
[0087] It should also be understood that although pixel format conversion takes up less memory space, considering that memory space is limited, if active calls to generate images are continuously made during the online stage of the application, a large number of image objects will accumulate in the memory, occupying too much memory space, resulting in restrictions on the operation of other functions of the application. Therefore, in order to be able to call to generate images without affecting the normal use of the application by users during the online stage, space for an image object can be reserved in advance. In addition, the memory address of the object can be retained without releasing it after each image conversion and saving. By holding the memory address, a new image can be directly generated using the memory address of this object when the next frame needs to be saved. In addition, in this process, since the number of active calls will not be continuous, the identifier can also be used inside the method to determine whether to maintain a strong reference to the conversion object.
[0088] In a possible manner, storing the target image and the state information in a preset storage unit may be:
[0089] When it is determined that the storage unit is capable of storing the target image and the state information, storing the target image and the state information in the storage unit according to a preset storage rule;
[0090] When it is determined that the storage unit cannot store the target image and the status information, the target image and the status information are stored in a preset program sandbox according to the storage rule.
[0091] It should be understood that when performing data storage management, due to iOS's restrictions on permissions, when images and information are saved, especially when the image does not have album permissions, the saving will fail. Therefore, after determining the target image and status information, it can be determined whether the storage unit can store the target image and status information, that is, access permission can be requested from the storage unit, and storage can be performed only when the storage unit allows access. If the storage unit does not allow access, that is, the storage unit cannot store the target image and status information, the target image and status information will be stored in the preset program sandbox according to the storage rules.
[0092] For example, after receiving a request to save data, you can first determine whether you need to save the image. If you need to save the image, you will know whether the path to save is the album. If you need to save it to the album, you will determine whether access to the album requires permission. If access permission is required, you can first request access to the album and wait for the system's feedback. After agreeing to the request, the image is saved. At this time, the main thread is still in a strong reference state. After the image is saved, a success instruction should be sent to the waiting thread immediately. After the system receives the exception information and successfully saves the mark, it does not need to consider thread safety. It can directly interrupt the forced holding of the main thread and end the application life cycle.
[0093] Figure 2 FIG. 1 is a flowchart of a rendering detection method according to another exemplary embodiment. Figure 2 As shown, the rendering detection method may include the following steps:
[0094] Step S201: when a rendering exception occurs, generate a rendering detection instruction.
[0095] Step S202: Responding to the rendering detection instruction, obtaining historical rendering data.
[0096] Step S203, determining initial rendering data corresponding to the current rendering frame according to the historical rendering data, wherein the initial rendering data includes vertex data and fragment functions of the shader.
[0097] Step S204 , performing data processing on the initial rendering data to obtain target rendering data, wherein the target rendering data includes texture data, vertex data, fragment data, and position coordinate data corresponding to the current rendering frame.
[0098] Step S205, determining whether a recognizable image can be generated according to the target rendering data based on the pixel format of the texture data. If it is determined that a recognizable image can be generated according to the target rendering data, executing step S206, otherwise executing step S208 or step S212.
[0099] Step S206, obtaining a preset image conversion method.
[0100] Step S207: Convert the texture data in the target rendering data into a target image by using an image conversion method. Execute step S213.
[0101] Step S208, determining a target rendering area according to the vertex data, the fragment data and the position coordinate data.
[0102] Step S209, determining whether the target rendering area is smaller than a preset area threshold, if it is determined that the target rendering area is smaller than the area threshold, executing step S210, otherwise executing step S212.
[0103] Step S210 , performing pixel format conversion on the texture data to obtain texture data in a target pixel format, wherein the target pixel format is a pixel format that can generate a target image.
[0104] Step S211, converting the texture data in the target pixel format into the target image by an image conversion method. Execute step S213.
[0105] Step S212, storing the vertex data, fragment data and position coordinate data into a preset storage unit.
[0106] Step S213, obtaining status information corresponding to the target image, where the status information includes shader running status information, rendering instruction status information, and a rendering channel identifier.
[0107] Step S214, determining whether the storage unit can store the target image and state information. If the storage unit can store the target image and state information, executing step S215, otherwise executing step S216.
[0108] Step S215: store the target image and / or state information into a storage unit according to a preset storage rule. Execute step S217.
[0109] Step S216: store the target image and / or state information in a preset program sandbox according to the storage rule. Execute step S217.
[0110] Step S217, performing anomaly detection based on the information in the storage unit or the program sandbox to determine an anomaly detection result.
[0111] Through the above technical solution, the texture data corresponding to the current rendering frame is converted to generate a recognizable target image through a preset image conversion method, and the status information corresponding to the target image, including shader running status information, rendering instruction status information, and rendering channel identifier, etc., is obtained, and then the target image and status information are stored in a preset storage unit, so that anomaly detection can be performed based on the image information and status information in the storage unit to determine the anomaly detection result. In this way, by generating a readable file object from the shader code, generating a readable file object from the attributes in Metal, and generating a readable file object from the rendering anomaly caused by the application, the last rendering effect can be saved even when the application crashes, and the way to obtain the rendering information and the location of the storage are controllable, and the detection and analysis of rendering anomalies can be performed without the help of Xcode.
[0112] Figure 3 FIG. 1 is a block diagram of a rendering detection device according to an exemplary embodiment. Figure 3 As shown, the rendering detection device 300 includes a first acquisition module 301 , a generation module 302 , a second acquisition module 303 , a storage module 304 and a detection module 305 .
[0113] A first acquisition module 301 is used to acquire target rendering data in response to a rendering detection instruction, wherein the target rendering data includes texture data, vertex data, fragment data, and position coordinate data corresponding to a current rendering frame;
[0114] A generating module 302, configured to generate a target image according to the target rendering data by a preset image conversion method, wherein the target image is a recognizable image;
[0115] A second acquisition module 303 is used to acquire status information corresponding to the target image, wherein the status information includes shader running status information, rendering instruction status information, and a rendering channel identifier;
[0116] The storage module 304 stores the target image and the state information in a preset storage unit;
[0117] The detection module 305 is used to perform rendering detection according to the image information and state information in the storage unit to determine the rendering detection result.
[0118] Optionally, the generating module 302 is used to:
[0119] Determining, according to a pixel format of the texture data, whether a target image can be generated according to the target rendering data;
[0120] In the case where a target image can be generated according to the target rendering data, obtaining a preset image conversion method;
[0121] By means of the image conversion method, the texture data in the target rendering data is converted into the target image.
[0122] Optionally, the rendering detection device 300 further includes:
[0123] According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, the vertex data, the fragment data and the position coordinate data are stored in a preset storage unit.
[0124] Optionally, the generating module 302 is further used for:
[0125] According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, determining the target rendering area according to the vertex data, the fragment data and the position coordinate data;
[0126] Determine whether the target rendering area is smaller than a preset area threshold;
[0127] When it is determined that the target rendering area is smaller than the area threshold, performing pixel format conversion on the texture data to obtain texture data in a target pixel format, wherein the target pixel format is a pixel format that can generate a target image;
[0128] The texture data in the target pixel format is converted into the target image by the image conversion method.
[0129] Optionally, the first acquisition module 301 is used to:
[0130] In case of rendering anomalies, generating rendering detection instructions;
[0131] In response to the rendering detection instruction, acquiring historical rendering data;
[0132] Determine, according to the historical rendering data, initial rendering data corresponding to the current rendering frame, wherein the initial rendering data includes vertex data and fragment functions of a shader;
[0133] The initial rendering data is processed to obtain the target rendering data.
[0134] Optionally, the storage module 304 is used to:
[0135] When it is determined that the storage unit is capable of storing the target image and the state information, storing the target image and the state information in the storage unit according to a preset storage rule;
[0136] When it is determined that the storage unit cannot store the target image and the status information, the target image and the status information are stored in a preset program sandbox according to the storage rule.
[0137] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0138] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, and the program instructions, when executed by a processor, implement the steps of the rendering detection method provided by the present disclosure.
[0139] The present disclosure also provides an electronic device, comprising:
[0140] a memory having a computer program stored thereon;
[0141] The processor is used to execute the computer program in the memory to implement the steps of the rendering detection method provided by the present disclosure.
[0142] Figure 4 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Figure 4 As shown, the electronic device 700 may include: a processor 701 , a memory 702 . The electronic device 700 may also include one or more of a multimedia component 703 , an input / output (I / O) interface 704 , and a communication component 705 .
[0143] The processor 701 is used to control the overall operation of the electronic device 700 to complete all or part of the steps in the above-mentioned storage method. The memory 702 is used to store various types of data to support the operation of the electronic device 700. For example, these data may include instructions for any application or method used to operate on the electronic device 700, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 702 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, magnetic disk or optical disk. The multimedia component 703 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 702 or sent through the communication component 705. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 704 provides an interface between the processor 701 and other interface modules, and the other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is used for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, is not limited here. Therefore, the corresponding communication component 705 may include: Wi-Fi module, Bluetooth module, NFC module, etc.
[0144] In an exemplary embodiment, the electronic device 700 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned rendering detection method.
[0145] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned rendering detection method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 702 including program instructions, and the above-mentioned program instructions can be executed by the processor 701 of the electronic device 700 to complete the above-mentioned rendering detection method.
[0146] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program executable by a programmable device. The computer program has a code portion for executing the above rendering detection method when executed by the programmable device.
[0147] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0148] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0149] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A rendering anomaly detection method, characterized in that: include: In response to the rendering detection instruction, acquiring target rendering data, the target rendering data including texture data, vertex data, fragment data, and position coordinate data corresponding to a current rendering frame rendered by the application program; Generate a target image according to the target rendering data by a preset image conversion method, wherein the target image is a recognizable image; Acquire status information corresponding to the target image, the status information including shader running status information, rendering instruction status information and a rendering channel identifier; Storing the target image and the status information in a preset storage unit; Performing anomaly detection based on the image information and state information in the storage unit to determine an anomaly detection result; Wherein, the method further comprises: Registering active call and rendering exception listener events in the main function of the application; When the rendering of the application is abnormal and the application crashes, the monitoring event strongly holds the main thread of the application so that the application will not end, and performs a rendering abnormality saving operation; the rendering abnormality saving operation saves the current rendering content and instructions by calling an interface provided by the rendering.
2. The method according to claim 1, characterized in that The calling of a preset image conversion method to generate a target image according to the target rendering data, wherein the target image is a recognizable image, includes: According to the pixel format of the texture data, when it is determined that a recognizable image can be generated according to the target rendering data, obtaining a preset image conversion method; By means of the image conversion method, the texture data in the target rendering data is converted into the target image.
3. The method according to claim 1 or 2, characterized in that: Also includes: According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, the vertex data, the fragment data and the position coordinate data are stored in a preset storage unit.
4. The method according to claim 1 or 2, characterized in that: The calling of a preset image conversion method to generate a target image according to the target rendering data, wherein the target image is a recognizable image, further comprises: According to the pixel format of the texture data, when it is determined that the target image cannot be generated according to the target rendering data, determining the target rendering area according to the vertex data, the fragment data and the position coordinate data; Determine whether the target rendering area is smaller than a preset area threshold; When it is determined that the target rendering area is smaller than the area threshold, performing pixel format conversion on the texture data to obtain texture data in a target pixel format, wherein the target pixel format is a pixel format that can generate a target image; The texture data in the target pixel format is converted into the target image by the image conversion method.
5. The method according to claim 1, characterized in that The step of obtaining target rendering data in response to the rendering detection instruction includes: In case of rendering anomalies, generating rendering detection instructions; In response to the rendering detection instruction, acquiring historical rendering data; Determine, according to the historical rendering data, initial rendering data corresponding to the current rendering frame, wherein the initial rendering data includes vertex data and fragment functions of a shader; The initial rendering data is processed to obtain the target rendering data.
6. The method according to claim 1, characterized in that The step of storing the target image and the state information in a preset storage unit includes: When it is determined that the storage unit is capable of storing the target image and the state information, storing the target image and the state information in the storage unit according to a preset storage rule; When it is determined that the storage unit cannot store the target image and the status information, the target image and the status information are stored in a preset program sandbox according to the storage rule.
7. A rendering detection device, characterized in that: include: A first acquisition module, configured to acquire target rendering data in response to a rendering detection instruction, wherein the target rendering data includes texture data, vertex data, fragment data, and position coordinate data corresponding to a current rendering frame rendered by the application program; A generating module, configured to generate a target image according to the target rendering data by a preset image conversion method, wherein the target image is a recognizable image; A second acquisition module, used to acquire status information corresponding to the target image, wherein the status information includes shader running status information, rendering instruction status information, and a rendering channel identifier; A storage module, storing the target image and the state information in a preset storage unit; A detection module, used to perform rendering detection according to the image information and state information in the storage unit to determine a rendering detection result; The rendering detection device also includes: A module for registering listening events for active calls and rendering exceptions in the main function of the application; When the rendering of the application is abnormal and the application crashes, the monitoring event strongly holds the main thread of the application so that the application will not end, and executes the rendering abnormality saving operation module; the rendering abnormality saving operation saves the current rendering content and instructions by calling the interface provided by the rendering.
8. The device according to claim 7, characterized in that The generation module is used for: Determining, according to a pixel format of the texture data, whether a target image can be generated according to the target rendering data; In the case where a target image can be generated according to the target rendering data, obtaining a preset image conversion method; By means of the image conversion method, the texture data in the target rendering data is converted into the target image.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 6 are implemented.
10. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 6.
