CN110647325A - Graphic resource conversion method, apparatus, electronic device and storage medium - Google Patents

Graphic resource conversion method, apparatus, electronic device and storage medium Download PDF

Info

Publication number
CN110647325A
CN110647325A CN201910775312.2A CN201910775312A CN110647325A CN 110647325 A CN110647325 A CN 110647325A CN 201910775312 A CN201910775312 A CN 201910775312A CN 110647325 A CN110647325 A CN 110647325A
Authority
CN
China
Prior art keywords
opengl
graphics
resource
graphic
vulkan
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
CN201910775312.2A
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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology 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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN201910775312.2A priority Critical patent/CN110647325A/en
Publication of CN110647325A publication Critical patent/CN110647325A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The present disclosure provides a method, an apparatus, an electronic device and a storage medium for converting a graphics resource, wherein the method comprises: acquiring an OpenGL graphic resource request input by a user; determining a corresponding Vulkan or DX graphic resource interface according to the OpenGL graphic resource request; applying for a corresponding graphic processor GPU to a graphic resource library through the Vulkan or DX graphic resource interface; and distributing the applied GPU to the user to realize the conversion between the OpenGL graphic resources and the Vulkan or DX graphic resources. That is to say, the embodiment of the present disclosure aims to determine a corresponding Vulkan or DX graphics resource interface according to the OpenGL graphics resource request without changing an original OpenGL upper layer code architecture, thereby implementing the conversion of graphics resources and reducing the workload and the development cost of research and development personnel.

Description

