CN110648272B - Graphics resource conversion method and device, electronic equipment and storage medium - Google Patents

Graphics resource conversion method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN110648272B
CN110648272B CN201910775303.3A CN201910775303A CN110648272B CN 110648272 B CN110648272 B CN 110648272B CN 201910775303 A CN201910775303 A CN 201910775303A CN 110648272 B CN110648272 B CN 110648272B
Authority
CN
China
Prior art keywords
opengl
resource
graphic
graphics
metal
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
CN201910775303.3A
Other languages
Chinese (zh)
Other versions
CN110648272A (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.)
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 CN201910775303.3A priority Critical patent/CN110648272B/en
Publication of CN110648272A publication Critical patent/CN110648272A/en
Application granted granted Critical
Publication of CN110648272B publication Critical patent/CN110648272B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Landscapes

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

Abstract

The disclosure provides a graphics resource conversion method, a graphics resource conversion device, an electronic device and a storage medium, wherein the graphics resource conversion method comprises the following steps: acquiring an OpenGL ES graphic resource request input by a user; determining a corresponding Metal or DX graphic resource interface according to the OpenGL ES graphic resource request; applying for corresponding GPU resources from a graphic resource library through the Metal or DX graphic resource interface; and distributing the applied GPU resource to the user to realize real-time conversion of the OpenGL ES graphic resource and the Metal or DX graphic resource. That is, the embodiment of the disclosure aims to determine the corresponding Metal or DX graphics resource interface according to the OpenGL ES graphics resource request on the basis of not changing the original OpenGL ES upper layer code architecture, so as to implement the conversion of graphics resources, and reduce the workload and development cost of graphics special effect rendering developers.

Description

