CN108520151B - Device and method for realizing triangle stippling function in GPU - Google Patents

Device and method for realizing triangle stippling function in GPU Download PDF

Info

Publication number
CN108520151B
CN108520151B CN201810328264.8A CN201810328264A CN108520151B CN 108520151 B CN108520151 B CN 108520151B CN 201810328264 A CN201810328264 A CN 201810328264A CN 108520151 B CN108520151 B CN 108520151B
Authority
CN
China
Prior art keywords
stippling
mode
module
address
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810328264.8A
Other languages
Chinese (zh)
Other versions
CN108520151A (en
Inventor
焦永
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Changsha Jingmei Integrated Circuit Design Co ltd
Original Assignee
Changsha Jingmei Integrated Circuit Design Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Changsha Jingmei Integrated Circuit Design Co ltd filed Critical Changsha Jingmei Integrated Circuit Design Co ltd
Priority to CN201810328264.8A priority Critical patent/CN108520151B/en
Publication of CN108520151A publication Critical patent/CN108520151A/en
Application granted granted Critical
Publication of CN108520151B publication Critical patent/CN108520151B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/30Circuit design
    • G06F30/39Circuit design at the physical level

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Geometry (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Image Processing (AREA)
  • Controls And Circuits For Display Device (AREA)

Abstract

The invention discloses a device and a method for realizing the function of stippling a triangle in a GPU, which utilize the coordinate after the triangle is rasterized to control the rasterized output effective signal according to a stippling mode, and the device comprises: the system comprises a click mode address calculation module, a click mode reading module and an output effective signal judgment module, and the realization method comprises the following steps: calculating to obtain a stippling mode corresponding to the rasterized coordinates, and controlling whether the rasterized output effective signals need to be output to a fragment processing module and a pixel processing module, wherein the final result is that the triangle generates a part of effect displayed in a frame memory and a part of effect discarded according to the stippling mode, namely the stippling triangle effect.

Description

Device and method for realizing triangle stippling function in GPU
Technical Field
The invention mainly relates to the field of GPU chip design, in particular to the field of realization of triangle drawing in a GPU.
Background
The generation of the polygon in the GPU is realized by decomposing the polygon into basic primitive triangles, so the function of the polygon can be realized by the triangle, and by default, the polygon is drawn in a solid mode, but sometimes it is required to realize a function of drawing the polygon, and by specifying a drawing mode, or called a mask, by a user, if the mode appears as 1, the pixel corresponding to the polygon is drawn, and if the mode appears as 0, the corresponding pixel in the polygon is not drawn.
Disclosure of Invention
The problems to be solved by the invention are as follows: the method comprises a pointing mode address calculation module, a pointing mode reading module and an output effective signal judgment module, controls whether the output effective signal needs to be output to a fragment processing module and a pixel processing module according to the obtained output effective signal, and finally generates a part of the triangle according to the pointing mode to be displayed in a frame memory, and discards a part of the triangle, namely, the pointing triangle effect.
The invention content is as follows:
the invention discloses a device for realizing a function of stippling a triangle in a GPU (graphics processing unit), which comprises the following modules:
(1) The stippling mode address calculation module: the module is used for calculating the address of the stippling mode corresponding to the current rasterized coordinate in the memory;
(2) A stippling mode reading module: the module is used for reading the stippling mode of the corresponding coordinate from the memory;
(3) The effective signal judgment module: the module executes judgment according to the dot drawing mode corresponding to the coordinates and the effective signal output by rasterization to obtain a data effective signal output to the next stage, if the data effective signal is effective, the data effective signal is output to the next stage for processing, otherwise, the data effective signal is directly discarded;
the invention also discloses a method for realizing the function of stippling a triangle in a GPU, a user needs to write a self-defined stippling mode into a memory at first, configure the StartAddr of a storage position and a Stride value Stride, configure the W bit of each row of the stippling mode, and have H rows, wherein each bit represents the stippling mode of one pixel, and simultaneously needs to configure the StartPos of the starting position in the row of the stippling mode, and the realization method of the invention is carried out according to the following steps:
step (1): calculating the address of the stippling mode corresponding to the current rasterized fragment coordinate in the memory, and obtaining the rasterized fragment integer coordinate as (x) by the rasterization module F ,y F ) Calculating an integer division: x is a radical of a fluorine atom F ÷W=x N ……x M And integer division: y is F ÷H=y N ……y M (ii) a The start address StartAddr and Stride value Stride and y in the memory according to the user-configured stippling mode M Calculating the dot-and-draw mode address of the current line as follows: address = StartAddr + Stride y M
Step (2): sending a request to a memory according to the Address obtained by calculation in the step (1), reading the stippling mode of the line from the memory, obtaining the actually used stippling mode Pattern according to the parameter of the initial position in the line configured by the user, namely, placing the stippling mode bit before the initial position to the tail of the line;
and (3): outputting effective signals and xth of Pattern from rasterized fragment M And performing AND operation on the bits, outputting the current segment to the next stage for processing when the result is 1, and otherwise, discarding the current segment.
The invention has the advantages that: 1. the realization is simple and convenient: and adding a plurality of modules for obtaining a dot-picture mode, calculating the dot-picture mode and judging an output effective signal after the triangle is rasterized.
Drawings
FIG. 1 is a block diagram of an apparatus for implementing a stippled triangle in a GPU according to the present invention;
FIG. 2 is a flowchart of a method for implementing stippling a triangle in a GPU according to the present invention;
FIG. 3 is a process of stippling a mode start position;
fig. 4 is a diagram illustrating the result of the stippling effect achieved by triangles.
Detailed Description
The invention will be described in further detail below with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, an apparatus for implementing a stippled triangle in a GPU includes three modules:
1. the stippling mode address calculation module: the module is used for calculating the address of the stippling mode corresponding to the current rasterized coordinate in the memory;
2. a stippling mode reading module: the module is used for reading the stippling mode of the corresponding coordinate from the memory;
3. the effective signal judgment module: the module executes judgment according to the dot-and-draw mode corresponding to the coordinates and the effective signals output by rasterization to obtain effective data signals output to the next level, if the effective data signals are effective, the effective data signals are output to the next level for processing, otherwise, the effective data signals are directly discarded;
as shown in fig. 2, in a method flow for implementing a stippling triangle in a GPU, a user writes a self-defined stippling pattern into a memory, configures a start address StartAddr and a Stride value Stride of a storage location, sets W bits in each row of the stippling pattern to have H rows, where each bit represents a stippling pattern of one pixel, and configures a start position StartPos in the stippling pattern row. The implementation method of the invention is carried out according to the following steps:
step (1): calculating the address of the stippling mode corresponding to the current rasterized fragment coordinate in the memory, and obtaining the rasterized fragment integer coordinate as (x) by the rasterization module F ,y F ) Calculating an integer division: x is the number of F ÷W=x N ……x M And integer division: y is F ÷H=y N ……y M (ii) a The start address StartAddr and Stride value Stride and y in the memory according to the user-configured stippling mode M Calculating the dot-and-draw mode address of the current line as follows: address = StartAddr + Stride y M
Step (2): sending a request to a memory according to the Address obtained by calculation in the step (1), reading the stippling mode of the line from the memory, obtaining a actually used stippling mode Pattern according to the parameter of the initial position in the line configured by the user, namely, placing a stippling mode bit before the initial position to the tail of the line, as shown in fig. 2;
and (3): outputting effective signals and xth of Pattern from rasterized fragment M And operation is performed on the bits, when the result is 1, the current segment is output to the next stage for processing, otherwise, the current segment is discarded until all the segments of the triangle are processed, the current segment is written into the frame memory, and the execution effect is as shown in fig. 3.
As shown in fig. 3, the dot pattern processing method when the intra-line start position StartPos is defined;
as shown in fig. 4, the implementation effect diagram of the invention for drawing triangles with dots is (1) a solid triangle, and (2) a triangle with dots.