Graphic resource conversion method, apparatus, electronic device and storage medium
Technical Field
The present disclosure relates to the field of computers, and in particular, to a method and an apparatus for converting graphics resources, an electronic device, and a storage medium.
Background
With the rapid development of terminal technology, some application programs (APP) of the intelligent terminal are provided with functions such as beauty, makeup, magic expression and the like, and due to the accumulation of codes for many years, the functions are compiled into corresponding renderers and graphic engines based on OpenGL at present. OpenGL supports various embedded platforms, supports 2D and 3D graphics Application Program Interfaces (APIs) with complete functions, is specially designed for various embedded systems, and is composed of well-defined desktop OpenGL subsets, creating a flexible and powerful bottom layer interactive interface between software and graphics acceleration.
However, with the rapid development of graphics hardware, a single-thread and global state set programming interface designed for graphics hardware with limited early performance, such as OpenGL, cannot exert the performance advantages of modern graphics hardware, so that each mainstream manufacturer in this year continuously launches a graphics programmable interface specially aiming at the characteristics of its own hardware, and gradually stops following a new version of OpenGL, even so that the OpenGL is no longer supported by a public statement, and an App developer is required to use a new API of the manufacturer to redevelop existing functions. For most of the APPs, if the graphics rendering function based on OpenGL is re-developed, for different operating systems, the corresponding renderer needs to be rewritten to implement the graphics rendering/computing function. Due to the great difference of the design ideas of the new and old graphics APIs, if the image codes are rewritten, the framework of the 2/3D rendering engine above the renderer is affected, and the workload and the development cost of the developers are increased.
Disclosure of Invention
In order to overcome the problems in the related art, the present disclosure provides a method and an apparatus for converting graphics resources, an electronic device, and a storage medium, so as to solve the technical problem in the prior art that the workload and the development cost of research and development personnel are increased if image codes are rewritten due to too large differences in the API design concepts of new and old graphics.
According to a first aspect of the embodiments of the present disclosure, there is provided a graphics resource conversion method, including:
acquiring an OpenGL graphic resource request input by a user;
determining a corresponding Vulkan or DX graphic resource interface according to the OpenGL graphic resource request;
applying for a corresponding graphic processor GPU to a graphic resource library through the Vulkan or DX graphic resource interface;
and distributing the applied GPU to the user to realize the conversion between the OpenGL graphic resources and the Vulkan or DX graphic resources.
Optionally, the determining a corresponding Vulkan or DX graphics resource interface according to the OpenGL graphics resource request includes:
searching a preset mapping relation according to the OpenGL graphic resource request to obtain a corresponding Vulkan or DX graphic resource interface;
and recording the corresponding association state of the OpenGL graphics resource request and the Vulkan or DX graphics resource interface in the mapping relation.
Optionally, before obtaining the OpenGL graphics resource request input by the user, the method further includes:
and establishing a mapping relation between the OpenGL graphic resource interface and the Vulkan or DX graphic resource interface code.
Optionally, the establishing a mapping relationship between the OpenGL graphics resource interface and the Vulkan or DX graphics resource interface specifically includes:
converting OpenGL graphic resource interface codes into corresponding Vulkan or DX graphic resource interface codes according to the requirements of OpenGL specifications;
and establishing a mapping relation between the OpenGL graphic resource interface codes and the Vulkan or DX graphic resource interface codes.
Optionally, before obtaining the OpenGL graphics resource request input by the user, the method further includes:
checking the validity of the parameters and the states of each device according to the requirements of the OpenGL specification document;
and if the parameters and the states of the devices are valid, executing the step of obtaining the OpenGL graphics resource request.
Optionally, after the applied GPU is allocated to the user, the method further includes:
and recording the applied GPU in the mapping relation.
According to a second aspect of the embodiments of the present disclosure, there is provided a graphics resource converting apparatus including:
an obtaining module configured to obtain an OpenGL graphics resource request;
a determining module configured to determine a corresponding Vulkan or DX graphics resource interface according to the OpenGL graphics resource request;
the resource application module is configured to apply for a corresponding graphic processor GPU to an image resource library through the Vulkan or DX graphic resource interface;
and the resource allocation module is configured to allocate the applied GPU to the user, so as to realize the conversion between the OpenGL graphics resource and the Vulkan or DX graphics resource.
Optionally, the determining module includes:
a searching module configured to search a preset mapping relation according to the OpenGL graphics resource request to obtain a corresponding Vulkan or DX graphics resource interface;
a first recording module configured to record a corresponding association state of the OpenGL graphics resource request and a Vulkan or DX graphics resource interface in the mapping relationship.
Optionally, the apparatus further comprises:
the establishing module is configured to establish a mapping relation between an OpenGL graphics resource interface code and a Vulkan or DX graphics resource interface code before the obtaining module obtains the OpenGL graphics resource request input by the user.
Optionally, the establishing module includes:
a conversion module configured to convert OpenGL graphics resource interface codes into corresponding Vulkan or DX graphics resource interface codes before the obtaining module obtains an OpenGL graphics resource request input by a user;
an establishing submodule configured to establish a mapping relationship between the OpenGL graphics resource interface code and the Vulkan or DX graphics resource interface code.
Optionally, the apparatus further comprises:
a checking module configured to check validity of parameters and states of each device according to OpenGL specification document requirements before the obtaining module obtains an OpenGL graphics resource request input by a user;
the obtaining module is further configured to obtain an OpenGL graphics resource request input by a user when the checking module checks that the parameters and the states of the devices are valid.
Optionally, the apparatus further comprises:
the second recording module is configured to record the applied GPU in the mapping relation after the distribution module distributes the applied GPU to the user.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including: a processor; a memory for storing the processor-executable instructions; wherein the processor is configured to perform any of the graphics resource conversion methods described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium, wherein instructions of the storage medium, when executed by a processor of an electronic device, cause the electronic device to perform any one of the above-mentioned graphics resource conversion methods.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, wherein instructions of the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform any one of the above-mentioned graphics resource conversion methods.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: in the graphics resource conversion method shown in the present exemplary embodiment, after an OpenGL graphics resource request input by a user is acquired, a Vulkan or DX graphics resource interface corresponding to the OpenGL graphics resource request is determined; applying for a corresponding graphic processor GPU to a graphic resource library through the Vulkan or DX graphic resource interface; and distributing the applied GPU to the user to realize the conversion between the OpenGL graphic resource and the Vulkan or DX graphic resource. That is to say, the embodiment of the present disclosure aims to convert the OpenGL graphics resource request into a corresponding Vulkan or DX graphics resource interface without changing the original OpenGL upper code architecture, thereby implementing the conversion of graphics resources and reducing the workload and the development cost of research and development personnel. .
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a flow diagram illustrating a method for graphics resource conversion in accordance with an illustrative embodiment;
FIG. 2 is another flow diagram illustrating a method of graphics resource conversion in accordance with an illustrative embodiment;
FIG. 3 is a block diagram illustrating an exemplary implementation of a graphics resource translation device in accordance with an illustrative embodiment;
FIG. 4 is another schematic diagram illustrating an architecture of a graphics resource translation device, according to an example embodiment;
FIG. 5 is a schematic diagram of yet another configuration of a graphics resource converting apparatus according to an example embodiment;
FIG. 6 is a schematic diagram illustrating the structure of an electronic device in accordance with one illustrative embodiment;
fig. 7 is another schematic diagram of an electronic device according to an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Prior to the introduction of the present disclosure, technical terms related to the present disclosure are introduced:
opengl (open Graphics library), which is an open Graphics library or open Graphics library, is a cross-language, cross-platform Application Programming Interface (API) for rendering 2D, 3D vector Graphics, and this interface consists of nearly 350 different function calls, used to draw complex three-dimensional scenes from simple Graphics bits. That is, OpenGL defines a specification for a cross-programming language, cross-platform programming interface, which is used for three-dimensional images (and also for two-dimensional images). OpenGL is a professional graphical program interface, and is a bottom-layer graphics library which is powerful in function and convenient to call.
OpenGL ES (OpenGL for Embedded Systems), which is a subset of OpenGL three-dimensional graphics APIs, is designed for Embedded devices such as mobile phones, PDAs, and game hosts.
Vulkan is a cross-platform 2D and 3D graphics Application Program Interface (API), and compared to OpenGL ES, Vulkan framework and its shader (shader) language, it can embody the performance advantages of modern graphics hardware.
With the understanding of the above technical terms, please refer to fig. 1, which is a flowchart illustrating a graphics resource conversion method according to an exemplary embodiment, and as shown in fig. 1, the graphics resource conversion method is used in a terminal, and includes the following steps:
step 101: and acquiring an OpenGL graphic resource request input by a user.
In this step, after the user opens the APP on the terminal, if the user wants to make a beautiful look or make a beautiful look, the user needs to apply for an image resource request from the OpenGL graphics resource library, that is, the background server obtains the OpenGL graphics resource request input by the user, where the request may include information such as an image resource request name, a user ID, and an image resource interface.
And 102, determining a corresponding Vulkan or DX graphic resource interface according to the OpenGL graphic resource request.
In this step, the background server may search a preset mapping relationship according to the OpenGL graphics resource request, and may obtain a Vulkan or DX graphics resource interface corresponding to the OpenGL graphics resource request according to the mapping relationship; and then, recording the corresponding association state of the OpenGL graphics resource request and the Vulkan or DX graphics resource interface in the mapping relation. Of course, in this embodiment, the corresponding Metal graphics resource interface may also be determined according to the OpenGL graphics resource request through a preset mapping relationship.
The mapping relationship is pre-established, that is, the mapping relationship between the OpenGL graphics resource interface and the Vulkan or DX graphics resource interface code is established, that is, the mapping relationship between the OpenGL graphics resource interface and the Vulkan graphics resource interface is one-to-one, or the mapping relationship between the OpenGL graphics resource interface and the DX graphics resource interface is one-to-one. The specific establishment process comprises the following steps:
firstly, according to the requirements of OpenGL specifications, OpenGL graphic resource interface codes are converted into corresponding Vulkan or DX graphic resource interface codes; and then establishing a mapping relation between the OpenGL graphic resource interface codes and the corresponding Vulkan or DX graphic interface codes.
Wherein one of the conversion processes is;
and converting the OpenGL graphic resource interface codes into Metal graphic resource interface codes according to the memory layout, coordinate axes and cutting space occupied by different graphic resource interface codes in the OpenGL specification.
The following takes the example of converting the glBuffer Data operation into the Metal graphics resource operation, but the invention is not limited thereto.
Firstly, parameter checking is carried out according to the requirements of OpenGL specifications, and corresponding error recording is carried out on an error parameter. Secondly, according to the parameter requirement, a graph resource buffer object instance is created, and finally, the implementation data which represents the data buffer to be oriented in the glBufferData parameter is transmitted to the instance. The specific implementation process is shown in the following program segment.
Step 103: and applying for a corresponding graphic processor GPU to an image resource library through the Vulkan or DX graphic resource interface.
The image resource library in this step may be a Vulkan or DX image resource library, and if the Vulkan Graphics resource interface is called, a corresponding Graphics Processor (GPU) is applied to the Vulkan image resource library, and if the DX Graphics resource interface is called, a corresponding GPU is applied to the DX image resource library. The graphics processor may process graphics rendering, or graphics drawing, among other things.
Step 104: and distributing the applied GPU to the user to realize the conversion between the OpenGL graphic resources and the Vulkan or DX graphic resources.
In this step, the Graphics Processor (GPU), commonly referred to as the processor of the graphics card, is the "heart" of the graphics card, similar to the CPU, except that the GPU is designed specifically to perform the complex mathematical and geometric calculations necessary for graphics rendering.
Currently, most GPUs have 2D or 3D graphics acceleration functions. For example, if the CPU wants to draw a two-dimensional graphic, the GPU needs only to send an instruction, such as "draw a rectangle with a length and width of a × b at the coordinate position (x, y)", the GPU can quickly calculate all pixels of the graphic, draw a corresponding graphic at a designated position on the display, notify the CPU that "i have drawn" after drawing, and then wait for the CPU to send a next graphic instruction. That is, with the GPU, the CPU is freed from the tasks of graphics processing, and can execute more other system tasks, which can greatly improve the overall performance of the computer.
In the graphics resource conversion method shown in the present exemplary embodiment, after an OpenGL graphics resource request input by a user is acquired, a Vulkan or DX graphics resource interface corresponding to the OpenGL graphics resource request is determined; applying for a corresponding graphic processor GPU to a graphic resource library through the Vulkan or DX graphic resource interface; and distributing the applied GPU to the user to realize the conversion between the OpenGL graphic resource and the Vulkan or DX graphic resource. That is to say, the embodiment of the present disclosure aims to convert the OpenGL graphics resource request into a corresponding Vulkan or DX graphics resource interface without changing the original OpenGL upper code architecture, thereby implementing resource interface conversion and reducing workload and development cost of developers.
That is, in the present disclosure, a user-oriented translation layer is added between the OpenGL APIs (such as functions of beauty, make-up and 3D engine) and the Vulkan API or DX API, and the translation layer re-implements the functions of the OpenGL APIs according to the OpenGL specification, that is, real-time translates the graphics operations required by the upper OpenGL service code to the Vulkan or DX graphics operations. The conversion layer is completely compatible with OpenGL APIs, all upper-layer service codes written based on the APIs do not need to be modified, the bottom layer is automatically converted into Vulkan APIs or DX APIs for calling in real time, the existing codes are seamlessly switched, and the access cost is almost zero. In addition, the utilization rate of the multi-core CPU is improved and the drawing performance is improved by utilizing the characteristics of the Vulkan API or the DX API. The conversion layer puts the dynamic conversion of different graphic APIs into one project, avoids the problem that different business teams in the traditional work flow need to allocate research and development resources to adapt to the new graphic API, and reduces the learning and research and development cost of the new graphic API.
Referring also to fig. 2, another flowchart of a method for converting a graphics resource is shown according to an example embodiment, where the method may further include:
step 201: checking the validity of the parameters and the states of each device according to the requirements of the OpenGL specification document;
one of the checking modes is to check the validity of the parameters and states of each device in the graphic resource library according to a multi-level state checking mode; wherein, the multilevel state checking mode comprises: the first level check is used for checking the parameters and the states of the equipment and providing text description for the parameters and the states with errors; a second level check to validly check the state of the state machine; and the third level checks, is used in under the situation that the system confirms all function parameter and call order of the said every apparatus are all correct, no longer check all function parameter and call order; or under the condition that the system determines that the parameters and the calling sequence of all the functions of each device are incorrect, the parameters and the calling sequence of the incorrect functions are checked.
While the middle layer of the graphics rendering interface provided by the present disclosure may provide multi-level state checking. This is because the existing state check is performed according to the OpenGL specification, but during the state check, since the OpenGL specification does not know whether the current code is in a development and debugging state or in an online running stage, the code in the online running stage performs redundant state check calculation, which wastes performance and cannot reach the most efficient running state.
Based on this, the present disclosure proposes a multilevel status check method, that is, different check methods are adopted at different stages, for example, three levels of check methods are adopted in the development and development practice: 1) a first level of inspection, i.e., a finest inspection; 2) second level checks, i.e., required checks; 3) third level inspection, namely simplest inspection, and the like. Wherein,
1) the finest inspection is a research and development stage and is used for inspecting the parameters and the states of each device and providing text description for the parameters and the states with errors; the examination of problem positioning efficiency can be improved through the detailed examination, namely, on the basis of the graphic API specification, according to the special effect and the requirements of different audio and video research and development teams, the most detailed error explanation is provided, and engineers in different levels can conveniently and quickly get on hand. Compared with the requirement of a specification document, the method has the advantages that the name of a function which is currently wrong, the text detailed description of a wrong value, the error information is recorded in the document and the like are purposely added.
In addition, where the specification documentation defines ambiguities, the present disclosure improves upon the current hardware manufacturer's manual (containing operations or functions that the manufacturer does not support), making additional checks.
2) The check, i.e. the code loading phase, is necessary to effectively check the state of the state machine, i.e. to apply the code on the equipment of some users, and if there is an error, this mode can be used to assist in locating the problem. That is, only a few states of the graphics state machine core are checked: whether the valid shader program and the valid framebuffer exist or not and whether the states of the valid shader program and the valid framebuffer are correct or not are judged.
3) The simplest check, namely the on-line running stage, is used for not checking the parameters and the calling sequence of all the functions of each device under the condition that the system determines that the parameters and the calling sequence of all the functions of each device are correct, or checking the parameters and the calling sequence of the incorrect functions under the condition that the system determines that the parameters and the calling sequence of all the functions of each device are incorrect, that is, if the system determines that the parameters and the calling sequence of all the functions are correct, the checking is not performed at all, and if the checking is wrong, only the parameters and the calling sequence of the wrong functions are detected, so that the maximum execution efficiency is realized.
Step 202: if all the parameters and the states are valid, acquiring an OpenGL graphic resource request;
step 203: determining a Vulkan or DX graphic resource interface corresponding to the OpenGL graphic resource request;
step 204: applying for a corresponding graphic processor GPU to a graphic resource library through the Vulkan or DX graphic resource interface;
step 205: and distributing the applied GPU to the user to realize the conversion between the OpenGL graphic resources and the Vulkan or DX graphic resources.
In this embodiment, steps 202 to 205 are the same as steps 101 to 104, and are described in detail above, and are not described herein again.
In the embodiment of the disclosure, on the basis of not changing an original OpenGL upper layer code architecture, a conversion layer is added on the basis of the original OpenGL architecture, a function code relation mapping table is stored in the conversion layer, and OpenGL graphic data can be converted into corresponding Vulkan or DX graphic data through the mapping relation of the function codes, that is, functions such as beauty, makeup, magic expression and the like based on OpenGL can be converted into functions such as beauty, makeup, magic expression and the like based on Vulkan or DX through the set mapping relation of the function codes. The code is automatically optimized, the GPU computing performance is improved, the drawing performance is improved, and therefore the user experience is improved. Furthermore, before drawing, the validity of the parameters and the state of each device is checked, so that unreasonable drawing behaviors are avoided, and the related collapse rate of the graph is reduced.
Fig. 3 is a schematic structural diagram illustrating a graphics resource converting apparatus according to an exemplary embodiment. Referring to fig. 3, the apparatus includes: an acquisition module 301, a determination module 302, a resource application module 303, and a resource allocation module 304, wherein,
an obtaining module 301 configured to obtain an OpenGL graphics resource request;
a determining module 302 configured to determine a corresponding Vulkan or DX graphics resource interface according to the OpenGL graphics resource request;
a resource application module 303, configured to apply for a corresponding GPU from an image resource library through the Vulkan or DX graphics resource interface;
a resource allocation module 304, configured to allocate the applied GPU to the user, so as to implement conversion between the OpenGL graphics resource and the Vulkan or DX graphics resource.
Optionally, in another embodiment, on the basis of the foregoing embodiment, the determining module 302 includes: a search module 401 and a first recording module 403, which are schematically shown in fig. 4, wherein,
a search module 401 configured to search a preset mapping relationship according to the OpenGL graphics resource request to obtain a corresponding Vulkan or DX graphics resource interface;
a first recording module 402, configured to record, in the mapping relationship, a corresponding association state of the OpenGL graphics resource request and a Vulkan or DX graphics resource interface.
Optionally, in another embodiment, on the basis of the above embodiment, the apparatus may further include: the establishing module is configured to establish a mapping relation between the OpenGL graphics resource interface codes and the Vulkan or DX graphics resource interface.
Optionally, in another embodiment, on the basis of the above embodiment, the establishing module includes: a conversion module and a set-up sub-module, wherein,
a conversion module configured to convert the OpenGL graphics resource interface codes into corresponding Vulkan or DX graphics resource interface codes;
and the establishing submodule is configured to establish a mapping relation between the OpenGL graphic resource interface codes and the corresponding Vulkan or DX graphic interface codes.
Optionally, in another embodiment, on the basis of the above embodiment, the apparatus may further include: the checking module 501 is schematically shown in fig. 5, wherein,
a checking module 501, configured to check validity of parameters and states of each device according to OpenGL specification document requirements before the obtaining module 301 obtains an OpenGL graphics resource request input by a user;
the obtaining module 301 is further configured to obtain an OpenGL graphics resource request input by a user when the checking module 501 checks that the parameters and the states of the devices are valid.
Optionally, in another embodiment, on the basis of the above embodiment, the apparatus may further include: a second recording module, wherein,
the second recording module is configured to record the applied GPU in the mapping relation after the distribution module distributes the applied GPU to the user.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
In the embodiment of the disclosure, because the code architecture of the original system does not need to be changed, the conversion of the resource function is realized through the customized mapping relation (or the customized data structure), and the workload and the research and development cost of research and development personnel are reduced. The method is compatible with the conventional graphics image function realized based on OpenGL API, and realizes the seamless switching of the conventional codes. And furthermore, the Vulkan API or DX API characteristics are utilized, the utilization rate of the multi-core CPU is improved, and the drawing performance is improved, so that the user experience is improved. Better graphics images are rendered using the richer graphics interface provided by the Vulkan API or dxl API. And by adding the state check of the equipment before drawing, unreasonable drawing behavior is avoided, thereby reducing the related collapse rate of the graph. And by self-development of a shader converter/compiler, automatic optimization of codes is realized, the GPU computing performance is improved, and the drawing performance is improved, so that the user experience is improved.
Fig. 6 is a block diagram illustrating an electronic device 600 according to an example embodiment. The electronic device may be a mobile terminal or a server, and in the embodiment of the present disclosure, the electronic device is taken as an example for description. For example, the electronic device 600 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 6, electronic device 600 may include one or more of the following components: a processing component 602, a memory 604, a power component 606, a multimedia component 608, an audio component 610, an interface to input/output (I/O) 612, a sensor component 614, and a communication component 616.
The processing component 602 generally controls overall operation of the electronic device 600, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 602 may include one or more processors 620 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 602 can include one or more modules that facilitate interaction between the processing component 602 and other components. For example, the processing component 602 can include a multimedia module to facilitate interaction between the multimedia component 608 and the processing component 602.
The memory 604 is configured to store various types of data to support operation at the device 600. Examples of such data include instructions for any application or method operating on the electronic device 600, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 604 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power supply component 606 provides power to the various components of electronic device 600. The power components 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 600.
The multimedia component 608 includes a screen that provides an output interface between the electronic device 600 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 600 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 610 is configured to output and/or input audio signals. For example, the audio component 610 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 600 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 604 or transmitted via the communication component 616. In some embodiments, audio component 610 further includes a speaker for outputting audio signals.
The I/O interface 612 provides an interface between the processing component 602 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor component 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor component 614 may detect an open/closed state of the device 600, the relative positioning of components, such as a display and keypad of the electronic device 600, the sensor component 614 may also detect a change in the position of the electronic device 600 or a component of the electronic device 600, the presence or absence of user contact with the electronic device 600, orientation or acceleration/deceleration of the electronic device 600, and a change in the temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 614 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communications between the electronic device 600 and other devices in a wired or wireless manner. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 616 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 616 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 600 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic elements for performing the graphics resource conversion methods illustrated in fig. 1 and 2 described above.
In an exemplary embodiment, there is also provided an electronic device including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the graphics resource conversion method described above.
In an exemplary embodiment, there is also provided a non-transitory computer readable storage medium, wherein instructions of the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the above-described graphics resource conversion method.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 604 comprising instructions, executable by the processor 620 of the electronic device 600 to perform the graphics resource conversion method illustrated in fig. 1 and 2 described above is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, and when the instructions in the computer program product are executed by the processor 620 of the electronic device 600, the electronic device 600 is caused to execute the graphics resource conversion method shown in fig. 1 and fig. 2.
Fig. 7 is a block diagram illustrating an electronic device 700 in accordance with an example embodiment. For example, the electronic device 700 may be provided as a server. Referring to fig. 7, electronic device 700 includes a processing component 722 that further includes one or more processors, and memory resources, represented by memory 732, for storing instructions, such as applications, that are executable by processing component 722. The application programs stored in memory 732 may include one or more modules that each correspond to a set of instructions. Further, the processing component 722 is configured to execute instructions to perform the method graphics resource conversion method described above.
The electronic device 700 may also include a power component 726 that is configured to perform power management of the electronic device 700, a wired or wireless network interface 750 that is configured to connect the electronic device 700 to a network, and an input output (I/O) interface 758. The electronic device 700 may operate based on an operating system stored in memory 732, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (10)

