KR20090077432A - Method of processing opengl programmable shader by using off-line compiling - Google Patents

Method of processing opengl programmable shader by using off-line compiling Download PDF

Info

Publication number
KR20090077432A
KR20090077432A KR1020080003398A KR20080003398A KR20090077432A KR 20090077432 A KR20090077432 A KR 20090077432A KR 1020080003398 A KR1020080003398 A KR 1020080003398A KR 20080003398 A KR20080003398 A KR 20080003398A KR 20090077432 A KR20090077432 A KR 20090077432A
Authority
KR
South Korea
Prior art keywords
shader
program
code
programmable
opengl
Prior art date
Application number
KR1020080003398A
Other languages
Korean (ko)
Inventor
김태영
오경수
Original Assignee
엠텍비젼 주식회사
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 엠텍비젼 주식회사 filed Critical 엠텍비젼 주식회사
Priority to KR1020080003398A priority Critical patent/KR20090077432A/en
Publication of KR20090077432A publication Critical patent/KR20090077432A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

A processing method of an OpenGL programmable shader by using the off-line compile is provided to perform the compile operation in the off-line state to save resources required for the compile. At least one shader source code is inputted and compiled(S210). A pre-compiled code is generated. The memory space of a shader object is generated(S220). The ID of the shader object is generated. The pre-compiled code is copied to the shader object(S230). The memory space of a program object is generated(S240). The ID of the program object is generated. The ID of the shader object is stored in the program object. The program object and shader object are connected(S250). The pre-compiled codes stored in the shader object are linked(S260).

Description

오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법{METHOD OF PROCESSING OPENGL PROGRAMMABLE SHADER BY USING OFF-LINE COMPILING}Process of OpenJule Programmable Shader Using Offline Compilation {METHOD OF PROCESSING OPENGL PROGRAMMABLE SHADER BY USING OFF-LINE COMPILING}

본 발명은 오픈쥐엘 프로그래머블 쉐이더의 처리 방법에 관한 것으로, 더욱 상세하게는 비교적 작은 프로세싱 파워를 가지는 임베디드 시스템 및 모바일 시스템 등에서 컴파일에 소요되는 리소스를 절약할 수 있도록 오프라인에서 컴파일 동작이 이루어지도록 하는 오픈쥐엘의 프로그래머블 쉐이더 처리 방법에 관한 것이다.The present invention relates to a processing method of the OpenJU programmable shader, and more particularly, OpenJU to perform the compilation operation offline to save the resources required for compilation in embedded systems and mobile systems having a relatively small processing power How to handle programmable shaders.

3차원 그래픽 라이브러리(3D Graphic Library)로서 널리 이용되고 있는 OpenGL은 '그래픽 하드웨어 제어를 위한 소프트웨어 인터페이스'로서 높은 이식성(portability)과 빠른 실행속도를 가진 3D 그래픽 및 모델링(modeling) 라이브러리이다. 이를 이용하면 광선 추적기(ray tracer) 수준의 시각적인 퀄리티를 가진 뛰어난 3D 그래픽을 비교적 손쉽게 만들 수가 있게 된다. OpenGL은 실리콘 그래픽스(SGI: Silicon Graphics Incoporated) 사에서 수년에 걸쳐 개발되고 최적화된 알고리즘을 바탕으로 여러 업체 및 개발자들에 의한 사용과 개선이 반복되면서 더욱 더 성능이 향상되고 최적화되는 형태로 발전되어 왔다. 이러한 발전을 바탕으로 하 여 OpenGL은 3D 그래픽 API로서 우월적인 지위를 유지하여 왔으며, 최근에 개발되는 대부분의 3D 가속 그래픽 하드웨어 들은 모두 OpenGL 드라이버들을 지원하는 추세에 있다.Widely used as a 3D Graphic Library, OpenGL is a software interface for controlling graphics hardware and is a highly portable and fast execution 3D graphics and modeling library. This makes it relatively easy to create stunning 3D graphics with visual quality of ray tracer level. OpenGL has evolved to be more and more performance-optimized as it is used and improved by many vendors and developers based on algorithms developed and optimized by Silicon Graphics Incoporated (SGI) over the years. . Based on these developments, OpenGL has maintained a superior position as a 3D graphics API, and most of the recently developed 3D accelerated graphics hardware tend to support OpenGL drivers.

특히, 종래 고성능의 시스템에 주로 적용되어 왔으면서도, 임베디드(embedded) 시스템 및 모바일 시스템이 가지는 하드웨어적인 제한 사항, 즉, 저용량 및 낮은 컴퓨팅 파워에도 최적화되어 OpenGL은 변천되어 왔는데, 넓은 범위의 임베디드 시스템에서 표준적인 3D 그래픽 프로그래밍을 지원하기 위해 개발된 OpenGL ES(Embedded System) 등이 그것이다. OpenGL ES는 OpenGL 버전 1.3의 일부기능을 기반으로, 약간의 부가적인 확장을 포함하여 규정되어 있는 임베디드 시스템에 적합한 OpenGL API 표준이라 할 수 있다.In particular, OpenGL has evolved to be optimized for hardware limitations of embedded systems and mobile systems, namely, low capacity and low computing power, while being mainly applied to high performance systems. This includes the OpenGL ES (Embedded System), which was developed to support standard 3D graphics programming. OpenGL ES, based on some of the features of OpenGL version 1.3, is an OpenGL API standard suitable for defined embedded systems with some additional extensions.