Graphics resource conversion method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computers, and in particular, to a graphics resource conversion method, device, electronic apparatus, and storage medium.
Background
Along with the rapid development of terminal technology, some application programs (APP) of the intelligent terminal are provided with functions such as beauty, make-up, magic expression and the like, and due to code accumulation for many years, the functions are written into corresponding renderers and graphic engines based on OpenGL ESs. The OpenGL ES supports multiple embedded platforms, supports 2D and 3D graphic Application Program Interfaces (APIs) with perfect functions, is specially designed for multiple embedded systems, consists of a carefully defined desktop OpenGL subset, and creates a flexible and powerful bottom interactive interface between software and graphic acceleration.
However, with the rapid development of graphics hardware, the single-thread global state set programming interface designed by the OpenGL ES for the graphics hardware with limited early performance cannot exert the performance advantages of modern graphics hardware, so that every mainstream manufacturer in the years can push out a graphics programmable interface specially aiming at the characteristics of the hardware, and meanwhile gradually stop following the new version of the OpenGL ES, even the fragile disclosure states that the OpenGL ES are no longer supported, and an App developer is required to use the new API of the manufacturer to re-develop the existing functions. For most APPs, if the graphics rendering function based on OpenGL ES is redeveloped, the corresponding renderer needs to be rewritten for different operating systems to implement the graphics rendering/computing function. Because the design concept of the new and old graphics APIs is too different, if the image codes are rewritten, the architecture of a 2/3D rendering engine on a renderer is affected, and the workload and the research and development cost of research and development personnel are increased.
Disclosure of Invention
In order to overcome the problems in the related art, the disclosure provides a graphics resource conversion method, a graphics resource conversion device, an electronic device and a storage medium, so as to solve the technical problems of excessive differences in design concepts of new and old graphics APIs, and increased workload and development cost of research personnel if image codes are rewritten in the prior art.
According to a first aspect of an embodiment of the present disclosure, there is provided a graphics resource conversion method, including:
acquiring an OpenGL ES graphic resource request input by a user;
determining a corresponding Metal or DX graphic resource interface according to the OpenGL ES graphic resource request;
applying for a corresponding graphic processor GPU from a graphic resource library through the Metal or DX graphic resource interface;
and distributing the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource.
Optionally, the determining the corresponding Metal or DX graphics resource interface according to the OpenGL ES graphics resource request includes:
searching a preset mapping relation according to the OpenGL ES graphic resource request to obtain a corresponding Metal or DX graphic resource interface;
and recording the corresponding association state of the OpenGL ES graphic resource request and a Metal or DX graphic resource interface in the mapping relation.
Optionally, before obtaining the OpenGL ES graphics resource request input by the user, the method further includes:
and establishing a mapping relation between the OpenGL ES graphic resource interface and the Metal or DX graphic resource interface.
Optionally, the establishing a mapping relationship between the OpenGL ES graphics resource interface and the Metal or DX graphics resource interface specifically includes:
according to the OpenGL ES specification, converting the OpenGL ES graphic resource interface code into a corresponding Metal or DX graphic resource interface code;
and establishing a mapping relation between the OpenGL ES graphic resource interface code and the Metal or DX graphic interface code.
Optionally, before obtaining the OpenGL ES graphics resource request, the method further includes:
checking the validity of parameters and states of each device in the graphic resource library according to the specification document requirements of OpenGL ES;
and if the parameters and the states of the devices are valid, executing the step of acquiring the OpenGL ES graphic 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 conversion apparatus including:
the acquisition module is configured to acquire an OpenGL ES graphic resource request;
the determining module is configured to determine a corresponding Metal or DX graphic resource interface according to the OpenGL ES graphic resource request;
the resource application module is configured to apply for the corresponding graphic processor GPU from the image resource library through the Metal or DX graphic resource interface;
and the resource allocation module is configured to allocate the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource.
Optionally, the determining module includes:
the searching module is configured to search a preset mapping relation according to the OpenGL ES graphic resource request to obtain a corresponding Metal or DX graphic resource interface;
the first recording module is configured to record corresponding association states of the OpenGL ES graphic resource request and a Metal or DX graphic resource interface in the mapping relation.
Optionally, the apparatus further includes:
the establishing module is configured to establish a mapping relation between OpenGL ES graphic resource interface codes and Metal or DX graphic resource interface codes before the acquiring module acquires the OpenGL ES graphic resource request input by the user.
Optionally, the establishing module includes:
the conversion module is configured to convert the OpenGL ES graphic resource interface code into a corresponding Metal or DX graphic resource interface code before the acquisition module acquires the OpenGL ES graphic resource request input by the user;
and the establishment sub-module is configured to establish a mapping relation between the OpenGL ES graphic resource interface code and the Metal or DX graphic interface code.
Optionally, the apparatus further includes:
the checking module is configured to check the validity of the parameters and the states of each device according to the specification document requirements of the OpenGL ES before the acquiring module acquires the OpenGL ES graphic resource request input by the user;
the acquisition module is further configured to acquire an OpenGL ES graphics resource request input by a user when the inspection module inspects that the parameters and the states of the devices are both valid.
Optionally, the apparatus further includes:
and the second recording module is configured to record the applied GPU in the mapping relation after the applied GPU is distributed to the user by the distribution module.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising: 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, which when executed by a processor of an electronic device, causes the electronic device to perform any one of the graphics resource conversion methods described above.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, which, when executed by a processor of an electronic device, causes the electronic device to perform any of the graphics resource conversion methods described above.
The technical scheme provided by the embodiment of the disclosure can comprise the following beneficial effects: according to the graphic resource conversion method shown in the present exemplary embodiment, after an OpenGL ES graphic resource request input by a user is acquired, a Metal or DX graphic resource interface corresponding to the OpenGL ES graphic resource request is determined; applying for a corresponding graphic processor GPU from a graphic resource library through the Metal or DX graphic resource interface; and distributing the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource. That is, the disclosed embodiments aim to convert the OpenGL ES graphics resource request into a corresponding Metal or DX graphics resource interface without changing the original OpenGL ES upper layer code architecture, so as to implement conversion of graphics resources, and reduce workload and development cost of developers. .
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 application and together with the description, serve to explain the principles of the application.
FIG. 1 is a flowchart illustrating a method of graphics resource conversion, according to an example embodiment;
FIG. 2 is another flow chart illustrating a method of graphics resource conversion, according to an example embodiment;
FIG. 3 is a schematic diagram illustrating a configuration of a graphic resource conversion apparatus according to an exemplary embodiment;
FIG. 4 is another schematic diagram of a graphics resource conversion device, according to an example embodiment;
FIG. 5 is a schematic diagram illustrating yet another configuration of a graphic resource conversion apparatus according to an exemplary embodiment;
FIG. 6 is a schematic diagram of an electronic device, according to an example embodiment;
fig. 7 is another structural schematic diagram of an electronic device according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
Prior to introducing the present disclosure, technical terms related to the present disclosure will be described:
OpenGL (Open Graphics Library), which is an open graphic library or an open graphic library, is a cross-language, cross-platform Application Programming Interface (API) for rendering 2D, 3D vector graphics, which consists of nearly 350 different function calls for drawing complex three-dimensional views from simple graphic bits. That is, openGL defines a specification of a cross-programming language, cross-platform programming interface, which is used for three-dimensional images (two-dimensional images are also possible). OpenGL is a specialized graphics program interface, which is a powerful, convenient to invoke, underlying graphics library.
OpenGL ES (OpenGL for Embedded Systems), a subset of OpenGL three-dimensional graphics APIs, is designed for embedded devices such as cell phones, PDAs, and game hosts.
Metal, a graphics application programming interface that is closer to hardware than OpenGL and OpenGL ES, provides the lowest layer of application programming interface (API, application Program Interface) needed for software, closest to graphics hardware, ensuring that software can run on different graphics chips. Compared with OpenGL ES, the Metal framework and a shader (loader) language thereof can better 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, 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 ES graphic resource request input by a user.
In the step, after a user opens an APP on a terminal, if the user wants to make up or beautify, the user needs to apply for an image resource request from a graphics resource library, that is, a background server obtains the OpenGL ES 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.
Step 102, determining a corresponding Metal or DX graphic resource interface according to the OpenGL ES graphic resource request.
In this step, the background server may find a preset mapping relationship according to the OpenGL ES graphics resource request, and may obtain a Metal or DX graphics resource interface corresponding to the OpenGL ES graphics resource request according to the mapping relationship; and then, recording the corresponding association state of the OpenGL ES graphic resource request and a Metal or DX graphic resource interface in the mapping relation.
The mapping relationship is pre-established, that is, a mapping relationship between the OpenGL ES graphic resource interface and the Metal or DX graphic resource interface is established, that is, a one-to-one mapping relationship between the OpenGL ES graphic resource interface and the Metal graphic resource interface, or a one-to-one mapping relationship between the OpenGL ES graphic resource interface and the DX graphic resource interface. The specific establishment process is as follows:
according to the OpenGL ES specification, converting the OpenGL ES graphic resource interface code into a corresponding Metal or DX graphic resource interface code; and then, establishing a mapping relation between the OpenGL ES graphic resource interface code and the Metal or DX graphic resource interface code. That is, the mapping relation is only a conversion relation (function) or mapping relation between two kinds of codes, and for example, an input code can be used to obtain an output code by using the conversion relation.
One of the conversion processes is as follows;
according to the memory layout, coordinate axes and clipping space occupied by different graphic resource interface codes in the OpenGL specification, converting the OpenGL ES graphic resource interface codes into Metal or DX graphic resource interface codes.
The following is an example of converting glBufferData operations into Metal or DX graphics resource operations, but is not limited thereto.
Firstly, parameter checking is carried out according to the OpenGL ES specification, and corresponding error recording is carried out on the error parameters. Secondly, according to the parameter requirement, a graphic resource buffer object instance is created, and finally, the realization data which represents the data buffer to be oriented in the glBufferData parameter is transferred to the instance.
Step 103: and applying for the corresponding graphic processor GPU from the image resource library through the Metal or DX graphic resource interface.
In this step, a Metal or DX graphics resource interface is invoked to apply for a corresponding graphics processor (GPU, graphics Processing Unit) to the image repository, where the graphics processor may process graphics rendering, or graphics rendering, etc.
Step 104: and distributing the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource.
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, GPUs mostly have 2D or 3D graphics acceleration functions. For example, if the CPU wants to draw a two-dimensional graphic, it only needs to send an instruction to the GPU, for example, "draw a rectangle with a length and a 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 the designated position on the display, notify the CPU that "i have drawn" after drawing, and wait for the CPU to send the next graphic instruction. That is, with the GPU, the CPU is freed from the task of graphics processing and can perform additional system tasks, which can greatly improve the overall performance of the computer.
According to the graphic resource conversion method shown in the present exemplary embodiment, after an OpenGL ES graphic resource request input by a user is acquired, a Metal or DX graphic resource interface corresponding to the OpenGL ES graphic resource request is determined; applying for a corresponding graphic processor GPU from a graphic resource library through the Metal or DX graphic resource interface; and distributing the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource. That is, the disclosed embodiments aim to convert the OpenGL ES graphics resource interface into a corresponding Metal or DX graphics resource interface without changing the original OpenGL ES upper layer code architecture, so as to implement conversion of graphics resources, and reduce workload and development cost of developers.
That is, in the present disclosure, a user-oriented conversion layer is added between OpenGL ES APIs (such as functions of beauty, make-up, and 3D engines) and Metal APIs or DX APIs, where the conversion layer re-implements the functions of the OpenGL ES APIs according to OpenGL ES specification requirements, that is, converting graphics operations required by the upper-layer OpenGL ES service codes into Metal or DX graphics operations in real time. The conversion layer is completely compatible with OpenGL ES API, all upper business codes written based on the APIs are not required to be modified, the bottom layer is automatically converted into a Metal API or a DX API call in real time, seamless switching of the existing codes is realized, and the access cost is almost zero. In addition, by utilizing the characteristics of the Metal API or the DX API, the utilization rate of the multi-core CPU is improved, and the drawing performance is improved. The conversion layer places dynamic conversion of different graphic APIs in one project, avoids that different business teams in the traditional workflow need to allocate development resources to adapt to new graphic APIs, and reduces the learning and development cost of the new graphic APIs.
Referring also to FIG. 2, another flowchart of a graphics resource transformation method is shown, which may further include:
step 201: checking the validity of parameters and states of each device according to the specification document requirements of OpenGL ES;
the checking mode can check the validity of the parameters and the states of all the devices in the graphic resource library according to a multi-level state checking mode; the multi-level state checking mode comprises the following steps: a first-level check for checking parameters and states of the devices and providing text descriptions for the checked error parameters and states; a second level check for checking the state of the state machine effectively; and third level checking, which is used for checking the parameters and the calling sequence of all functions no longer under the condition that the system determines that the parameters and the calling sequence of all functions of each device are correct; or checking the parameters and the calling sequence of all functions under the condition that the system determines that the parameters and the calling sequence of all functions of each device are incorrect.
While the middle layer of the graphics rendering interface provided by the present disclosure may provide multi-level status checking. This is because the existing state check is performed according to the OpenGL ES specification, but when the state check is performed, the OpenGL ES specification does not know whether the current code is in the development debug state or the online run phase, so that the code in the online run phase performs redundant state check calculation, which wastes performance and cannot reach the most efficient run state.
Based on this, the present disclosure proposes a multi-level status inspection method, that is, different inspection methods are adopted at different stages, for example, three-level inspection methods are adopted in research and development practice: 1) First level inspection, i.e., finest inspection; 2) A second level inspection, i.e., a necessary inspection; 3) Third level inspection, i.e., simplest inspection, etc. Wherein,,
1) The finest inspection is a research and development stage, and is used for inspecting parameters and states of all the devices and providing detailed text description for the parameters and states of the inspected errors; the problem positioning efficiency can be improved through the thinnest inspection, that is, on the basis of the graphic API specification, the inspection is improved according to special effects and requirements of different audio and video research and development teams, the most detailed misinterpretation is provided, and engineers at different levels can quickly get on hand conveniently. The present disclosure expressly adds the function name of the current error, a literal detailed description of the error value, error information recording to the document, etc., relative to the requirements of the specification document.
In addition, where the specification document definition is ambiguous, the present disclosure is improved upon by supplementing the current hardware manufacturer's manual (containing operations or functions not supported by the manufacturer).
2) The necessary check, the code up phase, is used to effectively check the core state of the state machine, i.e. apply the code on some user's devices, 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 there is a valid loader program, frame buffer, and whether its own status is correct, etc.
3) And the simplest inspection, namely an online operation stage, is used for not checking the parameters and the calling sequence of all functions of each device under the condition that the system determines that the parameters and the calling sequence of all functions of each device are correct. That is, if the system determines that the parameters and the calling order of all the functions are correct, it is not checked at all, and the maximum execution efficiency is achieved.
Step 202: if the parameters and the states are valid, acquiring an OpenGL ES graphic resource request;
step 203: determining a corresponding Metal or DX graphic resource interface according to the OpenGL ES graphic resource request;
step 204: applying for a corresponding graphic processor GPU from a graphic resource library through the Metal or DX graphic resource interface;
step 205: and distributing the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource.
In this embodiment, steps 202 to 205 are the same as steps 101 to 104, and detailed descriptions thereof are omitted herein.
In the embodiment of the disclosure, a conversion layer is added on the basis of the original OpenGL ES upper layer code architecture without changing the original OpenGL ES upper layer code architecture, and a function code relation mapping table is stored in the conversion layer. The method and the device realize automatic optimization of codes, improve GPU computing performance and drawing performance, and improve user experience. Further, before drawing, the validity of parameters and states of each device is checked, so that unreasonable drawing behaviors are avoided, and the graphics correlation collapse rate is reduced.
Fig. 3 is a schematic diagram illustrating a configuration of a graphic resource conversion 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 ES graphics resource request;
a determining module 302, configured to determine a corresponding Metal or DX graphics resource interface according to the OpenGL ES graphics resource request;
a resource application module 303, configured to apply for a corresponding graphics processor GPU to an image resource library through the Metal or DX graphics resource interface;
the resource allocation module 304 is configured to allocate the applied GPU to the user, so as to implement conversion between the OpenGL ES graphics resource and the Metal or DX graphics resource.
Optionally, in another embodiment, based on the foregoing embodiment, the determining module 302 includes: a schematic diagram of the search module 401 and the first recording module 403 is shown in fig. 4, in which,
the searching module 401 is configured to search a preset mapping relationship according to the OpenGL ES graphics resource request, so as to obtain a corresponding Metal or DX graphics resource interface;
a first recording module 402, configured to record, in the mapping relationship, a corresponding association state of the OpenGL ES graphics resource request and a Metal or DX graphics resource interface.
Optionally, in another embodiment, based on the foregoing embodiment, the apparatus may further include: the establishing module is configured to establish a mapping relation between the OpenGL ES graphic resource interface code and the Metal or DX graphic resource interface code.
Optionally, in another embodiment, based on the foregoing embodiment, the building module includes: a conversion module and a creation sub-module, wherein,
a conversion module configured to convert OpenGL ES graphics resource interface code into corresponding Metal or DX graphics resource interface code;
the establishing submodule is configured to establish a mapping relation between OpenGL ES graphic resource interface codes and corresponding Metal or DX graphic interface codes.
Optionally, in another embodiment, based on the foregoing embodiment, the apparatus may further include: an inspection module 501 is schematically illustrated in fig. 5, wherein,
the checking module 501 is configured to check the validity of the parameters and states of each device according to the specification document requirements of the OpenGL ES before the acquiring module 301 acquires the OpenGL ES graphics resource request input by the user;
the obtaining module 301 is further configured to obtain an OpenGL ES 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, based on the foregoing embodiment, the apparatus may further include: a second recording module, wherein,
and the second recording module is configured to record the applied GPU in the mapping relation after the applied GPU is distributed to the user by the distribution module.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
In the embodiment of the disclosure, the conversion of the resource function is realized through the custom mapping relation (or custom data structure) without changing the code architecture of the original system, so that the workload of the research personnel and the research cost are reduced. The method is compatible with the existing graphic image function realized based on the OpenGL ES API, and realizes the seamless switching of the existing codes. Further utilize Metal API or DX API characteristic, improve multicore CPU utilization ratio, improve drawing performance to improve user experience. The richer graphical interfaces provided by the Metal API or the DX API are utilized to draw better graphical images. And by adding the device state check before drawing, unreasonable drawing behaviors are avoided, so that the graphics correlation collapse rate is reduced. And through a self-grinding loader conversion/compiler, the code is automatically optimized, the GPU computing performance is improved, the drawing performance is improved, and therefore the user experience is improved.
Fig. 6 is a block diagram of 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 of the mobile terminal to describe. 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, an 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 input/output (I/O) interface 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 part 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 may 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 operations 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 nonvolatile 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 disk.
The power supply component 606 provides power to the various components of the electronic device 600. The power supply components 606 can 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 between the electronic device 600 and the user that provides an output interface. 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 input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 608 includes a front camera and/or a rear camera. When the electronic device 600 is in an operational mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
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 signals may be further 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 a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 614 includes one or more sensors for providing status assessment of various aspects of the electronic device 600. For example, the sensor assembly 614 may detect an on/off state of the device 600, a relative positioning of the components, such as a display and keypad of the electronic device 600, the sensor assembly 614 may also detect a change in position of the electronic device 600 or a component of the electronic device 600, the presence or absence of a user's contact with the electronic device 600, an orientation or acceleration/deceleration of the electronic device 600, and a change in temperature of the electronic device 600. The sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects in the absence of 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 gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 616 is configured to facilitate communication between the electronic device 600 and other devices, either wired or wireless. The electronic device 600 may access a wireless network based on a communication standard, such as WiFi, an operator network (e.g., 2G, 3G, 4G, or 5G), or a combination thereof. In one exemplary embodiment, the communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one 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, microcontrollers, microprocessors, or other electronic elements for performing the graphics resource conversion methods illustrated in fig. 1, 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, a non-transitory computer readable storage medium is also provided, which when executed by a processor of an electronic device, causes the electronic device to perform the graphics resource conversion method described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 604, including instructions executable by processor 620 of electronic device 600 to perform the graphics resource conversion method shown in fig. 1 and 2 described above. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
In an exemplary embodiment, a computer program product is also provided, which when executed by the processor 620 of the electronic device 600 causes the electronic device 600 to perform the graphical resource conversion method illustrated in fig. 1, 2 described above.
Fig. 7 is a block diagram of an electronic device 700, according to 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 application programs, 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 supply component 726 configured to perform power management of the electronic device 700, a wired or wireless network interface 750 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 application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (14)