1. A method for converting graphics resources, comprising:
acquiring an OpenGL graphic resource request input by a user;
determining a corresponding Vulkan or DX graphic resource interface according to the OpenGL graphic resource request;
applying for a corresponding graphic processor GPU to a graphic resource library through the Vulkan or DX graphic resource interface;
and distributing the applied GPU to the user to realize the conversion between the OpenGL graphic resources and the Vulkan or DX graphic resources.
2. The graphics resource conversion method of claim 1, wherein said determining a corresponding Vulkan or DX graphics resource interface from the OpenGL graphics resource request comprises:
searching a preset mapping relation according to the OpenGL graphic resource request to obtain a corresponding Vulkan or DX graphic resource interface;
and recording the corresponding association state of the OpenGL graphics resource request and the Vulkan or DX graphics resource interface in the mapping relation.
3. The graphics resource conversion method according to claim 2, wherein before the obtaining the OpenGL graphics resource request input by the user, the method further comprises:
and establishing a mapping relation between the OpenGL graphic resource interface and the Vulkan or DX graphic resource interface.
4. The method for graphics resource conversion according to claim 3, wherein the establishing a mapping relationship between an OpenGL graphics resource interface and a Vulkan or DX graphics resource interface specifically comprises:
converting OpenGL graphic resource interface codes into corresponding Vulkan or DX graphic resource interface codes according to the requirements of OpenGL specifications;
and establishing a mapping relation between the OpenGL graphic resource interface codes and the Vulkan or DX graphic resource interface codes.
5. The graphics resource conversion method according to any of claims 1 to 4, wherein before the obtaining the OpenGL graphics resource request input by the user, the method further comprises:
checking the validity of the parameters and the states of each device according to the requirements of the OpenGL specification document;
and if the parameters and the states of the devices are valid, executing the step of obtaining the OpenGL graphics resource request.
6. The method for converting graphics resources of any one of claims 1 to 4, wherein after the GPU applied is allocated to the user, the method further comprises:
and recording the applied GPU in the mapping relation.
7. A graphics resource converting apparatus, comprising:
the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is configured to acquire an OpenGL graphic resource request input by a user;
a determining module configured to determine a corresponding Vulkan or DX graphics resource interface according to the OpenGL graphics resource request;
the resource application module is configured to apply for a corresponding graphic processor GPU to an image resource library through the Vulkan or DX graphic resource interface;
and the resource allocation module is configured to allocate the applied GPU to the user, so as to realize the conversion between the OpenGL graphics resource and the Vulkan or DX graphics resource.
8. The resource conversion apparatus of claim 7, wherein the determining module comprises:
a searching module configured to search a preset mapping relation according to the OpenGL graphics resource request to obtain a corresponding Vulkan or DX graphics resource interface;
a first recording module configured to record a corresponding association state of the OpenGL graphics resource request and a Vulkan or DX graphics resource interface in the mapping relationship.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to perform the graphics resource conversion method of any of claims 1-6.
10. A non-transitory computer-readable storage medium, wherein instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the graphics resource conversion method of any of claims 1-6.
CN201910775312.2A 2019-08-21 2019-08-21 Graphic resource conversion method, apparatus, electronic device and storage medium Pending CN110647325A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910775312.2A CN110647325A (en) 2019-08-21 2019-08-21 Graphic resource conversion method, apparatus, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910775312.2A CN110647325A (en) 2019-08-21 2019-08-21 Graphic resource conversion method, apparatus, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN110647325A true CN110647325A (en) 2020-01-03