한편, OpenGL이 현재와 같은 지위를 가지게 한 높은 프로그래밍 효율성과 프로그래밍 자유도에 기여하는 것으로는, 기존의 고정적인 OpenGL 렌더링 파이프라인에 대하여 커스터마이징된 파이프라인(programmable pipe-line) 구성을 가능하도록 하는 프로그래머블 쉐이더(programmable shader)를 들 수 있다. 쉐이더는 기존의 처리 방식에 따른 버텍스(vertex) 속성 입력, 변환, 조명처리, 텍스쳐(texture) 좌표 생성 및 변환, 클리핑(clipping), 래스터라이즈(rasterize), 프래그먼트(fragment) 속성 입력, 텍스처링, 색상합, 안개처리, 안티알리아싱(anti-aliasing), 프래그먼트 대상 작업 등의 일련의 동작들에 대한 커스터마이징을 가능하게 한다.On the other hand, a programmable shader that allows for customizable pipe-line construction of existing fixed OpenGL rendering pipelines, contributing to the high programming efficiency and programming freedom that OpenGL has now achieved. (programmable shader). The shader uses vertex attribute input, transformation, lighting, texture coordinate generation and transformation, clipping, rasterize, fragment attribute input, texturing, color Allows customization of a series of actions such as sum, fog, anti-aliasing, and fragment target operations.

도 1은 종래 기술에 따른 오픈쥐엘의 프로그래머블 쉐이더 처리 과정을 예시 한 순서도이다.Figure 1 is a flow chart illustrating a programmable shader processing process of the OpenJulel according to the prior art.

도 1에서 예시된 OpenGL의 쉐이더 처리 과정은 OpenGL ES의 API를 기준으로 하여 예시된 순서도이다.The shader processing of OpenGL illustrated in FIG. 1 is a flowchart illustrated based on an API of OpenGL ES.

도 1을 참조하면, 기존의 쉐이더 처리 과정은 쉐이더 오브젝트 생성 단계(S110), 쉐이더 소스 복사 단계(S120), 쉐이더 소스 컴파일 단계(S130), 프로그램 오브젝트 생성 단계(S140), 프로그램 오브젝트와 쉐이더 오브젝트 어태치 단계(S150) 및 프로그램 링크 단계(S160)를 포함하여 구성된다.Referring to FIG. 1, a conventional shader processing process includes a shader object generation step S110, a shader source copying step S120, a shader source compilation step S130, a program object generation step S140, a program object and a shader object object. It comprises a attach step (S150) and a program link step (S160).

쉐이더 오브젝트 생성단계(S110)는 쉐이더 오브젝트(shader object)의 메모리 공간을 생성하고, 쉐이더 오브젝트의 아이디(ID)를 생성하는 단계로서, 예컨대, OpenGL ES API로는 glCreateShader API에 의하여 구현되도록 구성될 수 있다. 여기에서, 쉐이더 오브젝트는 버텍스 또는 프래그먼트 쉐이더 모듈을 의미하며, 쉐이더 소스와 컴파일 결과를 저장하기 위한 오브젝트이다.The shader object generation step S110 is a step of generating a memory space of the shader object and generating an ID of the shader object. For example, the shader object may be configured to be implemented by the glCreateShader API in the OpenGL ES API. . Here, the shader object refers to a vertex or fragment shader module, and is an object for storing shader source and compilation result.

쉐이더 소스 복사 단계(S120)는 쉐이더 소스를 앞서 쉐이더 오브젝트 생성 단계(S110)를 통하여 생성된 쉐이더 오브젝트의 쉐이더 프로그램 소스(program source) 부분에 복사하는 단계로서, 예컨대, OpenGL ES API로는 glShaderSource API에 의하여 구현되도록 구성될 수 있다.Copying the shader source (S120) is a step of copying the shader source to the shader program source portion of the shader object generated through the shader object generation step (S110). For example, the OpenGL ES API is performed by the glShaderSource API. It can be configured to be implemented.

쉐이더 소스 컴파일 단계(S130)는 쉐이더 소스 복사 단계(S120)에서 쉐이더 오브젝트의 프로그램 소스 부분에 복사된 쉐이더 소스를 컴파일하여 컴파일 코드(compiled code)를 생성하고, 생성된 컴파일 코드(compiled code)를 쉐이더 오브젝트에 복사하는 단계로서, 예컨대, OpenGL ES API로는 glCompileShader API에 의 하여 구현되도록 구성될 수 있다.In the shader source compilation step (S130), the shader source copied to the program source portion of the shader object in the shader source copy step (S120) is generated to generate compiled code, and the generated compiled code is shaded. As a step of copying to an object, for example, the OpenGL ES API may be configured to be implemented by the glCompileShader API.