1. A graphics resource conversion method, comprising:
acquiring an OpenGL ES graphic resource request input by a user, wherein the OpenGL ES graphic resource request comprises a graphic resource request name, a user ID and a graphic resource interface;
determining a corresponding Metal or DX graphics resource interface according to the OpenGL ES graphics resource request, including: searching a preset mapping relation according to the OpenGL ES graphic resource request to obtain a corresponding Metal or DX graphic resource interface, wherein the preset mapping relation is a one-to-one mapping relation between Metal or DX graphic resource interface codes corresponding to OpenGL ES graphic resource interface codes;
applying for a corresponding graphic processor GPU from a graphic resource library through the Metal or DX graphic resource interface;
and distributing the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource.
2. The graphics resource conversion method according to claim 1, wherein determining a corresponding Metal or DX graphics resource interface according to the OpenGL ES graphics resource request includes:
and recording the corresponding association state of the OpenGL ES graphic resource request and a Metal or DX graphic resource interface in the preset mapping relation.
3. The graphics resource conversion method according to claim 2, characterized in that before said obtaining the OpenGL ES graphics resource request input by the user, the method further comprises:
and establishing a mapping relation between the OpenGL ES graphic resource interface and the Metal or DX graphic resource interface.
4. The graphics resource conversion method according to claim 3, wherein the establishing a mapping relationship between the OpenGL ES graphics resource interface and the Metal or DX graphics resource interface specifically includes:
converting the OpenGL ES graphic resource interface code into a corresponding Metal or DX graphic resource interface code;
and establishing a mapping relation between the OpenGL ES graphic resource interface code and the Metal or DX graphic interface code.
5. The graphics resource conversion method according to any one of claims 1 to 4, characterized in that before said obtaining the OpenGL ES graphics resource request input by the user, the method further comprises:
checking the validity of parameters and states of each device in the graphic resource library according to the specification document requirements of OpenGL ES;
and if the parameters and the states of the devices are valid, executing the step of acquiring the OpenGL ES graphic resource request input by the user.
6. The graphics resource conversion method according to any one of claims 1 to 4, characterized in that after said assigning the applied GPU to the user, the method further comprises:
recording the applied GPU in the preset mapping relation.
7. A graphics resource conversion apparatus, comprising:
the system comprises an acquisition module, a storage module and a storage module, wherein the acquisition module is configured to acquire an OpenGL ES (open graphics library) graphic resource request, and the OpenGL ES graphic resource request comprises a graphic resource request name, a user ID (identity) and a graphic resource interface;
the determining module is configured to determine a corresponding Metal or DX graphic resource interface according to the OpenGL ES graphic resource request;
the resource application module is configured to apply for the corresponding graphic processor GPU from the image resource library through the Metal or DX graphic resource interface;
the resource allocation module is configured to allocate the applied GPU to the user to realize the conversion between the OpenGL ES graphic resource and the Metal or DX graphic resource;
the determining module includes:
the searching module is configured to search a preset mapping relation according to the OpenGL ES graphic resource request to obtain a corresponding Metal or DX graphic resource interface, wherein the preset mapping relation is a one-to-one mapping relation between OpenGL ES graphic resource interface codes and the Metal or DX graphic resource interface codes.
8. The resource conversion apparatus according to claim 7, wherein the determining module includes:
the first recording module is configured to record corresponding association states of the OpenGL ES graphics resource request and a Metal or DX graphics resource interface in the preset mapping relation.
9. The graphics resource conversion apparatus according to claim 8, characterized in that said apparatus further comprises:
the establishing module is configured to establish a mapping relation between OpenGL ES graphic resource interface codes and Metal or DX graphic resource interface codes before the acquiring module acquires the OpenGL ES graphic resource request input by the user.
10. The graphics resource conversion apparatus according to claim 9, wherein said setup module comprises:
the conversion module is configured to convert the OpenGL ES graphic resource interface code into a corresponding Metal or DX graphic resource interface code before the acquisition module acquires the OpenGL ES graphic resource request input by the user;
and the establishment sub-module is configured to establish a mapping relation between the OpenGL ES graphic resource interface code and the Metal or DX graphic resource interface code.
11. The graphics resource conversion apparatus according to any one of claims 7 to 10, characterized in that the apparatus further comprises:
the checking module is configured to check the validity of the parameters and the states of each device according to the specification document requirements of the OpenGL ES before the acquiring module acquires the OpenGL ES graphic resource request input by the user;
the acquisition module is further configured to acquire an OpenGL ES graphics resource request input by a user when the inspection module inspects that the parameters and the states of the devices are both valid.
12. The graphics resource conversion apparatus according to any one of claims 7 to 10, characterized in that the apparatus further comprises:
the second recording module is configured to record the applied GPU in the preset mapping relation after the applied GPU is distributed to the user by the distribution module.
13. 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.
14. 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 one of claims 1-6.
CN201910775303.3A 2019-08-21 2019-08-21 Graphics resource conversion method and device, electronic equipment and storage medium Active CN110648272B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910775303.3A CN110648272B (en) 2019-08-21 2019-08-21 Graphics resource conversion method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910775303.3A CN110648272B (en) 2019-08-21 2019-08-21 Graphics resource conversion method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110648272A CN110648272A (en) 2020-01-03
CN110648272B true CN110648272B (en) 2023-10-03