Family

ID=68990238

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910775312.2A Pending CN110647325A (en) 2019-08-21 2019-08-21 Graphic resource conversion method, apparatus, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN110647325A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022100685A1 (en) * 2020-11-13 2022-05-19 华为技术有限公司 Drawing command processing method and related device therefor

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3159849A1 (en) * 2015-10-21 2017-04-26 Stephen Viggers Systems and methods for using an opengl api with a vulkan graphics driver
US10074206B1 (en) * 2017-05-23 2018-09-11 Amazon Technologies, Inc. Network-optimized graphics library for virtualized graphics processing
US10102605B1 (en) * 2016-08-26 2018-10-16 Amazon Technologies, Inc. Graphics library virtualization for virtualized graphics processing
US20190073741A1 (en) * 2017-08-09 2019-03-07 Daniel Herring Systems and Methods for Using EGL with an OPENGL API and a Vulkan Graphics Driver
CN110136230A (en) * 2019-03-29 2019-08-16 北京达佳互联信息技术有限公司 Cartoon display method, device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3159849A1 (en) * 2015-10-21 2017-04-26 Stephen Viggers Systems and methods for using an opengl api with a vulkan graphics driver
US20170116702A1 (en) * 2015-10-21 2017-04-27 Stephen Viggers Systems and methods for using an opengl api with a vulkan graphics driver
US10102605B1 (en) * 2016-08-26 2018-10-16 Amazon Technologies, Inc. Graphics library virtualization for virtualized graphics processing
US10074206B1 (en) * 2017-05-23 2018-09-11 Amazon Technologies, Inc. Network-optimized graphics library for virtualized graphics processing
US20190073741A1 (en) * 2017-08-09 2019-03-07 Daniel Herring Systems and Methods for Using EGL with an OPENGL API and a Vulkan Graphics Driver
CN110136230A (en) * 2019-03-29 2019-08-16 北京达佳互联信息技术有限公司 Cartoon display method, device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘真等: "支持Shader的Direct3D9应用程序透明并行化", 《计算机研究与发展》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022100685A1 (en) * 2020-11-13 2022-05-19 华为技术有限公司 Drawing command processing method and related device therefor

