opencl

package
v0.0.0-...-e791307 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2023 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	NoDebug                     DebugFlag = 0
	PrimaryRayIntersectionDepth           = 1 << iota
	PrimaryRayIntersectionNormals
	AllEmissiveSamples
	VisibleEmissiveSamples
	OccludedEmissiveSamples
	Throughput
	Accumulator
	FrameBuffer
)

Variables

View Source
var (
	ErrContextCreationFailed  = errors.New("opencl tracer: could not create opencl context")
	ErrCmdQueueCreationFailed = errors.New("opencl tracer: could not create opencl command queue")
	ErrAlreadySetup           = errors.New("opencl tracer: tracer already set up")
	ErrProgramCreationFailed  = errors.New("opencl tracer: program creation failed")
	ErrProgramBuildFailed     = errors.New("opencl tracer: program compilation failed")
	ErrKernelCreationFailed   = errors.New("opencl tracer: could not create compute kernel")
	ErrGettingWorkgroupInfo   = errors.New("opencl tracer: could not get kernel work group info")
	ErrAllocatingBuffer       = errors.New("opencl tracer: could not allocate device buffer")
	ErrCopyingDataToHost      = errors.New("opencl tracer: could not copy device data to host buffer")
	ErrCopyingDataToDevice    = errors.New("opencl tracer: could not copy host data to device buffer")
	ErrSettingKernelArgument  = errors.New("opencl tracer: error setting kernel argument")
	ErrKernelExecutionFailed  = errors.New("opencl tracer: kernel execution failed")
	ErrUnsupportedChangeType  = errors.New("opencl tracer: unsupported change type")
	ErrInvalidChangeData      = errors.New("opencl tracer: invalid data type for change")
	ErrInvalidOption          = errors.New("opencl tracer: invalid tracer option")
	ErrNoSceneData            = errors.New("opencl tracer: no scene data uploaded")
)

Functions

func NewTracer

func NewTracer(id string, device *device.Device, ctx *cl.Context, pipeline *Pipeline) (tracer.Tracer, error)

Create a new opencl tracer.

Types

type DebugFlag

type DebugFlag uint16

Debug flags.

type Pipeline

type Pipeline struct {
	// Reset the tracer state. This stage is executed whenever the camera
	// is moved or the sample counter is reset.
	Reset PipelineStage

	// This stage is executed whenever the tracer generates a new set
	// of primary rays. Depending on the samples per pixel this stage
	// may be invoked more than once.
	PrimaryRayGenerator PipelineStage

	// This stage implements an integrator function to trace the primary
	// rays and add their contribution into the accumulation buffer.
	Integrator PipelineStage

	// A set of post-processing stages that are executed prior to
	// rendering the final frame.
	PostProcess []PipelineStage
}

The list of pluggable of stages that are used to render the scene.

func DefaultPipeline

func DefaultPipeline(debugFlags DebugFlag) *Pipeline

type PipelineStage

type PipelineStage func(tr *Tracer, blockReq *tracer.BlockRequest) (time.Duration, error)

An alias for functions that can be used as part of the rendering pipeline.

func ClearAccumulator

func ClearAccumulator() PipelineStage

Clear the frame accumulator buffer.

func CopyFrameBufferToOpenGLTexture

func CopyFrameBufferToOpenGLTexture() PipelineStage

Copy RGBA screen buffer to opengl texture. This function assumes that the caller has enabled the appropriate 2D texture target.

func MonteCarloIntegrator

func MonteCarloIntegrator(debugFlags DebugFlag) PipelineStage

Use a montecarlo pathtracer implementation.

func PerspectiveCamera

func PerspectiveCamera() PipelineStage

Use a perspective camera for the primary ray generation stage.

func SaveFrameBuffer

func SaveFrameBuffer(imgFile string) PipelineStage

Save a copy of the RGBA framebuffer.

func TonemapSimpleReinhard

func TonemapSimpleReinhard() PipelineStage

Apply simple Reinhard tone-mapping.

type Tracer

type Tracer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func (*Tracer) Close

func (tr *Tracer) Close()

Shutdown and cleanup tracer.

func (*Tracer) Flags

func (tr *Tracer) Flags() tracer.Flag

Get tracer flags.

func (*Tracer) Id

func (tr *Tracer) Id() string

Get tracer id.

func (*Tracer) Init

func (tr *Tracer) Init() error

Initialize tracer

func (*Tracer) MergeOutput

func (tr *Tracer) MergeOutput(other tracer.Tracer, blockReq *tracer.BlockRequest) (time.Duration, error)

Merge accumulator output from another tracer into this tracer's buffer.

func (*Tracer) Speed

func (tr *Tracer) Speed() uint32

Get the computation speed estimate (in GFlops).

func (*Tracer) Stats

func (tr *Tracer) Stats() *tracer.Stats

Retrieve last frame statistics.

func (*Tracer) SyncFramebuffer

func (tr *Tracer) SyncFramebuffer(blockReq *tracer.BlockRequest) (time.Duration, error)

Run post-process filters and update the framebuffer with the processed output.

func (*Tracer) Trace

func (tr *Tracer) Trace(blockReq *tracer.BlockRequest) (time.Duration, error)

Process block request.

func (*Tracer) UpdateState

func (tr *Tracer) UpdateState(mode tracer.UpdateMode, changeType tracer.ChangeType, data interface{}) (time.Duration, error)

Update tracer state

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL