[go: up one dir, main page]

CN104240285A - Method for transmitting mass data of CPU to GPU through VTF technology - Google Patents

Method for transmitting mass data of CPU to GPU through VTF technology Download PDF

Info

Publication number
CN104240285A
CN104240285A CN201410470451.1A CN201410470451A CN104240285A CN 104240285 A CN104240285 A CN 104240285A CN 201410470451 A CN201410470451 A CN 201410470451A CN 104240285 A CN104240285 A CN 104240285A
Authority
CN
China
Prior art keywords
texture
data
gpu
cpu
vtf
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201410470451.1A
Other languages
Chinese (zh)
Inventor
张翼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Of Ancient India Day Infotech Share Co Ltd In Wuxi
Original Assignee
Of Ancient India Day Infotech Share Co Ltd In Wuxi
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 Of Ancient India Day Infotech Share Co Ltd In Wuxi filed Critical Of Ancient India Day Infotech Share Co Ltd In Wuxi
Priority to CN201410470451.1A priority Critical patent/CN104240285A/en
Publication of CN104240285A publication Critical patent/CN104240285A/en
Pending legal-status Critical Current

Links

Landscapes

  • Image Generation (AREA)

Abstract

The invention discloses a method for transmitting mass data of a CPU to a GPU through a VTF technology. The method comprises the steps that a texture of the CPU is established, and data are written in the texture; the GPU reads the texture with the written-in data from the CPU, and carries out point sampling to obtain the written-in data in the texture. The mass data are stored in the texture, then the texture is transmitted to the GPU so as to enable the mass data to enter the GPU to be calculated, the data can be accessed in a vertex shader program, and the problem that the mass data can not be read is solved.

Description

