CN117671106A - Occlusion query method and device, electronic equipment and storage medium - Google Patents

Occlusion query method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN117671106A
CN117671106A CN202311634180.4A CN202311634180A CN117671106A CN 117671106 A CN117671106 A CN 117671106A CN 202311634180 A CN202311634180 A CN 202311634180A CN 117671106 A CN117671106 A CN 117671106A
Authority
CN
China
Prior art keywords
command
query
target object
operation command
executed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311634180.4A
Other languages
Chinese (zh)
Inventor
刘宏达
叶雨曦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN202311634180.4A priority Critical patent/CN117671106A/en
Publication of CN117671106A publication Critical patent/CN117671106A/en
Pending legal-status Critical Current

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Image Generation (AREA)

Abstract

The embodiment of the invention provides a shielding query method, a shielding query device, electronic equipment and a storage medium, wherein the method comprises the following steps: after receiving the inquiry starting command, sequentially reading the operation command from the operation command queue and sending the operation command into the graphics pipeline for execution; the operation command queue contains drawing commands of the target object and is used for drawing the target object according to a first drawing mode; if the operation command which is executed currently is identified as a drawing command, acquiring the pixel number which is executed currently and corresponds to the drawing command and rendered; after receiving the query ending command, returning a query result; the query result comprises the sum of pixel numbers rendered by all drawing commands between the start query command and the end query command; and if the query result meets the drawing condition, drawing the target object according to a second drawing mode. The embodiment of the invention can reduce unnecessary rendering workload, save the operation resources of the GPU, improve the rendering efficiency and improve the running efficiency of the application program.

Description