프로그램 오브젝트 생성 단계(S140)는 프로그램 오브젝트(program object)의 메모리 공간을 생성하고, 프로그램 오브젝트의 아이디를 생성하는 단계로서, 예컨대, OpenGL ES API로는 glCreateProgram API에 의하여 구현되도록 구성될 수 있다. 여기에서, 프로그램 오브젝트는 버텍스와 프래그먼트 쉐이더로 이루어진 단일 실행 단위를 나타내며, 쉐이더 프로그램을 구성하는 쉐이더 오브젝트들을 연결하고 생성된 오브젝트 코드(object code)를 저장하기 위한 오브젝트이다.The program object generation step S140 is a step of generating a memory space of a program object and generating an ID of the program object. For example, the program object may be configured to be implemented by the glCreateProgram API in the OpenGL ES API. Here, the program object represents a single execution unit composed of vertices and fragment shaders, and is an object for connecting shader objects constituting the shader program and storing the generated object code.

프로그램 오브젝트와 쉐이더 오브젝트 어태치 단계(S150)는 생성된 쉐이더 오브젝트와 생성된 프로그램 오브젝트를 연결(attach)시키는 단계로서, 프로그램 오브젝트에 쉐이어 오브젝트의 아이디를 저장함으로써, 프로그램 오브젝트와 쉐이더 오브젝트를 연결시키는 동작을 수행한다. 예컨대, OpenGL ES API로는 glAttachShader API에 의하여 구현되도록 구성될 수 있다.The program object and the shader object attaching step (S150) is a step of attaching the generated shader object and the generated program object, and storing the ID of the shader object in the program object, thereby connecting the program object and the shader object. Perform the action. For example, the OpenGL ES API may be configured to be implemented by the glAttachShader API.

마지막으로, 프로그램 링크 단계(S160)에서는 쉐이더 오브젝트에 저장된 컴파일 코드들을 링크(link)하여 그래픽 하드웨어의 GPU(Graphic Processing Unit)에서 실행가능하도록 실행 코드(executable code)를 생성하는 단계로서, 예컨대, OpenGL ES API로는 glLinkProgram API에 의하여 구현되도록 구성될 수 있다.Finally, in the program linking step (S160), the executable code is generated to be executable in the graphic processing unit (GPU) of the graphics hardware by linking the compiled codes stored in the shader object, for example, OpenGL. ES API may be configured to be implemented by the glLinkProgram API.

한편, 이와 같은 처리과정은 쉐이더 소스 코드의 수정이 용이하여 직접적인 개발과 즉시적인 테스트 수행을 가능하게 한다는 장점이 존재하나, 개발과 테스트가 완료된 이후에도 매번 런타임 수행시에 많은 처리를 필요로 하여 작업 시간을 늘이는 단점이 있다. On the other hand, this process has the advantage that it is easy to modify the shader source code to enable direct development and immediate test execution, but it requires a lot of processing time at runtime every time even after the development and testing is completed. There is a drawback to extending.

또한, 데이터를 처리하기 위해서는 버텍스 쉐이더와 프래그먼트 쉐이더가 각각 하나씩 필요하기 때문에 런타임 동작시에 2번 이상 소스를 읽고 컴파일하는 작업이 수행되어야 한다. 따라서, 컴퓨팅 파워와 메모리가 부족한 임베디드 시스템 또는 모바일 시스템의 경우에는 이러한 런타임 컴파일 작업들은 상당한 부하로 작용될 수 있다.Also, since one vertex shader and one fragment shader are required to process data, the source must be read and compiled more than once during runtime. Thus, for embedded systems or mobile systems that lack computing power and memory, these runtime compilation tasks can be a significant load.

상기와 같은 문제점을 해결하기 위한 본 발명의 목적은 오픈쥐엘의 프로그래머블 쉐이더의 처리 과정에 있어서, 런타임 동작에서 작업의 부하로 작용하는 프로그래블 쉐이더의 런타임 컴파일 작업을 개선하여 컴퓨팅 파워와 메모리가 부족한 임베디드 시스템이나 모바일 시스템에 적용할 수 있도록 하는 오픈쥐엘 프로그래머블 쉐이더의 처리 방법을 제공하는데 있다.An object of the present invention for solving the above problems is to improve the runtime compilation of the programmable shader that acts as a load of work in the run-time operation of the programmable shader of OpenJule, embedded with insufficient computing power and memory The purpose of the present invention is to provide a method for processing OpenJell programmable shaders that can be applied to a system or a mobile system.