VTF technical finesse CPU data in enormous quantities are utilized to import the method for GPU into
Technical field
The present invention relates to Computer Image Processing field, particularly, relate to the method that a kind of VTF of utilization technical finesse CPU data in enormous quantities import GPU into.
Background technology
Along with the development of computer technology, increasing data scale has reached TB even PB magnitude, and this just needs computing machine to have powerful floating data computing power.At present by the impact of Game Market, HD video, electronic product and Military Simulation simulation demand, in order to realize graph image effect true to nature, GPU supports the computing become increasingly complex.Be faced with figure and data calculate the problem become increasingly complex, stern challenge is proposed to the speed of computer processing data.
A current common texture picture is made up of (RGB texture) RGB passage, and each RGB numerical range is (0 ~ 255), with hexadecimal representation (0x00 ~ 0xFF), each passage takies a byte, a byte 8 bit positions, therefore a kind of color comprises RGB and occupies 24, so can give expression to plant color, computer disposal function mainly contains CPU (CPU (central processing unit)) and GPU(Graphics Processing Unit) complete, in these process, what CPU was responsible for is that the things that logicality is stronger calculates, GPU is then responsible for the high image rendering of bulk density, in GPU rendering pipeline, be divided into the different stages, the application program stage, the geometry stage, rasterization stage, because the shader programmable features of GPU, shader is commonly referred to coloring process, coloring process is divided into two classes: vertex shading program (vertex shader) and pixel shader (pixel shader) program.When processing picture, need data to import into GPU from CPU.And when a large amount of data even import into GPU vertex shading program from CPU by more data, there will be the problem that can not read these mass data.
Summary of the invention
The object of the invention is to, for the problems referred to above, propose the method that a kind of VTF of utilization technical finesse CPU data in enormous quantities import GPU into, to solve the problem that mass data can not read.
For achieving the above object, the technical solution used in the present invention is:
Utilize VTF technical finesse CPU data in enormous quantities to import a method of GPU into, comprise CPU and create texture, and the step of data write texture;
GPU reads the texture after above-mentioned write data from CPU, and carries out the step that point sampling obtains writing in texture data.
Preferably, CPU creates texture, and data write texture is specially:
Arranging texture file type is texture image;
Create dynamic texture, then toward texture write floating data.
Preferably, above-mentioned dynamic texture is 2 d texture.
Preferably, above-mentioned point sampling is specially:
For making GPU access texture corresponding to association, the hardware that computing machine is corresponding be sequence number that the texture created is arranged map one by one step;
The sampling pattern of GPU is set to the step of Clamp sampling pattern;
Import the texture after above-mentioned sequence into step that sampling function obtains data in enormous quantities.
Technical scheme of the present invention has following beneficial effect:
Technical scheme of the present invention, large batch of data are saved in texture, and then texture is passed to GPU, thus allow a large amount of data enter GPU computing, make to conduct interviews to these data in vertex shading program, solve the problem that mass data can not read.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Accompanying drawing explanation
Fig. 1 imports the method flow diagram of GPU into for the VTF technical finesse CPU data in enormous quantities that utilize described in the embodiment of the present invention.
Embodiment
Below in conjunction with accompanying drawing, the preferred embodiments of the present invention are described, should be appreciated that preferred embodiment described herein is only for instruction and explanation of the present invention, is not intended to limit the present invention.
As shown in Figure 1, a kind of VTF of utilization technical finesse CPU data in enormous quantities import the method for GPU into, comprise CPU and create texture, and the step of data write texture;
GPU reads the texture after above-mentioned write data from CPU, and carries out the step that point sampling obtains writing in texture data.
Preferably, CPU creates texture, and data write texture is specially:
Arranging texture file type is texture image;
Create dynamic texture, then toward texture write floating data.Dynamic texture is 2 d texture.
Need in gaming to load the needs of a large amount of texture pictures for interface, and texture and picture supply the object of the pinup picture of CPU and GPU operation after being loaded into internal memory.According to the difference storing data, different textures can be defined to store the data of different purposes, but 4 texture storage can only be supported at most in existing DirectX 9.0 version.
In actual applications, create four texture pictures respectively and be used for data storage, be respectively:
D3DVERTEXTEXTURESAMPLER0、D3DVERTEXTEXTURESAMPLER1、
D3DVERTEXTEXTURESAMPLER2、D3DVERTEXTEXTURESAMPLER3
In order to make the texture can accessing establishment in GPU, need texture to be set to the discernible texture type of GPU: as follows:
IDirect3DDevice::SetTexture (D3DVERTEXTEXTURESAMPLER0, IDirect3DTexture*) // for D3DVERTEXTEXTURESAMPLER0 arranges texture (pinup picture) file type is texture image
Be generally create dynamic texture realize Lock texture then toward texture write floating data then Unlock finally texture is passed to GPU;
Texture->Lock();
For(int?i=0;i<w;i++)
For(int?j=0;j<h;j++)
Pixel [i] [j]=pdata; ///write data in 2 d texture
Texture->Unlock();
If also have other texture, the same setting, then the texture that the data write needed creates.
Preferably, above-mentioned point sampling is specially:
For making GPU access texture corresponding to association, the hardware that computing machine is corresponding is the step that the sequence number of the texture setting created maps one by one;
The sampling pattern of GPU is set to the step of Clamp sampling pattern;
Import the texture after above-mentioned sequence into step that sampling function obtains data in enormous quantities.
Vertex texture is utilized to obtain (Vertex Texture Fetch), be called for short VTF, it is a characteristic of Shader module, texture is retrieved in the shader of summit in GPU pipeline, due to the process of GPU high-speed parallel and floating-point operation ability, import Shader into and only have concrete numerical value, data type is int(integer graphic data), float(floating data), bool(Boolean) or matrix(matrix) etc., wherein maximum matrix4 has 16 amounts, it is very huge for now these these data being imported into summit shader, then this characteristic of VTF is utilized, these data are kept in texture, and be no longer the value of pixel, by this medium, a large amount of data are allowed to enter GPU computing, make to conduct interviews to these data in the shader of summit.
In order to enable the texture in upper step can access texture corresponding to association in GPU, the sequence number that the hardware that computing machine is corresponding can be arranged for the texture created maps one by one, arranges as follows:
D3DVERTEXTEXTURESAMPLER0 associates sequence number s0
D3DVERTEXTEXTURESAMPLER1 associates sequence number s1
D3DVERTEXTEXTURESAMPLER2 associates sequence number s2
D3DVERTEXTEXTURESAMPLER3 associates sequence number s3
Then sample to the texture of association, sampling has a variety of, and that usually uses has point sampling, line sampling etc.So-called sampling is sampled to texture coordinate exactly, passes to the process that sampling function returns pixel.
In general, texture image is square, and the height and width of texture are respectively H, W, and (H, W size is n is integer), by in texture a to polygon or curved surface and when transforming to screen coordinate, the single texture pixel of texture seldom corresponds to the pixel on the image of screen, according to conversion used and texture, on screen, single pixel can correspond to sub-fraction (namely amplifying) or large quantities of texture pixel (namely reducing) of a texture pixel.In texture image, the coordinate U of each pixel, V are in [0,1] scope, and such as texture image is 512*512 size, obtain the pixel U of 48*48 position, V coordinate, that is: [48/512,48/512].
The method of line sampling: 4 pixels of namely getting around this pixel are averaged the U of this pixel, V value.
Technical solution of the present invention adopts the method for point sampling to sample to surrounding pixel, can obtain true U, the V of this pixel, the Clamp sampling pattern of concrete employing.Be specially:
IDirect3DDevice::SetSamplerState (D3DVERTEXTEXTURESAMPLER0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP); Arranging texture U coordinate is Clamp sampling,
IDirect3DDevice::SetSamplerState (D3DVERTEXTEXTURESAMPLER0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP); Arranging texture V coordinate is Clamp sampling,
IDirect3DDevice::SetSamplerState(D3DVERTEXTEXTURESAMPLER0,D3DSAMP_MINFILTER,D3DTEXF_POINT);
Wherein D3DTEXF_POINT is set to point sampling, and D3DSAMP_MINFILTER specifies the method reducing filtering,
IDirect3DDevice::SetSamplerState(D3DVERTEXTEXTURESAMPLER0,D3DSAMP_MAGFILTER,D3DTEXF_POINT);
Wherein D3DTEXF_POINT is set to point sampling, and D3DSAMP_MAGFILTER specifies the method for amplification filtering.
Sampling function tex2Dlod (g_texture is imported into by the texture image of above-mentioned association in the Shader process of GPU summit, uv) data in enormous quantities are obtained, each data are again after pixel shader, then to these data rasterization process, then by coloring process to final color value carry out calculating output to frame buffering in and be shown on screen.
In sum, technical solution of the present invention solves imports from the data in enormous quantities of CPU the problem that GPU coloring process cannot read into, has usable range wide, the advantages such as implementation method is simple.Be applied to various field more and more widely now, in game skeleton cartoon technology, in game role animation, be drive animation by the matrix of bone, then bone quantity is more, matrixing is more comparatively speaking, these data are very huge, and these data are saved in floating-point texture, and then pass to GPU process, just can draw the reposition that role is obtained by matrixing, effectively solve the not treatable problem of mass data.
When Simulated Water animation effect, water is the model that a lot of grids are formed, water belongs to liquid object again, constantly there is its shape of change change, data are many, and in CPU, be so respectively water summit position skew and normal create texture image, are each vertex side-play amount in a program, just there is N number of shift value on so N number of summit, and its normal is also in continuous change; The pixel offset value difference on each summit will produce hydrodynamic(al) and draw.In the process of a large amount of entity of process, the position of each entity, towards difference, need a large amount of data too, now in these data write texture, and then import GPU process into, complete the access to mass data.
Technique also may be used for the every field such as Military Simulation, satellite sounding, bio-science, repeats no more herein.
Last it is noted that the foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, although with reference to previous embodiment to invention has been detailed description, for a person skilled in the art, it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature.Within the spirit and principles in the present invention all, any amendment done, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (4)

