Road element drawing method, device, equipment, medium, product and vehicle
By transferring CPU computing tasks to GPU and optimizing data storage and access, the problem of low efficiency and real-time performance of road element drawing in the prior art is solved, and efficient and real-time 3D scene restoration is achieved.
Patent Information
- Application Number
- CN202411185886.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-20
AI Technical Summary
In the prior art, the drawing efficiency and real-time performance of road elements are low. Especially when dealing with complex 3D scenes, the traditional CPU computing mode cannot meet the requirements of efficient real-time scene restoration.
Transfer some CPU computing tasks to the GPU and store the processing results of the GPU in video memory, reducing the number of instruction calls between the CPU and the GPU, optimizing data storage and access through thread group identification and mapping relationships, realizing parallel processing and rapid processing draw.
It significantly reduces the demand for CPU resources, improves the overall operating efficiency of the system and the model drawing speed, and ensures real-time and drawing efficiency in high-complex scenarios.
Smart Images

Figure CN119169211A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of three-dimensional (3D) model processing, and in particular to a road element drawing method, device, equipment, medium, product and vehicle. Background Art
[0002] With the development of autonomous driving technology, the real-time restoration and display of 3D scenes have become increasingly important in intelligent driving systems. Currently, the expression of 3D scene data is gradually transitioning from the traditional high-order curve fitting equation coefficients to more accurate point and line data expression. This transition aims to improve the accuracy of scene restoration so that intelligent driving systems can perceive and respond to complex road conditions more accurately.
[0003] Currently, the restoration of 3D scene data mostly relies on pre-modeled 3D models. Through programmatic modeling methods, 3D models are dynamically generated based on real-time received point and line data to restore road elements.
[0004] However, the existing modeling methods have low efficiency and real-time performance in drawing road elements. Summary of the invention
[0005] The purpose of the present invention is to provide a road element drawing method, device, equipment, medium, product and vehicle to solve the problems of low drawing efficiency and real-time performance of road elements in the prior art.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is as follows:
[0007] In a first aspect, the present invention provides a road element drawing method, comprising:
[0008] Assigning a thread group identifier to each road sub-element in the road element, and generating a first mapping relationship between the road sub-element and the thread group identifier;
[0009] The first mapping relationship and the point and line data of each road sub-element are stored in a structured buffer;
[0010] For each GPU, according to the target thread group identifier of the currently executed shader and the first mapping relationship, obtain the point and line data of the target road sub-element corresponding to the target thread group identifier from the structured buffer;
[0011] Generate vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element based on the point and line data of the target road sub-element through the GPU, and store them in the video memory;
[0012] Get the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of each road sub-element from the video memory and draw the road element.
[0013] According to the above technical means, the computing burden of the CPU is reduced, and the calculation data stored in the video memory is used for drawing, which effectively reduces the number of CPU instruction calls to the GPU, thereby significantly reducing the demand for CPU resources, improving the overall operating efficiency of the system, speeding up the drawing speed of the model, and improving real-time performance.
[0014] Furthermore, before allocating a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, the method further includes:
[0015] Allocate data storage arrays in the video memory. The data storage arrays include vertex arrays, UV arrays, and triangle index arrays.
[0016] According to the above technical means, it is possible to store the vertex coordinate parameters, UV coordinate parameters and triangle index parameters corresponding to the road sub-elements separately, thereby improving the convenience of data management.
[0017] Further, the data storage group is divided into a plurality of data storage areas according to a preset maximum number of road sub-elements and a maximum amount of point and line data;
[0018] Establishing a second mapping relationship between the thread group identifier and the data storage area;
[0019] Correspondingly, the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element are generated by the GPU according to the point and line data of the target road sub-element, and stored in the video memory, including:
[0020] Generate vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element based on the point and line data of the target road sub-element through the GPU;
[0021] Determine a target data storage area from the data storage group according to the second mapping relationship and the target thread group identifier;
[0022] The vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element are stored in the corresponding positions in the target data storage area.
[0023] According to the above technical solution, the data storage group can be divided into multiple data storage areas, each data storage area corresponds to a road sub-element, which can effectively allocate and manage video memory resources and realize fast access and storage of data during parallel processing.
[0024] Further, a thread group identifier is assigned to each road sub-element in the road element, and a first mapping relationship between the road sub-element and the thread group identifier is generated, including:
[0025] Determine whether the number of road sub-elements of the road element exceeds the maximum number of road sub-elements, and whether the point and line data contained in each road sub-element exceeds the maximum amount of point and line data;
[0026] If the number of road sub-elements does not exceed the first preset number, and the point and line data contained in each road sub-element does not exceed the maximum point and line data amount, a thread group identifier is assigned to each road sub-element in the road element to generate a first mapping relationship.
[0027] According to the above technical solution, by judging whether the number of road sub-elements of the road element exceeds the maximum number of road sub-elements and whether the point and line data contained in each road sub-element exceeds the maximum amount of point and line data, it is determined whether the current drawing exceeds the processing capacity of the electronic device itself. When it is determined that the processing capacity is not exceeded, subsequent operations are performed to avoid drawing failure caused by excessive data volume.
[0028] Furthermore, the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element are generated by the GPU according to the point and line data of the target road sub-element, including:
[0029] For any point line data of the target road sub-element, the GPU generates vertex coordinate parameters corresponding to the point line data based on the point line data and adjacent point line data;
[0030] Generate UV coordinate parameters corresponding to point and line data according to vertex coordinate parameters and the length of road elements;
[0031] Generate the triangle surface index parameters corresponding to the point and line data according to the vertex coordinate parameters and the adjacent vertex coordinate parameters.
[0032] According to the above technical solution, the continuity and consistency of the finally drawn road elements are ensured.
[0033] Furthermore, before allocating a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, the method further includes:
[0034] Acquire initial road data including road elements through sensors;
[0035] The initial road data is segmented and the point and line data of each road sub-element in the road element are extracted.
[0036] According to the above technical solution, an accurate description of the road environment is achieved, providing basic support for the drawing of road elements.
[0037] Furthermore, the method further comprises:
[0038] Render the drawn road elements onto the display screen.
[0039] According to the above technical solution, road elements can be presented in an intuitive and easy-to-understand manner to facilitate subsequent interaction with users.
[0040] Furthermore, for any point line data of the target road sub-element, the GPU generates vertex coordinate parameters corresponding to the point line data according to the point line data and adjacent point line data, including:
[0041] For any point line data of the target road sub-element, determine the tangent line between two adjacent points according to the adjacent point line data;
[0042] Generate vertex coordinate parameters corresponding to the point and line data according to the tangent line, point and line data, and extrusion width.
[0043] According to the above technical solution, the position information of each vertex in the road sub-element can be accurately constructed.
[0044] In a second aspect, the present invention provides a road element drawing device, comprising:
[0045] A mapping relationship generation module, used for assigning a thread group identifier to each road sub-element in the road element, and generating a first mapping relationship between the road sub-element and the thread group identifier;
[0046] A storage module, used for storing the first mapping relationship and the point and line data of each road sub-element into a structured buffer;
[0047] A point and line data acquisition module is used to acquire, for each GPU, point and line data of a target road sub-element corresponding to the target thread group identifier and the first mapping relationship from the structured buffer;
[0048] The road sub-element information acquisition module is used to generate vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element through the GPU, and store them in the video memory;
[0049] The road element drawing module is used to obtain the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of each road sub-element from the video memory to draw the road elements.
[0050] In a third aspect, the present invention provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0051] Memory stores computer-executable instructions;
[0052] The processor executes the computer-executable instructions stored in the memory to implement any method of the first aspect.
[0053] In a fourth aspect, the present invention proposes a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement any method as in the first aspect.
[0054] In a fifth aspect, the present invention proposes a computer program product, comprising a computer program, which implements any method of the first aspect when executed by a processor.
[0055] In a fifth aspect, the present invention provides a vehicle, comprising the electronic device described in the third aspect.
[0056] The road element drawing method, device, equipment, medium, product and vehicle provided by the present invention generate a first mapping relationship between the road sub-element and the thread group identifier by assigning a thread group identifier to each road sub-element in the road element; store the first mapping relationship and the point and line data of each road sub-element in a structured buffer; for each GPU, obtain the point and line data of the target road sub-element corresponding to the target thread group identifier from the structured buffer according to the target thread group identifier of the shader currently executed and the first mapping relationship; generate the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element by the GPU, and store them in the video memory; obtain the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of each road sub-element from the video memory to draw the road element. The present invention reduces the calculation burden of the CPU, directly uses the calculation data stored in the video memory for drawing, effectively reduces the number of instruction calls from the CPU to the GPU, thereby significantly reducing the demand for CPU resources, improving the overall operating efficiency of the system, and accelerating the drawing speed of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] Figure 1 A schematic diagram of a process flow of a road element drawing method provided by an embodiment of the present invention;
[0058] Figure 2 Another schematic diagram of a process flow of a road element drawing method provided by an embodiment of the present invention;
[0059] Figure 3 A schematic diagram of the structure of data allocation in the road element drawing method provided by an embodiment of the present invention;
[0060] Figure 4 A schematic diagram of the structure of a second mapping relationship in the road element drawing method provided by an embodiment of the present invention;
[0061] Figure 5 A schematic diagram of the structure of vertex positions in the road element drawing method provided by an embodiment of the present invention;
[0062] Figure 6 A schematic diagram of the working principle of threads in a thread group provided by an embodiment of the present invention;
[0063] Figure 7 An overall flow chart of a road element drawing method provided by an embodiment of the present invention;
[0064] Figure 8 A schematic diagram of the structure of a road element drawing device provided by an embodiment of the present invention;
[0065] Fig. 9 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.
[0066] The above drawings have shown clear embodiments of the present invention, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0067] The following will describe the embodiments of the present invention with reference to the accompanying drawings and preferred embodiments. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be understood that the preferred embodiments are only for illustrating the present invention, not for limiting the scope of protection of the present invention.
[0068] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0069] In existing intelligent driving systems, data display of 3D scenes is usually expressed using traditional high-order curve fitting equation coefficients. However, with the development of intelligent driving technology, traditional methods have gradually exposed some problems. For example, traditional high-order curve fitting is difficult to ensure high-precision data matching and utilization when dealing with delicate and complex road scenes, especially when facing lane lines with varying degrees of curvature. The accuracy is particularly insufficient. In addition, with the expansion of the perception range and the increase in road complexity, the number of lane lines may increase significantly, resulting in a large amount of computing requirements. This makes the method of relying on the central processing unit (CPU) for 3D model generation and processing increasingly incapable, especially when resources are limited, and it cannot meet the requirements of efficient real-time scene restoration.
[0070] That is to say, the existing technology has low drawing efficiency and real-time performance.
[0071] In view of the shortcomings of the prior art in restoring 3D scenes for intelligent driving, the inventors realized that due to the limited CPU computing resources, the traditional CPU operation mode needs to occupy a large amount of CPU computing resources when processing high-precision, large-scale 3D scenes. When the CPU computing resources are limited, road elements cannot be generated in time. Taking into account the parallel computing characteristics of the graphics processing unit (GPU), and the fact that the GPU can usually provide higher performance than the CPU, the inventors proposed an innovative technical solution based on in-depth analysis and research on the above technical issues, that is, transferring part of the computing tasks originally undertaken by the CPU to the GPU, and directly storing the processing results of the GPU in the video memory, and then directly performing subsequent drawing processing on the data stored in the video memory, thereby reducing the frequent instruction transmission between the CPU and the GPU. Through this calculation method, not only the problems of excessive calculation amount and insufficient precision in the traditional method are solved, but also the demand for CPU resources is significantly reduced, ensuring the real-time performance and drawing efficiency in highly complex scenes.
[0072] The technical solution of the present invention and how the technical solution of the present invention solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present invention will be described below in conjunction with the accompanying drawings.
[0073] Figure 1 Schematic diagram of the process of drawing road elements provided by an embodiment of the present invention. Figure 1 As shown, including:
[0074] S101. Allocate a thread group identifier to each road sub-element in a road element, and generate a first mapping relationship between the road sub-element and the thread group identifier.
[0075] The execution subject of the embodiment of the present invention is an electronic device, which can be a terminal device, such as a vehicle-mounted terminal, a desktop computer, a tablet computer, etc., or a server. In practical applications, whether the electronic device is a terminal device or a server can be determined according to actual conditions, and no specific limitation is imposed on this.
[0076] Exemplarily, the road element may be a lane line element, and the road sub-element may be a lane line.
[0077] Optionally, there may be a one-to-one correspondence between the road sub-element and the thread group identifier. By generating the first mapping relationship, it is possible to ensure that each subsequent thread group can process its corresponding road sub-element, thereby ensuring the accuracy of the processing process and avoiding resource conflicts and reuse.
[0078] Optionally, a data structure, such as a hash table or an array, may be established to store the first mapping relationship between the road sub-elements and their corresponding thread group identifiers, wherein the identifier of each road sub-element may be used as a key and the thread group identifier may be used as a value.
[0079] Optionally, before assigning a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, initial road data including the road element may be acquired through a sensor. The initial road data is then segmented to extract point and line data of each road sub-element in the road element.
[0080] During the driving process of the vehicle, the initial road data of the vehicle's surrounding environment can be obtained in real time through various sensors installed on the vehicle. After obtaining the initial road data, the electronic device will pre-process the initial road data, including denoising, correction, filtering and other operations to improve the accuracy and reliability of the data. Then, the pre-processed initial road data is segmented and decomposed into multiple independent road sub-elements, and then the point and line data corresponding to each road sub-element is obtained.
[0081] Take the road element as the lane line element and the road sub-element as the lane line as an example for explanation. When a vehicle is driving on the road, it can obtain images or point cloud data of the vehicle's surrounding environment through lidar, camera, radar, etc. The image or point cloud data is the initial road data, which contains multiple lane lines. After that, the initial road data is preprocessed, and the lane lines in the preprocessed initial road data are separated from other parts, that is, the point line data of multiple lane lines are segmented as a whole from the preprocessed initial road data. Finally, the point line data of multiple lane lines are segmented again to obtain the point line data of each lane line.
[0082] The point and line data include a coordinate sequence of multiple points, which are used to indicate the direction and position of the road sub-elements and are used to subsequently generate vertices, edges and faces of the 3D model.
[0083] Through the above technical solution, an accurate description of the road environment is achieved, providing basic support for the drawing of road elements.
[0084] Optionally, before assigning a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, a data storage array may also be allocated in the video memory, the data storage array including a vertex array, a UV array, and a triangle index array.
[0085] Before allocating a thread group identifier to each road sub-element and generating the first mapping relationship, it is necessary to allocate necessary data storage space in the GPU's video memory to facilitate saving the processing results generated by subsequent calculations (i.e., vertex coordinate parameters, UV coordinate parameters, and triangle index parameters).
[0086] Specifically, the data storage space mainly includes the storage space of the vertex array, the storage space of the UV array, and the storage space of the triangle index array (English: Indices). Among them, the storage space of the vertex array is used to store the vertex coordinate parameters generated by each road sub-element, so as to build the basic geometric shape of the 3D model; the storage space of the UV array is used to store the UV coordinates corresponding to each vertex, so as to correctly map the texture to the surface of the road sub-element during rendering; the storage space of the triangle index array is used to store the vertex index of each road sub-element, so as to define the connection relationship between vertices, thereby generating triangles, which ultimately constitute the surface of the road sub-element.
[0087] In one feasible way, the size of each data storage array can be pre-allocated, that is, the size of each array is determined according to the preset maximum number of road sub-elements and the complexity of each road sub-element. The allocation of video memory space should be as reasonable as possible, meeting the needs of large-scale scenes while avoiding excessive occupation of video memory resources.
[0088] Optionally, in this method, S101 may be implemented in the following manner:
[0089] It is determined whether the number of road sub-elements of the road element exceeds the maximum number of road sub-elements, and whether the point and line data contained in each road sub-element exceeds the maximum point and line data amount. If the number of road sub-elements does not exceed the first preset number, and the point and line data contained in each road sub-element does not exceed the maximum point and line data amount, a thread group identifier is assigned to each road sub-element in the road element to generate a first mapping relationship.
[0090] Among them, before allocating the thread group identifier, it will be checked whether the vertex coordinate parameters, UV coordinate parameters and triangle index parameters generated by this drawing process exceed the storage capacity of the data storage array. For example, when the electronic device detects that the total number of road sub-elements in these scenes exceeds the preset maximum number of road sub-elements, or the point and line data contained in any road sub-element exceeds the maximum amount of point and line data, there is a problem that the generated vertex coordinate parameters, UV coordinate parameters and triangle index parameters exceed the storage capacity of the data storage array. In the subsequent process, the excess data cannot be stored, and cannot participate in the subsequent drawing operations. Therefore, in this scenario, the road element should not be further processed, that is, the thread group identifier is not assigned to each road sub-element in the road element, and the first mapping relationship is not generated.
[0091] Similarly, if it is determined that the vertex coordinate parameters, UV coordinate parameters and triangle index parameters generated by this drawing process do not exceed the storage capacity of the data storage array, subsequent operations can be performed, that is, assigning a thread group identifier to each road sub-element in the road element.
[0092] For example, taking the lane line point line data to draw the lane line as an example, the IndirectDraw graphics rendering function is used. At this time, the CPU pre-calculation module will pre-allocate a vertex array, UV array, and Indices array video memory block. Each time it runs, it will first determine whether the point line data that needs to be calculated exceeds the range of the maximum data amount of a single drawing element (whether the number of road sub-elements of the road element exceeds the maximum number of road sub-elements, and whether the point line data contained in each road sub-element exceeds the maximum point line data amount). If it exceeds, it will not be drawn and regarded as invalid data; if it does not exceed, the first mapping relationship generation operation will continue.
[0093] S102: Store the first mapping relationship and the point and line data of each road sub-element into a structured buffer.
[0094] Among them, the structured buffer (English: StructruedBuffer) is a special storage area that can efficiently store and access structured data, such as arrays, key-value pairs, etc., to ensure the orderliness and fast access of data. In the structured buffer, the first mapping relationship and the point-line data may be stored in a tightly coupled manner. For example, after the point-line data is extracted, the point-line data corresponding to each thread group identifier will be inserted into the StructruedBuffer that needs to be passed to the GPU. This storage method facilitates the subsequent GPU to quickly retrieve the corresponding point-line data according to the thread group identifier when executing the shader, and perform parallel calculations.
[0095] S103 . For each GPU, according to the target thread group identifier of the currently executed shader and the first mapping relationship, obtain the point and line data of the target road sub-element corresponding to the target thread group identifier from the structured buffer.
[0096] When executing the rendering task on each GPU, the electronic device determines the target thread group identifier according to the shader currently used, and then determines the specific road sub-element that the current shader task needs to process through the target thread group identifier and the first mapping relationship. Then, the GPU reads the point and line data related to the target road sub-element stored in the structured buffer, wherein this point and line data is the basis for the subsequent calculation of vertex coordinate parameters, UV coordinate parameters and triangle index parameters.
[0097] S104 , generating vertex coordinate parameters, UV coordinate parameters, and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element through the GPU, and storing them in the video memory.
[0098] It should be understood that the implementation principle and process of this step will be Figure 2 The relevant contents in the illustrated embodiment are described in detail and will not be repeated here.
[0099] S105 , obtaining vertex coordinate parameters, UV coordinate parameters, and triangle index parameters of each road sub-element from the video memory, and drawing the road element.
[0100] Among them, the IndirectDrawBuffer method can be used to draw all road sub-elements at one time based on the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of each road sub-element in the video memory, that is, draw the road elements.
[0101] After the road elements are drawn, the drawn road elements may also be rendered onto a display screen.
[0102] Specifically, the GPU will take the vertex coordinate parameters, UV coordinate parameters and triangle index parameters as input and pass them to the vertex shader and fragment shader of graphics rendering. The vertex shader uses the vertex coordinates to calculate the final position of the vertex on the screen, while the fragment shader uses the UV coordinate parameters to map the texture. The triangle index parameters are used to define how the vertices are combined into triangles to build a complete 3D surface. Then, the GPU combines the vertices into triangles according to the definition of the triangle index, and draws these triangles in sequence through the rendering pipeline to finally form a complete road sub-element surface. Among them, since all data is in the video memory, the entire drawing process avoids frequent data exchange between the CPU and the GPU. The GPU can directly read the required geometry and texture data from the video memory and complete the drawing in a very short time. Finally, after the drawing is completed, the generated 3D road model will be synthesized into the entire scene and displayed on the screen. At this time, the user or system can see the high-precision road scene generated based on the actual point and line data, completing the conversion from data to vision, so as to facilitate subsequent interaction with the user.
[0103] The road element drawing method provided by the embodiment of the present invention realizes the optimization of the whole process from data acquisition to 3D model generation and then to rendering and display by processing the point and line data of the road sub-elements in parallel on the GPU. By allocating thread group identifiers and establishing mapping relationships, the reasonable allocation and utilization of resources are ensured and data conflicts are avoided. At the same time, the use of structured buffers and real-time calculation to generate geometric parameters greatly improves the efficiency of data access and processing. Finally, the road elements are directly drawn by the GPU and displayed on the screen, realizing high-precision and real-time 3D scene restoration, providing users with an accurate and smooth visual experience, while significantly reducing the burden on the CPU and system latency, and improving the efficiency and real-time performance of road element drawing.
[0104] Figure 2 Another schematic diagram of the process flow of the road element drawing method provided by an embodiment of the present invention. Figure 2 As shown, the road element drawing method may further include:
[0105] S201. Divide a data storage group into a plurality of data storage areas according to a preset maximum number of road sub-elements and a maximum amount of point and line data.
[0106] Among them, first set two key parameters: the maximum number of road sub-elements and the maximum amount of point and line data. These two sets of parameters determine the capacity and performance limits of electronic devices when processing complex road scenes. Among them, the maximum number of road sub-elements refers to the maximum number of road sub-elements that the electronic device can process simultaneously, and the maximum amount of point and line data refers to the maximum number of points and lines that each road sub-element can contain. According to the above preset maximum values, the electronic device divides the corresponding data storage area in the GPU's video memory.
[0107] It should be noted that the data storage group in the video memory is usually divided into multiple independent storage areas, each of which is used to store the parameter data of a road sub-element (vertex coordinate parameters, UV coordinate parameters, and triangle index parameters). These storage areas can be fixed-size arrays or dynamically allocated memory blocks, depending on the implementation of the electronic device and the video memory management strategy. The number and size of the divided areas must match the preset maximum number of road sub-elements and the amount of point and line data to ensure that all parameter data can be effectively stored in extreme cases.
[0108] S202: Establish a second mapping relationship between the thread group identifier and the data storage area.
[0109] Among them, the thread group identifier assigned by the electronic device to each road sub-element needs to establish a second mapping relationship with the corresponding data storage area in the video memory to ensure that the thread group can accurately find its corresponding data storage location.
[0110] Based on the above steps, S104 can be implemented through the following S203-S205.
[0111] S203 , generating vertex coordinate parameters, UV coordinate parameters, and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element through the GPU.
[0112] In a possible implementation, for any point line data of the target road sub-element, the GPU generates vertex coordinate parameters corresponding to the point line data based on the point line data and the adjacent point line data. Then, the UV coordinate parameters corresponding to the point line data are generated based on the vertex coordinate parameters and the length of the road element. Finally, the triangle index parameters corresponding to the point line data are generated based on the vertex coordinate parameters and the adjacent vertex coordinate parameters.
[0113] Optionally, for any point line data of the target road sub-element, the GPU generates vertex coordinate parameters corresponding to the point line data according to the point line data and adjacent point line data, which can be achieved by the following steps:
[0114] For any point line data of the target road sub-element, the tangent line between two adjacent points is determined based on the adjacent point line data. Then, the vertex coordinate parameters corresponding to the point line data are generated based on the tangent line, point line data and extrusion width.
[0115] For each target road sub-element, the GPU first obtains its point and line data. For each point and line data, the GPU calculates the relationship between the adjacent point and line data to generate the vertex coordinate parameters corresponding to the point and line data. These vertex coordinate parameters include vertex coordinate information, which is used to determine the shape and position of the road sub-element in 3D space. For example, the tangent direction between two adjacent points is determined based on the adjacent point and line data. Then, based on the tangent direction, the position of the current point and line data, and the preset extrusion width, the vertex coordinate parameters corresponding to the current point and line data are calculated and generated.
[0116] After generating the vertex coordinate parameters, the GPU will further calculate the corresponding UV coordinates based on these vertex coordinate parameters and the length of the road element. Among them, the UV coordinate parameters are used to define how to map the texture to the surface of the 3D model to ensure that the texture can correctly cover the road sub-elements. Specifically, the UV coordinates are usually calculated in a normalized manner, that is, according to the relative position and length of the vertex on the road element, the UV coordinate range is mapped to the interval [0,1].
[0117] Finally, the GPU creates triangle index parameters based on the generated vertex coordinate parameters and adjacent vertex coordinate parameters. These index parameters define how to connect vertices to form triangles, thereby constructing the geometric surface of the road sub-element. The GPU combines adjacent vertices into triangles and records the index order of these vertices to ensure that the shape of the road sub-element can be correctly drawn during rendering.
[0118] S204: Determine a target data storage area from the data storage group according to the second mapping relationship and the target thread group identifier.
[0119] The second mapping relationship associates each thread group identifier with one or more data storage areas, ensuring that the correct data storage area can be accurately located when storing data, thereby reducing the complexity of data search and management.
[0120] S205 , storing the vertex coordinate parameters, UV coordinate parameters, and triangle index parameters of the target road sub-element into corresponding positions in the target data storage area.
[0121] Among them, the GPU generates geometric parameters according to the point and line data of the target road sub-element, including vertex coordinate parameters, UV coordinate parameters and triangle index parameters. These parameters are the basis for building a 3D model and reflect the shape, size and surface details of the road sub-element; finally, according to the second mapping relationship and the target thread group identifier currently being processed, the GPU determines the corresponding target data storage area from the divided data storage group, and accurately stores the generated vertex coordinate parameters, UV coordinate parameters and triangle index parameters in the corresponding target data storage area. The generation and storage processes of all parameter data are completed on the GPU, avoiding unnecessary CPU participation and resource consumption, and further improving the efficiency and real-time performance of the road element drawing process.
[0122] The road element drawing method provided by the embodiment of the present invention fully utilizes the computing and storage capabilities of the GPU by dividing the data storage area, establishing a second mapping relationship, generating vertices, UV and index parameters, determining the storage area and storing calculation results, ensuring that the data processed by each thread group can be quickly and accurately stored in the correct position of the video memory, thereby ensuring the efficiency of the road element drawing process.
[0123] Figure 3 This is a schematic diagram of the structure of data allocation in the road element drawing method provided by an embodiment of the present invention. Figure 3 As shown, taking lane line point line data to draw lane lines as an example.
[0124] Assuming that each lane has a maximum of 100 data points, the system presets a maximum of 20 lanes; based on the above preset conditions, calculate the total number of vertices of all lane lines. For example, 100 data points for a single lane can generate 100 vertices, so 20 lanes will have 100*20=2000 vertices; however, in actual 3D rendering, a single data point usually generates 2 vertices through an "extrusion" operation to form a three-dimensional shape or surface. In this case, each data point generates 2 new vertices through the extrusion operation, where extrusion is to build more complex geometric shapes, such as adding thickness or shape contours to lane lines. 100 data points for each lane will generate 100*2=200 vertices (the maximum number of vertices for a single lane line), and 20 lanes will generate 100*20*2=4000 vertices; based on the above calculation, it can be determined that the size of the vertex array pool should be 4000 vertices (the total length pre-allocated according to the maximum number of lane lines). This is the space that needs to be allocated in the video memory for the vertex data of all lane lines to ensure that all possible geometric shapes can be correctly stored and processed on the GPU. This vertex array pool size provides the basis for subsequent rendering and calculation. All vertex generation, texture mapping, and triangle index calculations will be performed in this vertex array pool.
[0125] Figure 4 This is a schematic diagram of the structure of the second mapping relationship in the road element drawing method provided by an embodiment of the present invention. Figure 4 As shown, taking lane line drawing with lane line point data as an example, parallel calculation is performed through ComputeShader in the GPU, and the data storage location of each thread group is determined by ThreadGroupID.
[0126] Among them, the GPU executes a large number of parallel computing tasks through ComputeShader. Each computing task is divided into many thread groups, namely Thread Group. Each thread group contains multiple threads and can process data simultaneously. In this way, the GPU can efficiently process large amounts of data, such as complex 3D scene rendering. In addition, in parallel computing, each thread group is assigned a unique ThreadGroupID to identify the position of the thread group in the entire computing task. This ID is usually an integer or vector to determine the processing range of the current thread group.
[0127] Secondly, in order to allow each thread group to process the correct lane line point data, the system uses ThreadGroupID to distinguish the drawing elements that each thread group is processing. For example, the thread group with ThreadGroupID 0 is used to process the data of the first lane line, the thread group with ThreadGroupID 1 is used to process the data of the second lane line, and so on. After determining the ThreadGroupID, the lane line point data that the thread group needs to process can be determined, including the point data and the number of vertices that need to be generated. This process ensures that the data processed by each thread group is independent and correct, avoiding data conflicts and repeated processing.
[0128] Then, the specific location of data storage needs to be calculated: first determine the starting point of storage. When rendering lane lines, the data of each lane line will occupy a specific position in the vertex array pool. For example, since the thread group with ThreadGroupID 0 processes the first lane line, the vertex array pool data it generates needs to be stored at the starting position of the vertex array pool. Specifically, the system determines the storage location in the vertex array pool by calculating the formula ThreadGroupID*100*2. Among them, ThreadGroupID represents the ID of the thread group. When the ID is 0, it represents the first thread group, 100 represents the maximum number of data points for a single lane line, and 2 represents the two vertices generated by each data point after the extrusion operation.
[0129] Finally, data is written and stored according to the specific location of the data storage: after calculating the starting storage position of the vertex array pool, the thread group with ThreadGroupID 0 will write the calculated vertex data to this position. Because it is the first thread group, it starts storing data from the 0th position of the vertex array pool. If it is a thread group with ThreadGroupID 1, the lane line point line data it processes will be stored from the position 1*100*2=200, and so on. Subsequently, the GPU can draw according to the stored data to complete the rendering of the entire 3D scene.
[0130] Figure 5 This is a schematic diagram of the structure of the vertex position in the road element drawing method provided by the embodiment of the present invention. Figure 5 As shown, the process of determining the vertex includes:
[0131] First, obtain the three adjacent points from the lane line point data: the three-dimensional coordinates of the current point p1, the previous point p0, and the next point p2, and use the coordinates of p0 and p1 to calculate the tangent t0 of p1. Among them, the tangent refers to the vector in the direction between two points, which is used to determine the direction of the surface of the figure along the boundary. After determining the tangent t0, the direction of the secondary tangent is calculated by rotation or other geometric transformations, where the secondary tangent is used to determine the width direction of the extrusion along the lane line, as shown by the dotted line in the figure. Then, based on the secondary tangent and the extrusion width, determine the positions of the two new vertices at p1. For example, when the preset width is w, the new top line positions (p1,0) and (p1,1) can be obtained by extruding from p1 along the secondary tangent direction.
[0132] Figure 6 The following is a schematic diagram of the working principle of threads in a thread group provided by an embodiment of the present invention. Figure 6 As shown, each thread group includes multiple threads, and each thread is used to process part of the sub-point line data of a lane line. Specifically, each thread obtains the corresponding part of the sub-point line data from the corresponding position of the lane line point line data for processing. Through parallel processing of multiple threads, the processing efficiency is further improved.
[0133] In actual applications, the process of drawing road elements can be completed by calling IndirectDraw based on the position information of each vertex stored in the graphics card. Specifically, the data structure filled in IndirectBuffer mainly includes StartIndex, BaseVertIndex, StartInstance, IndexCountPerInstance, and InstanceCount; among them, StartIndex is an integer value, which indicates the starting position of the data in the vertex index buffer (IndexBuffer). The index data of each vertex will be read from this position to point to the starting position of drawing during rendering, ensuring that the GPU starts reading data from the correct vertex; BaseVertIndex specifies the index of the base vertex in the vertex array (VertexBuffer). When executing the drawing command, all vertex positions will be offset relative to this base vertex, which allows different primitives to be drawn by offset when sharing vertex data; StartInstance is the starting instance index value, which is used for instanced rendering (Instanced Rendering), which defines which instance to start rendering from. Through this field, the GPU can efficiently manage and access instance data when drawing multiple instances; IndexCountPerInstance defines the number of indexes required for each instance; InstanceCount indicates the number of instances that need to be drawn in a DrawCall, which determines how many object instances will be repeatedly rendered in the draw call.
[0134] Figure 7 The overall flow chart of the road element drawing method provided by the embodiment of the present invention. Figure 7 As shown, including:
[0135] S301: CPU preprocessing.
[0136] Among them, the CPU performs preliminary calculations and preparations, involving preliminary data processing, resource allocation, and calculation of some preliminary parameters for subsequent GPU use. For example, the CPU may calculate preliminary data for each drawing element, allocate thread groups, and determine the amount of data to be passed to the GPU.
[0137] S302: Allocate a GPU thread group.
[0138] After the CPU completes the preliminary calculations, it assigns the work tasks to multiple GPU thread groups, which will process the computing tasks in parallel. Each thread group is responsible for different data fragments or drawing elements. This process is the basis of parallel computing and can use the powerful parallel processing capabilities of the GPU to accelerate the entire computing process.
[0139] S303, GPU calculates and writes the position.
[0140] Among them, the GPU will perform position calculations according to the assigned tasks, including: calculating the position of vertex data, determining the specific storage location of each data in the video memory, and writing the calculation results to the corresponding location in the video memory to prepare for subsequent operations.
[0141] S304, GPU computing grid.
[0142] After the position calculation is completed, the GPU thread group will further process the mesh calculation, including generating vertices, UV coordinates, and index information. These data are used to build the final 3D model mesh and are stored in the video memory in preparation for drawing operations.
[0143] S305: CPU calls IndirectDraw.
[0144] Among them, when all GPU thread groups have completed their computing tasks and written data to the video memory, the CPU will issue an IndirectDraw command. The execution of this command marks the beginning of the actual rendering process of the GPU, using the previously calculated and stored data to generate the final image or model.
[0145] In the overall process of the road element drawing method provided by the present invention, the CPU is responsible for preliminary calculation and task allocation, while the GPU uses its parallel processing capability to efficiently complete the calculation and storage of large amounts of data. This division of labor makes the rendering process both efficient and capable of processing complex large-scale data. Among them, the use of IndirectDraw reduces the intervention of the CPU, allowing the GPU to independently complete the drawing task, thereby improving the rendering performance of the entire system.
[0146] Figure 8 Schematic diagram of the structure of the road element drawing device provided by the embodiment of the present invention. Figure 8 As shown, the road element drawing device 40 includes:
[0147] The mapping relationship generating module 401 is used to assign a thread group identifier to each road sub-element in the road element, and generate a first mapping relationship between the road sub-element and the thread group identifier.
[0148] The storage module 402 is used to store the first mapping relationship and the point and line data of each road sub-element in a structured buffer.
[0149] The point and line data acquisition module 403 is used to acquire the point and line data of the target road sub-element corresponding to the target thread group identifier from the structured buffer according to the target thread group identifier of the currently executed shader and the first mapping relationship for each GPU.
[0150] The road sub-element information acquisition module 404 is used to generate vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element through the GPU, and store them in the video memory.
[0151] The road element drawing module 405 is used to obtain the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of each road sub-element from the video memory to draw the road element.
[0152] In a possible implementation, before allocating a thread group identifier for each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, the road element drawing device 40 also includes an allocation module for allocating a data storage array in a video memory, the data storage array including a vertex array, a UV array, and a triangle index array.
[0153] In a possible implementation, the road element drawing device 40 further includes:
[0154] The division module is used to divide the data storage group into multiple data storage areas according to the preset maximum number of road sub-elements and the maximum amount of point and line data.
[0155] An establishing module is used to establish a second mapping relationship between the thread group identifier and the data storage area.
[0156] Accordingly, the road element drawing module 405 is specifically used for:
[0157] The vertex coordinate parameters, UV coordinate parameters and triangle surface index parameters of the target road sub-element are generated by the GPU according to the point and line data of the target road sub-element.
[0158] According to the second mapping relationship and the target thread group identifier, a target data storage area is determined from the data storage group.
[0159] The vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element are stored in the corresponding positions in the target data storage area.
[0160] In a possible implementation, the mapping relationship generation module 401 is specifically configured to:
[0161] It is determined whether the number of road sub-elements of the road element exceeds the maximum number of road sub-elements, and whether the point-line data contained in each road sub-element exceeds the maximum amount of point-line data.
[0162] If the number of road sub-elements does not exceed the first preset number, and the point and line data contained in each road sub-element does not exceed the maximum point and line data amount, a thread group identifier is assigned to each road sub-element in the road element to generate a first mapping relationship.
[0163] In a possible implementation, the road element drawing module 405 is specifically used to:
[0164] For any point line data of the target road sub-element, the GPU generates vertex coordinate parameters corresponding to the point line data based on the point line data and adjacent point line data.
[0165] Generate UV coordinate parameters corresponding to the point and line data according to the vertex coordinate parameters and the length of the road element.
[0166] Generate the triangle surface index parameters corresponding to the point and line data according to the vertex coordinate parameters and the adjacent vertex coordinate parameters.
[0167] In a possible implementation, before allocating a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, the road element drawing device 40 further includes an acquisition module for:
[0168] Initial road data including road elements is acquired through sensors.
[0169] The initial road data is segmented and the point and line data of each road sub-element in the road element are extracted.
[0170] In a possible implementation, the road element drawing device 40 further includes a rendering module, which is used to render the drawn road elements onto a display screen.
[0171] In a possible implementation, the road element drawing module 405 is specifically used to:
[0172] For any point line data of the target road sub-element, the tangent line between two adjacent points is determined according to the adjacent point line data.
[0173] Generate vertex coordinate parameters corresponding to the point and line data according to the tangent line, point and line data, and extrusion width.
[0174] The road element drawing device provided in the embodiment of the present application can be used to execute the road element drawing method in any of the above embodiments. Its implementation principle and technical effects are similar and will not be repeated here.
[0175] Fig. 9 Schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. Fig. 9As shown, the electronic device 50 may include a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a communication component 503 and other components. The processor 501, the memory 502 and the communication component 503 are connected via a bus 504.
[0176] In a specific implementation process, at least one processor 501 executes the computer-executable instructions stored in the memory 502, so that the at least one processor 501 executes the above road element drawing method.
[0177] The specific implementation process of the processor 501 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0178] In the above Fig. 9 In the illustrated embodiment, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0179] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.
[0180] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present invention is not limited to only one bus or one type of bus.
[0181] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0182] The electronic device provided in the embodiment of the present application can be used to execute the road element drawing method provided in any of the above method embodiments. The implementation principle and technical effect are similar and will not be repeated here.
[0183] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0184] To this end, an embodiment of the present invention provides a computer-readable storage medium, in which a plurality of instructions are stored. The instructions can be loaded by a processor to execute the steps in any one of the road element drawing methods provided by the embodiments of the present invention.
[0185] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0186] According to one aspect of the present invention, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions stored in a computer readable storage medium.
[0187] Since the instructions stored in the storage medium can execute the steps in any road element drawing method provided in the embodiments of the present invention, the beneficial effects that can be achieved by any road element drawing method provided in the embodiments of the present invention can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0188] According to one aspect of the present invention, a vehicle is provided, comprising an electronic device 50 .
[0189] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0190] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present invention may be integrated into one unit / module, or each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0191] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.
[0192] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0193] The above embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Any equivalent substitution or change made by a person skilled in the art based on the present invention is within the protection scope of the present invention.
Claims
1. A road element drawing method, characterized in that: include: Assigning a thread group identifier to each road sub-element in the road element, and generating a first mapping relationship between the road sub-element and the thread group identifier; Storing the first mapping relationship and the point and line data of each road sub-element in a structured buffer; For each graphics processor GPU, according to the target thread group identifier of the currently executed shader and the first mapping relationship, obtaining the point and line data of the target road sub-element corresponding to the target thread group identifier from the structured buffer; Generate vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element through the GPU, and store them in the video memory; The vertex coordinate parameters, UV coordinate parameters and triangle index parameters of each road sub-element are obtained from the video memory, and the road element is drawn.
2. The method according to claim 1, characterized in that Before allocating a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, the method further includes: A data storage array is allocated in the video memory, wherein the data storage array includes a vertex array, a UV array, and a triangle face index array.
3. The method according to claim 1, characterized in that The method further comprises: The data storage group is divided into a plurality of data storage areas according to the preset maximum number of road sub-elements and the maximum amount of point and line data; Establishing a second mapping relationship between the thread group identifier and the data storage area; Correspondingly, the GPU generates vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element, and stores them in the video memory, including: Generate, by the GPU, vertex coordinate parameters, UV coordinate parameters, and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element; Determine a target data storage area from the data storage group according to the second mapping relationship and the target thread group identifier; The vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element are stored in corresponding positions in the target data storage area.
4. The method according to claim 3, characterized in that The step of allocating a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier includes: Determine whether the number of road sub-elements of the road element exceeds the maximum number of road sub-elements, and whether the point and line data contained in each road sub-element exceeds the maximum amount of point and line data; If the number of the road sub-elements does not exceed the first preset number, and the point and line data contained in each road sub-element does not exceed the maximum point and line data amount, a thread group identifier is allocated to each road sub-element in the road element to generate the first mapping relationship.
5. The method according to claim 3, characterized in that: The step of generating, by the GPU, vertex coordinate parameters, UV coordinate parameters, and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element includes: For any point line data of the target road sub-element, the GPU generates vertex coordinate parameters corresponding to the point line data according to the point line data and adjacent point line data; Generate UV coordinate parameters corresponding to the point and line data according to the vertex coordinate parameters and the length of the road element; The triangle surface index parameters corresponding to the point and line data are generated according to the vertex coordinate parameters and the adjacent vertex coordinate parameters.
6. The method according to any one of claims 1 to 5, characterized in that: Before allocating a thread group identifier to each road sub-element in the road element and generating a first mapping relationship between the road sub-element and the thread group identifier, the method further includes: Acquiring initial road data including the road elements through a sensor; The initial road data is segmented to extract point and line data of each road sub-element in the road element.
7. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: The drawn road elements are rendered onto a display screen.
8. The method according to claim 5, characterized in that For any point line data of the target road sub-element, generating vertex coordinate parameters corresponding to the point line data by the GPU according to the point line data and adjacent point line data includes: For any point line data of the target road sub-element, determine the tangent line between two adjacent points according to the adjacent point line data; According to the tangent line, the point line data and the extrusion width, vertex coordinate parameters corresponding to the point line data are generated.
9. A road element drawing device, characterized in that: include: A mapping relationship generation module, used for assigning a thread group identifier to each road sub-element in the road element, and generating a first mapping relationship between the road sub-element and the thread group identifier; A storage module, used for storing the first mapping relationship and the point and line data of each road sub-element into a structured buffer; A point and line data acquisition module, configured to acquire, for each GPU, point and line data of a target road sub-element corresponding to the target thread group identifier of the currently executed shader and the first mapping relationship from the structured buffer; A road sub-element information acquisition module, used to generate vertex coordinate parameters, UV coordinate parameters and triangle index parameters of the target road sub-element according to the point and line data of the target road sub-element through the GPU, and store them in the video memory; The road element drawing module is used to obtain the vertex coordinate parameters, UV coordinate parameters and triangle index parameters of each road sub-element from the video memory to draw the road element.
10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.
12. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.
13. A vehicle, characterized in that: Comprising the electronic device as claimed in claim 10.
