MTLRenderPipelineState

Horus-iOS·2022년 7월 19일
0

https://developer.apple.com/documentation/metal/mtlrenderpipelinestate

An object that contains graphics functions and configuration state to use in a render command.

렌더 커맨드에서 사용하기 위한 그래픽 함수 및 설정 상태를 포함하는 객체입니다.

Declaration

protocol MTLRenderPipelineState

Overview

MTLRenderPipelineState 프로토콜은 그래픽 렌더링 파이프라인의 구체적인 설정으로 참조하기 위해 사용하는 경량 객체를 위한 인터페이스를 정의합니다.

렌더링 통과를 위해 커맨드를 인코딩하기 위해서 MTLRenderCommandEncoder를 사용하려면 드로잉 호출을 발행하기 전에 버텍스, 프래그먼트 셰이더 함수를 포함시켜 그래픽 상태를 정의하는 MTLRenderPipelineState 객체를 구체화해야 합니다. 파이프라인 상태 객체를 생성하는 것은 비싼 그래픽 상태 평가 및 지정된 그래픽 셰이더 기능의 가능한 컴파일을 요구할 수 있기 때문에 앱의 개발에서 초기에 파이프라인 상태 객체를 생성하게 될 것이며, 생애주기 동안 파이프라인 상태 객체를 재사용하게 될 것입니다.

MTLRenderPipelineState 객체를 생성할 때 표준 할당 및 초기화 테크닉을 사용하지 않아야 합니다. 대신 먼저 파이프라인의 원하는 상태를 설명하고 있는 MTLRenderPipelineDescriptor 객체를 생성해야 합니다. 이후 아래에 있는 MTLDevice 메소드 중 한 가지를 호출해야 합니다.

  • 동기적으로 MTLRenderPipelineState 객체를 생성하고 그래픽 상태를 컴파일(그래픽 셰이더 코드 포함)하려면 makeRenderPipelineState(descriptor:) 혹은 makeRenderPipelineState(descriptor:options:reflection:) 메소드를 호출하시기 바랍니다.
  • 비동기적으로 MTLRenderPipelineState 객체를 생성하고 그래픽 상태를 컴파일(그래픽 셰이더 코드 포함)하려면 makeRenderPipelineState(descriptor:completionHandler:) 혹은 makeRenderPipelineState(descriptor:options:completionHandler:) 메소드를 호출하시기 바랍니다. 메탈 디바이스 객체는 파이프라인 상태 객체를 생성한 후 컴플리션 핸들러를 호출합니다.

MTLDevicemakeRenderPipelineState(descriptor:options:reflection:)makeRenderPipelineState(descriptor:options:completionHandler:) 메소드는 버텍스 및 프래그먼트 함수의 인자에 대한 세부사항을 드러내고 있는 MTLRenderPipelineReflection 객체에 있는 리플렉션 데이터를 얻게 됩니다. makeRenderPipelineState(descriptor:options:completionHandler:) 메소드를 호출하면 메탈은 컴플리션 핸들러를 호출하는 시점에 리플렉션 데이터를 반환합니다. 필요할 때에만 리플렉션 데이터를 요청하시기 바랍니다.

0개의 댓글