Homogenization and back porch blanking floating point hardware acceleration circuit in general purpose graphics processors
By employing a state machine, floating-point divider, and cache unit in a general-purpose graphics processor, and changing the cache address based on the blanking result, efficient homogenization, backface blanking, and double-sided color processing are achieved, solving the problems of excessive computing resources and fixed-point data overflow.
Patent Information
- Application Number
- CN202210688276.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-17
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-06-17
AI Technical Summary
Existing technologies consume excessive computational resources when performing backface blanking on general-purpose graphics processors, resulting in low computational efficiency. Furthermore, the use of microinstruction methods leads to non-pipelining, increasing clock cycles.
By employing a state machine, a floating-point divider, a floating-point multiplier, and a cache unit, double-sided color processing is achieved by simply changing the read cache address based on the blanking result after homogenization and blanking are completed, thus reducing computational resources.
It achieves efficient homogenization, backface culling, and double-sided color processing, reduces the use of computing resources, solves the problem of excessive computing resources in existing technologies, and solves the overflow problem of fixed-point data format in the homogenization calculation process.
Smart Images

Figure CN115202614B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of large-scale digital integrated circuit design, in particular to a homogeneous and back face culling floating point hardware acceleration circuit in a general-purpose graphics processor. BACKGROUND
[0002] At present, the latest patent related to back face culling is a patent named "A forward culling geometry engine structure" applied by Xi'an Institute of Aviation Computing Technology of China Aviation Industry Group with the announcement number CN108022202B, which only describes that the position of the culling function module processing is advanced to before the plane clipping, but does not mention the specific implementation scheme of back face culling.
[0003] In addition, there is another patent named "3D graphics processing window transformation and back face culling hardware accelerator" applied by Chipview (Changzhou) Microelectronics Co., Ltd. with the announcement number CN108961432A, which describes the implementation scheme of back face culling and window transformation in detail. The main features of the scheme are as follows:
[0004] 1) The functions of back face culling and window transformation are completed;
[0005] 2) The window transformation is completed first, and then the back face culling is completed;
[0006] 3) The micro-instruction method is used for implementation in the document;
[0007] 4) The non-pipelined design is used; and the technical scheme is summarized as follows: the window transformation is performed first, and then the back face culling is performed.
[0008] However, the disadvantage of this is that it increases redundant calculation. For example, if the input primitive is a face that needs to be eliminated, the window transformation is performed first, which will cause redundant calculation. In addition, the micro-instruction method is used for implementation, which inevitably leads to non-pipelined design. Another disadvantage is time-consuming, which requires more clock to complete the function.
[0009] Therefore, it is urgent to design and develop a floating point hardware acceleration circuit for homogeneous and back face culling in a general-purpose graphics processor with the least calculation resources. SUMMARY
[0010] The application aims to provide a floating point hardware acceleration circuit for homogenization and back surface blanking in a general purpose graphic processor, which further completes the double surface color processing mode by simply changing the address of reading the cache according to the blanking result in the output process after the homogenization and blanking function is completed.
[0011] A floating point hardware acceleration circuit for homogenization and back surface blanking in a general purpose graphic processor, comprising:
[0012] A receiving module receives a control module enabling signal, sequentially acquires target object control information and graphic primitive information sent by an upper pipeline, and respectively caches the control information to the control module and caches the triangle graphic primitive to the homogenization module BUF cache;
[0013] A homogenization module receives a control module enabling signal, adopts time division multiplexing and pipeline mode, selects the coordinate value of the target object according to the triangle graphic primitive acquired in the homogenization module BUF cache, and then delivers it to the homogenization module FDIV floating point divider to calculate the homogenized coordinate of the target object, and caches the homogenized coordinate of the target object to the homogenization module BUF cache;
[0014] An area calculation module receives a control module (5) enabling signal, calculates the area of the target object triangle graphic primitive based on the homogenized coordinate of the target object, and judges whether the current triangle graphic primitive is positive or negative, and then completes the back surface culling of the current triangle graphic primitive;
[0015] An output module receives a control module enabling signal, and forwards the target object control information and the current processed triangle graphic primitive to a lower pipeline;
[0016] A control module switches the working state of the graphic processor system after power on, and controls the timing of the homogenization and blanking operation process of the system.
[0017] As an improvement of the floating point hardware acceleration circuit for homogenization and back surface blanking in a general purpose graphic processor, the specific timing steps of the receiving module acquiring the target object control information and the triangle graphic primitive are as follows:
[0018] S1-1, first, acquire the control information sent by the upper pipeline, and cache the control information to the control module (5);
[0019] S1-2, secondly, the triangle primitive sent by the upper pipeline is acquired, and the coordinate related information in the triangle primitive is buffered into the homogeneous module BUF buffer according to the primitive data type;
[0020] S1-3, finally, the triangle primitive attribute data sent by the upper pipeline is received based on the enable signal sent by the control module, wherein when the triangle primitive attribute data is received, it is buffered into the SRAM of the BUF buffer of the homogeneous module until the buffering is completed, and the receiving instruction is ended;
[0021] S1-4, the receiving control module enable signal is waited again, and the step S1 is returned to sequentially execute the receiving instruction.
[0022] As an improvement of the floating point hardware acceleration circuit for homogenization and back surface blanking in the general-purpose graphics processor, the coordinates of the target object after homogenization are calculated as: x0 / w0, y0 / w0, z0 / w0, x1 / w1, y1 / w1, z1 / w1, x2 / w2, y2 / w2, z2 / w2,
[0023] In the formula, x0, x1, x2; y0, y1, y2; z0, z1, z2; w0, w1, w2; represent the three vertex coordinates of the target object triangle primitive respectively.
[0024] As an improvement of the floating point hardware acceleration circuit for homogenization and back surface blanking in the general-purpose graphics processor, the area calculation module calculates the area of the target object triangle primitive, and the timing steps for completing the back surface culling of the current triangle primitive are:
[0025] S3-1, first, the area of the target object triangle primitive is calculated based on the three vertex coordinates of the target object after homogenization:
[0026] area=x0(y1-y2)+x1(y2-y0)+x2(y0-y1), in the formula, area represents the area of the triangle primitive;
[0027] S3-2, secondly, the order of the three vertices of the target object triangle primitive is set as positive when it is counterclockwise or clockwise, and vice versa, and the culling surface of the target object triangle primitive is set as positive or negative or positive and negative;
[0028] S3-3, the current triangle primitive is judged to be positive or negative based on the area of the triangle primitive obtained in S3-1: when area is greater than 0, the triangle primitive is counterclockwise;
[0029] S3-4, culling preprocessing:
[0030] If the front or back surface is set to be removed, the removal is performed according to the order of the three vertices of the current triangle;
[0031] If the front and back surfaces are set to be removed, the removal is performed directly without determining the order of the three vertices of the triangle.
[0032] As an improvement of the floating-point hardware acceleration circuit for homogenization and back surface blanking in a general-purpose graphics processor, the output module receives a control module enable signal, forwards target object control information of a lower-stage pipeline, including a primitive type containing coordinate-related information in a triangle primitive, a number of vertex attributes, and control information required by the lower-stage pipeline; wherein,
[0033] When the output module receives the primitive coordinate or attribute data enable signal sent by the control module, the output module first sends the homogenized coordinate data of the target object.
[0034] Secondly, the attribute data is read from the SRAM of the BUF buffer of the homogenization module and sent.
[0035] As an improvement of the floating-point hardware acceleration circuit for homogenization and back surface blanking in a general-purpose graphics processor, in the process of reading the attribute data from the SRAM of the BUF buffer of the homogenization module and sending,
[0036] it is necessary to determine whether the double-sided color is currently enabled and the front and back surface information of the current triangle primitive, and perform double-sided color processing; wherein,
[0037] if the double-sided color is not enabled, the attribute data is output in the normal order; otherwise,
[0038] the front and back surface of the current triangle primitive is determined, if the current triangle primitive is a front surface, the front surface color is output as the main color; if the current triangle primitive is a back surface, the back surface color is output as the main color.
[0039] As an improvement of the floating-point hardware acceleration circuit for homogenization and back surface blanking in a general-purpose graphics processor, the control module controls the timing of the homogenization and blanking operation of the system in the following manner:
[0040] When the graphics processor system is powered on, the working state of the control module is switched to the idle IDLE state, and the receiving module is ready to receive data from the upper-stage pipeline; when the data received by the receiving module is control information that needs to be sent, the control module enters the sending control SEND_CTRL state; when the data received by the receiving module is vertex coordinate data, the control module enters the receiving coordinate REV_COORD state; in other cases, the state remains unchanged.
[0041] When the working state of the control module is switched to the sending control SEND_CTRL state, the output module starts to work and sends the control information received by the receiving module to the lower stage pipeline, and when the lower stage pipeline receives the control information, the control module enters the idle IDLE state; otherwise, the state remains unchanged.
[0042] When the working state of the control module is switched to the receiving coordinate REV_COORD state, the receiving module always works until the coordinate receiving is completed; when the coordinate receiving is completed, the control module enters the receiving attribute REV_ATTR state or the homogenization HOM state or the culling CULL_ST state.
[0043] When the working state of the control module is switched to the receiving attribute REV_ATTR state, it indicates that the current triangle primitive needs to be culled; at this time, the receiving module receives the attribute data and discards it until the attribute receiving is completed; when the attribute data receiving is completed, the control module enters the idle IDLE state.
[0044] When the working state of the control module is switched to the homogenization HOM state, it indicates that the current triangle primitive only needs to be homogenized; at this time, the homogenization module starts to work until the homogenization calculation is completed, and the control module enters the coordinate sending SEND_COORD state.
[0045] When the working state of the control module is switched to the culling CULL_ST state, it indicates that the current triangle primitive needs not only to be homogenized but also to be calculated in area; when the working state of the control module is switched to the culling CULL_ST state, the homogenization is performed first, and then the area of the triangle primitive is calculated; after the area of the triangle primitive is calculated, whether the current triangle primitive needs to be culled is determined according to the positive and negative of the area of the triangle primitive and the configuration of the culling surface; if the current triangle primitive needs to be culled, the receiving attribute REV_ATTR state is entered, and the attribute data is discarded; otherwise, the sending coordinate SEND_COORD state is entered.
[0046] When the working state of the control module is switched to the sending coordinate SEND_COORD state, the output module starts to work; when the working state of the control module is switched to the sending coordinate SEND_COORD state, the output module reads the homogenized coordinate value and packs it into internal interface data to output to the lower stage pipeline, and then enters the receiving attribute REV_ATTR1 state after the coordinate sending is completed.
[0047] When the working state of the control module is switched to the receiving attribute REV_ATTR1 state, the receiving module starts to work, and in the working state of the control module switched to the receiving attribute REV_ATTR1 state, the attribute information of the triangle primitive is received and cached into the SRAM of the BUF buffer of the homogenization module until the receiving is completed, and then the sending attribute SEND_ATTR state is entered;
[0048] When the working state of the control module is switched to the sending attribute SEND_ATTR state, the output module starts to work, and in the state, the color of the triangle primitive attribute is also simply processed: the back color is taken as the main color of the primitive and output in the case of the back surface; otherwise, the front color is taken as the main color of the triangle primitive and output, and when the attribute data is sent, the processing of one triangle primitive is completed, and the control module enters the idle IDLE state.
[0049] As an improvement of the floating-point hardware acceleration circuit for homogenization and back surface blanking in the universal graphic processor, when the working state of the control module is switched to the receiving coordinate REV_COORD state, and at the end of the coordinate receiving, it is necessary to judge the entering state of the control module in the next stage, wherein the specific judgment method is:
[0050] If the triangle of the current triangle primitive and the blanking are both the front and back surfaces, the receiving attribute REV_ATTR state is entered;
[0051] When none of the back surface blanking and the double-side color is enabled, or the current triangle primitive is a point or a line, any one of the above three conditions is established, and then the homogenization HOR state is entered;
[0052] When the current processed primitive is a triangle primitive and the double-side color is enabled, or when the current processed primitive is a triangle and the back surface blanking is enabled and is not the blanking of the front and back surfaces, the blanking CULL_ST state is entered.
[0053] Compared with the prior art, the present application has the following advantages:
[0054] By changing the address of reading the cache according to the blanking result in the output process after the homogenization and blanking functions are completed, the double-side color processing is further completed, so that the present application can complete the homogenization, back surface blanking and double-side color processing functions by using only one state machine, one floating-point divider, one floating-point multiplier, one floating-point adder and cache components, and the calculation function is efficiently completed with the least calculation resources.
[0055] The application solves the overflow problem of fixed-point data format in the process of homogenization calculation when a user renders a scene with large depth of field by adopting a standard single-precision floating-point 754 operation mode. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 The figure is a structural principle diagram of the floating-point hardware acceleration circuit for homogenization and back surface blanking in the general-purpose graphic processor proposed in an embodiment of the application.
[0057] Figure 2 The figure is a switching state diagram of the control module when timing controlling the homogenization and blanking operation process of the system. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only part of the embodiments of the application, rather than all the embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the application.
[0059] In the description of the application, it should be understood that the terms "upper", "lower", "front", "back", "left", "right", "top", "bottom", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only used to facilitate the description of the application and simplify the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the application.
[0060] The application will be further described in detail below with reference to the drawings, but is not limited to the application.
[0061] As an understanding of the technical concept of the application: homogenization and back surface blanking are key functions in the general-purpose graphic processor.
[0062] It can be understood that 1) homogenization is mainly to convert the homogenization coordinates in the clipping coordinate system into normal coordinates, and the objects processed include points, lines and triangles in the basic graphic primitives, and the specific function is to divide the X / Y / Z coordinate values of the graphic primitive coordinates by the W value, and the W value remains unchanged for the use of the lower-level pipeline.
[0063] 2) Back surface blanking is mainly to complete the back surface rejection of the solid object rendering, and back surface blanking is mainly for triangle graphic primitives, and since points and lines have no front and back surfaces, they are not processed in the application.
[0064] In the specific implementation, the known solid object can be provided with a front surface and a back surface. Meanwhile, based on the computer graphics, the order of setting three vertices of a triangle can be counterclockwise or clockwise as the front surface, and the opposite order as the back surface. The front surface, the back surface and the front and back surfaces can also be set.
[0065] Therefore, when the back surface blanking is performed, it is necessary to first determine whether the input triangle is the front surface or the back surface (if the order of the three vertices of the triangle is consistent with the setting, it is indicated that the triangle is the front surface, and otherwise, it is the back surface)
[0066] Secondly, the back surface blanking function) is performed according to the setting of the front surface, the back surface or the front and back surfaces (if the front surface or the back surface is set to be removed, the removal is performed according to the order of the three vertices of the current triangle. If the front and back surfaces are set to be removed, the order of the three vertices of the triangle does not need to be determined, and the removal is directly performed. It should be noted that the above-mentioned back surface blanking is performed under the condition that the user enables (the definition of enabling is responsible for the input and output of the control signal, that is, the enabling is an input pin of the chip or a configuration register of the circuit, and the blanking function can work normally only when the enabling is activated, for example, is at a high level)
[0067] 3) The double-sided color is mainly after the upper pipeline light processing. If the user enables the double-sided light, each vertex of the triangle has two colors, one is the back surface color, and the other is the front surface color. At this time, according to the result of the above-mentioned back surface blanking, it is determined whether the current triangle is the front surface or the back surface. If it is the back surface, the back surface color needs to be taken as the main color of the corresponding vertex, otherwise, the front surface color is taken as the main color of the corresponding vertex.
[0068] Based on the understanding of the above technical concept, as Figure 1 As an embodiment of the present application, a floating point hardware acceleration circuit for homogenization and back surface blanking in a general-purpose graphics processor is provided, comprising:
[0069] The receiving module 1 can understand that the receiving module 1 mainly completes the reception of the control signal and the primitive data information sent by the upper level. In the specific implementation, the receiving module 1 receives the control module 5 enabling signal (the enabling signal at this time is a start signal), sequentially receives the target object control information and the triangle primitive (contained in the primitive information) sent by the upper pipeline, and buffers the control information to the control module 5 and buffers the triangle primitive to the homogenization module 2BUF buffer.
[0070] Based on the above technical concept, it should be noted that the specific timing steps of the receiving module 1 for obtaining the target object control information and the triangle primitive are as follows:
[0071] S1-1, first, after obtaining the control information sent by the upper pipeline, the control information is cached to the control module 5, and the control information includes the primitive type (point, line and triangle), the number of vertex attributes, the control information of the lower pipeline, whether the double-sided lighting is enabled, whether the blanking is enabled, and the order of the front and the blanking surface (front, back or front and back), and the like; S1-2, secondly, the triangle primitive sent by the upper pipeline is obtained, and according to the primitive data type, the coordinate related information in the triangle primitive is cached to the BUF cache of the homogenization module 2; S1-3, finally, based on the enable signal (received signal) sent by the control module 5, the triangle primitive attribute data sent by the upper pipeline is received, wherein when the triangle primitive attribute data is received, it is cached to the SRAM of the BUF cache of the homogenization module 2 until the end of the caching, and the receiving instruction is ended; S1-4, again, wait for the enable signal (start signal) of the control module 5, return to step S1, and sequentially execute the receiving instruction.
[0072] The floating-point hardware acceleration circuit further comprises a homogenization module 2, which can be understood as mainly completing the conversion of the homogenization coordinates in the clipping coordinate system into ordinary coordinates, that is, completing the homogenization processing. In specific implementation: receiving the enable signal (start signal) of the control module 5, adopting time division multiplexing and pipeline mode, after selecting the coordinate values of the target object according to the triangle primitives obtained in the BUF cache of the homogenization module 2, the coordinate values are sent to the FDIV floating-point divider of the homogenization module 2 to calculate the homogenized coordinates of the target object, that is, x0 / w0, y0 / w0, z0 / w0, x1 / w1, y1 / w1, z1 / w1, x2 / w2, y2 / w2, z2 / w2, (in the formula, x0, x1, x2; y0, y1, y2; z0, z1, z2; w0, w1, w2; respectively represent the three vertex coordinates of the triangle primitive of the target object); and the homogenized coordinates of the target object are cached to the BUF cache of the homogenization module 2.
[0073] Based on the above technical concept, it can be understood that the homogenization module 2 adopts time division multiplexing and pipeline method, and the total homogenization operation takes 17 clock cycles, which achieves the efficient calculation function with the least calculation resources.
[0074] The floating-point hardware acceleration circuit further comprises an area calculation module 3. It can be understood that the area calculation module 3 mainly completes the area calculation of the triangle primitive. In specific implementation, in the case that three vertex coordinates a(x0, y0, z0, w0), b(x1, y1, z1, w1), and c(x2, y2, z2, w2) are known, the area of the triangle primitive is calculated by the formula area = x0(y1-y2) + x1(y2-y0) + x2(y0-y1). Secondly, the order of the three vertices of the target object triangle primitive is set to be counterclockwise or clockwise when the front surface is positive, and vice versa. Meanwhile, the culling surface of the target object triangle primitive for culling is set to be the front surface or the back surface or the front-back surface. Thirdly, the area of the triangle primitive is used to determine whether the current triangle primitive is the front surface or the back surface: when the area is greater than 0, the triangle primitive is counterclockwise. Finally, the culling preprocessing is performed: if the front surface or the back surface is set for culling, the culling is performed according to the order of the three vertices of the current triangle; otherwise, if the front-back surface is set for culling, the order of the three vertices of the triangle does not need to be determined, and the culling is directly performed.
[0075] The floating-point hardware acceleration circuit further comprises an output module 4. It can be understood that the output module 4 mainly completes the forwarding of the upper-level control information, the forwarding of the point and line primitive data, and the sending of the processed triangle data. It can be understood that the target object control information forwarded by the output module 4 to the lower-level pipeline in response to the enable signal of the control module 5 includes the primitive type including the coordinate related information in the triangle primitive, the number of vertex attributes, and the control information required by the lower-level pipeline.
[0076] In specific implementation, after the output module 4 receives the primitive coordinate or attribute data enable signal sent by the control module 5, the output module 4 first sends the homogeneous coordinate data of the target object.
[0077] Secondly, the attribute data is read from the SRAM of the BUF buffer of the homogenization module 2 and is sent.
[0078] Based on the above technical concept, it needs to be noted that in the process of reading the attribute data from the SRAM of the BUF buffer of the homogenization module 2 and sending the attribute data, it is necessary to first determine whether the double-sided color is enabled and the front-back surface information of the current triangle primitive, and then perform the double-sided color processing. If the double-sided color is not enabled, the attribute data is output in the normal order. Otherwise, the front-back surface of the current triangle primitive is determined. If the current triangle primitive is the front surface, the front color is output as the main color. If the current triangle primitive is the back surface, the back color is output as the main color, that is, the double color processing is completed.
[0079] The floating-point hardware acceleration circuit further comprises a control module 5, which can be understood as being configured to switch the working state of the graphic processor system after power-on, and to control the timing of the homogenization and culling operation of the system.
[0080] As shown in Figure 2 the specific implementation, the control module 5 is configured to switch the state as a state machine (the state machine is composed of a state register and a combination logic circuit, and can switch the state according to the control signal according to the pre-set state, and is a control center for coordinating the actions of related signals and completing specific operations). The control module 5 as a state machine comprises nine switching states.
[0081] 1) When the working state of the control module 5 after the graphic processor system is powered on is switched to the idle state IDLE, at this time, the receiving module 1 is ready to receive the data of the upper pipeline; when the data received by the receiving module 1 is the control information to be sent, the control module 5 enters the sending control SEND_CTRL state; when the data received by the receiving module 1 is the vertex coordinate data (three vertex coordinates after the homogeneous transformation of the target object), the control module 5 enters the receiving coordinate REV_COORD state; and in other cases, the state remains unchanged.
[0082] 2) When the working state of the control module 5 is switched to the sending control SEND_CTRL state, the output module 4 starts to work and sends the control information to be sent received by the receiving module 1 to the lower pipeline, and when the lower pipeline receives the control information to be sent, the control module 5 enters the idle state IDLE; otherwise, the state remains unchanged.
[0083] 3) When the working state of the control module 5 is switched to the receiving coordinate REV_COORD state, the receiving module 1 always works until the coordinate receiving is completed; when the coordinate receiving is completed, the control module 5 enters the receiving attribute REV_ATTR state, the homogenization HOM state or the culling CULL_ST state.
[0084] Based on the technical concept in item 3), it should be noted that when the working state of the control module 5 after the graphic processor system is powered on is switched to the receiving coordinate REV_COORD state, and when the coordinate receiving is completed, it is necessary to determine the entering state of the control module 5 in the next stage, and the specific determination method is as follows.
[0085] If the triangle of the current triangle primitive and the blanking are both the front and back conditions, the receiving attribute REV ATTR state is entered; if the back blanking is not enabled and the double-sided color is not enabled or the current triangle primitive is a point or the current triangle primitive is a line, any one of the above three conditions is established, the homogenization HOR state is entered; if the current processing triangle primitive is a triangle primitive and the double-sided color is enabled, or if the current processing primitive information is a triangle and the back blanking is enabled and is not the blanking front and back, the blanking CULL ST state is entered.
[0086] 4) When the working state of the control module 5 is switched to the receiving attribute REV ATTR state, it indicates that the current triangle primitive needs to be blanked; at this time, the receiving module 1 directly receives the attribute data and discards it, until the attribute receiving is completed; when the attribute data receiving is completed, the control module 5 enters the idle IDLE state;
[0087] 5) When the working state of the control module 5 is switched to the homogenization HOM state, it indicates that the current triangle primitive only needs to be homogenized; at this time, the homogenization module 2 starts to work until the homogenization calculation is completed, and the control module 5 enters the coordinate sending SEND_COORD state
[0088] 6) When the working state of the control module 5 is switched to the blanking CULL ST state, it indicates that the current triangle primitive not only needs to be homogenized, but also needs to be calculated in area, wherein, when the working state of the control module 5 is switched to the blanking CULL ST state, the homogenization is first processed, and then the area of the triangle primitive is calculated; after the area calculation of the triangle primitive is completed, whether the current triangle primitive needs to be blanked is determined according to the positive and negative of the area of the triangle primitive and the configuration of the set blanking surface; if it needs to be blanked, the receiving attribute REV ATTR state is entered, and the attribute data is discarded; otherwise, the sending coordinate SEND_COORD state is entered;
[0089] 7) When the working state of the control module 5 is switched to the sending coordinate SEND_COORD state, the output module 4 starts to work; when the working state of the control module 5 is switched to the sending coordinate SEND_COORD state, the output module 4 reads the homogenized coordinate value and packs it into internal interface data to output to the lower pipeline, until the coordinate sending is completed, and then enters the receiving attribute REV ATTR1 state;
[0090] 8) When the working state of the control module 5 is switched to the receiving attribute REV_ATTR1 state, the receiving module 1 starts to work, in the working state of the control module 5 switched to the receiving attribute REV_ATTR1 state, the attribute information of the triangle primitive is received and cached into the SRAM of the BUF cache of the homogenization module 2, until the receiving is completed, and then the sending attribute SEND_ATTR state is entered;
[0091] 9) When the working state of the control module 5 is switched to the sending attribute SEND_ATTR state, the output module 4 starts to work, in the state, the color of the triangle primitive attribute is also simply processed: when the double-side color is enabled and the current triangle primitive is the back side, the back color is output as the main color of the primitive; otherwise, the front color is output as the main color of the triangle primitive, when the attribute data is sent, the processing of a triangle primitive is completed, and the control module 5 enters the idle IDLE state.
[0092] Based on the above technical concept, it can be understood that, through the state switching of the control module 5, in the output process after the homogenization and blanking function is completed, according to the blanking result, the address of the read cache is simply changed, and the double-side color processing mode is further completed, so that the present application can complete the homogenization, back blanking and double-side color processing functions by using only one state machine, one floating point divider, one floating point multiplier, one floating point adder and cache components, and the calculation function is efficiently completed with the least calculation resources. At the same time,
[0093] As an embodiment of the present application, the floating point hardware acceleration circuit proposed by the present application uses a standard single-precision floating point 754 format for operation, and it can be understood that the floating point data format solves the overflow problem of fixed point data format in the homogenization calculation process when the user renders a scene with large depth of field.
[0094] The basic principles and main features of the present application and the advantages of the present application are shown and described above, and it is obvious for those skilled in the art that the present application is not limited to the details of the above exemplary embodiments, and the present application can be realized in other specific forms without departing from the spirit or essential characteristics of the present application; therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, the scope of the present application is defined by the appended claims rather than the above description, therefore all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application, and any figure reference in the claims should not be regarded as limiting the claims.
[0095] Furthermore, it should be understood that although the specification is described in terms of embodiments, not every embodiment includes every feature or implementation described herein. The specification can include implicit combinations of explicitly mentioned features and / or implicit combinations of implicitly mentioned features. Such combinations are also expressly included within the scope of the specification and an embodiment.
Claims
1. A floating point hardware acceleration circuit for homogenization and back porch blanking in a general purpose graphics processor, comprising: The application comprises: a receiving module (1) receiving control module (5) enable signal, sequentially receiving target object control information and triangle primitive information sent by the upper pipeline, and respectively buffering the control information to the control module (5) and buffering the triangle primitive to the homogeneous module (2) BUF buffer; the homogeneous module (2) receiving the control module (5) enable signal, using time division multiplexing and pipeline mode, after selecting the coordinate value of the target object according to the information of the triangle primitive obtained in the homogeneous module (2) BUF buffer, delivering to the homogeneous module (2) FDIV floating point divider to calculate the homogeneous coordinate of the target object, and buffering the homogeneous coordinate of the target object to the homogeneous module (2) BUF buffer; the area calculation module (3) receiving the control module (5) enable signal, calculating the area of the target object triangle primitive based on the homogeneous coordinate of the target object, and judging whether the current triangle primitive is positive or negative, and completing the back face culling of the current triangle primitive; the output module (4) receiving the control module (5) enable signal forwards the target object control information and the current processed primitive to the lower pipeline; the control module (5) switches the working state of the acceleration circuit, and controls the timing of the homogeneous and blanking operation process of the system; the target object control information forwarded to the lower pipeline by the output module (4) receiving the control module (5) enable signal includes primitive type containing coordinate related information in the triangle primitive, vertex attribute number and control information required by the lower pipeline; wherein, after the output module (4) receives the primitive coordinate or attribute data enable signal sent by the control module (5), the output module (4) first sends the homogeneous coordinate data of the target object; secondly, the attribute data is read by the SRAM of the BUF buffer of the homogeneous module (2) and sent.
2. A floating-point hardware acceleration circuit for homogenization and backplane blanking in a general-purpose graphics processor as recited in claim 1, wherein, The specific timing steps of the receiving module (1) obtaining the target object control information and the triangle primitive are as follows: S1-1, first, after obtaining the control information sent by the upper pipeline, the control information is buffered to the control module (5); S1-2, secondly, the triangle primitive sent by the upper pipeline is obtained, and the coordinate related information in the triangle primitive is buffered to the BUF buffer of the homogeneous module (2) according to the primitive data type; S1-3, finally, based on the enable signal sent by the control module (5), the triangle primitive attribute data sent by the upper pipeline is received, wherein after receiving the triangle primitive attribute data, it is buffered to the SRAM of the BUF buffer of the homogeneous module (2) until the buffering is completed, and the receiving instruction is ended; S1-4, again, wait for the control module (5) enable signal, return to step S1, and sequentially execute the receiving instruction.
3. A floating-point hardware acceleration circuit for homogenization and backplane blanking in a general-purpose graphics processor as recited in claim 1, wherein, the homogeneous coordinate of the target object is calculated as follows: x0 / w0, y0 / w0, z0 / w0; x1 / w1, y1 / w1, z1 / w1; x2 / w2, y2 / w2, z2 / w2, In the formula, x0, y0, z0, w0; x1, y1, z1, w1; x2, y2, z2, w2, respectively represent three vertex coordinates of the target object triangle primitive.
4. A floating-point hardware acceleration circuit for homogenization and backplane blanking in a general-purpose graphics processor as recited in claim 3, wherein, The area calculation module (3) performs area calculation of the target object triangle primitive, and the timing step for completing back face culling of the current triangle primitive is: S3-1, first, the area of the target object triangle primitive is calculated based on the obtained three vertex coordinates after homogenization: area=(x0 / w0)(y1 / w1-y2 / w2)+(x1 / w1)(y2 / w2-y0 / w0)+(x2 / w2)(y0 / w0-y1 / w1) In the formula, area represents the area of the triangle primitive; S3-2, secondly, the order of the three vertices of the target object triangle primitive is set to be positive if the order is counterclockwise or clockwise, and vice versa, and the culling face of the target object triangle primitive is set to be positive or negative or both; S3-3, based on the area of the triangle primitive obtained in S3-1, the current triangle primitive is judged to be positive or negative: when area is greater than 0, the triangle primitive is counterclockwise; S3-4, culling preprocessing: If the positive or negative face is set to be culled, the culling is performed according to the order of the three vertices of the current triangle; Otherwise, if the positive and negative faces are set to be culled, the order of the three vertices of the triangle does not need to be determined, and the culling is directly performed.
5. A floating-point hardware acceleration circuit for homogenization and backplane blanking in a general-purpose graphics processor as recited in claim 1, wherein, In the process of reading the attribute data of the SRAM of the BUF buffer of the homogenization module (2) and sending, It is necessary to first determine whether the current double-sided color and the positive and negative information of the current triangle primitive are enabled to perform double-sided color processing: wherein, If the double-sided color is not enabled, the attribute data is output in normal order; otherwise, The positive and negative of the current triangle primitive are determined, if the current triangle primitive is positive, the positive color is output as the main color; if the current triangle primitive is negative, the negative color is output as the main color.
6. A floating-point hardware acceleration circuit for homogenization and backplane blanking in a general-purpose graphics processor as recited in claim 1, wherein, The control module (5) controls the timing of the homogenization and blanking operation of the system in the following way: When the working state of the control module (5) is switched to the idle state IDLE after the power of the graphics processor system is turned on, the receiving module (1) is ready to receive the data of the upper pipeline; when the data received by the receiving module (1) is the control information that needs to be sent, the SEND_CTRL state is entered; when the data received by the receiving module (1) is the vertex coordinate data, the REV_COORD state is entered; otherwise, the state remains unchanged; When the working state of the control module (5) is switched to the SEND_CTRL state, the output module (4) starts to work, and sends the control information that needs to be sent received by the receiving module (1) to the lower pipeline; when the lower pipeline receives the data, the idle state IDLE is entered; otherwise, the state remains unchanged; When the working state of the control module (5) switches to the receiving coordinate REV_COORD state, the receiving module (1) works until the coordinate receiving ends; when the coordinate receiving ends, the control module (5) enters the receiving attribute REV_ATTR state or the homogenization HOM state or the culling CULL_ST state; When the working state of the control module (5) switches to the receiving attribute REV_ATTR state, it indicates that the current triangle primitive needs to be culled; at this time, the receiving module (1) receives the attribute data and discards it until the attribute receiving is completed; when the attribute data receiving is completed, the control module (5) enters the IDLE state; When the working state of the idle control module (5) switches to the homogenization HOM state, it indicates that the current triangle primitive only needs to be homogenized; at this time, the homogenization module (2) starts to work until the homogenization calculation ends, and the control module (5) enters the coordinate sending SEND_COORD state When the working state of the control module (5) switches to the culling CULL_ST state, it indicates that the current triangle primitive not only needs to be homogenized, but also needs to be calculated in area; when the working state of the control module (5) switches to the culling CULL_ST state, the homogenization is performed first, and then the area of the triangle primitive is calculated; after the area calculation of the triangle primitive is completed, whether the current triangle primitive needs to be culled is determined according to the positive and negative of the area of the triangle primitive and the configuration of the set culling surface; if it needs to be culled, it enters the receiving attribute REV_ATTR state and discards the attribute data; otherwise, it enters the sending coordinate SEND_COORD state; When the working state of the control module (5) switches to the sending coordinate SEND_COORD state, the output module (4) starts to work; when the working state of the control module (5) switches to the sending coordinate SEND_COORD state, the output module (4) reads the homogenized coordinate value and packs it into internal interface data to output to the lower pipeline, until the coordinate sending ends, and enters the receiving attribute REV_ATTR1 state; When the working state of the control module (5) switches to the receiving attribute REV_ATTR1 state, the receiving module (1) starts to work; when the working state of the control module (5) switches to the receiving attribute REV_ATTR1 state, the attribute information of the triangle primitive is received and cached in the SRAM of the BUF cache of the homogenization module (2); after the receiving ends, it enters the sending attribute SEND_ATTR state; When the working state of the control module (5) switches to the sending attribute SEND_ATTR state, the output module (4) starts to work; in this state, the attribute of the triangle primitive is sent, and the color of the triangle primitive is also simply processed; When the double-side color is enabled and the current triangle primitive is the back side, the back side color needs to be output as the main color of the primitive; otherwise, the front side color is output as the main color of the triangle primitive. After the attribute data is sent, the processing of a triangle primitive is completed, and the control module (5) enters an idle IDLE state.
7. A floating-point hardware acceleration circuit for homogenization and backplane blanking in a general-purpose graphics processor as recited in claim 6, wherein, When the working state of the control module (5) is switched to the receiving coordinate REV_COORD state, and at the end of the coordinate receiving, the current control module (5) needs to be judged to enter the state in the next stage. The specific judgment method is as follows: If the triangle of the current triangle primitive and the blanking are both the front and back sides, the receiving attribute REV_ATTR state is entered; When the back side blanking is not enabled and the double-side color is not enabled or the current triangle primitive is a point or the current triangle primitive is a line, any one of the above three conditions is established, and the homogeneous HOR state is entered; When the current processed primitive is a triangle primitive and the double-side color is enabled, or when the current processed primitive is a triangle and the back side blanking is enabled and is not the blanking front and back sides, the blanking CULL_ST state is entered.
8. A floating-point hardware acceleration circuit for homogenization and backplane blanking in a general-purpose graphics processor as recited in any of claims 1-7, wherein, The floating-point hardware acceleration circuit adopts a standard single-precision floating-point 754 format for operation.
Citation Information
Patent Citations
An advanced hidden surface geometry engine structure
CN108022202B
Window transformation and back face culling hardware accelerator for 3D graphics processing
CN108961432A
A geometric processing stage for a pipelined graphic engine, corresponding method and computer program product therefor
EP1496475A1