KR102254119B1 - Method and apparatus for processing graphics command - Google Patents
Method and apparatus for processing graphics command Download PDFInfo
- Publication number
- KR102254119B1 KR102254119B1 KR1020160025039A KR20160025039A KR102254119B1 KR 102254119 B1 KR102254119 B1 KR 102254119B1 KR 1020160025039 A KR1020160025039 A KR 1020160025039A KR 20160025039 A KR20160025039 A KR 20160025039A KR 102254119 B1 KR102254119 B1 KR 102254119B1
- Authority
- KR
- South Korea
- Prior art keywords
- shader
- shader program
- pixel
- shaders
- vertex
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
- G06T15/80—Shading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T1/00—General purpose image data processing
- G06T1/60—Memory management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2200/00—Indexing scheme for image data processing or generation, in general
- G06T2200/28—Indexing scheme for image data processing or generation, in general involving image processing hardware
Abstract
그래픽스 명령을 처리하는 방법은 어플리케이션을 실행하는 장치로부터 상기 그래픽스 명령을 수신할 수 있다. 그래픽스 명령에 포함된, 그래픽스 프로세서에서 처리될 적어도 하나의 셰이더를 선택할 수 있으며 상기 선택된 적어도 하나의 셰이더를 이용하여 셰이더 프로그램을 생성할 수 있다. 이전에 컴파일 된 적어도 하나의 셰이더 프로그램 중에서 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색하여 검색된 셰이더 프로그램을 출력할 수 있다.A method of processing a graphics command may receive the graphics command from a device executing an application. At least one shader included in the graphics instruction to be processed by the graphics processor may be selected, and a shader program may be generated using the selected at least one shader. Among at least one shader program compiled previously, a shader program identical to the generated shader program can be searched and the searched shader program can be output.
Description
그래픽스 명령을 처리하는 방법 및 장치에 관한 것이다.It relates to a method and apparatus for processing graphics commands.
그래픽스 프로세싱 유닛(Graphics Processing Unit, 이하 GPU)은 OpenGL ES 및 OpenCL (CUDA)등의 그래픽스 API를 처리하여 휴대기기 및 TV에서 화려한 그래픽스 효과를 구현 할 수 있다. The Graphics Processing Unit (GPU) processes graphics APIs such as OpenGL ES and OpenCL (CUDA) to realize gorgeous graphics effects on mobile devices and TVs.
GPU에서 프로그램이 처리되기 위해서는 프로그램이 표준 API의 정해진 규칙에 따라 작성되어야 한다. GPU에서 처리되는 프로그램은 이미지 생성에 필수적인 버텍스 셰이더(vertex shader)와 픽셀 셰이더(pixel shader)로 구성된다. 버텍스 셰이더와 픽셀 셰이더는 컴파일(compile) 및 링크(link)되어 프로그램에 사용된다.In order for a program to be processed by the GPU, the program must be written according to the rules set by the standard API. The program processed on the GPU consists of a vertex shader and a pixel shader, which are essential for image generation. Vertex shaders and pixel shaders are compiled and linked to be used in programs.
휴대 기기 및 TV에 사용되는 어플리케이션에서 화려한 그래픽스 효과가 구현되면서 GPU에서 처리되는 어플리케이션의 프로그램 크기가 커지고 있다. GPU에서 처리되는 프로그램의 크기가 커지면서 프로그램을 구성하는 버텍스 셰이더 및 픽셀 셰이더를 컴파일, 링크하는데 많은 시간이 소요되며, 특히 게임에서 사용되는 프로그램에서는 동일 효과를 구현하기 위해 다수의 셰이더들이 반복적으로 사용된다.As colorful graphics effects are implemented in applications used in portable devices and TVs, the program size of applications processed by GPUs is increasing. As the size of the program processed in the GPU increases, it takes a lot of time to compile and link the vertex shaders and pixel shaders that make up the program. In particular, in a program used in a game, multiple shaders are repeatedly used to achieve the same effect. .
그래픽스 명령을 처리하는 방법 및 장치를 제공하는 데 있다. 또한, 상기 방법을 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 기록 매체를 제공하는 데 있다. 본 실시예가 이루고자 하는 기술적 과제는 상기된 바와 같은 기술적 과제들로 한정되지 않으며, 이하의 실시예들로부터 또 다른 기술적 과제들이 유추될 수 있다.It is to provide a method and apparatus for processing graphics commands. Further, it is to provide a computer-readable recording medium in which a program for executing the method on a computer is recorded. The technical problem to be achieved by the present embodiment is not limited to the technical problems as described above, and other technical problems may be inferred from the following embodiments.
일 측면에 따른, 그래픽스 명령을 처리하는 방법에 있어서, 어플리케이션을 실행하는 장치로부터 상기 그래픽스 명령을 수신하는 단계; 상기 그래픽스 명령에 포함된, 그래픽스 프로세서에서 처리될 적어도 하나의 셰이더를 선택하는 단계; 상기 선택된 적어도 하나의 셰이더를 이용하여 셰이더 프로그램을 생성하는 단계; 이전에 컴파일된 적어도 하나의 셰이더 프로그램 중에서 상기 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색하는 단계; 및 상기 검색된 셰이더 프로그램을 출력하는 단계;를 포함할 수 있다.According to an aspect, a method of processing a graphics command, the method comprising: receiving the graphics command from a device executing an application; Selecting at least one shader included in the graphics instruction to be processed by a graphics processor; Generating a shader program using the selected at least one shader; Searching for a shader program identical to the generated shader program from among at least one shader program compiled previously; And outputting the searched shader program.
다른 일 측면에 따라, 그래픽스 명령 처리 장치에 있어서, 어플리케이션을 실행하는 장치로부터 그래픽스 명령을 수신하고, 상기 그래픽스 명령에 포함된 그래픽스 프로세서에서 처리될 적어도 하나의 셰이더를 선택하며, 상기 선택된 적어도 하나의 셰이더를 이용하여 셰이더 프로그램을 생성하여, 이전에 컴파일된 적어도 하나의 셰이더 프로그램 중에서 상기 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색하고, 상기 검색된 셰이더 프로그램을 출력하는 프로세서; 및 이전에 컴파일 된 셰이더 프로그램들을 저장하는 캐시;를 포함할 수 있다.According to another aspect, in a graphics command processing apparatus, a graphics command is received from a device executing an application, and at least one shader to be processed by a graphics processor included in the graphics command is selected, and the selected at least one shader A processor for generating a shader program by using, searching for a shader program identical to the generated shader program among at least one shader program compiled previously, and outputting the found shader program; And a cache for storing previously compiled shader programs.
또 다른 일 측면에 따라, GPU에 있어서, 어플리케이션을 실행하는 장치로부터 그래픽스 명령을 수신하고, 상기 그래픽스 명령에 포함된 그래픽스 프로세서에서 처리될 적어도 하나의 셰이더를 선택하며, 상기 선택된 셰이더를 이용하여 셰이더 프로그램을 생성하여, 이전에 컴파일된 적어도 하나의 셰이더 프로그램 중에서 상기 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색하고, 상기 검색된 셰이더 프로그램을 출력하는 그래픽스 드라이버; 및 이전에 컴파일된 셰이더 프로그램들을 저장하는 캐시;를 포함할 수 있다.According to another aspect, in a GPU, a graphics command is received from a device executing an application, a graphics processor included in the graphics command selects at least one shader to be processed, and a shader program using the selected shader A graphics driver for generating and searching for a shader program identical to the generated shader program among at least one shader program compiled previously, and outputting the found shader program; And a cache for storing previously compiled shader programs.
또 다른 일 측면에 따라, 컴퓨터에서 실행시키기 위한 프로그램을 기록한 컴퓨터로 읽을 수 있는 비일시적 기록매체는 제 1항의 방법을 컴퓨터에서 실행시키기 위한 프로그램으로 기록한다.According to another aspect, a computer-readable non-transitory recording medium storing a program for execution on a computer records the method of claim 1 as a program for execution on a computer.
상기된 바에 따르면, 그래픽스 명령을 지연처리 함으로써 연산을 생략할 수 있다. 또한, 셰이더 프로그램을 재생성할 때, 기존에 저장된 셰이더 프로그램 바이너리를 재사용하여 셰이더 프로그램을 컴파일하는 과정을 생략함으로써 연산량을 줄일 수 있다.As described above, the operation can be omitted by delaying the graphics command. In addition, when regenerating the shader program, the amount of computation can be reduced by reusing the shader program binaries previously stored and omitting the process of compiling the shader program.
도 1은 일 실시예에 따른 그래픽스 명령을 처리하는 방법의 흐름도이다.
도 2는 일 실시예에 따른 GPU 외부에 위치한 그래픽스 명령 처리 장치에서 그래픽스 명령이 처리되는 예시를 나타내는 도면이다.
도 3은 일 실시예에 따른 GPU 내부에 위치한 그래픽스 명령 처리 장치에서 그래픽스 명령이 처리되는 예시를 나타내는 도면이다.
도 4는 일 실시예에 따른 셰이더 프로그램 매니저의 블록도이다.
도 5는 일 실시예에 따른 워크 프로세서에서 셰이더 프로그램을 검색하는 예시를 나타내는 도면이다.
도 6은 일 실시예에 따른 그래픽스 명령 처리 장치가 셰이더 프로그램을 검색 및 출력하는 예시를 나타내는 도면이다.
도 7은 일 실시 예에 따른 그래픽스 명령 처리 장치에서 데이터가 처리되는 과정의 예시를 구체적으로 나타내는 도면이다.
도 8은 일 실시 예에 따른 그래픽스 명령을 처리하는 방법의 자세한 흐름도이다.
도 9는 일 실시 예에 따른 그래픽스 드라이버가 셰이더 프로그램 관련 API를 처리하는 방법의 흐름도이다.
도 10은 일 실시 예에 따른 셰이더 프로그램 매니저가 셰이더 프로그램 관련 API를 처리하는 방법의 흐름도이다.1 is a flowchart of a method of processing graphics commands according to an exemplary embodiment.
FIG. 2 is a diagram illustrating an example in which graphics commands are processed in a graphics command processing apparatus located outside a GPU according to an exemplary embodiment.
3 is a diagram illustrating an example in which graphics commands are processed in a graphics command processing apparatus located inside a GPU according to an exemplary embodiment.
4 is a block diagram of a shader program manager according to an embodiment.
5 is a diagram illustrating an example of searching for a shader program in a work processor according to an embodiment.
6 is a diagram illustrating an example in which a graphics command processing apparatus according to an exemplary embodiment searches for and outputs a shader program.
7 is a diagram illustrating a detailed example of a process of processing data in a graphics command processing apparatus according to an exemplary embodiment.
8 is a detailed flowchart of a method of processing a graphics command according to an exemplary embodiment.
9 is a flowchart illustrating a method of processing an API related to a shader program by a graphics driver according to an embodiment.
10 is a flowchart of a method for a shader program manager to process an API related to a shader program according to an exemplary embodiment.
아래에서는 첨부한 도면을 참조하여 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 본 발명의 실시예를 상세히 설명한다. 그러나 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예에 한정되지 않는다. 그리고 도면에서 본 발명을 명확하게 설명하기 위해서 설명과 관계없는 부분은 생략하였으며, 명세서 전체를 통하여 유사한 부분에 대해서는 유사한 도면 부호를 붙임으로써 중복 설명을 생략한다.Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings so that those of ordinary skill in the art can easily implement the present invention. However, the present invention may be implemented in various different forms and is not limited to the embodiments described herein. In the drawings, parts not related to the description are omitted in order to clearly describe the present invention, and redundant descriptions are omitted by denoting similar reference numerals for similar parts throughout the specification.
명세서 전체에서, 어떤 부분이 다른 부분과 "연결"되어 있다고 할 때, 이는 "직접적으로 연결"되어 있는 경우뿐 아니라, 그 중간에 다른 소자를 사이에 두고 "전기적으로 연결"되어 있는 경우도 포함한다. 또한, 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있는 것을 의미한다.Throughout the specification, when a part is said to be "connected" with another part, this includes not only "directly connected" but also "electrically connected" with another element interposed therebetween. . In addition, when a part "includes" a certain component, it means that other components may be further included rather than excluding other components unless specifically stated to the contrary.
이하에 첨부 도면을 참조하면서 본 발명의 실시형태에 대해서 상세히 설명하기로 한다.Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
도 1은 일 실시예에 따른 그래픽스 명령을 처리하는 방법의 흐름도이다. 단계 101에서, 어플리케이션에서 그래픽스 명령을 처리하라는 요청이 발생한 경우, 그래픽스 명령 처리 장치는 어플리케이션을 실행하는 장치로부터 그래픽스 명령을 수신한다. 그래픽스 명령에는 GPU에서 처리될 수 있는 명령이 포함될 수 있다. 예를 들어, 셰이더 프로그램 관련 API가 포함 될 수 있다. 1 is a flowchart of a method of processing graphics commands according to an exemplary embodiment. In
단계 102에서, 그래픽스 명령 처리 장치는 단계 101에서 수신된 그래픽스 명령에 포함된, 그래픽스 프로세서에서 처리될 적어도 하나의 셰이더를 선택할 수 있다. 그래픽스 프로세서에서 처리될 셰이더는 버텍스 셰이더 및 픽셀 셰이더를 포함할 수 있다. 그러나 이에 제한되지 않는다.In
단계 103에서, 그래픽스 명령 처리 장치는 단계 102에서 선택된 적어도 하나의 셰이더를 이용하여 셰이더 프로그램을 생성할 수 있다. 셰이더 프로그램은 GPU에서 처리될 수 있는 프로그램의 단위 또는 형태이다. 셰이더 프로그램은 단계 102에서 선택된 셰이더 및 그래픽스 명령 처리 장치가 수신한 유니폼 데이터를 포함할 수 있다. 그러나 이에 제한되지 않는다.In
단계 104에서, 그래픽스 명령 처리 장치는 이전에 컴파일된 적어도 하나의 셰이더 프로그램 중에서, 단계 103에서 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색할 수 있다. 그래픽스 명령 처리 장치는 셰이더 프로그램에 포함된 버텍스 셰이더 및 픽셀 셰이더의 소스(source) 코드(또는 컴파일 코드), 유니폼 데이터, 컴파일러 버전, 및 GPU 버전 정보를 이용하여 단계 103에서 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색할 수 있다. 그래픽스 명령 처리 장치는 셰이더 소스 코드의 텍스트 및 텍스트의 길이와 유니폼 데이터의 텍스트 및 텍스트의 길이를 이용하여 단계 103에서 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색할 수 있다. 그래픽스 명령 처리 장치는 셰이더 소스 코드의 텍스트 및 텍스트의 길이, 유니폼 데이터의 텍스트 및 텍스트의 길이, 컴파일러 버전, 및 GPU 버전 정보를 이용하여 키를 생성할 수 있다. 그래픽스 명령 처리 장치는 생성된 키와 동일한 키를 검색할 수 있다. 키는 셰이더 프로그램을 식별하기 위한 고유(unique)의 데이터이다. 다시 말해서, 셰이더 프로그램마다 서로 다른 키가 생성된다.In
단계 105에서, 그래픽스 명령 처리 장치는 단계 104에서 검색된 셰이더 프로그램을 출력할 수 있다. 그래픽스 명령 처리 장치는 검색된 셰이더 프로그램을 그래픽스 드라이버 또는 그래픽스 프로세서로 출력할 수 있다. 셰이더 프로그램 매니저는 단계 104에서 검색된 셰이더 프로그램을 바이너리로 출력할 수 있다. In
도 1의 단계들은 프로그램 또는 인스트럭션 등의 형태로 메모리에 저장되고, 메인 프로세서, GPU, 셰이더 프로그램 매니저, 그래픽스 드라이버 등에 의해 구현될 수 있다. 그러나 이에 제한되지 않는다.The steps of FIG. 1 are stored in a memory in the form of a program or instruction, and may be implemented by a main processor, a GPU, a shader program manager, a graphics driver, or the like. However, it is not limited thereto.
도 2는 일 실시예에 따른 GPU 외부에 위치한 그래픽스 명령 처리 장치에서 그래픽스 명령이 처리되는 예시를 나타내는 도면이다.FIG. 2 is a diagram illustrating an example in which graphics commands are processed in a graphics command processing apparatus located outside a GPU according to an exemplary embodiment.
도 2를 참조하면, 그래픽스 명령 처리 장치는 메인 프로세서(10) 또는 셰이더 프로그램 매니저(100)에 의해 구현될 수 있다. 셰이더 프로그램 매니저(100)는 GPU(20) 외부에 위치할 수 있다.Referring to FIG. 2, the graphics command processing apparatus may be implemented by the
GPU(20)는 그래픽스 드라이버(200), 그래픽스 프로세서(300) 및 컴파일러(500)를 포함할 수 있다. The GPU 20 may include a
메인 프로세서(10)는 셰이더 프로그램 매니저(100) 및 캐시(400)를 포함할 수 있다.The
캐시(400)에는 이전에 컴파일된 적어도 하나의 셰이더 프로그램이 저장될 수 있다. 캐시(400)에는 셰이더 프로그램이 바이너리로 저장될 수 있다. 캐시(400)에는 셰이더 프로그램(1000a)에 포함된 정보를 이용하여 생성된 키가 저장될 수 있다. 키는 셰이더 소스 코드의 텍스트 및 텍스트의 길이, 유니폼 데이터의 텍스트 및 텍스트의 길이, 컴파일러 버전, 및 GPU 버전 정보를 이용하여 생성될 수 있다. 그러나 이에 제한되지 않는다.At least one previously compiled shader program may be stored in the
셰이더 프로그램 매니저(100)는 그래픽스 명령을 수신할 수 있다. 셰이더 프로그램 매니저(100)는 수신된 그래픽스 명령에 포함된, 그래픽스 프로세서에서 처리될 적어도 하나의 셰이더를 선택할 수 있다. 셰이더 프로그램 매니저(100)는 선택된 적어도 하나의 셰이더를 이용하여 셰이더 프로그램을 생성할 수 있다. 셰이더 프로그램 매니저(100)는 이전에 컴파일된 적어도 하나의 셰이더 프로그램 중에서, 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색할 수 있고 검색된 셰이더 프로그램을 출력할 수 있다.The
셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색하는 단계에서 키를 이용할 수 있다. 일 실시예에서, 셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)에 포함된 정보를 이용하여 키를 생성할 수 있다. 또한, 셰이더 프로그램 매니저(100)가 생성한 키는 캐시(400)에 저장될 수 있다. 키가 캐시에 저장된 경우, 셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)의 키와 캐시(400)에 저장된 셰이더 프로그램의 키를 비교함으로써, 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 캐시(400)에서 검색할 수 있다.The
셰이더 프로그램 매니저(100)가 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색한 경우, 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 출력할 수 있다. 동일한 셰이더 프로그램이 검색된 경우, 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 그래픽스 드라이버(200)로 출력할 수 있다. 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 바이너리로 출력할 수 있다. 바이너리는 그래픽스 프로세서(300)에서 인식 가능한 형태의 데이터이다.When the
셰이더 프로그램 매니저(100)가 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색하지 못한 경우, 셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)을 그래픽스 드라이버(200)로 출력할 수 있다. 생성된 셰이더 프로그램(1000a)이 그래픽스 드라이버(200)로 출력된 경우, 그래픽스 드라이버(200)는 컴파일러(500)를 이용하여 입력받은 셰이더 프로그램(1000a)을 컴파일하여 바이너리를 생성할 수 있다. 그래픽스 드라이버(200)는 생성된 바이너리를 그래픽스 프로세서(300)로 출력할 수 있다. 그래픽스 드라이버(200)는 생성된 바이너리를 캐시(400)에 저장할 수 있다. 셰이더 프로그램 매니저(100)는 검색에 이용한 셰이더 프로그램(1000a)의 키를 캐시(400)에 저장할 수 있다. When the
도 3은 일 실시예에 따른 GPU 내부에 위치한 그래픽스 명령 처리 장치에서 그래픽스 명령이 처리되는 예시를 나타내는 도면이다.3 is a diagram illustrating an example in which graphics commands are processed in a graphics command processing apparatus located inside a GPU according to an exemplary embodiment.
도 3을 참조하면, 그래픽스 명령 처리 장치는 그래픽스 드라이버(200) 또는 셰이더 프로그램 매니저(100)에 의해 구현될 수 있다. 그러나 이에 제한되지 않는다. 셰이더 프로그램 매니저(100)는 GPU(20) 내부에 위치할 수 있다.Referring to FIG. 3, the graphics command processing apparatus may be implemented by the
GPU(20)는 그래픽스 드라이버(200), 그래픽스 프로세서(300), 캐시(400) 및 컴파일러(500)를 포함할 수 있다. The
캐시(400)에는 이전에 컴파일된 적어도 하나의 셰이더 프로그램이 저장될 수 있다. 캐시(400)에는 셰이더 프로그램이 바이너리로 저장될 수 있다. 캐시(400)에는 셰이더 프로그램(1000a)에 포함된 정보를 이용하여 생성된 키가 저장될 수 있다. 키는 셰이더 소스 코드의 텍스트 및 텍스트의 길이, 유니폼 데이터의 텍스트 및 텍스트의 길이, 컴파일러 버전, 및 GPU 버전 정보를 이용하여 생성될 수 있다. 그러나 이에 제한되지 않는다.At least one previously compiled shader program may be stored in the
셰이더 프로그램 매니저(100)는 그래픽스 명령을 수신할 수 있다. 셰이더 프로그램 매니저(100)는 수신된 그래픽스 명령에 포함된, 그래픽스 프로세서에서 처리될 적어도 하나의 셰이더를 선택할 수 있다. 셰이더 프로그램 매니저(100)는 선택된 적어도 하나의 셰이더를 이용하여 셰이더 프로그램을 생성할 수 있다. 셰이더 프로그램 매니저(100)는 이전에 컴파일된 적어도 하나의 셰이더 프로그램 중에서, 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색할 수 있고 검색된 셰이더 프로그램을 출력할 수 있다.The
셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색하는 단계에서 키를 이용할 수 있다. 일 실시예에서, 셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)에 포함된 정보를 이용하여 키를 생성할 수 있다. 또한, 셰이더 프로그램 매니저(100)가 생성한 키는 캐시(400)에 저장될 수 있다. 키가 캐시에 저장된 경우, 셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)의 키와 캐시(400)에 저장된 셰이더 프로그램의 키를 비교함으로써, 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 캐시(400)에서 검색할 수 있다.The
셰이더 프로그램 매니저(100)가 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색한 경우, 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 출력할 수 있다. 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 그래픽스 프로세서(300)로 출력할 수 있다. 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 바이너리로 출력할 수 있다.When the
셰이더 프로그램 매니저(100)가 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색하지 못한 경우, 셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)을 컴파일러(500)로 출력할 수 있다. 컴파일러(500)는 입력받은 셰이더 프로그램(1000a)을 컴파일하여 바이너리를 생성할 수 있다. 그래픽스 드라이버(200)는 생성된 바이너리를 그래픽스 프로세서(300)로 출력할 수 있다. 생성된 바이너리는 캐시(400)에 저장될 수 있다. 셰이더 프로그램 매니저(100)가 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색하지 못한 경우, 생성된 셰이더 프로그램(1000a)의 키는 캐시(400)에 저장될 수 있다. 그러나 이에 제한되지 않는다.When the
도 4는 일 실시예에 따른 셰이더 프로그램 매니저의 블록도이다.4 is a block diagram of a shader program manager according to an embodiment.
도 4를 참조하면, 일 실시예에 따른 셰이더 프로그램 매니저(100)는 셰이더 메모리(110) 및 워크 매니저(120)를 포함할 수 있다.Referring to FIG. 4, the
셰이더 메모리(110)에는 셰이더 프로그램 매니저(100)가 수신한 그래픽스 명령이 저장될 수 있다. 셰이더 메모리(110)에는 그래픽스 명령에 포함된 적어도 하나의 셰이더가 저장될 수 있다. 셰이더 메모리(110)에 저장된 셰이더는 버텍스 셰이더 및 픽셀 셰이더를 포함할 수 있다. Graphics commands received by the
일 실시예에서, 셰이더 메모리(110)에는 소스 API를 포함하는 버텍스 셰이더 및 픽셀 셰이더가 저장될 수 있다. 소스 API는 소스 코드를 포함할 수 있다. 셰이더 메모리(110)에는 소스 API를 포함하는 버텍스 셰이더 및 픽셀 셰이더의 소스 코드가 저장될 수 있다. 버텍스 셰이더 및 픽셀 셰이더의 소스 코드는 텍스트 형태로 저장될 수 있다. 버텍스 셰이더 및 픽셀 셰이더 각각의 소스 코드는 셰이더 메모리(110)의 TEXT_소스 공간에 독립적으로 저장될 수 있다. 그러나 이에 제한되지 않는다.In one embodiment, the
또한, 셰이더 메모리(110)에는 소스 API 및 컴파일 API를 포함하는 버텍스 셰이더 및 픽셀 셰이더가 저장될 수 있다. 컴파일 API는 컴파일 코드를 포함할 수 있다. 셰이더 메모리(110)에는 버텍스 셰이더 및 픽셀 셰이더의 컴파일 코드가 저장될 수 있다. 버텍스 셰이더 및 픽셀 셰이더의 컴파일 코드는 텍스트 형태로 저장될 수 있다. 버텍스 셰이더 및 픽셀 셰이더 각각의 컴파일 코드는 셰이더 메모리(110)의 TEXT_컴파일 공간에 독립적으로 저장될 수 있다.In addition, the
또는, 하나의 셰이더가 수신될 때 컴파일 API는 소스 API보다 나중에 처리될 수 있다. 셰이더 메모리(110)의 TEXT_소스 공간에 독립적으로 저장되어 있는 버텍스 셰이더 및 픽셀 셰이더의 소스 코드가 복사되어, 복사된 소스 코드는 셰이더 메모리(110)의 TEXT_컴파일 공간에 독립적으로 저장될 수 있다. 그러나 이에 제한되지 않는다.Or, when one shader is received, the compilation API can be processed later than the source API. The vertex shader and the pixel shader source code independently stored in the TEXT_source space of the
셰이더 프로그램 매니저(100)가 소스 API를 포함하는 적어도 하나의 버텍스 셰이더 및 픽셀 셰이더 각각을 순차적으로 수신하는 경우, 셰이더 프로그램 매니저(100)는 나중에 수신한 버텍스 셰이더 및 픽셀 셰이더를 셰이더 메모리(110)에 저장할 수 있다.When the
일 실시예에서, 셰이더 메모리(110)내의 TEXT_소스 공간에 소스 코드가 저장되어있는지 여부와 상관없이, 셰이더 프로그램 매니저(100)는 나중에 수신한 버텍스 셰이더 및 픽셀 셰이더 각각의 소스 코드를 셰이더 메모리(110)내의 TEXT_소스 공간에 독립적으로 저장할 수 있다. 최종적으로 셰이더 메모리(110)내의 TEXT_소스 공간에는 소스 API를 포함하는 버텍스 셰이더 및 픽셀 셰이더 중에서 셰이더 프로그램 매니저(100)가 가장 나중에 수신한 버텍스 셰이더 및 픽셀 셰이더의 소스 코드가 독립적으로 저장될 수 있다.In one embodiment, regardless of whether the source code is stored in the TEXT_source space in the
셰이더 프로그램 매니저(100)가 소스 API 및 컴파일 API를 포함하는 적어도 하나의 버텍스 셰이더 및 픽셀 셰이더 각각을 순차적으로 수신하는 경우, 셰이더 프로그램 매니저(100)는 나중에 수신한 버텍스 셰이더 및 픽셀 셰이더를 셰이더 메모리(110)에 저장할 수 있다.When the
일 실시예에서, 셰이더 메모리(110)내의 TEXT_컴파일 공간에 소스 코드(또는 컴파일 코드)가 저장되어있는지 여부와 상관없이, 셰이더 프로그램 매니저(100)는 나중에 수신한 버텍스 셰이더 및 픽셀 셰이더 각각의 소스 코드(또는 컴파일 코드)를 셰이더 메모리(110)내의 TEXT_컴파일 공간에 독립적으로 저장할 수 있다. 셰이더 프로그램 매니저(100)가 셰이더 메모리(110)내의 TEXT_컴파일 공간에 소스 코드를 독립적으로 저장하는 경우, 셰이더 메모리(110)의 TEXT_소스 공간에 독립적으로 저장되어 있는 버텍스 셰이더 및 픽셀 셰이더의 소스 코드가 복사되어, 복사된 소스 코드는 셰이더 메모리(110)의 TEXT_컴파일 공간에 독립적으로 저장될 수 있다.In one embodiment, regardless of whether the source code (or compiled code) is stored in the TEXT_compile space in the
일 실시예에서, 그래픽스 명령을 지연처리 함으로써 연산을 생략할 수 있다. 또 다른 실시예에서, 셰이더 프로그램 선택을 위해 수신받은 셰이더를 지연처리함으로써 셰이더 프로그램에서 사용되지 않을 셰이더 생성 연산을 생략할 수 있다. 다른 실시예에서, 지연처리되는 셰이더는 버텍스 셰이더 및 픽셀 셰이더일 수 있다.In one embodiment, the operation may be omitted by delaying the graphics command. In another embodiment, a shader generation operation that is not to be used in a shader program may be omitted by delaying a received shader for selection of a shader program. In another embodiment, shaders to be delayed may be vertex shaders and pixel shaders.
워크 매니저(120)는 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색할 수 있다.The
워크 매니저(120)는 워크 메모리(121) 및 워크 프로세서(122)를 포함할 수 있다.The
워크 메모리(121)에는 셰이더 프로그램 검색에 이용되는 정보가 저장될 수 있다. The
워크 메모리(121)에는 버텍스 셰이더, 픽셀 셰이더, 유니폼 데이터 정보가 포함될 수 있다. 일 실시예에서, 워크 메모리(121)에는 버텍스 셰이더 및 픽셀 셰이더 소스 코드(또는 컴파일 코드)의 텍스트 및 텍스트의 길이, 유니폼 데이터의 텍스트 및 텍스트의 길이, 컴파일러 버전 및 GPU 버전 정보가 포함될 수 있다.The
워크 프로세서(122)는 셰이더 프로그램을 검색할 수 있다. 이하의 도 5를 참조하여 워크 프로세서(122)에 대해 설명하기로 한다.The
도 5는 일 실시예에 따른 워크 프로세서에서 셰이더 프로그램을 검색하는 예시를 나타내는 도면이다.5 is a diagram illustrating an example of searching for a shader program in a work processor according to an embodiment.
워크 프로세서(122)는 워크 메모리(121)에 저장된 정보를 이용하여, 컴파일 된 적어도 하나의 셰이더 프로그램 중에서 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램을 검색할 수 있다.The
워크 프로세서(122)는 키를 이용하여 검색을 할 수 있다. 키를 이용하여 검색하는 경우, 워크 프로세서(122)는 키 생성부(123) 및 키 비교부(124)를 포함할 수 있다.The
키 생성부(123)는 워크 메모리(121)에 저장된 검색에 이용되는 정보를 이용하여 키를 생성할 수 있다. 예를 들어, 워크 메모리(121)에 저장된 버텍스 셰이더 및 픽셀 셰이더 소스 코드(또는 컴파일 코드)의 텍스트 및 텍스트의 길이, 유니폼 데이터의 텍스트 및 텍스트의 길이, 컴파일러 버전 및 GPU 버전 정보를 이용하여 키를 생성할 수 있다.The
키 비교부(124)는 키 생성부(123)에서 생성된 키와 이전에 컴파일된 적어도 하나의 셰이더 프로그램의 키를 비교할 수 있다. 이전에 컴파일된 적어도 하나의 셰이더 프로그램의 키는 캐시(400)에 저장될 수 있다. 키가 캐시(400)에 저장된 경우, 키 비교부(124)는 키 생성부(123)에서 생성된 키와 캐시(400)에 저장되어있는 이전에 컴파일 된 적어도 하나의 셰이더 프로그램의 키를 비교할 수 있다.The
도 6은 일 실시예에 따른 그래픽스 명령 처리 장치가 셰이더 프로그램을 검색 및 출력하는 예시를 나타내는 도면이다.6 is a diagram illustrating an example in which a graphics command processing apparatus according to an exemplary embodiment searches for and outputs a shader program.
도 6을 참조하면, 일 실시예에 따른 그래픽스 명령 처리 장치는 셰이더 프로그램 매니저(100)에 의해 구현될 수 있다. 그러나 이에 제한되지 않는다.Referring to FIG. 6, the graphics command processing apparatus according to an embodiment may be implemented by the
워크 프로세서(122)에서 생성된 셰이더 프로그램(1000a)과 동일한 컴파일 된 셰이더 프로그램을 검색한 경우, 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 그래픽스 드라이버(200)로 출력할 수 있다. 또는, 그래픽스 명령 처리 장치가 그래픽스 드라이버(200)에 의해 구현되는 경우, 그래픽스 드라이버(200)는 검색된 셰이더 프로그램을 그래픽스 프로세서(300)로 출력할 수 있다. 검색된 셰이더 프로그램은 바이너리로 출력될 수 있다.When a compiled shader program identical to the
워크 프로세서(122)가 생성된 셰이더 프로그램(1000a)과 동일한 컴파일 된 셰이더 프로그램을 검색하지 못한 경우, 셰이더 프로그램 매니저(100)는 생성된 셰이더 프로그램(1000a)을 컴파일러(500)로 출력할 수 있고, 생성된 셰이더 프로그램(1000a)은 컴파일러(500)에서 컴파일될 수 있다. 또는, 그래픽스 명령 처리 장치가 그래픽스 드라이버(200)에 의해 구현되는 경우, 그래픽스 드라이버(200)는 생성된 셰이더 프로그램(1000a)을 컴파일러(500)로 출력할 수 있고, 생성된 셰이더 프로그램(1000a)은 컴파일러(500)에서 컴파일될 수 있다. 컴파일된 셰이더 프로그램(1000b)은 워크 프로세서(122)가 새롭게 생성된 셰이더 프로그램(1000a)과 동일한 셰이더 프로그램이 있는지 검색할 때 이용될 수 있다. 워크 프로세서(122)가 생성된 셰이더 프로그램(1000a)과 동일한 컴파일 된 셰이더 프로그램을 검색하지 못한 경우, 컴파일된 셰이더 프로그램(1000b)은 캐시(400)에 저장될 수 있다. 컴파일된 셰이더 프로그램(1000b)은 캐시(400)에 바이너리로 저장될 수 있다.When the
워크 프로세서(122)가 생성된 셰이더 프로그램(1000a)과 동일한 컴파일 된 셰이더 프로그램을 검색하는 경우, 키를 이용하여 셰이더 프로그램을 검색할 수 있다. When the
워크 프로세서(122)가 생성된 셰이더 프로그램(1000a)의 키와 동일한 키를 갖는 컴파일된 셰이더 프로그램을 검색하지 못한 경우, 생성된 셰이더 프로그램(1000a)의 키가 캐시(400)에 저장될 수 있다. 생성된 셰이더 프로그램(1000a)이 컴파일 된 후 컴파일된 셰이더 프로그램(1000b)은 캐시(400)에 바이너리로 저장될 수 있다. 바이너리가 캐시(400)에 저장된 후, 캐시(400)에 저장되어 있던 셰이더 프로그램(1000a)의 키가 바이너리와 연결될 수 있다.When the
도 7은 일 실시 예에 따른 그래픽스 명령 처리 장치에서 데이터가 처리되는 과정의 예시를 구체적으로 나타내는 도면이다. 그러나 이제 제한되지 않는다.7 is a diagram illustrating a detailed example of a process of processing data in a graphics command processing apparatus according to an exemplary embodiment. But now it is not limited.
도 8은 일 실시 예에 따른 그래픽스 명령을 처리하는 방법의 자세한 흐름도이다.8 is a detailed flowchart of a method of processing a graphics command according to an exemplary embodiment.
도 8의 아래 단계들은 메인 프로세서, GPU, 셰이더 프로그램 매니저, 그래픽스 드라이버 등에 의해 구현될 수 있다. 그러나 이에 제한되지 않는다.The steps below in FIG. 8 may be implemented by a main processor, a GPU, a shader program manager, a graphics driver, or the like. However, it is not limited thereto.
이하 셰이더 프로그램 매니저(100)에 의해 각 단계들이 실행되는 경우로 설명하기로 한다.Hereinafter, a case where each step is executed by the
셰이더 프로그램 매니저(100)는 그래픽스 명령이 수신되었는지 판단할 수 있다. 그래픽스 명령이 수신되었다고 판단되면, 셰이더 프로그램 매니저(100)는 이하의 동작을 시작할 수 있다. 단계 810에서 셰이더 프로그램 매니저(100)는 수신한 그래픽스 명령이 셰이더 프로그램 관련 API 인지 판단할 수 있다. The
단계 810에서 판단 결과, 셰이더 프로그램 관련 API가 아닌 API가 수신되었다고 판단되면, 셰이더 프로그램 관련 API가 아닌 API는 셰이더 프로그램 매니저(100)에서 처리되지 않고 직접 그래픽스 드라이버(200)로 출력될 수 있다. 그래픽스 드라이버(200)로 출력된 셰이더 프로그램 관련 API가 아닌 API에 대해 기존 그래픽스 드라이버(200) 연산이 수행될 수 있다.As a result of the determination in
또는, 단계 810에서 판단 결과, 셰이더 프로그램 관련 API가 수신되었다고 판단되면 단계 820을 진행할 수 있다.Alternatively, as a result of the determination in
단계 820에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 프로그램 생성 또는 삭제 API를 수신하였다고 판단되면, 단계 821에서 셰이더 프로그램 매니저(100)는 셰이더 및 셰이더 프로그램 관련 메모리에 공간을 할당 또는 삭제할 수 있다. 단계 821에서 셰이더 프로그램 매니저(100)는 셰이더 메모리(110) 및 워크 메모리(121)에 공간을 할당 또는 삭제할 수 있다. As a result of the determination in
또는, 단계 820에서 판단 결과, 셰이더 프로그램 생성 또는 셰이더 프로그램 삭제 API를 수신하지 않았다고 판단되면, 단계 830을 진행할 수 있다.Alternatively, if it is determined in
단계 830에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 소스 API를 수신하였다고 판단되면, 단계 831에서 셰이더 프로그램 매니저(100)는 셰이더 소스 API를 포함하는 셰이더를 저장할 수 있다. 셰이더는 셰이더 메모리(110)에 저장될 수 있다. 셰이더의 소스 코드가 셰이더 메모리(110)에 저장될 수 있다. 셰이더의 소스 코드는 셰이더 메모리(110)의 TEXT_소스 공간에 저장될 수 있다. 버텍스 셰이더 및 픽셀 셰이더 각각의 소스 코드는 셰이더 메모리(110)의 TEXT_소스 공간에 독립적으로 저장될 수 있다. 그러나 이에 제한되지 않는다.As a result of the determination in
또는 단계 830에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 소스 API를 수신하지 않았다고 판단되면, 단계 840을 진행할 수 있다.Alternatively, as a result of the determination in
단계 840에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 컴파일 API를 수신하였다고 판단되면, 단계 841에서 셰이더 프로그램 매니저(100)는 셰이더를 저장할 수 있다. 셰이더는 셰이더 메모리(110)에 저장될 수 있다. 셰이더의 소스 코드(또는 컴파일 코드)가 셰이더 메모리(110)에 저장될 수 있다. 셰이더의 소스 코드(또는 컴파일 코드)는 셰이더 메모리(110)의 TEXT_컴파일 공간에 저장될 수 있다. 셰이더의 소스 코드가 저장되는 경우, TEXT_소스 공간에 저장되어 있는 소스 코드가 복사되어, 복사된 소스 코드는 셰이더 메모리(110)의 TEXT_컴파일 공간에 저장될 수 있다. 버텍스 셰이더 및 픽셀 셰이더 각각의 소스 코드는 셰이더 메모리(110)의 TEXT_컴파일 공간에 독립적으로 저장될 수 있다.As a result of the determination in
또한, 단계 841에서 셰이더 메모리(110)내의 TEXT_소스 공간에 소스 코드가 저장되어있거나 또는 TEXT_컴파일 공간에 소스 코드(또는 컴파일 코드)가 저장되어있는 경우, TEXT_소스 공간 또는 TEXT_컴파일 공간에는 셰이더 프로그램 매니저(100)가 나중에 수신한 셰이더의 소스 코드(또는 컴파일 코드)가 저장될 수 있다.In addition, in step 841, if the source code is stored in the TEXT_source space in the
또는 단계 840에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 컴파일 API를 수신하지 않았다고 판단되면, 단계 850을 진행할 수 있다.Alternatively, as a result of the determination in
단계 850에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 attach/detach API를 수신하였다고 판단되면, 단계 851에서 셰이더 프로그램 매니저(100)는 셰이더 메모리(110)에 저장된 셰이더를 워크 매니저(120)로 연결(또는 저장)할 수 있다. 셰이더가 워크 매니저(120)로 연결(또는 저장)된 경우, TEXT_컴파일 공간에 저장된 소스 코드(또는 컴파일 코드)를 워크 매니저(120)로 연결(또는 저장)할 수 있다. 셰이더가 워크 매니저(120)에 저장되는 경우, 셰이더 프로그램 매니저(100)는 소스 코드(또는 컴파일 코드)를 워크 메모리(121)에 저장할 수 있다. 소스 코드(또는 컴파일 코드)의 텍스트 및 텍스트의 길이가 워크 메모리(121)에 저장될 수 있다. 또는 단계 850에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 attach/detach API를 수신하지 않았다고 판단되면, 단계 860을 진행할 수 있다. As a result of the determination in
단계 860에서의 판단 결과, 셰이더 프로그램 매니저(100)가 유니폼 데이터 저장 API를 수신하였다고 판단되면, 단계 861에서 셰이더 프로그램 매니저(100)는 유니폼 데이터를 워크 매니저(120)로 연결(또는 저장)할 수 있다. 셰이더가 워크 매니저(120)에 저장되는 경우, 셰이더 프로그램 매니저(100)는 유니폼 데이터를 워크 메모리(121)에 저장할 수 있다. 유니폼 데이터의 텍스트 및 텍스트의 길이가 워크 메모리(121)에 저장될 수 있다. 그러나 이에 제한되지 않는다.As a result of the determination in
또는 단계 860에서의 판단 결과, 셰이더 프로그램 매니저(100)가 유니폼 데이터 저장 API를 수신하지 않았다고 판단되면, 단계 870을 진행할 수 있다.Alternatively, as a result of the determination in
단계 870에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 프로그램 링크 API를 수신하였다고 판단되면, 단계 871에서 셰이더 프로그램 매니저(100)는 워크 매니저(120)에 연결(또는 저장)된 정보를 이용하여 키를 생성할 수 있다. 키가 생성된 경우, 셰이더 프로그램 매니저(100)는 워크 매니저(120)에 연결(또는 저장)된 적어도 하나의 셰이더 소스 코드의 텍스트 및 텍스트의 길이, 유니폼 데이터의 텍스트 및 텍스트의 길이, 컴파일러 버전, 및 GPU 버전 정보를 이용하여 키를 생성할 수 있다. As a result of the determination in
또는 단계 870에서의 판단 결과, 셰이더 프로그램 매니저(100)가 셰이더 프로그램 링크 API를 수신하지 않았다고 판단되면, 수신된 API에 대해 그래픽스 명령에 대해 기존 그래픽스 드라이버(200) 연산이 수행될 수 있다.Alternatively, as a result of the determination in
단계 872에서의 판단 결과, 단계 871에서 생성된 키와 동일한 키를 갖는 셰이더 프로그램이 검색되었다고 판단되면, 단계 873에서 셰이더 프로그램 매니저(100)는 검색된 셰이더 프로그램을 출력할 수 있다. 출력된 셰이더 프로그램에 대해 기존 그래픽스 드라이버(200) 연산이 수행될 수 있다. 셰이더 프로그램의 키는 캐시에 저장될 수 있다. 검색된 셰이더 프로그램은 바이너리로 출력될 수 있다. As a result of the determination in
또는 단계 872에서의 판단 결과, 단계 871에서 생성된 키와 동일한 키를 갖는 셰이더 프로그램이 검색되지 않았다고 판단되면, 단계 874에서 셰이더 프로그램 매니저(100)는 워크 매니저(120)에 연결(또는 저장)된 정보를 이용하여 셰이더 프로그램 컴파일에 필요한 정보를 생성하고 그래픽스 드라이버(200)에 컴파일 요청을 할 수 있다. Alternatively, as a result of the determination in
도 9는 일 실시 예에 따른 그래픽스 드라이버가 셰이더 프로그램 관련 API를 처리하는 방법의 흐름도이다. 도 10은 일 실시 예에 따른 셰이더 프로그램 매니저가 셰이더 프로그램 관련 API를 처리하는 방법의 흐름도이다.9 is a flowchart illustrating a method of processing an API related to a shader program by a graphics driver according to an exemplary embodiment. 10 is a flowchart of a method for a shader program manager to process an API related to a shader program according to an exemplary embodiment.
이하 도 9와 비교하여 도 10을 설명하기로 한다.Hereinafter, compared with FIG. 9, FIG. 10 will be described.
도 10을 참조하면, 셰이더 프로그램 매니저(100)가 적어도 하나의 버텍스 셰이더 및 적어도 하나의 픽셀 셰이더를 수신한 경우, 셰이더를 수신한 순서대로 버텍스 셰이더 및 픽셀 셰이더가 셰이더 프로그램 매니저(100)에 의해 처리될 수 있다.Referring to FIG. 10, when the
도 9에서 셰이더가 수신될 때마다 그래픽스 드라이버(200)에서 셰이더에 포함된 모든 API를 처리하는 것과 달리, 도 10에서는 셰이더 프로그램 매니저(100)가 셰이더 생성 API 및 소스 코드 저장 API만을 처리할 수 있다. 셰이더에 포함된 그 외의 API에 대해선 처리를 보류할 수 있다. 셰이더 프로그램 매니저(100)는 셰이더 프로그램 링크 API 수신 전까지 셰이더 생성 API 및 소스 코드 저장 API만을 처리하고 그 외의 API에 대해선 처리를 보류할 수 있다. 그러나 이에 제한되지 않는다.Unlike in FIG. 9, the
도 10에서는 셰이더 프로그램 매니저(100)가 셰이더 프로그램 링크 API를 수신한 경우, 가장 나중에 수신한 버텍스 셰이더 및 픽셀 셰이더 각각에 포함된 API를 처리할 수 있다. 버텍스 셰이더 및 픽셀 셰이더는 소스 API 및 컴파일 API를 포함할 수 있다. 버텍스 셰이더 및 픽셀 셰이더에 소스 API 및 컴파일 API가 포함된 경우, 셰이더 프로그램 매니저(100)는 컴파일 API를 제외한 API를 처리할 수 있다. 컴파일 API를 제외한 API가 처리된 후, 컴파일 API는 그래픽스 드라이버(200)에서 처리될 수 있다.In FIG. 10, when the
도 10을 참조하면, 그래픽스 드라이버(200)가 컴파일 API 명령을 처리하면 컴파일러(500)에서 버텍스 셰이더 및 픽셀 셰이더가 컴파일 될 수 있다. 컴파일러(500)에서 컴파일 되는 버텍스 셰이더 및 픽셀 셰이더 각각은 셰이더 프로그램 매니저(100)가 가장 나중에 수신한 버텍스 셰이더 및 픽셀 셰이더일 수 있다. 버텍스 셰이더 및 픽셀 셰이더가 컴파일된 경우, 그래픽스 드라이버(200)는 컴파일 된 버텍스 셰이더 및 픽셀 셰이더를 포함하는 셰이더 프로그램(1000b)을 생성할 수 있다. 생성된 셰이더 프로그램(1000b)에 대해 기존 그래픽스 드라이버(200) 연산이 수행될 수 있다.Referring to FIG. 10, when the
일부 실시예는 컴퓨터에 의해 실행되는 프로그램 모듈과 같은 컴퓨터에 의해 실행가능한 명령어를 포함하는 기록 매체의 형태로도 구현될 수 있다. 컴퓨터 판독 가능 매체는 컴퓨터에 의해 액세스될 수 있는 임의의 가용 매체일 수 있고, 휘발성 및 비휘발성 매체, 분리형 및 비분리형 매체를 모두 포함한다. 또한, 컴퓨터 판독가능 매체는 컴퓨터 저장 매체 및 통신 매체를 모두 포함할 수 있다. 컴퓨터 저장 매체는 컴퓨터 판독가능 명령어, 데이터 구조, 프로그램 모듈 또는 기타 데이터와 같은 정보의 저장을 위한 임의의 방법 또는 기술로 구현된 휘발성 및 비휘발성, 분리형 및 비분리형 매체를 모두 포함한다. 통신 매체는 전형적으로 컴퓨터 판독가능 명령어, 데이터 구조, 프로그램 모듈, 또는 반송파와 같은 변조된 데이터 신호의 기타 데이터, 또는 기타 전송 메커니즘을 포함하며, 임의의 정보 전달 매체를 포함한다. Some embodiments may also be implemented in the form of a recording medium including instructions executable by a computer, such as a program module executed by a computer. Computer-readable media can be any available media that can be accessed by a computer, and includes both volatile and nonvolatile media, removable and non-removable media. Further, the computer-readable medium may include both computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Communication media typically includes computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, or other transmission mechanism, and includes any information delivery media.
또한, 본 명세서에서, "부"는 프로세서 또는 회로와 같은 하드웨어 구성(hardware component), 및/또는 프로세서와 같은 하드웨어 구성에 의해 실행되는 소프트웨어 구성(software component)일 수 있다.In addition, in this specification, the "unit" may be a hardware component such as a processor or a circuit, and/or a software component executed by a hardware configuration such as a processor.
전술한 본 발명의 설명은 예시를 위한 것이며, 본 발명이 속하는 기술분야의 통상의 지식을 가진 자는 본 발명의 기술적 사상이나 필수적인 특징을 변경하지 않고서 다른 구체적인 형태로 쉽게 변형이 가능하다는 것을 이해할 수 있을 것이다. 그러므로 이상에서 기술한 실시예들은 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야만 한다. 예를 들어, 단일형으로 설명되어 있는 각 구성 요소는 분산되어 실시될 수도 있으며, 마찬가지로 분산된 것으로 설명되어 있는 구성 요소들도 결합된 형태로 실시될 수 있다.The above description of the present invention is for illustrative purposes only, and those of ordinary skill in the art to which the present invention pertains will be able to understand that other specific forms can be easily modified without changing the technical spirit or essential features of the present invention. will be. Therefore, it should be understood that the embodiments described above are illustrative and non-limiting in all respects. For example, each component described as a single type may be implemented in a distributed manner, and similarly, components described as being distributed may also be implemented in a combined form.
본 발명의 범위는 상기 상세한 설명보다는 후술하는 특허청구범위에 의하여 나타내어지며, 특허청구범위의 의미 및 범위 그리고 그 균등 개념으로부터 도출되는 모든 변경 또는 변형된 형태가 본 발명의 범위에 포함되는 것으로 해석되어야 한다.The scope of the present invention is indicated by the claims to be described later rather than the detailed description, and all changes or modified forms derived from the meaning and scope of the claims and their equivalent concepts should be interpreted as being included in the scope of the present invention do.
Claims (15)
어플리케이션(application)을 실행하는 장치로부터 상기 그래픽스 명령을 수신하는 단계;
상기 그래픽스 명령에 포함된 복수의 버텍스 셰이더(shader) 및 복수의 픽셀 셰이더(shader) 중에서, 그래픽스 프로세서에서 처리될 버텍스 셰이더 및 픽셀 셰이더를 선택하는 단계;
상기 선택된 버텍스 셰이더 및 픽셀 셰이더에 포함된 소스 명령 및 컴파일 명령을 처리하는 단계;
상기 소스 명령 및 컴파일 명령이 처리된 버텍스 셰이더 및 픽셀 셰이더를 이용하여 셰이더 프로그램(shader program)을 생성하는 단계;
상기 생성된 셰이더 프로그램의 생성 시점 이전에 컴파일(compile) 된 적어도 하나의 셰이더 프로그램 중에서 상기 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색하는 단계; 및
상기 검색된 셰이더 프로그램을 출력하는 단계;
를 포함하고,
상기 버텍스 셰이더 및 픽셀 셰이더를 선택하는 단계는,
상기 복수의 버텍스 셰이더 및 복수의 픽셀 셰이더 각각에 대해서, 상기 각각의 버텍스 셰이더 및 픽셀 셰이더에 포함된 복수의 명령들 중에서 셰이더 생성 명령 및 셰이더 소스 코드 저장 명령만을 처리하는 단계;
상기 그래픽스 명령에 포함된 복수의 셰이더 중 적어도 일부를 컴파일 및 링크하기 위한 셰이더 프로그램 링크 명령을 수신하는 단계; 및
상기 셰이더 프로그램 링크 명령이 수신되면, 상기 그래픽스 명령에 포함된 복수의 버텍스 셰이더 및 복수의 픽셀 셰이더 중 가장 나중에 수신된 버텍스 셰이더 및 픽셀 셰이더를 선택하는 단계; 를 포함하고,,
상기 복수의 버텍스 셰이더 및 상기 복수의 픽셀 셰이더는 상기 소스 명령 및 상기 컴파일 명령을 포함하는 것인, 방법.In the method of processing graphics commands,
Receiving the graphics command from a device executing an application;
Selecting a vertex shader and a pixel shader to be processed by a graphics processor from among a plurality of vertex shaders and a plurality of pixel shaders included in the graphics command;
Processing a source command and a compile command included in the selected vertex shader and pixel shader;
Generating a shader program using a vertex shader and a pixel shader on which the source command and the compile command are processed;
Searching for a shader program identical to the generated shader program among at least one shader program compiled before the generated shader program is generated; And
Outputting the searched shader program;
Including,
The step of selecting the vertex shader and the pixel shader,
For each of the plurality of vertex shaders and the plurality of pixel shaders, processing only a shader generation instruction and a shader source code storage instruction from among a plurality of instructions included in each of the vertex shaders and pixel shaders;
Receiving a shader program link instruction for compiling and linking at least some of a plurality of shaders included in the graphics instruction; And
Selecting a vertex shader and a pixel shader received last from among a plurality of vertex shaders and a plurality of pixel shaders included in the graphics command when the shader program link command is received; Including,
Wherein the plurality of vertex shaders and the plurality of pixel shaders include the source instruction and the compile instruction.
상기 셰이더 프로그램 생성하는 단계는, 상기 버텍스 셰이더, 상기 픽셀 셰이더, 및 유니폼 데이터를 이용하여 셰이더 프로그램을 생성하는 것인, 방법.The method of claim 1,
The generating of the shader program comprises generating a shader program using the vertex shader, the pixel shader, and uniform data.
상기 검색하는 단계는, 상기 적어도 하나의 셰이더의 텍스트 및 텍스트 길이, 유니폼 데이터(uniform data)의 텍스트 및 텍스트 길이, 컴파일러(compiler) 버전, 및 GPU 버전 정보를 포함하는 키를 생성하는 단계; 및
상기 생성된 키를 이용하여 검색하는 단계;
를 포함하는, 방법.The method of claim 1,
The searching may include generating a key including text and text length of the at least one shader, text and text length of uniform data, a compiler version, and GPU version information; And
Searching using the generated key;
Containing, the method.
상기 출력하는 단계는, 상기 검색된 셰이더 프로그램의 바이너리(binary)를 출력하는 것인, 방법.The method of claim 1,
The outputting step is to output a binary (binary) of the searched shader program.
어플리케이션을 실행하는 장치로부터 그래픽스 명령을 수신하고, 상기 그래픽스 명령에 포함된 복수의 버텍스 셰이더 및 복수의 픽셀 셰이더 중에서, 그래픽스 프로세서에서 처리될 버텍스 셰이더 및 픽셀 셰이더를 선택하며, 상기 선택된 버텍스 셰이더 및 픽셀 셰이더에 포함된 소스 명령 및 컴파일 명령을 처리하고, 상기 소스 명령 및 컴파일 명령이 처리된 버텍스 셰이더 및 픽셀 셰이더를 이용하여 셰이더 프로그램을 생성하여, 상기 생성된 셰이더 프로그램의 생성 시점 이전에 컴파일된 적어도 하나의 셰이더 프로그램 중에서 상기 생성된 셰이더 프로그램과 동일한 셰이더 프로그램을 검색하고, 상기 검색된 셰이더 프로그램을 출력하는 프로세서; 및
이전에 컴파일된 셰이더 프로그램들을 저장하는 캐시;
를 포함하고,
상기 프로세서는, 상기 복수의 버텍스 셰이더 및 복수의 픽셀 셰이더 각각에 대해서, 상기 각각의 버텍스 셰이더 및 픽셀 셰이더에 포함된 복수의 명령들 중에서 셰이더 생성 명령 및 셰이더 소스 코드 저장 명령만을 처리하고, 상기 그래픽스 명령에 포함된 복수의 셰이더 중 적어도 일부를 컴파일 및 링크하기 위한 셰이더 프로그램 링크 명령을 수신하고, 상기 셰이더 프로그램 링크 명령이 수신되면, 상기 그래픽스 명령에 포함된 복수의 버텍스 셰이더 및 복수의 픽셀 셰이더 중 가장 나중에 수신된 버텍스 셰이더 및 픽셀 셰이더를 선택하는 것이고,
상기 복수의 버텍스 셰이더 및 상기 복수의 픽셀 셰이더는 상기 소스 명령 및 상기 컴파일 명령을 포함하는 것인, 장치.In the graphics command processing device,
Receives a graphics command from a device executing an application, selects a vertex shader and a pixel shader to be processed in a graphics processor from among a plurality of vertex shaders and a plurality of pixel shaders included in the graphics command, and the selected vertex shader and pixel shader At least one compiled before the generation time of the generated shader program by processing the source command and the compile command included in and generating a shader program using the vertex shader and pixel shader on which the source command and the compile command are processed. A processor that searches for a shader program identical to the generated shader program among shader programs and outputs the found shader program; And
A cache for storing previously compiled shader programs;
Including,
The processor, for each of the plurality of vertex shaders and the plurality of pixel shaders, processes only a shader generation instruction and a shader source code storage instruction among a plurality of instructions included in the respective vertex shaders and pixel shaders, and the graphics instruction When a shader program link instruction for compiling and linking at least some of the plurality of shaders included in is received, and when the shader program link instruction is received, the last of a plurality of vertex shaders and a plurality of pixel shaders included in the graphics instruction is received. Is to select the received vertex shader and pixel shader,
Wherein the plurality of vertex shaders and the plurality of pixel shaders include the source instruction and the compile instruction.
상기 프로세서는, 상기 버텍스 셰이더, 상기 픽셀 셰이더, 및 유니폼 데이터를 이용하여 셰이더 프로그램을 생성하는 것인, 장치.The method of claim 7,
Wherein the processor generates a shader program using the vertex shader, the pixel shader, and uniform data.
상기 프로세서는, 상기 적어도 하나의 셰이더의 텍스트 및 텍스트 길이, 유니폼 데이터의 텍스트 및 텍스트 길이, 컴파일러 버전, 및 GPU 버전 정보를 포함하는 데이터를 이용하여 키를 생성하고, 상기 생성된 키를 이용하여 검색하는 것인, 장치.The method of claim 7,
The processor generates a key using data including text and text length of the at least one shader, text and text length of uniform data, compiler version, and GPU version information, and searches using the generated key The device.
상기 캐시는, 컴파일된 셰이더 프로그램들에 대응하는 키와 바이너리를 포함하는 정보를 저장하는 것인, 장치.The method of claim 7,
Wherein the cache stores information including keys and binaries corresponding to compiled shader programs.
상기 프로세서는, 컴파일 코드를 포함하는 셰이더를 수신하여도 컴파일을 수행하지 않는 것인, 장치.The method of claim 7,
The apparatus, wherein the processor does not perform compilation even when receiving a shader including a compiled code.
이전에 컴파일된 셰이더 프로그램들을 저장하는 캐시;
를 포함하고
상기 그래픽스 드라이버는, 상기 복수의 버텍스 셰이더 및 복수의 픽셀 셰이더 각각에 대해서, 상기 각각의 버텍스 셰이더 및 픽셀 셰이더에 포함된 복수의 명령들 중에서 셰이더 생성 명령 및 셰이더 소스 코드 저장 명령만을 처리하고, 상기 그래픽스 명령에 포함된 복수의 셰이더 중 적어도 일부를 컴파일 및 링크하기 위한 셰이더 프로그램 링크 명령을 수신하고, 상기 셰이더 프로그램 링크 명령이 수신되면, 상기 그래픽스 명령에 포함된 복수의 버텍스 셰이더 및 복수의 픽셀 셰이더 중 가장 나중에 수신된 버텍스 셰이더 및 픽셀 셰이더를 선택하는 것이고,
상기 복수의 버텍스 셰이더 및 상기 복수의 픽셀 셰이더는 상기 소스 명령 및 상기 컴파일 명령을 포함하는 것인, GPU.Receives a graphics command from a device executing an application, selects a vertex shader and a pixel shader to be processed in a graphics processor from among a plurality of vertex shaders and a plurality of pixel shaders included in the graphics command, and the selected vertex shader and pixel shader At least one compiled before the generation time of the generated shader program by processing the source command and the compile command included in and generating a shader program using the vertex shader and pixel shader on which the source command and the compile command are processed. A graphics driver for searching for a shader program identical to the generated shader program among shader programs and outputting the found shader program; And
A cache for storing previously compiled shader programs;
Including
The graphics driver, for each of the plurality of vertex shaders and the plurality of pixel shaders, processes only a shader generation command and a shader source code storage command among a plurality of commands included in the respective vertex shaders and pixel shaders, and the graphics A shader program link instruction for compiling and linking at least some of the plurality of shaders included in the instruction is received, and when the shader program link instruction is received, the most of a plurality of vertex shaders and a plurality of pixel shaders included in the graphics instruction is received. Is to select the vertex shader and pixel shader received later,
Wherein the plurality of vertex shaders and the plurality of pixel shaders include the source instruction and the compile instruction.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US15/198,155 US10002401B2 (en) | 2015-11-11 | 2016-06-30 | Method and apparatus for efficient processing of graphics commands |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US201562253891P | 2015-11-11 | 2015-11-11 | |
US62/253,891 | 2015-11-11 |
Publications (2)
Publication Number | Publication Date |
---|---|
KR20170055392A KR20170055392A (en) | 2017-05-19 |
KR102254119B1 true KR102254119B1 (en) | 2021-05-20 |
Family
ID=59049525
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
KR1020160025039A KR102254119B1 (en) | 2015-11-11 | 2016-03-02 | Method and apparatus for processing graphics command |
Country Status (1)
Country | Link |
---|---|
KR (1) | KR102254119B1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110609688A (en) * | 2019-09-19 | 2019-12-24 | 网易(杭州)网络有限公司 | Processing method and processing device of shader, storage medium and processor |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8144149B2 (en) | 2005-10-14 | 2012-03-27 | Via Technologies, Inc. | System and method for dynamically load balancing multiple shader stages in a shared pool of processing units |
US20130293544A1 (en) * | 2012-05-03 | 2013-11-07 | Richard W. Schreyer | Tiled Forward Shading with Improved Depth Filtering |
US20140043333A1 (en) * | 2012-01-11 | 2014-02-13 | Nvidia Corporation | Application load times by caching shader binaries in a persistent storage |
US20150379680A1 (en) | 2014-06-26 | 2015-12-31 | Qualcomm Incorporated | Load scheme for shared register in gpu |
US20160055667A1 (en) | 2014-08-22 | 2016-02-25 | Qualcomm Incorporated | Shader program execution techniques for use in graphics processing |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7750913B1 (en) * | 2006-10-24 | 2010-07-06 | Adobe Systems Incorporated | System and method for implementing graphics processing unit shader programs using snippets |
-
2016
- 2016-03-02 KR KR1020160025039A patent/KR102254119B1/en active IP Right Grant
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8144149B2 (en) | 2005-10-14 | 2012-03-27 | Via Technologies, Inc. | System and method for dynamically load balancing multiple shader stages in a shared pool of processing units |
US20140043333A1 (en) * | 2012-01-11 | 2014-02-13 | Nvidia Corporation | Application load times by caching shader binaries in a persistent storage |
US20130293544A1 (en) * | 2012-05-03 | 2013-11-07 | Richard W. Schreyer | Tiled Forward Shading with Improved Depth Filtering |
US20150379680A1 (en) | 2014-06-26 | 2015-12-31 | Qualcomm Incorporated | Load scheme for shared register in gpu |
US20160055667A1 (en) | 2014-08-22 | 2016-02-25 | Qualcomm Incorporated | Shader program execution techniques for use in graphics processing |
Also Published As
Publication number | Publication date |
---|---|
KR20170055392A (en) | 2017-05-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106796522B (en) | System and method for updating source code file | |
CN110008009B (en) | Binding constants at runtime to improve resource utilization | |
US11354159B2 (en) | Method, a device, and a computer program product for determining a resource required for executing a code segment | |
US9747084B2 (en) | Offline shader compilation | |
JP6506412B2 (en) | Application loading method and apparatus | |
US20150019825A1 (en) | Sharing virtual memory-based multi-version data between the heterogeneous processors of a computer platform | |
KR20150024842A (en) | Adaptive portable libraries | |
CN103984582A (en) | Method and device for hot updating | |
CN106164862A (en) | Memory reference metadata for compiler optimization | |
US9977759B2 (en) | Parallel computing apparatus, compiling apparatus, and parallel processing method for enabling access to data in stack area of thread by another thread | |
CN107797820B (en) | Method and device for generating patch | |
CN103782280A (en) | Memory copy engine for graphics processing | |
US10002401B2 (en) | Method and apparatus for efficient processing of graphics commands | |
US8397217B2 (en) | Integrating templates into tests | |
US11029924B2 (en) | Program optimization by converting code portions to directly reference internal data representations | |
US20100299661A1 (en) | Load-Time Code Optimization In a Computing Environment | |
US20170153985A1 (en) | Method to efficiently implement synchronization using software managed address translation | |
US8769498B2 (en) | Warning of register and storage area assignment errors | |
KR102254119B1 (en) | Method and apparatus for processing graphics command | |
US9081560B2 (en) | Code tracing processor selection | |
US11573777B2 (en) | Method and apparatus for enabling autonomous acceleration of dataflow AI applications | |
US20140013312A1 (en) | Source level debugging apparatus and method for a reconfigurable processor | |
CN103176843A (en) | File migration method and file migration equipment of Map Reduce distributed system | |
CN110045962A (en) | A kind of method and apparatus for supporting multilingual script execution | |
US20160253120A1 (en) | Multicore programming apparatus and method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A201 | Request for examination | ||
E902 | Notification of reason for refusal | ||
AMND | Amendment | ||
E601 | Decision to refuse application | ||
AMND | Amendment | ||
X701 | Decision to grant (after re-examination) | ||
GRNT | Written decision to grant |