상기 목적을 달성하기 위한 본 발명은, 적어도 하나의 쉐이더 소스 코드를 입력 받고 컴파일하여 프리 컴파일 코드를 생성하는 프리 컴파일 단계, 쉐이더 오브젝트의 메모리 공간을 생성하고, 쉐이더 오브젝트의 아이디를 생성하는 쉐이더 오브젝트 생성 단계, 상기 프리 컴파일 코드를 상기 쉐이더 오브젝트에 복사하는 쉐이더 바이너리 복사 단계, 프로그램 오브젝트의 메모리 공간을 생성하고, 프로그램 오브젝트의 아이디를 생성하는 프로그램 오브젝트 생성 단계, 상기 프로그램 오브젝트에 상기 쉐이더 오브젝트의 아이디를 저장함으로써, 상기 프로그램 오브젝트와 상기 쉐이더 오브젝트를 연결시키는 프로그램 오브젝트와 쉐이더 오브젝트 어태치 단계 및 상기 쉐이더 오브젝트에 저장된 상기 프리 컴파일 코드들을 링크하여 기계어 코드를 생성하는 프로그램 링크 단계를 포함한 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법을 제공한다.In order to achieve the above object, the present invention provides a precompile step of generating a precompiled code by receiving and compiling at least one shader source code, generating a shader object memory space, and generating a shader object ID. A copying of the shader binary to copy the precompiled code to the shader object, generating a memory space of a program object, generating a program object ID, and storing the shader object ID to the program object. Thereby generating a machine code by linking the program object and the shader object attaching step of connecting the program object and the shader object and the precompiled codes stored in the shader object. Provides a method of handling OpenJUSL programmable shaders using offline compilation, including program linking.

여기에서, 상기 쉐이더 소스 코드는 버텍스 쉐이더의 소스 코드일 수 있다.Here, the shader source code may be source code of a vertex shader.

여기에서, 상기 쉐이더 소스 코드는 프래그먼트 쉐이더의 소스 코드일 수 있다. Here, the shader source code may be source code of a fragment shader.

여기에서, 상기 프리 컴파일 단계는, 상기 쉐이더 소스 코드를 오프라인 상태에서 입력받아 컴파일하는 것을 특징으로 한다.Here, the pre-compilation step, characterized in that the shader source code is received in the offline state to compile.

여기에서, 상기 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법은 오픈쥐엘 이에스(OpenGL ES) API 상에서 이루어질 수 있으며, 이 경우, 상기 쉐이더 바이너리 복사 단계는 오픈쥐엘 이에스의 glShaderBinary API 또는 이에 상응하는 API를 이용하여 상기 프리 컴파일 코드를 상기 쉐이더 오브젝트에 복사하는 것에 의하여 이루어질 수 있다.Here, the processing method of the OpenJUSL programmable shader using the offline compilation may be performed on the OpenGLES API. In this case, the shader binary copying step may be performed using the OpenGLLS glShaderBinary API or the corresponding API. By copying the precompile code into the shader object.

상기와 같은 본 발명에 따른 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리 방법을 이용하면, 임베디드 시스템이나 모바일 시스템과 같이 컴퓨팅 파워와 메모리가 부족한 소규모 시스템에서 런타임 동작의 부하를 감소시켜, 처리 능력을 향상시키는 것이 가능해진다.By using the OpenJEL programmable shader processing method using offline compilation according to the present invention as described above, the load of runtime operation is reduced in a small system that lacks computing power and memory such as an embedded system or a mobile system, thereby improving processing power. It becomes possible.

따라서, 본 발명에 따른 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리 방법을 이용하면, 제한된 그래픽 가속 능력을 가지는 임베디드 시스템에서도 프로그래머블 쉐이더의 소스코드를 컴파일 하는데 소요되는 작업시간을 대폭 축소시키는 것이 가능하여 3D 그래픽의 처리능력을 향상시키는 결과를 가져올 수 있다.Therefore, by using the OpenJUSL programmable shader processing method using offline compilation according to the present invention, it is possible to significantly reduce the work time required to compile the source code of the programmable shader even in an embedded system having limited graphics acceleration. This can result in improved graphics processing.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시예를 가질 수 있는 바, 특정 실시예들을 도면에 예시하고 상세한 설명에 상세하게 설명하고자 한다. 그러나, 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다. 각 도면을 설명하면서 유사한 참조부호를 유사한 구성요소에 대해 사용하였다. As the invention allows for various changes and numerous embodiments, particular embodiments will be illustrated in the drawings and described in detail in the written description. However, this is not intended to limit the present invention to specific embodiments, it should be understood to include all modifications, equivalents, and substitutes included in the spirit and scope of the present invention. In describing the drawings, similar reference numerals are used for similar elements.

제1, 제2, A, B 등의 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들어, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. 및/또는 이라는 용어는 복수의 관련된 기재된 항목들의 조합 또는 복수의 관련된 기재된 항목들 중의 어느 항목을 포함한다. Terms such as first, second, A, and B may be used to describe various components, but the components should not be limited by the terms. The terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of the present invention, the first component may be referred to as the second component, and similarly, the second component may also be referred to as the first component. The term and / or includes a combination of a plurality of related items or any item of a plurality of related items.

어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다. When a component is referred to as being "connected" or "connected" to another component, it may be directly connected to or connected to that other component, but it may be understood that other components may be present in between. Should be. On the other hand, when a component is said to be "directly connected" or "directly connected" to another component, it should be understood that there is no other component in between.

본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것 으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terminology used herein is for the purpose of describing particular example embodiments only and is not intended to be limiting of the invention. Singular expressions include plural expressions unless the context clearly indicates otherwise. In this application, the terms "comprise" or "have" are intended to indicate that there is a feature, number, step, operation, component, part, or combination thereof described in the specification, and one or more other features. It is to be understood that the present invention does not exclude the possibility of the presence or the addition of numbers, steps, operations, components, components, or a combination thereof.