Claims (2)

  1. A device for realizing the function of stippling a triangle in a GPU is characterized in that: the system comprises the following modules:
    (1) The stippling mode address calculation module: the module is used for calculating the address of the stippling mode corresponding to the current rasterized coordinate in the memory;
    (2) A stippling mode reading module: the module is used for reading the stippling mode of the corresponding coordinate from the memory;
    (3) The effective signal judgment module: the module performs judgment according to the dot drawing mode corresponding to the coordinates and the effective signals output by rasterization to obtain effective data signals output to the next level, if the effective data signals are effective, the effective data signals are output to the next level for processing, and if the effective data signals are not effective, the effective data signals are directly discarded.
  2. A method for realizing the function of stippling a triangle in a GPU is characterized in that: the user needs to write a self-defined stippling mode into a memory, configure a starting address StartAddr and a Stride value Stride of a storage position, configure W bits of each row of the stippling mode, and totally H rows, wherein each bit represents the stippling mode of one pixel, and also needs to configure a starting position StartPos in the stippling mode row, and the implementation method is implemented according to the following steps:
    step (1): calculating the current lightThe address of the dot drawing mode corresponding to the rasterized fragment coordinate in the memory is (x) which is the fragment integer coordinate obtained by the rasterization module F ,y F ) And calculating integer division: x is the number of F ÷W=x N ……x M And integer division: y is F ÷H=y N ……y M (ii) a The start address StartAddr and Stride value Stride and y in the memory according to the user-configured stippling mode M Calculating the dot-and-draw mode address of the current line as follows: address = StartAddr + Stride y M
    Step (2): sending a request to a memory according to the Address obtained by calculation in the step (1), reading the stippling mode of the line from the memory, obtaining the actually used stippling mode Pattern according to the parameter of the initial position in the line configured by the user, namely, placing the stippling mode bit before the initial position to the tail of the line;
    and (3): the valid signal output by the rasterized fragment and the xth of Pattern M And performing AND operation on the bits, outputting the current segment to the next stage for processing when the result is 1, and otherwise, discarding the current segment.