1. utilize VTF technical finesse CPU data in enormous quantities to import a method of GPU into, it is characterized in that, comprise CPU and create texture, and the step of data write texture;
GPU reads the texture after above-mentioned write data from CPU, and carries out the step that point sampling obtains writing in texture data.
2. the VTF of utilization technical finesse CPU according to claim 1 data in enormous quantities import the method for GPU into, it is characterized in that, CPU creates texture, and data write texture is specially:
Arranging texture file type is texture image;
Create dynamic texture, then toward texture write floating data.
3. the VTF of utilization technical finesse CPU according to claim 2 data in enormous quantities import the method for GPU into, it is characterized in that, above-mentioned dynamic texture is 2 d texture.
4. the VTF technical finesse CPU data in enormous quantities that utilize according to Claims 2 or 3 import the method for GPU into, and it is characterized in that, above-mentioned point sampling is specially:
For making GPU access texture corresponding to association, the hardware that computing machine is corresponding is the step that the sequence number of the texture setting created maps one by one;
The sampling pattern of GPU is set to the step of Clamp sampling pattern;
Import the texture after above-mentioned sequence into step that sampling function obtains data in enormous quantities.
CN201410470451.1A 2014-09-16 2014-09-16 Method for transmitting mass data of CPU to GPU through VTF technology Pending CN104240285A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410470451.1A CN104240285A (en) 2014-09-16 2014-09-16 Method for transmitting mass data of CPU to GPU through VTF technology

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410470451.1A CN104240285A (en) 2014-09-16 2014-09-16 Method for transmitting mass data of CPU to GPU through VTF technology

Publications (1)

Publication Number Publication Date
CN104240285A true CN104240285A (en) 2014-12-24

Family

ID=52228287

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410470451.1A Pending CN104240285A (en) 2014-09-16 2014-09-16 Method for transmitting mass data of CPU to GPU through VTF technology

Country Status (1)