다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가지고 있다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥상 가지는 의미와 일치하는 의미를 가지는 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless defined otherwise, all terms used herein, including technical or scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art. Terms such as those defined in the commonly used dictionaries should be construed as having meanings consistent with the meanings in the context of the related art, and are not construed in ideal or excessively formal meanings unless expressly defined in this application. Do not.

이하, 본 발명에 따른 바람직한 실시예를 첨부된 도면을 참조하여 상세하게 설명한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings.

도 2는 본 발명에 따른 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리 방법을 예시하기 위한 순서도이다.2 is a flow chart illustrating a processing method of an OpenJUSL programmable shader using offline compilation according to the present invention.

도 2를 참조하면, 본 발명에 따른 온 라인 컴파일 방법이 적용될 경우의 OpenGL의 쉐이더 처리 과정은, 프리 컴파일 단계(S210), 쉐이더 오브젝트 생성 단계(S220), 쉐이더 바이너리 복사 단계(S230), 프로그램 오브젝트 생성 단계(S240), 프로그램 오브젝트와 쉐이더 오브젝트 어태치 단계(S250) 및 프로그램 링크 단계(S260)를 포함하여 구성될 수 있다.Referring to FIG. 2, a shader processing process of OpenGL when the online compilation method according to the present invention is applied may include a precompile step (S210), a shader object generation step (S220), a shader binary copy step (S230), and a program object. It may be configured to include a generation step (S240), a program object and shader object attach step (S250) and a program link step (S260).

여기에서, 프리 컴파일 단계(S210)는 런타임(run-time)시에 수행되는 쉐이더 오브젝트 생성 단계(S220) 내지 프로그램 링크 단계(S260)와는 별도로 런타임 동작 이전에 미리 수행되는 동작을 의미한다. 따라서, 프로그램의 개발 및 디버깅 단계에서는 도 1에서 예시한 종래 기술의 프로그래머블 쉐이더 처리 과정을 이용하고, 개발과 디버깅이 완료된 프로그램의 최종 실행은 본 발명에 따른 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리 방법이 이용되는 것이 바람직할 것이다.Here, the pre-compilation step S210 refers to an operation that is performed in advance before the runtime operation separately from the shader object generation step S220 to the program linking step S260 performed at run-time. Therefore, in the development and debugging phase of the program, the conventional shader processing process of the prior art illustrated in FIG. 1 is used, and the final execution of the developed and debugged program is performed by the OpenJuel programmable shader using offline compilation according to the present invention. It would be desirable to use this.

프리 컴파일 단계(S210)는 적어도 하나의 쉐이더 소스 코드를 입력받아 컴파일하여 프리 컴파일 코드를 생성하는 단계로서, 도 3의 개념도를 통하여 상술된다.The precompile step S210 is a step of receiving and compiling at least one shader source code to generate a precompile code, which will be described in detail with reference to the conceptual diagram of FIG. 3.

도 3은 본 발명에 따른 오픈쥐엘 프로그래머블 쉐이더 처리 방법에 적용되는 프리 컴파일 단계를 설명하기 위한 개념도이다.3 is a conceptual diagram illustrating a pre-compile step applied to the OpenJell programmable shader processing method according to the present invention.

도 3에서 예시하고 있는 프리 컴파일 단계, 즉, 오프라인(off-line) 컴파일 단계는, 본 발명에 따른 오픈쥐엘 프로그래머블 쉐이더 처리 방법에 적용되는 오프라인 컴파일 방법으로서, 기존 런-타임 컴파일 방식으로 동작하였던 OpenGL의 프로그래머블 쉐이더의 컴파일 동작을 오프라인 동작으로 수행토록 함으로써 런 타임 수행시간을 단축시키는 특징을 가진다.The precompile step illustrated in FIG. 3, that is, the off-line compilation step, is an offline compilation method applied to the OpenJUSL programmable shader processing method according to the present invention, and is an OpenGL that operates in a conventional run-time compilation method. The execution time of the programmable shader is reduced by performing the offline compilation operation of the programmable shader.

도 3을 참조하면, 본 발명에 따른 프리 컴파일 단계(S210)은, 버텍스 쉐이더(vertex shader)의 소스 코드(101)와 프래그먼트 쉐이더(fragment shader)의 소 스 코드(102)를 입력받아, 컴파일을 수행하고, 미리 컴파일된 프리-컴파일 코드(pre-compiled code; 200)를 생성하도록 구성될 수 있다.Referring to FIG. 3, in the precompilation step (S210) according to the present invention, a source code 101 of a vertex shader and a source code 102 of a fragment shader are input and compiled. And generate pre-compiled pre-compiled code 200.