Family

ID=68990305

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910775303.3A Active CN110648272B (en) 2019-08-21 2019-08-21 Graphics resource conversion method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110648272B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711477B (en) * 2021-03-29 2021-06-25 北京拓课网络科技有限公司 Method and device for switching application programs and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103336816A (en) * 2013-06-28 2013-10-02 广州市动景计算机科技有限公司 Canvas element rendering method and device realized on Android system based on GPU (Graphic Processing Unit)
WO2017129117A1 (en) * 2016-01-29 2017-08-03 腾讯科技(深圳)有限公司 Gpu resource reconstruction method, user device, system, and storage medium
CN109964204A (en) * 2017-10-19 2019-07-02 腾讯科技(深圳)有限公司 For handling the method and system of figure

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103336816A (en) * 2013-06-28 2013-10-02 广州市动景计算机科技有限公司 Canvas element rendering method and device realized on Android system based on GPU (Graphic Processing Unit)
WO2017129117A1 (en) * 2016-01-29 2017-08-03 腾讯科技(深圳)有限公司 Gpu resource reconstruction method, user device, system, and storage medium
CN109964204A (en) * 2017-10-19 2019-07-02 腾讯科技(深圳)有限公司 For handling the method and system of figure

Also Published As

Publication number Publication date
CN110648272A (en) 2020-01-03

