A method for synchronizing drawing commands based on continuous graphics primitives

Through graphics command parsing and processing, the glBegin configuration command is hidden and entered into glVertex, which solves the problem of graphics pipeline interruption caused by primitive switching in OpenGL and improves graphics drawing performance.

CN112581350BActive Publication Date: 2024-08-23西安翔腾微电子科技有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202011389235.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-05
Publication Date
2024-08-23
Estimated Expiration
2040-12-05

AI Technical Summary

Technical Problem

In the existing OpenGL graphics API, primitive switching between glBegin and glEnd causes the graphics pipeline to interrupt, affecting drawing performance.

Method used

Through graphics command analysis, the glBegin, glEnd and glVertex commands are judged and processed, and the glBegin primitive configuration command is hidden and entered into glVertex, thereby reducing the waiting time for primitive switching and realizing the synchronous processing of consecutive primitive commands.

Benefits of technology

It effectively reduces graphics pipeline interruptions when switching primitives and improves graphics drawing performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112581350B
    Figure CN112581350B
Patent Text Reader

Abstract

The present invention relates to a method for synchronizing drawing commands based on continuous primitives. The method comprises the following steps: 1) parsing graphics commands; 2) judging whether the current command is glBegin / glEnd; if yes, proceeding to step 7), otherwise proceeding to step 3); 3) judging whether the current command is glVertex, if yes, proceeding to step 4), otherwise proceeding to step 5); 4) judging whether the current command is the first glVertex after glBegin, if yes, proceeding to step 5), otherwise proceeding to step 6); 5) marking the current vertex primitive type; 6) sending graphics commands, and sending the commands to each stage for processing. The present invention is based on a drawing command synchronization method in which continuous primitive commands are continuously flowed, which reduces the impact of the interruption of the graphics pipeline caused by primitive switching, and achieves the purpose of improving the graphics drawing performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer graphics, and in particular relates to a synchronization method based on continuous primitive drawing commands. Background Art

[0002] OpenGL is an industry standard for high-performance graphics algorithms and the most widely accepted 2D / 3D graphics API in the industry. Since its birth, it has spawned thousands of excellent applications on various computer platforms and devices. glBegin and glEnd are functions used in OpenGL. glBegin is used in conjunction with glEnd.

[0003] The drawing command synchronization method based on the continuous flow of continuous primitive commands is mainly used to reduce the impact of graphics pipeline interruption caused by primitive switching between multiple glBegin and glEnd, so as to improve the performance of graphics drawing. However, no drawing command synchronization method based on the continuous flow of continuous primitive commands has been found in the current public information. Summary of the invention

[0004] In order to solve the above-mentioned technical problems existing in the background technology, the present invention provides a method for synchronizing drawing commands based on continuous primitives. The method is based on a drawing command synchronization method in which continuous primitive commands flow continuously, thereby reducing the impact of graphics pipeline interruption caused by primitive switching, thereby achieving the purpose of improving graphics drawing performance.

[0005] The technical solution of the present invention is: the present invention is a method for synchronizing drawing commands based on continuous primitives, and the special feature of the method is that the method comprises the following steps:

[0006] 1) Graphics command parsing;

[0007] 2) Determine whether the current command is glBegin / glEnd; if yes, go to step 7), otherwise go to step 3);

[0008] 3) Determine whether the current command is glVertex, if yes, go to step 4), otherwise go to step 5);

[0009] 4) Determine whether the current command is the first glVertex after glBegin, if yes, go to step 5), otherwise go to step 6);

[0010] 5) Mark the current vertex primitive type;

[0011] 6) Send graphics commands and send them to various stages for processing.

[0012] Preferably, the specific steps of step 1) are as follows: parsing and classifying according to the data carried by the graphic command.

[0013] Preferably, in step 2), it is determined whether the current command is glBegin / glEnd, and the two functions glBegin / glEnd need to be specially processed. The glBegin function specifies the start of a graphics drawing and sets the current drawing primitive type; glEnd indicates the end of this description of the drawing primitive.

[0014] Preferably, in step 3), it is determined whether the current command is glVertex, and primitive assembly is related to glVertex.

[0015] Preferably, in step 4), it is determined whether the current command is the first glVertex after glBegin. Different from other glVertex, the first glVertex carries a primitive command identification code.

[0016] Preferably, in step 5), the current vertex primitive type is marked, glBegin and glEnd appear in pairs, and the glVertex after glBegin needs to go through four stages: graphics vertex stage processing, graphics geometry stage, graphics fragment stage, and graphics pixel stage, and end with glEnd before the next primitive can be switched. This will cause a graphics pipeline interruption, and the glBegin primitive configuration command is hidden in glVertex, without the need for switching and waiting.

[0017] Preferably, step 6) further includes step 7) recording the current primitive type, glBegin and glEnd do not issue graphics commands, and glBegin records the current primitive type.

[0018] The present invention provides a method for synchronizing drawing commands based on continuous graphics primitives, which parses graphics commands and reduces the impact of graphics pipeline disconnection caused by switching graphics primitives between multiple glBegin and glEnd, so as to improve the graphics drawing performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a flow chart of the method of the present invention;

[0020] Figure 2 This is the primitive vertex data format of the method of the present invention. DETAILED DESCRIPTION

[0021] A method for synchronizing drawing commands based on continuous primitives of the present invention comprises the following steps:

[0022] 1) Graphics command parsing;

[0023] 2) Determine whether the current command is glBegin / glEnd; if yes, go to step 7), otherwise go to step 3);