Similar Documents

Publication Publication Date Title
EP3754490B1 (en) User interface rendering method and apparatus, and terminal
CN110990105B (en) Interface display method and device, electronic equipment and storage medium
KR102193404B1 (en) Incrementally compiling software artifacts from an interactive development environment
CN110874217A (en) Interface display method and device for fast application and storage medium
CN110990075A (en) Starting method, device and equipment of fast application and storage medium
CN110865863B (en) Interface display method and device for fast application and storage medium
CN110851240B (en) Function calling method, device and storage medium
CN113377366A (en) Control editing method, device, equipment, readable storage medium and product
CN111078325B (en) Application program running method and device, electronic equipment and storage medium
CN110751592A (en) Graphic resource conversion method, apparatus, electronic device and storage medium
CN110659024B (en) Graphics resource conversion method and device, electronic equipment and storage medium
CN110865864A (en) Interface display method, device and equipment for fast application and storage medium
CN110648272B (en) Graphics resource conversion method and device, electronic equipment and storage medium
CN110647325A (en) Graphic resource conversion method, apparatus, electronic device and storage medium
CN109522131A (en) Resource allocation method, device and equipment
CN111104183B (en) Application program running method and device, electronic equipment and storage medium
CN116740254B (en) Image processing method and terminal
CN111459494A (en) Code processing method and device
CN113419650A (en) Data moving method and device, storage medium and electronic equipment
CN110569037A (en) Data writing method and device
CN112256274A (en) Application program processing method and device and storage medium
US11782705B2 (en) Scene switching method, device and medium
CN114116590B (en) Data acquisition method, device, vehicle, storage medium and electronic equipment
CN113568737A (en) Hardware resource allocation method and device
CN113687879B (en) Interaction method and device for cross-platform framework and platform interaction library

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