Country Link
CN (1) CN104240285A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106570922A (en) * 2016-08-25 2017-04-19 浙江科澜信息技术有限公司 Method for improving three-dimensional model rendering performance
CN108122266A (en) * 2017-12-20 2018-06-05 成都卓杭网络科技股份有限公司 A kind of method, apparatus and storage medium for caching skeleton cartoon and rendering texture
CN108648252A (en) * 2018-05-17 2018-10-12 成都明镜视觉科技有限公司 A kind of skeleton cartoon compatibility processing method
CN110799940A (en) * 2017-07-05 2020-02-14 Arm有限公司 Content data management
CN110969690A (en) * 2019-12-19 2020-04-07 福建天晴数码有限公司 Vertex animation data storage method and system based on texture

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350106A (en) * 2007-07-17 2009-01-21 普罗姆泰克软件公司 Method for constructing data structure used for proximate particle search

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101350106A (en) * 2007-07-17 2009-01-21 普罗姆泰克软件公司 Method for constructing data structure used for proximate particle search

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
TAEHYUN RHEE等: "Real-TimeWeighted Pose-Space Deformation on the GPU", 《EUROGRAPHICS 2006》 *
宋丽丽等: "基于VTF的海洋生物骨骼动画系统设计与实现", 《计算机与现代化》 *
张荣华: "基于 GPU 的动态地形实时绘制技术的研究与实现", 《计算机工程与设计》 *
毛星云: "《逐梦旅程 Windows游戏编程之从零开始》", 30 November 2013 *
王德才等: "《精通DirectX 3D图形与动画程序设计》", 31 May 2007 *
耿肇英: "《Direct 3D 和 XNA 游戏开发基础:C* 语言版》", 31 January 2009 *
金禾工作室编著: "《3D游戏程序设计基础》", 31 October 2006 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106570922A (en) * 2016-08-25 2017-04-19 浙江科澜信息技术有限公司 Method for improving three-dimensional model rendering performance
CN110799940A (en) * 2017-07-05 2020-02-14 Arm有限公司 Content data management
US11704127B2 (en) 2017-07-05 2023-07-18 Arm Limited Marking current context data to control a context-data-dependent processing operation to save current or default context data to a data location
CN110799940B (en) * 2017-07-05 2023-12-22 Arm有限公司 Content data management
CN108122266A (en) * 2017-12-20 2018-06-05 成都卓杭网络科技股份有限公司 A kind of method, apparatus and storage medium for caching skeleton cartoon and rendering texture
CN108122266B (en) * 2017-12-20 2021-07-27 成都卓杭网络科技股份有限公司 Method, device and storage medium for caching rendering textures of skeleton animation
CN108648252A (en) * 2018-05-17 2018-10-12 成都明镜视觉科技有限公司 A kind of skeleton cartoon compatibility processing method
CN110969690A (en) * 2019-12-19 2020-04-07 福建天晴数码有限公司 Vertex animation data storage method and system based on texture
CN110969690B (en) * 2019-12-19 2023-05-23 福建天晴数码有限公司 Vertex animation data storage method and system based on textures

Similar Documents

Publication Publication Date Title
KR100902974B1 (en) Tile based precision rasterization in a graphics pipeline
CN103718244B (en) For collection method and the device of media accelerator
US7564460B2 (en) Systems and methods for providing intermediate targets in a graphics system
US8059144B2 (en) Generating and resolving pixel values within a graphics processing pipeline
CN110544290A (en) data rendering method and device
US6738069B2 (en) Efficient graphics state management for zone rendering
US20080235316A1 (en) Processor with adaptive multi-shader
CN104240285A (en) Method for transmitting mass data of CPU to GPU through VTF technology
CN110751696A (en) Method, device, equipment and medium for converting BIM (building information modeling) model data into glTF (glTF) data
US20050280652A1 (en) System and method for a universal data write unit in a 3-D graphics pipeline including generic cache memories
KR20170132758A (en) Hybrid 2d/3d graphics rendering
CN114820990B (en) Digital twin-based river basin flood control visualization method and system
US11308648B2 (en) Compressing texture data on a per-channel basis
KR101427408B1 (en) Scalable and unified compute system
EP3251081B1 (en) Graphics processing unit with bayer mapping
CN104463937A (en) Animation generation method and device based on irregular object
CN107038729A (en) A kind of digital meter panel method for drafting based on OpenGL ES
CN108010113B (en) Deep learning model execution method based on pixel shader
CN106886974A (en) Image accelerator apparatus and related methods
US20240233263A1 (en) Primitive rendering method and apparatus, computer device and storage medium
CN104008565A (en) System and method for playing Flash bitmap animation by using cocos2d-x and HE engines
US10089708B2 (en) Constant multiplication with texture unit of graphics processing unit
CN111681307B (en) Implementation method of dynamic three-dimensional coordinate axis applied to three-dimensional software
Zemcik et al. Particle rendering engine in DSP and FPGA
CN104881836A (en) Meteorological early warning information publishing system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20141224

RJ01 Rejection of invention patent application after publication