[0024] 3) Determine whether the current command is glVertex, if yes, go to step 4), otherwise go to step 5);

[0025] 4) Determine whether the current command is the first glVertex after glBegin, if yes, go to step 5), otherwise go to step 6);

[0026] 5) Mark the current vertex primitive type;

[0027] 6) Send graphics commands and send them to various stages for processing.

[0028] The specific steps of step 1) are as follows: parsing and classifying the data carried by the graphic command.

[0029] Among them, in step 2), it is determined whether the current command is glBegin / glEnd, and the two functions glBegin / glEnd need to be specially processed. The glBegin function specifies the start of a graphics drawing and sets the current drawing primitive type; glEnd indicates the end of this description of the drawing primitive.

[0030] Among them, in step 3), it is determined whether the current command is glVertex, and primitive assembly is related to glVertex.

[0031] Wherein, in step 4), it is determined whether the current command is the first glVertex after glBegin. Different from other glVertex, the first glVertex carries a primitive command identification code.

[0032] Among them, in step 5), the current vertex primitive type is marked, glBegin and glEnd appear in pairs, and the glVertex after glBegin needs to go through four stages: graphics vertex stage processing, graphics geometry stage, graphics fragment stage, and graphics pixel stage, and end with glEnd. Only then can the next primitive be switched, which will cause a graphics pipeline interruption. The glBegin primitive configuration command is hidden in glVertex, and there is no need to switch and wait.

[0033] Wherein, after step 6), step 7) is also included to record the current primitive type, glBegin and glEnd do not issue graphics commands, and glBegin records the current primitive type.

[0034] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0035] See also Figure 1The preferred embodiment of the present invention is based on the synchronization method of continuous primitive drawing commands, which specifically includes the following steps:

[0036] 1) Graphics command parsing;

[0037] Parse and classify data carried by graphic commands;

[0038] 2) Determine whether the current command is glBegin / glEnd; if yes, go to step 7), otherwise go to step 3);

[0039] To determine whether the current command is glBegin / glEnd, the two functions glBegin / glEnd need to be specially processed. The glBegin function specifies the start of a graphics drawing and sets the current drawing primitive type; glEnd indicates the end of this description of the drawing primitive;

[0040] 3) Determine whether the current command is glVertex, if yes, go to step 4), otherwise go to step 5);

[0041] Determine whether the current command is glVertex. Primitive assembly is related to glVertex.

[0042] 4) Determine whether the current command is the first glVertex after glBegin, if yes, go to step 5), otherwise go to step 6);

[0043] Determine whether the current command is the first glVertex after glBegin. Different from other glVertex, the first glVertex carries the primitive command identification code.

[0044] 5) Mark the current vertex primitive type;

[0045] See also Figure 2 , mark the current vertex primitive type, glBegin and glEnd appear in pairs, glVertex after glBegin needs to go through four stages: graphics vertex stage processing, graphics geometry stage, graphics fragment stage, and graphics pixel stage, and end with glEnd before switching to the next primitive, which will cause a graphics pipeline interruption. The glBegin primitive configuration command is hidden in glVertex, and there is no need to switch and wait;

[0046] 6) Send graphics commands and send them to various stages for processing;

[0047] 7) Record the current primitive type. glBegin and glEnd do not issue graphics commands. glBegin records the current primitive type.

[0048] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for synchronizing drawing commands based on continuous primitives, characterized in that: The method comprises the following steps: 1) Graphics command parsing; 2) Determine whether the current command is glBegin / glEnd; if yes, go to step 7), otherwise go to step 3); when determining whether the current command is glBegin / glEnd, the two functions glBegin / glEnd need to be specially processed. The glBegin function specifies the start of a graphics drawing and sets the current drawing primitive type; glEnd indicates the end of this description of the drawing primitive; 3) Determine whether the current command is glVertex, if yes, go to step 4), otherwise go to step 5); 4) Determine whether the current command is the first glVertex after glBegin. If yes, proceed to step 5), otherwise proceed to step 6); the first glVertex is different from other glVertexes. The first glVertex carries the primitive command identification code. 5) Mark the current vertex primitive type; glBegin and glEnd appear in pairs. The glVertex after glBegin needs to go through four stages: graphics vertex stage processing, graphics geometry stage, graphics fragment stage, and graphics pixel stage. It ends with glEnd before the next primitive can be switched. This will cause a graphics pipeline interruption. The glBegin primitive configuration command is hidden in glVertex, and there is no need to switch and wait. 6) Send graphics commands and send them to various stages for processing; 7) Record the current primitive type. glBegin and glEnd do not issue graphics commands. glBegin records the current primitive type.

2. The method for synchronizing drawing commands based on continuous primitives according to claim 1, characterized in that: The specific steps of step 1) are as follows: parsing and classifying the data carried by the graphic command.

3. The method for synchronizing drawing commands based on continuous primitives according to claim 2, characterized in that: In the step 3), it is determined whether the current command is glVertex, and primitive assembly is related to glVertex.

Citation Information

Patent Citations

  • Implementation method for quickly reading peak in GPU (graphics processing unit)

    CN102819819A

  • Computer system, graphics processing unit and graphics processing method thereof

    CN109242756A

  • Computer system, graphics processing unit and graphics processing method thereof

    CN109325899A

  • Vector diagram display method and device for Web end and computer equipment

    CN111737618A

  • Image forming apparatus, control method for image forming apparatus, and program

    JP2013022889A