Similar Documents

Publication Publication Date Title
CN111026396B (en) Page rendering method and device, electronic equipment and storage medium
CN112052008B (en) Code checking method, device, computer equipment and computer readable 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
CN110990105A (en) Interface display method and device, electronic equipment and storage medium
US20210173681A1 (en) Method and device for displaying interface, electronic equipment, server, and storage medium
CN110851240B (en) Function calling method, device and storage medium
CN110865863B (en) Interface display method and device for fast application and storage medium
EP3356932A1 (en) System and method for using ubershader variants without preprocessing macros
CN110968362B (en) Application running 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
CN111324376B (en) Function configuration method, device, electronic equipment and computer readable medium
CN110659024B (en) Graphics resource conversion method and device, electronic equipment and storage medium
CN110751592A (en) Graphic resource conversion method, apparatus, electronic device and storage medium
WO2022199111A1 (en) Method and apparatus for implementing functions in application program, electronic device and storage medium
CN110648272B (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
CN110908629A (en) Electronic equipment operation method and device, electronic equipment and storage medium
US11507633B2 (en) Card data display method and apparatus, and storage medium
CN111104183B (en) Application program running method and device, electronic equipment and storage medium
CN110647325A (en) Graphic resource conversion method, apparatus, electronic device and storage medium
CN107765858B (en) Method, device, terminal and storage medium for determining face angle
CN111290812B (en) Display method, device, terminal and storage medium of application control
CN113885996A (en) User interface generation method and device

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