이때, 버텍스 쉐이더의 소스코드(101)는 사용자가 개발한 프로그램으로 3차원의 데이터를 그래픽스 하드웨어에서 처리하기 위한 버텍스 쉐이더 소스 코드이다. 구체적으로, 버텍스 쉐이더는 3차원 상에 위치하는 정점(버텍스)의 정보들을 입력받아 버텍스의 위치와 색상 그리고 추가정보들을 출력한다. 사용자는 API를 통하여 버텍스 데이터와 버텍스 처리 코드를 그래픽스 하드웨어에 전달하게 된다.At this time, the source code 101 of the vertex shader is a program developed by the user and the vertex shader source code for processing three-dimensional data in graphics hardware. In detail, the vertex shader receives information of vertices located in three dimensions and outputs vertex positions, colors, and additional information. The user passes vertex data and vertex processing code to the graphics hardware through the API.

또한, 프래그먼트 쉐이더의 소스코드(102)는 마찬가지로, 사용자가 개발한 프로그램으로 프래그먼트에 전달된 색상 및 텍스쳐 좌표등의 정보를 가지고, 그 프래그먼트의 색상을 결정한다.In addition, the source code 102 of the fragment shader similarly determines the color of the fragment with information such as color and texture coordinates transmitted to the fragment by a program developed by the user.

따라서, 프리 컴파일 단계(S210)에서는 입력받은 두가지 쉐이더 소스코드(101, 102)를 오프라인에서 컴파일하여 프리-컴파일드 파일(200)을 생성하게 된다. 생성된 프리-컴파일드 파일은 바이너리(binary) 파일로서, 종래기술에서 도 1을 통하여 설명된 바와 같이, 쉐이더 소스 컴파일 단계(S130)에서 생성된 컴파일 코드와 동등한 코드를 의미하게 된다. 프리 컴파일 단계(S210)에서 생성된 프리-컴파일드 파일은 생성된 쉐이더 오브젝트에 후술될 쉐이더 바이너리 복사 단계(S230)에 의하여 복사되게 된다.Therefore, in the pre-compile step (S210), the two shader source codes 101 and 102 received are compiled offline to generate the pre-compiled file 200. The generated pre-compiled file is a binary file, and as described with reference to FIG. 1 in the prior art, it means a code equivalent to the compiled code generated in the shader source compilation step S130. The pre-compiled file generated in the precompile step S210 is copied by the shader binary copy step S230 to be described later to the generated shader object.

다시 도 2를 참조하면, 쉐이더 오브젝트 생성단계(S220)는 쉐이더 오브젝트의 메모리 공간을 생성하고, 쉐이더 오브젝트의 아이디를 생성하는 단계로서, 예컨대, OpenGL ES API로는 glCreateShader API에 의하여 구현되도록 구성될 수 있다. 여기에서, 쉐이더 오브젝트는 버텍스 또는 프래그먼트 쉐이더 모듈을 의미하며, 쉐이더 소스와 컴파일 결과를 저장하기 위한 오브젝트이다.Referring back to FIG. 2, the shader object generation step S220 is a step of generating a memory space of the shader object and generating an ID of the shader object. For example, the shader object may be configured to be implemented by the glCreateShader API in the OpenGL ES API. . Here, the shader object refers to a vertex or fragment shader module, and is an object for storing shader source and compilation result.

쉐이더 바이너리 복사 단계(S230)는, 앞서 도 3을 통하여 상술되었던 쉐이더 소스 코드의 프리 컴파일 단계(S210)에 의하여 미리 생성된 프리 컴파일 코드 바이너리 파일을 쉐이더 오브젝트로 복사하는 단계이다. 여기에서, 쉐이더 바이너리 복사 단계(S230)는 OpenGL ES API로서 glShaderBinary API 또는 이에 상응하는 API 에 의하여 구현되도록 구성될 수 있다.The shader binary copying step S230 is a step of copying a precompiled code binary file generated in advance by the precompiler step S210 of the shader source code described above with reference to FIG. 3 to a shader object. Here, the shader binary copy step S230 may be configured to be implemented by the glShaderBinary API or an equivalent API as the OpenGL ES API.

도 1을 통하여 설명되었던, 종래 기술의 쉐이더 처리 과정에서는 쉐이더 소스 복사 단계(S120) 및 쉐이더 소스 컴파일 단계(S130)에서 쉐이더 소스를 쉐이더 오브젝트의 쉐이더 프로그램 소스 부분에 복사하고, 프로그램 소스 부분에 복사된 쉐이더 소스를 컴파일하여 컴파일 코드를 생성하여, 생성된 컴파일 코드를 쉐이더 오브젝트의 컨스턴트 데이터(constant data) 부분에 복사하는 과정을 런 타임에서 수행하여야 한다.In the prior art shader processing described with reference to FIG. 1, the shader source is copied to the shader program source portion of the shader object in the shader source copy step (S120) and the shader source compilation step (S130), and copied to the program source portion. Compile the shader source to generate compiled code, and copy the generated compiled code to the constant data portion of the shader object at runtime.