CN201810328264.8A 2018-04-12 2018-04-12 Device and method for realizing triangle stippling function in GPU Active CN108520151B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810328264.8A CN108520151B (en) 2018-04-12 2018-04-12 Device and method for realizing triangle stippling function in GPU

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810328264.8A CN108520151B (en) 2018-04-12 2018-04-12 Device and method for realizing triangle stippling function in GPU

Publications (2)

Publication Number Publication Date
CN108520151A CN108520151A (en) 2018-09-11
CN108520151B true CN108520151B (en) 2022-12-06

Family

ID=63432449

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810328264.8A Active CN108520151B (en) 2018-04-12 2018-04-12 Device and method for realizing triangle stippling function in GPU

Country Status (1)

Country Link
CN (1) CN108520151B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7221368B1 (en) * 2003-12-18 2007-05-22 Nvidia Corporation Stippled lines using direct distance evaluation
CN102004832A (en) * 2010-11-22 2011-04-06 长沙景嘉微电子有限公司 Realization of triangle rasterization based on horizontal line scanning
CN102306391A (en) * 2011-09-20 2012-01-04 深圳Tcl新技术有限公司 OpenGL (open graphics library)-based inverted image display processing device and method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7656416B2 (en) * 2002-11-27 2010-02-02 Ati Technologies, Inc. Apparatus for generating anti-aliased and stippled 3d lines, points and surfaces using multi-dimensional procedural texture coordinates

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7221368B1 (en) * 2003-12-18 2007-05-22 Nvidia Corporation Stippled lines using direct distance evaluation
CN102004832A (en) * 2010-11-22 2011-04-06 长沙景嘉微电子有限公司 Realization of triangle rasterization based on horizontal line scanning
CN102306391A (en) * 2011-09-20 2012-01-04 深圳Tcl新技术有限公司 OpenGL (open graphics library)-based inverted image display processing device and method

Also Published As

Publication number Publication date
CN108520151A (en) 2018-09-11

Similar Documents

Publication Publication Date Title
KR102275712B1 (en) Rendering method and apparatus, and electronic apparatus
US9640148B2 (en) Method of and apparatus for controlling frame buffer operations
WO2021248705A1 (en) Image rendering method and apparatus, computer program and readable medium
CN108259797B (en) Method and device for carrying out character superposition on image
CN111062858A (en) Efficient rendering-ahead method, device and computer storage medium
US9160895B2 (en) Method and apparatus for quickly responding to signal
JP6352943B2 (en) Data processing method, apparatus, program, and ink jet printer
GB2565613A (en) Data processing systems
CN105531743A (en) Rendering device
JP5254250B2 (en) Method and system for generating boundaries in the process of rasterizing vector graphics, and method for manufacturing the system
CN108520151B (en) Device and method for realizing triangle stippling function in GPU
CN103617790A (en) Field programmable gate array (FPGA)-based graphic controller
US10210595B2 (en) Producing and using data according to first and second different patterns in data processing systems
CN104361619A (en) Horizontal line filling based 2D (2-dimensional) graph IP (intellectual property) core implementation method
US7508397B1 (en) Rendering of disjoint and overlapping blits
KR100361387B1 (en) Polygon drawing method and polygon drawing apparatus
US11069326B2 (en) Processing method for character stroke and related device
CN105574868A (en) Data processing method and device in image transmission process
JP4208350B2 (en) Drawing apparatus, drawing method, and storage medium
CN107169917B (en) Device for vector graphics processor to finish real-time drawing of graphics image without DDR
JP3791203B2 (en) Image processing device
JP4803063B2 (en) Image processing circuit and printer controller equipped with the same
JP6283980B2 (en) Image processing apparatus and image processing method
CN108399595A (en) A kind of realization device and method of image processing algorithm
JP6155604B2 (en) Image processing apparatus and image processing method

Legal Events

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