Occlusion query method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for shielding query, an electronic device, and a storage medium.
Background
With the development of computer technology and image processing technology, 3D drawing technology is increasingly applied to computer drawing, and can draw vivid three-dimensional scenes.
In the rendering of 3D scenes, there are a large number of complex graphics. A complex 3D rendered frame may contain many complex 3D graphics, where there is a mutual occlusion between the graphics, the occluded graphics occupy the GPU (Graphic Processing Unit, graphics processor) computational resources, but no projection of these occluded graphics occurs on the final frame, which results in a waste of GPU computational resources.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are provided to provide an occlusion query method that overcomes or at least partially solves the above problems, so as to reduce unnecessary rendering workload, save operation resources of a GPU, improve rendering efficiency, and improve running efficiency of an application.
Correspondingly, the embodiment of the invention also provides a shielding inquiry device, electronic equipment and a storage medium, which are used for ensuring the realization and application of the method.
In a first aspect, an embodiment of the present invention discloses an occlusion query method, applied to a GPU, the method including:
After receiving a start inquiry command, sequentially reading the operation commands from an operation command queue, and respectively sending the operation commands into a graphics pipeline for execution; the operation command queue comprises drawing commands corresponding to a target object, and is used for drawing the target object according to a first drawing mode;
if the operation command which is executed currently is identified as a drawing command, acquiring the number of pixels which are executed currently and are rendered corresponding to the drawing command;
after receiving the query ending command, returning a query result; the query result comprises the sum of the pixel numbers of rendering corresponding to all drawing commands which are executed and completed between the start query command and the end query command;
and if the query result meets the drawing condition, drawing the target object according to a second drawing mode.
In a second aspect, an embodiment of the present invention discloses an occlusion query device, applied to a GPU, the device including:
the command execution module is used for sequentially reading the operation commands from the operation command queue after receiving the inquiry starting command, and respectively sending the operation commands into the graphics pipeline for execution; the operation command queue comprises drawing commands corresponding to a target object, and is used for drawing the target object according to a first drawing mode;
The data acquisition module is used for acquiring the number of pixels rendered corresponding to the drawing command which is currently executed if the operation command which is currently executed is identified as the drawing command;
the result returning module is used for returning the query result after receiving the query ending command; the query result comprises the sum of the pixel numbers of rendering corresponding to all drawing commands which are executed and completed between the start query command and the end query command;
and the drawing module is used for drawing the target object according to a second drawing mode if the query result meets the drawing condition.
In a third aspect, an embodiment of the present invention discloses an electronic device, including: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is configured to store at least one executable instruction that causes the processor to perform the steps of the occlusion query method of any of the preceding claims.
In a fourth aspect, an embodiment of the present invention discloses a readable storage medium, where a program or an instruction is stored, where the program or the instruction can implement the occlusion query method according to any one of the embodiments of the present invention when executed by a processor.
The shielding query method, the shielding query device, the electronic equipment and the storage medium provided by the embodiment of the invention have the following advantages:
according to the shielding query method provided by the embodiment of the invention, the target object is firstly drawn according to the first drawing mode, and after drawing, query can be performed according to the condition that the target object is correspondingly shielded, so that a query result is obtained, and the query result can provide reference for the optimization of the subsequent drawing process, so that graphic application designers can simplify graphic rendering conveniently. For example, if the target object is not blocked or the proportion of blocked target object is smaller than the preset value, the target object is drawn according to the second mode, otherwise, the target object is not drawn, so that unnecessary rendering workload can be reduced, the operation resource of the GPU is saved, the rendering efficiency is improved, and the running efficiency of the application program is improved.
Drawings
FIG. 1 is a flow chart of steps of an embodiment of an occlusion query method of the present invention;
FIG. 2 is a schematic diagram of an exemplary occlusion query of the present invention;
FIG. 3 is a block diagram of an embodiment of an occlusion query device of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present invention may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type, and are not limited to the number of objects, such as the first object may be one or more. Furthermore, the term "and/or" as used in the specification and claims to describe an association of associated objects means that there may be three relationships, e.g., a and/or B, may mean: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship. The term "plurality" in embodiments of the present invention means two or more, and other adjectives are similar.
FIG. 1 shows a flowchart of steps of an embodiment of an occlusion query method of the present invention, which may be applied to a GPU, which may include the steps of:
step 101, after receiving a start query command, sequentially reading the operation commands from an operation command queue, and respectively sending the operation commands into a graphics pipeline for execution; the operation command queue comprises drawing commands corresponding to a target object, and is used for drawing the target object according to a first drawing mode;
102, if the operation command which is currently executed is identified as a drawing command, acquiring the number of pixels which are rendered corresponding to the drawing command which is currently executed;
step 103, after receiving the query ending command, returning a query result; the query result comprises the sum of the pixel numbers of rendering corresponding to all drawing commands which are executed and completed between the start query command and the end query command;
and 104, if the query result meets the drawing condition, drawing the target object according to a second drawing mode.
Graphics Processing Units (GPUs), also known as display cores, vision processors, and display chips, are microprocessors that are dedicated to performing image and graphics related operations on personal computers, workstations, gaming machines, and some mobile devices (e.g., tablet computers, smartphones, etc.). The GPU is used to perform mathematical and geometric calculations for graphics rendering.
The shielding inquiry method provided by the embodiment of the invention can be applied to the GPU. The GPU may be integrated in an electronic device, which may be a terminal, a server, or the like. The terminal can be a mobile phone, a tablet computer, an intelligent Bluetooth device, a notebook computer, a personal computer (Personal Computer, PC) or the like; the server may be a single server or a server cluster composed of a plurality of servers.
An application program can be run in the electronic device, and the application program can draw a target object by utilizing the GPU when running. For example, the application programs include, but are not limited to, gaming applications, map applications, medical applications, augmented Reality (AR) applications, virtual Reality (VR) applications, autopilot applications, and the like, which require graphics rendering. A start query command may be sent to the GPU before the application needs to draw the target object. And after the GPU receives the starting inquiry command, starting an shielding inquiry function, and carrying out shielding inquiry on the drawing command received after the starting inquiry command to acquire the pixel number rendered by the drawing command.
The target object refers to a drawing target, and may be a 3D scene or a 3D object to be drawn by an application program. A 3D scene is a space that describes the spatial relationship between objects. A 3D scene is a model of a physical world that can be represented mathematically by a geometry that can describe all points in 3D space by coordinates. The 3D object may be a modeled object or a 3D modeled 3D model, it being understood that the scope of the present examples is not limited in this respect.
A draw command (which may also be referred to as a rendering instruction or a rendering command) refers to an instruction for drawing (also referred to as generating) a drawing target in an image frame, such as a draw call (draw call) implemented based on OpenGL (Open Graphics Library, open image library) (i.e., a call command by a CPU to an underlying graphics drawing interface). The drawing and rendering in the embodiments of the present invention may be interchanged. Accordingly, the set of drawing targets generated according to the drawing command may constitute display data of the corresponding graphic frame. For example, assuming that a certain image frame includes a person a and a person B, the drawing commands of the image frame may include one or more drawing commands for generating the drawing target of the person a and one or more drawing commands for generating the drawing target of the person B, and accordingly, the GPU may obtain the display data of the image frame by executing the drawing commands. In the embodiment of the invention, the implementation method is described by taking OpenGL as an example, but the invention is not limited to OpenGL and can be applied to other types of graphics libraries. The drawing command carries drawing parameters. The rendering parameters are used to generate a rendering target. Further, the drawing command may further carry drawing model information for indicating a drawing model based on which the drawing target is generated. The GPU may generate a drawing target based on the drawing model by executing the drawing command, and the shape characteristics satisfy the drawing parameters.
The "drawing command" described in the embodiments of the present invention may be an instruction, for example, an API call function; or may be a collection of instructions. For example, in OpenGL, a draw call implemented based on OpenGL typically includes multiple API (Application Programming Interface, application program interface) call functions, and this draw call may be considered as a drawing command, to complete a drawing. One draw call may draw one drawing target, or a plurality of draw calls may draw one drawing target or a plurality of drawing targets. The present invention does not limit how to divide the drawing targets, for example, one bag is an inseparable drawing target or one bag is a drawing target, but the drawing targets include three drawing targets of a bag body, a shoulder strap, and a zipper.
The method for querying the occlusion of the target objects to be painted by using the occlusion query method provided by the invention can eliminate the occluded target objects in the painting process and render only the currently visible target objects, thereby reducing unnecessary rendering workload, improving rendering efficiency, ensuring smooth running of the application and improving running efficiency of the application.
Specifically, first, the application may issue a start query command to the GPU to trigger the GPU to start executing the operation of the occlusion query. The application may then issue a draw command to the GPU for drawing the target object. The rendering process is jointly participated by the CPU and GPU. When the application program needs to draw the target object, the CPU adds an operation command into an operation command queue, and the GPU reads the operation command from the operation command queue and executes the operation command. The CPU may write a plurality of operation commands at a time, and after the GPU reads one operation command and executes the operation command, the GPU reads the next operation command and executes the operation command. A target object may contain multiple components, each of which may need to execute one or more drawing commands. After the GPU receives the inquiry starting command, the operation commands are sequentially read from the operation command queue, and the operation commands are respectively sent into the graphics pipeline for execution. The operation command queue comprises drawing commands, and the operation command queue is used for drawing the target object according to a first drawing mode. Further, the operation command queue may further include a synchronous command, where the synchronous command may be used to block operation of the graphics pipeline, and instruct the graphics pipeline to wait for all drawing commands before the synchronous command to execute, and then continue executing the drawing commands after the synchronous command.
And for the operation command of which the current execution of the graphics pipeline is completed, if the operation command of which the current execution is completed is identified as a drawing command, acquiring the pixel number corresponding to the drawing command to be rendered. Finally, the application may issue an end query command to the GPU to trigger the GPU to end the operation of executing the occlusion query. At this point, the GPU may return a query result; the query result may include a sum of the number of pixels rendered corresponding to all drawing commands for which execution is completed between the start query command and the end query command. That is, the sum of the numbers of pixels rendered corresponding to all the drawing commands in the process of drawing the target object can be obtained. According to the embodiment of the invention, the target object is drawn according to the first drawing mode, so that the query result of whether the target object is blocked or the proportion of blocked target object can be obtained by query.
According to the shielding query method provided by the embodiment of the invention, the target object is firstly drawn according to the first drawing mode, and the query result of whether the target object is shielded or not can be obtained after the drawing is completed, and the query result can provide a reference for the optimization of the subsequent drawing process, so that the simplification of graphic rendering by graphic application designers is facilitated. Specifically, if the query result satisfies the drawing condition, the target object may be drawn in the second drawing manner. The embodiment of the invention can preset the drawing conditions, and the drawing conditions are not limited.
For example, the drawing condition may be that the target object is not occluded, or that the proportion of the target object that is occluded is less than a preset value. If the query result does not meet the drawing condition, the target object is not drawn, so that the GPU performance and the running efficiency of the application program can be improved.
The first drawing mode may be a concise drawing mode set by a user, and the concise drawing mode may be based on simpler drawing parameters, so as to realize a basic rendering effect, and occupy less GPU resources as much as possible. The simple drawing aims at carrying out shielding inquiry on the target object and obtaining the pixel number rendered by the drawing operation of the target object, so that whether the target object is shielded or the proportion of the shielded target object can be known. The start query command and the end query command may cover the complete rendering process of the target object. The second drawing mode may be a fine drawing mode set by the user, and compared with the simple drawing mode, the fine drawing mode realizes a rendering effect actually required by the user based on more complex drawing parameters, and occupies more GPU resources. The purpose of the fine drawing mode is to draw the target object according to the actual demands of the user. The user may determine not to render the target object or redraw a more complex and finer target object based on the query results. Therefore, unnecessary fine drawing can be reduced, the rendering efficiency is improved, smooth operation of the application is ensured, and the operation efficiency of the application is improved.
In an alternative embodiment of the present invention, the start query command and the end query command may be sent by an application in the GPU-mounted platform to a Mesa driver by calling an OpenGL interface, and sent to the GPU by the Mesa driver; the query result may be returned to the Mesa driver by the GPU and returned to the application by the Mesa driver by invoking the OpenGL interface.
The Mesa is a OpenGL (Open Graphics Library) implementation under Linux. OpenGL is a cross-platform graphics programming interface for rendering 2D and 3D graphics. It defines a series of functions and state machines that allow developers to create high-performance graphics applications, including games, computer-aided design and scientific visualization, and the like. The Mesa is an open-source graphics library that implements the functions of OpenGL and other graphics APIs. It provides a generic interface so that applications can use the same API for graphics rendering on different operating systems and hardware platforms.
According to the shielding query method, before an application program needs to draw a target object, a start query command can be sent to the GPU by calling an OpenGL interface, and after receiving the start query command, a Mesa driver sends the start query command to the GPU. And enabling the function of shielding the query after the GPU receives the query starting command. The application program then sends drawing commands to the GPU by calling the OpenGL interface, these drawing commands are stored in the operation command queue, and the GPU reads and executes them. When the shielding inquiry needs to be ended, the application program sends an ending inquiry command to the GPU by calling the OpenGL interface, and the Mesa driver receives the ending inquiry command and then sends the ending inquiry command to the GPU. And after the GPU receives the query ending command, stopping shielding query, returning a query result to the Mesa driver, and calling the OpenGL interface by the Mesa driver to return the query result to the application program. And the application program determines whether the target object needs to be drawn according to the second drawing mode according to the query result.
It should be noted that, the application program sends the start query command and the operation command queue to the GPU through the Mesa driver in sequence, that is, when one occlusion query is performed, the start query command needs to be sent first, so that the GPU hardware enables the occlusion query function, then sends the operation command (including the drawing command) needed to perform the query occlusion query, and finally sends the end query command. The final query results include the query results of all drawing commands between the start query command and the end query command. That is, the query result includes a sum of the pixel numbers rendered by all drawing commands between the start query command and the end query command.
When the shielding inquiry needs to be started, an application program running in the electronic equipment calls an OpenGL interface to send a starting inquiry command, the starting inquiry command is sent to the GPU firmware through the Mesa driver, the GPU firmware enables a corresponding shielding inquiry function, and the shielding inquiry operation starts to be executed.
When the shielding inquiry needs to be finished, an application program running in the electronic equipment calls an OpenGL interface to send an inquiry finishing command, the inquiry finishing command is sent to the GPU firmware through a Mesa driver, the inquiry operation is finished, an inquiry result is returned to the Mesa driver, the Mesa driver sends the inquiry result to the OpenGL interface, and the inquiry result is returned to the application program.
In the embodiment of the invention, the GPU enables the function of shielding the query after receiving the query starting command, sequentially sends the operation commands in the operation command queue into the graphics pipeline for sequential execution, and after each execution completes one drawing command, can acquire the pixel number rendered by the drawing command so as to acquire the query result of each drawing command.
The graphics pipeline is a hardware unit used by the GPU to perform rendering operations. The graphics pipeline is also referred to as a rendering pipeline or rendering pipeline. The work task of the graphics pipeline is to convert the graphics pipeline into a two-dimensional image according to information such as vertexes, textures and the like in a three-dimensional scene. This is typically done by the CPU and the GPU together, with the CPU constantly sending data to be processed to the GPU, which mobilizes the individual computing units to process the data into a two-dimensional image.
The graphics pipeline typically includes three stages: an application phase, a geometry phase and a raster phase. The application stage is completed by the CPU, and is mainly used for preparing necessary data (such as vertices, textures, etc.) for the GPU. The geometry stage and the raster stage are completed by the GPU. It should be noted that, in the embodiment of the present invention, the graphics pipeline refers to a geometric stage and a raster stage.
In the application phase, the CPU loads data (e.g., vertices, textures, etc.) required to draw the target object into the memory, sets the rendering state, and issues the drawing command(s). The drawing command is written into an operation command queue in a buffer. A drawing command points to a list of primitives to be rendered, which the GPU may render according to the set rendering state. The primitives herein may be points, lines and triangles.
The purpose of the geometric stage is to perform operations such as adjustment, modification, conversion, addition and deletion on the input primitive, the input data of the geometric stage is the primitive, the processed data is the primitive, and the output data is the primitive.
The purpose of the rasterization stage is to convert the primitives resulting from the geometry stage processing into a series of pixels for subsequent final output onto the screen.
Wherein each pixel carries Z-coordinate information (i.e., depth information) and alpha information (i.e., transparency). Based on the depth information and alpha information, a series of tests can be performed to determine which pixels are to be occluded and do not need to be displayed; which pixels have a transparency of not 1, a Blending operation is required to determine the pixel information that is ultimately required to be output. Thus, after the graphics flow execution completes each drawing command, the number of elements rendered by the drawing command can be obtained.
In an alternative embodiment of the present invention, the method may further include:
sequentially reading operation commands from an operation command queue, and respectively sending the operation commands into the graphics pipeline for execution, wherein the operation types of the operation commands read each time are sequentially recorded in a preset structure array;
and triggering an interrupt operation when each operation command is executed by the graphics pipeline, wherein the interrupt operation is used for inquiring the operation type of the operation command which is executed currently and recorded in the preset structure body array so as to identify whether the operation command which is executed currently and completed is a drawing command.
A graphics pipeline is a hardware unit of a GPU that performs drawing operations, and may trigger an interrupt operation every time an operation command is performed. Since the operation command queue may include other operation commands (e.g., synchronization commands) in addition to the drawing command, when the graphics pipeline execution completes one operation command, it is not known whether the operation command currently being executed is a drawing command. Only the drawing command is rendered, so that an interrupt operation can be triggered when the graphics pipeline completes an operation command, the interrupt operation is used for judging whether the operation command which is currently completed is the drawing command, and if the operation command is the drawing command, the number of pixels which are rendered corresponding to the operation command which is currently completed can be obtained.
In order to be able to identify whether each operation command is a drawing command after the execution of the operation command is completed, in the embodiment of the invention, in the process of sequentially reading the operation commands from an operation command queue and respectively sending the operation commands into the graphics pipeline for execution, the operation types of the operation commands read each time are sequentially recorded in a preset structure array; the operation types may include drawing or synchronization. Each structure in the preset structure array records the operation type of one operation command. Each time an operation command is read into the graphics pipeline, the operation type of the operation command read is written into the preset fabric array. The embodiment of the invention does not limit the structure of the preset structure body array. Thus, when the graphics pipeline completes one operation command and triggers an interrupt operation every time, the operation type of the operation command which is currently executed and completed can be obtained by querying the preset structure body array, so that whether the operation type of the operation command which is currently executed and completed is drawing or not can be judged, and if so, the number of pixels which are rendered corresponding to the drawing command which is currently executed and completed is obtained.
In an alternative embodiment of the present invention, the method may further include:
initializing a first counter and a second counter;
each time an operation command is sent into the graphics pipeline, adding 1 to the value of the first counter;
each time the graphics pipeline completes an operation command, the operation command after the execution is pressed into an outgoing line queue as a node in sequence;
each time the outgoing line queue is added with a node, the value of the second counter is added with 1;
the operation type of the operation command read each time is recorded in the preset structure body array in sequence, and the operation type comprises the following steps:
when one operation command is read from the operation command queue and is sent to the graphics pipeline for execution, the current value of the first counter is used as the sequence number of the operation command which is read currently, and the operation type and the corresponding sequence number of the operation command which is read currently are recorded in a preset structure body array;
the querying the operation type of the operation command recorded in the preset structure body array and completed by the current execution comprises the following steps:
and taking the current value of the second counter as the sequence number of the operation command of which the current execution is completed, and inquiring the corresponding operation type in the preset structure body array.
Further, embodiments of the present invention may maintain an ingress pipeline queue and an egress pipeline queue. The pipeline inlet queue is the operation command queue. The operation commands in the pipeline inlet queue are sequentially sent into the graphics pipeline for execution according to the first-in first-out sequence, and when one operation command is read, the operation type of the operation command is written into the preset structure body array, and then the operation command is sent into the graphics pipeline. The operation commands in the graphics pipeline are sequentially executed in a first-in first-out order, and each time an operation command is completed, the operation command is sent to the out-pipeline queue.
Embodiments of the present invention may maintain a counter (e.g., referred to as a first counter) when an operation command is entered into the graphics pipeline, i.e., the value of the first counter is incremented by 1 for each operation command entered into the graphics pipeline. One counter (e.g., referred to as a second counter) may be maintained as an operation command is issued in the graphics pipeline, i.e., each time the graphics pipeline completes an operation command, the value of the second counter is incremented by 1 as the completed operation command is issued from the graphics pipeline into the dequeue. Thus, the value of the first counter and the value of the second counter are kept synchronized, i.e. the value of the first counter and the value of the second counter correspond to the sequence number of the currently executed operation command.
When one operation command is read from the operation command queue and is sent to the graphics pipeline for execution, the current value of the first counter is used as the serial number of the operation command which is read currently, and the operation type of the operation command which is read currently and the corresponding serial number are recorded in a preset structure body array. Therefore, the preset structure body array records the sequence number and the operation type corresponding to each operation command in the operation command queue.
And triggering an interrupt operation when the graphics pipeline completes one operation command, wherein the current value of the second counter is the sequence number of the operation command which is currently executed and completed, inquiring the preset structure body array based on the sequence number, so that the operation type of the operation command which is currently executed and completed can be obtained, and further, whether the operation command which is currently executed and completed is a drawing command can be identified.
In one example, assume that 16 operation commands are contained in the operation command queue. In the process that the GPU sequentially sends the operation commands in the operation command queue into the graphics pipeline, the operation type (synchronous command or drawing command) of each operation command is respectively recorded in a preset structure array. The preset structure body array comprises 16 structure bodies, and operation types of 16 operation commands are respectively recorded. When the execution of one operation command is completed, the hardware triggers an interrupt operation to inform the software that the execution of the operation command is completed. At this time, the GPU may obtain the sequence number of the operation command that is currently executed through the value of the second counter, and query the preset structure array for the operation type recorded in the structure corresponding to the sequence number, so as to know whether the operation command that is currently executed is a drawing command.
It should be noted that, in the embodiment of the present invention, the number of operation commands included in the operation command queue is not limited, and the above 16 operation commands are only illustrated as examples.
In an alternative embodiment of the present invention, the method may further include:
respectively distributing a preset register for each drawing command in the operation command queue; the preset register is used for recording the pixel number rendered by the drawing command;
the obtaining the pixel number rendered corresponding to the drawing command may include:
and acquiring a value in a preset register corresponding to the drawing command.
For an operation command in the graphics pipeline, only when the graphics pipeline executes a drawing command in the graphics pipeline, the drawing command with the execution completed generates a corresponding rendered pixel number. Therefore, the embodiment of the invention respectively allocates a preset register for each drawing command in the operation command queue, and each preset register is used for recording the pixel number rendered by the corresponding drawing command. Therefore, for a drawing command which is executed, the pixel number corresponding to the drawing command and rendered can be obtained by reading the value in the preset register corresponding to the drawing command.
Optionally, in order to reduce the operation steps of determining whether the operation command is a drawing command, the embodiment of the present invention may allocate a preset register to each operation command in the operation command queue. That is, there is a one-to-one correspondence between the operation command and the preset register. The value in each preset register is initially 0. It will be appreciated that only when the currently executing completed operation command is a drawing command, the operation command is likely to generate the number of rendered pixels; if the operation command of the current execution completion is a synchronous command, the operation command does not generate the number of the rendered pixels, and the value in the preset register corresponding to the operation command is still 0. That is, only when a certain operation command is a drawing command, after the execution is completed, the value in the corresponding preset register is updated to the pixel number rendered by the operation command.
Taking the above example as an example, the operation command queue contains 16 operation commands, and therefore, one preset register is allocated to each of the 16 operation commands, that is, 16 preset registers are allocated. Each preset register corresponds to a sequence number of a corresponding operation command.
When the execution of one operation command is completed, the hardware triggers an interrupt operation to inform the software that the execution of the operation command is completed. At this time, the GPU may obtain the sequence number of the operation command that is currently executed through the value of the second counter, and query the preset structure array for the operation type recorded in the structure corresponding to the sequence number, so as to know whether the operation command that is currently executed is a drawing command; if the operation command is a drawing command, acquiring a value in a preset register corresponding to the sequence number, and obtaining the pixel number rendered by the operation command.
Further, after each time the number of pixels rendered by the operation command currently performed and completed is obtained, accumulation may be performed, so that, after receiving the end query command, the returned query result includes the sum of the numbers of pixels rendered by all drawing commands between the start query command and the end query command.
Referring to FIG. 2, a schematic diagram of an occlusion query example of an embodiment of the present invention is shown. As shown in fig. 2, the GPU hardware in turn feeds the operation commands (drawing commands or synchronization commands) in the operation command queue into the graphics pipeline. The first 5 operation commands are exemplified in this example. Each time an operation command is fed into the graphics pipeline, the operation type of the operation command is recorded in the preset structure array, and the value of the first counter is increased by 1. The graphics pipeline sequentially executes the operation commands, generating an interrupt operation each time an operation command is executed. The GPU software reads the value of the second counter as the serial number (the serial number is 0 at the moment) of the operation command which is executed currently, inquires the operation type corresponding to the serial number in the preset structure body array, if the operation type is a drawing command, reads the value in the preset register with the serial number of 0, and the value in the preset register with the serial number of 0 is the pixel number rendered by the drawing command. The value of the second counter is incremented by 1 and the next operation command in the graphics pipeline is continued.
In this example, it is assumed that operation commands with sequence numbers 0, 1, 2, and 4 are drawing commands, and operation command with sequence number 3 is a synchronization command. After the execution of the operation command with the sequence number of 0 is completed, the GPU reads the value in the preset register corresponding to the sequence number of 0 and accumulates with the current accumulated value (the accumulated value at this time is 0). After the execution of the operation command with the sequence number of 1 is completed, the GPU reads the value in the preset register corresponding to the sequence number of 1 and accumulates the value with the current accumulated value (the number of pixels rendered by the drawing command with the sequence number of 0 at the moment) to obtain the sum of the numbers of pixels rendered by the drawing commands with the sequence numbers of 0 and 1. After the execution of the operation command with the sequence number of 2 is completed, the GPU reads the value in the preset register corresponding to the sequence number of 2 and accumulates the value with the current accumulated value (the accumulated value at the moment is the sum of the pixel numbers rendered by the drawing commands with the sequence numbers of 0 and 1) to obtain the sum of the pixel numbers rendered by the drawing commands with the sequence numbers of 0, 1 and 2. After the execution of the operation command with the sequence number of 3 is completed, since the operation command with the sequence number of 3 is a synchronous command, no rendering operation is performed, and thus the value in the preset register with the sequence number of 3 is still 0, and the value in the preset register is not required to be read at this time. And so on.
Assuming that after the execution of the operation command with the sequence number 4 is completed, a query end command is received, a query result including the sum of the numbers of pixels rendered by the four drawing commands with the sequence numbers 0, 1, 2, and 4 is returned.
Therefore, the embodiment of the invention realizes a set of management mechanism of shielding inquiry function in the GPU firmware, distinguishes the operation commands in the GPU graphics pipeline, sorts and sends the inquiry results of the drawing commands to the Mesa driver, and the Mesa driver returns the inquiry results to the application program through the OpenGL interface so as to provide reference for the optimization of the subsequent drawing process.
In an alternative embodiment of the present invention, the method may further include:
if the sum of the pixel numbers of the rendering corresponding to all the drawing commands which are executed and completed between the starting query command and the ending query command is 0, determining that the target object is blocked;
if the sum of the pixel numbers of the rendering is equal to the sum of the pixel numbers of the target object, determining that the target object is not shielded;
if the sum of the pixel numbers of the rendering is larger than 0 and smaller than the sum of the pixel numbers of the target object, determining the ratio of the target object to be shielded according to the ratio of the sum of the pixel numbers of the rendering to the sum of the pixel numbers of the target object;
And judging whether the target object is blocked or not, and/or taking the proportion of blocked target object as the query result.
The query result comprises the sum of the pixel numbers of all rendering commands between the start query command and the end query command, and whether the target object is blocked or not can be determined according to the sum of the pixel numbers of the rendering commands. For example, if the sum of the number of pixels rendered is 0, it is indicated that the target object is occluded; if the sum of the rendered pixel numbers is greater than 0, it is indicated that the target object is not or partially occluded.
If the sum of the pixel numbers rendered by all drawing commands between the start query command and the end query command is greater than 0 and less than the sum of the pixel numbers of the target object, the ratio of the blocked target object can be determined according to the ratio between the sum of the pixel numbers rendered and the sum of the pixel numbers of the target object.
The query result returned by the GPU may include whether the target object is occluded, for example, it is indicated by 0 and it is indicated by 1 that the target object is not occluded. It is thus possible to decide whether or not to finely draw the target object based on the query result.
Further, in the case that it is determined that the target object is blocked, the query result returned by the GPU may include a proportion of the target object that is blocked, such as 5% blocked or 30% blocked. Therefore, whether the target object is finely drawn or not can be determined according to the query result, if the shielding proportion is smaller than the preset value, the fine drawing is performed, and otherwise, the fine drawing is not performed.
According to the embodiment of the invention, the target object can be simply drawn once, and the shielding inquiry result of the target object can be obtained through the simple drawing operation, so that only the visible object can be finely drawn again, the resource waste caused by finely drawing the shielded object is avoided, and the image rendering efficiency is improved.
Further, according to the embodiment of the invention, when the GPU is to draw the target object, whether the target object is shielded or the proportion of the target object which is shielded can be obtained through shielding inquiry, so that whether the target object is drawn or not is determined, and the performance of the GPU can be greatly optimized.
In a specific implementation, after a drawing command is processed through the graphics pipeline, pixel information obtained after the final rendering of the GPU is finished is stored in a frame buffer (frame buffer), and then a Video Controller (Video Controller) can read the information in the frame buffer and transmit the information to a display (Monitor) for display through digital-to-analog conversion.
The pixel information obtained after the target object is drawn according to the first drawing mode is stored in the frame buffer and is not displayed on the display. And determining whether the target object needs to be re-drawn according to the second drawing mode according to the query result, and storing pixel information obtained after the target object is drawn according to the second drawing mode in a frame buffer first and then displaying the pixel information on a display according to the need.
In summary, the method for querying the occlusion provided by the embodiment of the invention firstly renders the target object according to the first rendering mode, and after the rendering is completed, the query can be performed according to the condition that the target object is occluded correspondingly, so as to obtain a query result, and the query result can provide a reference for the optimization of the subsequent rendering process, thereby facilitating the simplification of graphic rendering by graphic application designers. For example, if the target object is not blocked or the proportion of blocked target object is smaller than the preset value, the target object is drawn according to the second mode, otherwise, the target object is not drawn, so that unnecessary rendering workload can be reduced, the operation resource of the GPU is saved, the rendering efficiency is improved, and the running efficiency of the application program is improved.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to FIG. 3, there is shown a block diagram of an embodiment of an occlusion query device of the present invention, the device being applicable to a GPU, the device may include:
a command execution module 301, configured to sequentially read operation commands from an operation command queue after receiving a start query command, and send the operation commands into a graphics pipeline for execution, respectively; the operation command queue comprises drawing commands corresponding to a target object, and is used for drawing the target object according to a first drawing mode;
the data obtaining module 302 is configured to obtain, if the operation command that is currently executed is identified as a drawing command, the number of pixels that are rendered corresponding to the drawing command that is currently executed;
The result returning module 303 is configured to return a query result after receiving the query ending command; the query result comprises the sum of the pixel numbers of rendering corresponding to all drawing commands which are executed and completed between the start query command and the end query command;
and the drawing module 304 is configured to draw the target object according to a second drawing manner if the query result meets the drawing condition.
Optionally, the operation command queue further includes a synchronous command, where the synchronous command is used to instruct all drawing commands before the synchronous command to execute after the synchronous command is executed, and each drawing command after the synchronous command is executed continuously.
Optionally, the apparatus further comprises:
the type recording module is used for sequentially recording the operation types of the operation commands read each time in a preset structure array in the process of sequentially reading the operation commands from the operation command queue and respectively sending the operation commands into the graphics pipeline for execution;
and the type query module is used for triggering an interrupt operation when each operation command is executed by the graphics pipeline, and the interrupt operation is used for querying the operation type of the operation command which is executed currently and is recorded in the preset structure body array so as to identify whether the operation command which is executed currently and is completed is a drawing command.
Optionally, the apparatus further comprises:
the initialization module is used for initializing the first counter and the second counter;
the first counting module is used for adding 1 to the value of the first counter every time an operation command is sent into the graphics pipeline;
the command output module is used for pressing the operation command which is executed into an outgoing line queue as a node in sequence when the graphic assembly line completes one operation command every time the graphic assembly line executes;
the second counting module is used for adding 1 to the value of the second counter every time one node is added to the outgoing line queue;
the type recording module is specifically configured to record, in a preset structure array, an operation type and a corresponding sequence number of a currently read operation command by using a current value of the first counter as the sequence number of the currently read operation command when each operation command read from the operation command queue is sent to the graphics pipeline for execution;
the type query module is specifically configured to query the preset structure array for a corresponding operation type by using the current value of the second counter as the sequence number of the operation command that is executed currently.
Optionally, the apparatus further comprises:
the register allocation module is used for allocating a preset register for each drawing command in the operation command queue respectively; the preset register is used for recording the pixel number rendered corresponding to the drawing command;
the data acquisition module is specifically configured to acquire a value in a preset register corresponding to the drawing command that is currently executed.
Optionally, the apparatus further comprises:
a first result determining module, configured to determine that the target object is blocked if a sum of pixel numbers corresponding to all executed drawing commands between the start query command and the end query command is 0;
a second result determining module, configured to determine that the target object is not blocked if the sum of the pixel numbers of the renderings is equal to the sum of the pixel numbers of the target object;
a third result determining module, configured to determine, if the sum of the number of pixels rendered is greater than 0 and less than the sum of the number of pixels of the target object, a proportion of the target object that is blocked according to a ratio of the sum of the number of pixels rendered to the sum of the number of pixels of the target object;
And the result determining module is used for determining whether the target object is blocked or not and/or the blocked proportion of the target object as the query result.
Optionally, the start query command and the end query command are sent to a Mesa driver by an application program in the GPU-mounted platform by calling an OpenGL interface, and sent to the GPU by the Mesa driver; and returning the query result to the Mesa driver by the GPU, and returning the query result to the application program by the Mesa driver by calling the OpenGL interface.
According to the shielding inquiry device provided by the embodiment of the invention, the target object is firstly drawn according to the first drawing mode, after drawing, inquiry can be carried out according to the condition that the target object is correspondingly shielded, so that an inquiry result is obtained, the inquiry result can provide reference for the optimization of the subsequent drawing process, and the simplification of graphic rendering by a graphic application designer is facilitated. For example, if the target object is not blocked or the proportion of blocked target object is smaller than the preset value, the target object is drawn according to the second mode, otherwise, the target object is not drawn, so that unnecessary rendering workload can be reduced, the operation resource of the GPU is saved, the rendering efficiency is improved, and the running efficiency of the application program is improved.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Referring to fig. 4, a schematic structural diagram of an electronic device according to an embodiment of the present invention is shown. As shown in fig. 4, the electronic device includes: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is configured to store at least one executable instruction, where the executable instruction causes the processor to perform the steps of the occlusion query method of the foregoing embodiment.
An embodiment of the present invention provides a non-transitory computer-readable storage medium, which when executed by a program or a processor of a terminal, enables the terminal to perform the steps of the occlusion query method of the previous embodiment.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The principles and embodiments of the present invention have been described herein with reference to specific examples, the description of which is intended only to assist in understanding the methods of the present invention and the core ideas thereof; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (16)