그러나, 본 발명에 따른 쉐이더 처리 방법이 적용될 경우에는, 프리 컴파일 단계(S210)에서 런 타임 수행이전에 미리 컴파일해두었던, 쉐이더의 프리 컴파일 코드(200)를 쉐이더 오브젝트에 직접적으로 복사하는 단계를 거침으로써, 쉐이더 소스 복사 단계(S120) 및 쉐이더 소스 컴파일 단계(S130)를 거치면서 소모되어야 했던 런타임 시의 작업시간을 대폭 축소할 수 있게 된다.However, when the shader processing method according to the present invention is applied, a step of directly copying the precompiled code 200 of the shader, which has been precompiled before the runtime execution in the precompile step (S210), is directly copied to the shader object. As a result, it is possible to drastically reduce the work time at runtime, which should be consumed during the shader source copying step S120 and the shader source compiling step S130.

프로그램 오브젝트 생성 단계(S240)는 프로그램 오브젝트(program object)의 메모리 공간을 생성하고, 프로그램 오브젝트의 아이디를 생성하는 단계로서, 예컨 대, OpenGL ES API로는 glCreateProgram API에 의하여 구현되도록 구성될 수 있다. 여기에서, 프로그램 오브젝트는 버텍스와 프래그먼트 쉐이더로 이루어진 단일 실행 단위를 나타내며, 쉐이더 프로그램을 구성하는 쉐이더 오브젝트들을 연결하고 생성된 오브젝트 코드(object code)를 저장하기 위한 오브젝트이다.The program object generation step S240 is a step of generating a memory space of a program object and generating an ID of a program object. For example, the OpenGL ES API may be configured to be implemented by the glCreateProgram API. Here, the program object represents a single execution unit composed of vertices and fragment shaders, and is an object for connecting shader objects constituting the shader program and storing the generated object code.

프로그램 오브젝트와 쉐이더 오브젝트 어태치 단계(S250)는 생성된 쉐이더 오브젝트와 생성된 프로그램 오브젝트를 연결(attach)시키는 단계로서, 프로그램 오브젝트에 쉐이어 오브젝트의 아이디를 저장함으로써, 프로그램 오브젝트와 쉐이더 오브젝트를 연결시키는 동작을 수행한다. 예컨대, OpenGL ES API로는 glAttachShader API에 의하여 구현되도록 구성될 수 있다.The program object and the shader object attaching step (S250) is a step of attaching the generated shader object and the generated program object, and storing the ID of the shader object in the program object, thereby connecting the program object and the shader object. Perform the action. For example, the OpenGL ES API may be configured to be implemented by the glAttachShader API.

마지막으로, 프로그램 링크 단계(S260)에서는 쉐이더 오브젝트에 저장된 컴파일 코드들을 링크(link)하여 그래픽 하드웨어의 GPU(Graphic Processing Unit)에서 실행가능하도록 실행 코드(executable code)를 생성하는 단계로서, 예컨대, OpenGL ES API로는 glLinkProgram API에 의하여 구현되도록 구성될 수 있다.Finally, in the program linking step S260, the executable code is generated to be executable in the graphic processing unit (GPU) of the graphics hardware by linking the compiled codes stored in the shader object, for example, OpenGL. ES API may be configured to be implemented by the glLinkProgram API.

이상에서 살펴본 바와 같은 추가적인 보안 대책들은 선택적으로 또는 조합되어 적용될 수 있으며, 상기에서는 본 발명의 바람직한 실시예를 참조하여 설명하였지만, 해당 기술 분야의 숙련된 당업자는 하기의 특허 청구의 범위에 기재된 본 발명의 사상 및 영역으로부터 벗어나지 않는 범위 내에서 본 발명을 다양하게 수정 및 변경시킬 수 있음을 이해할 수 있을 것이다. Additional security measures as described above may be applied selectively or in combination, while the above has been described with reference to a preferred embodiment of the present invention, those skilled in the art will be described in the following claims It will be understood that various modifications and changes can be made in the present invention without departing from the spirit and scope of the invention.

도 1은 종래 기술에 따른 오픈쥐엘 프로그래머블 쉐이더 처리 과정을 예시한 순서도이다.1 is a flow chart illustrating an OpenJell programmable shader process according to the prior art.

도 2는 본 발명에 따른 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리 방법을 예시하기 위한 순서도이다.2 is a flow chart illustrating a processing method of an OpenJUSL programmable shader using offline compilation according to the present invention.

도 3은 본 발명에 따른 오픈쥐엘 프로그래머블 쉐이더 처리 방법에 적용되는 프리 컴파일 단계를 설명하기 위한 개념도이다.3 is a conceptual diagram illustrating a pre-compile step applied to the OpenJell programmable shader processing method according to the present invention.

Claims (6)