1. An occlusion query method, applied to a GPU, the method comprising:
after receiving a start inquiry command, sequentially reading the operation commands from an operation command queue, and respectively sending the operation commands into a graphics pipeline for execution; the operation command queue comprises a drawing command corresponding to a target object and is used for drawing the target object in a first drawing mode;
if the operation command which is executed currently is identified as a drawing command, acquiring the number of pixels which are executed currently and are rendered corresponding to the drawing command;
after receiving the query ending command, returning a query result; the query result comprises the sum of the pixel numbers of rendering corresponding to all drawing commands which are executed and completed between the start query command and the end query command;
And if the query result meets the drawing condition, drawing the target object according to a second drawing mode.
2. The method of claim 1, wherein the operation command queue further includes a synchronization command, and the synchronization command is used to indicate that all drawing commands before the synchronization command are executed, and after all drawing commands before the synchronization command are executed, the drawing commands after the synchronization command are executed respectively continue.
3. The method according to claim 1, wherein the method further comprises:
sequentially reading operation commands from an operation command queue, and respectively sending the operation commands into the graphics pipeline for execution, wherein the operation types of the operation commands read each time are sequentially recorded in a preset structure array;
and triggering an interrupt operation when each operation command is executed by the graphics pipeline, wherein the interrupt operation is used for inquiring the operation type of the operation command which is executed currently and recorded in the preset structure body array so as to identify whether the operation command which is executed currently and completed is a drawing command.
4. A method according to claim 3, characterized in that the method further comprises:
Each time an operation command is sent into the graphics pipeline, adding 1 to the value of a first counter;
each time the graphics pipeline completes an operation command, the operation command after the execution is pressed into an outgoing line queue as a node in sequence;
each time one node is added to the outgoing line queue, the value of the second counter is added by 1;
the operation type of the operation command read each time is recorded in the preset structure body array in sequence, and the operation type comprises the following steps:
when one operation command is read from the operation command queue and is sent to the graphics pipeline for execution, the current value of the first counter is used as the sequence number of the operation command which is read currently, and the operation type and the corresponding sequence number of the operation command which is read currently are recorded in a preset structure body array;
the querying the operation type of the operation command recorded in the preset structure body array and completed by the current execution comprises the following steps:
and taking the current value of the second counter as the sequence number of the operation command of which the current execution is completed, and inquiring the corresponding operation type in the preset structure body array.
5. The method according to claim 1, wherein the method further comprises:
Respectively distributing a preset register for each drawing command in the operation command queue; the preset register is used for recording the pixel number rendered corresponding to the drawing command;
the step of obtaining the pixel number rendered corresponding to the drawing command which is currently executed and completed includes: and acquiring a value in a preset register corresponding to the drawing command which is currently executed.
6. The method according to claim 1, wherein the method further comprises:
if the sum of the pixel numbers of the rendering corresponding to all the drawing commands which are executed and completed between the starting query command and the ending query command is 0, determining that the target object is blocked;
if the sum of the pixel numbers of the rendering is equal to the sum of the pixel numbers of the target object, determining that the target object is not shielded;
if the sum of the pixel numbers of the rendering is larger than 0 and smaller than the sum of the pixel numbers of the target object, determining the ratio of the target object to be shielded according to the ratio of the sum of the pixel numbers of the rendering to the sum of the pixel numbers of the target object;
and judging whether the target object is blocked or not, and/or taking the proportion of blocked target object as the query result.
7. The method of claim 1, wherein the start query command and the end query command are sent by an application in the GPU-mounted platform to a Mesa driver by invoking an OpenGL interface, and sent by the Mesa driver to the GPU;
and returning the query result to the Mesa driver by the GPU, and returning the query result to the application program by the Mesa driver by calling the OpenGL interface.
8. An occlusion querying device, for use with a GPU, the device comprising:
the command execution module is used for sequentially reading the operation commands from the operation command queue after receiving the inquiry starting command, and respectively sending the operation commands into the graphics pipeline for execution; the operation command queue comprises drawing commands corresponding to a target object, and is used for drawing the target object according to a first drawing mode;
the data acquisition module is used for acquiring the number of pixels rendered corresponding to the drawing command which is currently executed if the operation command which is currently executed is identified as the drawing command;
the result returning module is used for returning the query result after receiving the query ending command; the query result comprises the sum of the pixel numbers of rendering corresponding to all drawing commands which are executed and completed between the start query command and the end query command;
And the drawing module is used for drawing the target object according to a second drawing mode if the query result meets the drawing condition.
9. The apparatus of claim 8, wherein the operation command queue further includes a synchronization command, the synchronization command being used to indicate that all drawing commands before the synchronization command are executed, and to continue executing drawing commands after the synchronization command, respectively.
10. The apparatus of claim 8, wherein the apparatus further comprises:
the type recording module is used for sequentially recording the operation types of the operation commands read each time in a preset structure array in the process of sequentially reading the operation commands from the operation command queue and respectively sending the operation commands into the graphics pipeline for execution;
and the type query module is used for triggering an interrupt operation when each operation command is executed by the graphics pipeline, and the interrupt operation is used for querying the operation type of the operation command which is executed currently and is recorded in the preset structure body array so as to identify whether the operation command which is executed currently and is completed is a drawing command.
11. The apparatus of claim 10, wherein the apparatus further comprises:
the first counting module is used for adding 1 to the value of the first counter every time an operation command is sent into the graphics pipeline;
the command output module is used for pressing the operation command which is executed into an outgoing line queue as a node in sequence when the graphic assembly line completes one operation command every time the graphic assembly line executes;
the second counting module is used for adding 1 to the value of the second counter every time one node is added to the outgoing line queue;
the type recording module is specifically configured to record, in a preset structure array, an operation type and a corresponding sequence number of a currently read operation command by using a current value of the first counter as the sequence number of the currently read operation command when each operation command read from the operation command queue is sent to the graphics pipeline for execution;
the type query module is specifically configured to query the preset structure array for a corresponding operation type by using the current value of the second counter as the sequence number of the operation command that is executed currently.
12. The apparatus of claim 8, wherein the apparatus further comprises:
The register allocation module is used for allocating a preset register for each drawing command in the operation command queue respectively; the preset register is used for recording the pixel number rendered corresponding to the drawing command;
the data acquisition module is specifically configured to acquire a value in a preset register corresponding to the drawing command that is currently executed.
13. The apparatus of claim 8, wherein the apparatus further comprises:
a first result determining module, configured to determine that the target object is blocked if a sum of pixel numbers corresponding to all executed drawing commands between the start query command and the end query command is 0;
a second result determining module, configured to determine that the target object is not blocked if the sum of the pixel numbers of the renderings is equal to the sum of the pixel numbers of the target object;
a third result determining module, configured to determine, if the sum of the number of pixels rendered is greater than 0 and less than the sum of the number of pixels of the target object, a proportion of the target object that is blocked according to a ratio of the sum of the number of pixels rendered to the sum of the number of pixels of the target object;
And the result determining module is used for determining whether the target object is blocked or not and/or the blocked proportion of the target object as the query result.
14. The apparatus of claim 8, wherein the start query command and the end query command are sent by an application in the GPU-mounted platform to a Mesa driver by invoking an OpenGL interface, and sent by the Mesa driver to the GPU; and returning the query result to the Mesa driver by the GPU, and returning the query result to the application program by the Mesa driver by calling the OpenGL interface.
15. An electronic device, comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is configured to store at least one executable instruction that causes the processor to perform the steps of the occlusion query method of any of claims 1-7.
16. A readable storage medium, wherein a program or instructions is stored on the readable storage medium, which when executed by a processor, implements the steps of the occlusion query method of any of claims 1 to 7.
CN202311634180.4A 2023-11-30 2023-11-30 Occlusion query method and device, electronic equipment and storage medium Pending CN117671106A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311634180.4A CN117671106A (en) 2023-11-30 2023-11-30 Occlusion query method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311634180.4A CN117671106A (en) 2023-11-30 2023-11-30 Occlusion query method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117671106A true CN117671106A (en) 2024-03-08