적어도 하나의 쉐이더 소스 코드를 입력 받고 컴파일하여 프리 컴파일 코드를 생성하는 프리 컴파일 단계;A precompile step of receiving and compiling at least one shader source code to generate precompile code; 쉐이더 오브젝트의 메모리 공간을 생성하고, 쉐이더 오브젝트의 아이디를 생성하는 쉐이더 오브젝트 생성 단계;A shader object generation step of generating a memory space of the shader object and generating an ID of the shader object; 상기 프리 컴파일 코드를 상기 쉐이더 오브젝트에 복사하는 쉐이더 바이너리 복사 단계; A shader binary copy step of copying the precompiled code to the shader object; 프로그램 오브젝트의 메모리 공간을 생성하고, 프로그램 오브젝트의 아이디를 생성하는 프로그램 오브젝트 생성 단계; Generating a memory space of the program object and generating an ID of the program object; 상기 프로그램 오브젝트에 상기 쉐이더 오브젝트의 아이디를 저장함으로써, 상기 프로그램 오브젝트와 상기 쉐이더 오브젝트를 연결시키는 프로그램 오브젝트와 쉐이더 오브젝트 어태치 단계 및A program object and a shader object attaching step of connecting the program object and the shader object by storing the ID of the shader object in the program object; 상기 쉐이더 오브젝트에 저장된 상기 프리 컴파일 코드들을 링크하여 기계어 코드를 생성하는 프로그램 링크 단계를 포함한 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법. And a program linking step of linking the precompiled codes stored in the shader object to generate machine code. 제 1 항에 있어서,The method of claim 1, 상기 쉐이더 소스 코드는 버텍스 쉐이더의 소스 코드인 것을 특징으로 하는 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법. The shader source code is a processing method of the OpenJule programmable shader using offline compilation, characterized in that the source code of the vertex shader. 제 1 항에 있어서,The method of claim 1, 상기 쉐이더 소스 코드는 프래그먼트 쉐이더의 소스 코드인 것을 특징으로 하는 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법. The shader source code is a method of processing open shader programmable shaders using offline compilation, characterized in that the source code of the fragment shader. 제 1 항에 있어서,The method of claim 1, 상기 프리 컴파일 단계는, 상기 쉐이더 소스 코드를 오프라인 상태에서 입력받아 컴파일하는 것을 특징으로 하는 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법. In the precompilation step, the OpenJUEL programmable shader processing method using offline compilation may include compiling the shader source code in an offline state. 제 1 항에 있어서,The method of claim 1, 상기 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법 은 오픈쥐엘 이에스(OpenGL ES) API 상에서 이루어지는 것을 특징으로 하는 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법. The processing method of the OpenJU programmable shader using the offline compilation is performed on the OpenGL ES API. 제 5 항에 있어서,The method of claim 5, wherein 상기 쉐이더 바이너리 복사 단계는 오픈쥐엘 이에스의 glShaderBinary API를 이용하여 상기 프리 컴파일 코드를 상기 쉐이더 오브젝트에 복사하는 것을 특징으로 하는 오프라인 컴파일을 이용한 오픈쥐엘 프로그래머블 쉐이더의 처리방법. The shader binary copying step may include copying the precompiled code into the shader object by using the glShaderBinary API of OpenJUSL ES.
KR1020080003398A 2008-01-11 2008-01-11 Method of processing opengl programmable shader by using off-line compiling KR20090077432A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020080003398A KR20090077432A (en) 2008-01-11 2008-01-11 Method of processing opengl programmable shader by using off-line compiling

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020080003398A KR20090077432A (en) 2008-01-11 2008-01-11 Method of processing opengl programmable shader by using off-line compiling

Publications (1)

Publication Number Publication Date
KR20090077432A true KR20090077432A (en) 2009-07-15

Family

ID=41335930

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020080003398A KR20090077432A (en) 2008-01-11 2008-01-11 Method of processing opengl programmable shader by using off-line compiling

Country Status (1)

Country Link
KR (1) KR20090077432A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105843603A (en) * 2016-03-17 2016-08-10 广州爱九游信息技术有限公司 Image processing method and device
US9952842B2 (en) 2014-12-18 2018-04-24 Samsung Electronics Co., Ltd Compiler for eliminating target variables to be processed by the pre-processing core
CN110543620A (en) * 2019-09-03 2019-12-06 武汉中海庭数据技术有限公司 method and system for drawing graphics primitives based on OpenGL ES2.0

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9952842B2 (en) 2014-12-18 2018-04-24 Samsung Electronics Co., Ltd Compiler for eliminating target variables to be processed by the pre-processing core
CN105843603A (en) * 2016-03-17 2016-08-10 广州爱九游信息技术有限公司 Image processing method and device
CN110543620A (en) * 2019-09-03 2019-12-06 武汉中海庭数据技术有限公司 method and system for drawing graphics primitives based on OpenGL ES2.0

Similar Documents

Publication Publication Date Title
US11106504B2 (en) Application interface on multiple processors
US11237876B2 (en) Data parallel computing on multiple processors
US10552226B2 (en) Data parallel computing on multiple processors
US11544075B2 (en) Parallel runtime execution on multiple processors
US10067797B2 (en) Application programming interfaces for data parallel computing on multiple processors
US20120066668A1 (en) C/c++ language extensions for general-purpose graphics processing unit
KR20090077432A (en) Method of processing opengl programmable shader by using off-line compiling
US11836506B2 (en) Parallel runtime execution on multiple processors
AU2018226440B2 (en) Data parallel computing on multiple processors
Brumme The OpenGL Shading Language
AU2011253819A1 (en) Parallel runtime execution on multiple processors

Legal Events

Date Code Title Description
WITN Withdrawal due to no request for examination