Family

ID=90072707

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311634180.4A Pending CN117671106A (en) 2023-11-30 2023-11-30 Occlusion query method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117671106A (en)

Similar Documents

Publication Publication Date Title
US11270506B2 (en) Foveated geometry tessellation
US10733691B2 (en) Fragment shaders perform vertex shader computations
US11232534B2 (en) Scheme for compressing vertex shader output parameters
CN110084875B (en) Using a compute shader as a front-end for a vertex shader
US6317137B1 (en) Multi-threaded texture modulation for axis-aligned volume rendering
US11908039B2 (en) Graphics rendering method and apparatus, and computer-readable storage medium
CN111080766A (en) WebGL-based GPU (graphics processing unit) method for accelerating efficient rendering of massive targets
US11727632B2 (en) Shader binding management in ray tracing
CN109213607B (en) Multithreading rendering method and device
US6177944B1 (en) Two phase rendering for computer graphics
RU2680355C1 (en) Method and system of removing invisible surfaces of a three-dimensional scene
CN117058288A (en) Graphics processor, multi-core graphics processing system, electronic device, and apparatus
CN108290071B (en) Media, apparatus, system, and method for determining resource allocation for performing rendering with prediction of player's intention
CN117671106A (en) Occlusion query method and device, electronic equipment and storage medium
CN112988609B (en) Data processing method, device, storage medium and client
CN116802673A (en) System and method for distributed rendering using two levels of binning
US20230177763A1 (en) Method for Adapting the Rendering of a Scene
US11836333B2 (en) Computer-implemented method and SDK for rapid rendering of object-oriented environments with enhanced interaction
CN117788609A (en) Method, device, equipment and storage medium for picking up interface graphic elements
CN115814407A (en) Information processing method, information processing apparatus, storage medium, and electronic apparatus
KR20140040389A (en) Combination-type rendering method for improving user responsiveness, and computer-readable recording medium with rendering program for the same

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination