Clover Git
OpenCL 1.1 software implementation
Defines | Functions

sampler.cpp File Reference

OpenCL C image access functions. More...

#include "../memobject.h"
#include "../sampler.h"
#include "kernel.h"
#include "buffer.h"
#include "builtins.h"
#include <cstdlib>
#include <cmath>
#include <immintrin.h>
Include dependency graph for cpu/sampler.cpp:

Go to the source code of this file.

Defines

#define __has_builtin(x)   0
#define shuffle4(rs, a, b, x, y, z, w)   slow_shuffle4(rs, a, b, x, y, z, w)

Functions

static int clamp (int a, int b, int c)
static int min (int a, int b)
static int max (int a, int b)
static float frac (float x)
static float round (float x)
static bool handle_address_mode (Image2D *image, int &x, int &y, int &z, uint32_t sampler)
static void slow_shuffle4 (uint32_t *rs, uint32_t *a, uint32_t *b, int x, int y, int z, int w)
static void convert_to_format (void *dest, float *data, cl_channel_type type, unsigned int channels)
static void convert_from_format (float *data, void *source, cl_channel_type type, unsigned int channels)
static void convert_to_format (void *dest, int *data, cl_channel_type type, unsigned int channels)
static void convert_from_format (int32_t *data, void *source, cl_channel_type type, unsigned int channels)
static void convert_to_format (void *dest, uint32_t *data, cl_channel_type type, unsigned int channels)
static void convert_from_format (uint32_t *data, void *source, cl_channel_type type, unsigned int channels)
template<typename T >
static void vec4_scalar_mul (T *vec, float val)
template<typename T >
static void vec4_add (T *vec1, T *vec2)
static void swizzle (uint32_t *target, uint32_t *source, cl_channel_order order, bool reading, uint32_t t_max)
template<typename T >
uint32_t type_max_value ()
template<>
uint32_t type_max_value< float > ()
template<>
uint32_t type_max_value< int32_t > ()
template<>
uint32_t type_max_value< uint32_t > ()

Detailed Description

OpenCL C image access functions.

It is recommended to compile this file using Clang as it supports the __builtin_shufflevector() built-in function, providing SSE or NEON-accelerated code.

Definition in file cpu/sampler.cpp.


Define Documentation

#define __has_builtin (   x)    0

Definition at line 106 of file cpu/sampler.cpp.

#define shuffle4 (   rs,
  a,
  b,
  x,
  y,
  z,
 
)    slow_shuffle4(rs, a, b, x, y, z, w)

Definition at line 336 of file cpu/sampler.cpp.

Referenced by swizzle().


Function Documentation

static int clamp ( int  a,
int  b,
int  c 
) [static]

Definition at line 53 of file cpu/sampler.cpp.

Referenced by handle_address_mode().

static void convert_from_format ( float *  data,
void *  source,
cl_channel_type  type,
unsigned int  channels 
) [static]

Definition at line 145 of file cpu/sampler.cpp.

Referenced by Coal::CPUKernelWorkGroup::readImageImplI().

static void convert_from_format ( int32_t *  data,
void *  source,
cl_channel_type  type,
unsigned int  channels 
) [static]

Definition at line 193 of file cpu/sampler.cpp.

static void convert_from_format ( uint32_t *  data,
void *  source,
cl_channel_type  type,
unsigned int  channels 
) [static]

Definition at line 235 of file cpu/sampler.cpp.

static void convert_to_format ( void *  dest,
float *  data,
cl_channel_type  type,
unsigned int  channels 
) [static]

Definition at line 118 of file cpu/sampler.cpp.

Referenced by Coal::CPUKernelWorkGroup::writeImageImpl().

static void convert_to_format ( void *  dest,
int *  data,
cl_channel_type  type,
unsigned int  channels 
) [static]

Definition at line 172 of file cpu/sampler.cpp.

static void convert_to_format ( void *  dest,
uint32_t *  data,
cl_channel_type  type,
unsigned int  channels 
) [static]

Definition at line 214 of file cpu/sampler.cpp.

static float frac ( float  x) [static]

Definition at line 68 of file cpu/sampler.cpp.

Referenced by Coal::CPUKernelWorkGroup::readImageImplF().

static bool handle_address_mode ( Image2D image,
int &  x,
int &  y,
int &  z,
uint32_t  sampler 
) [static]
static int max ( int  a,
int  b 
) [static]

Definition at line 63 of file cpu/sampler.cpp.

Referenced by Coal::CPUKernelWorkGroup::readImageImplF().

static int min ( int  a,
int  b 
) [static]

Definition at line 58 of file cpu/sampler.cpp.

Referenced by Coal::CPUKernelWorkGroup::readImageImplF().

static float round ( float  x) [static]

Definition at line 73 of file cpu/sampler.cpp.

Referenced by Coal::CPUKernelWorkGroup::readImageImplF().

static void slow_shuffle4 ( uint32_t *  rs,
uint32_t *  a,
uint32_t *  b,
int  x,
int  y,
int  z,
int  w 
) [static]

Definition at line 109 of file cpu/sampler.cpp.

static void swizzle ( uint32_t *  target,
uint32_t *  source,
cl_channel_order  order,
bool  reading,
uint32_t  t_max 
) [static]
template<typename T >
uint32_t type_max_value ( )

Definition at line 473 of file cpu/sampler.cpp.

template<>
uint32_t type_max_value< float > ( )

Definition at line 479 of file cpu/sampler.cpp.

template<>
uint32_t type_max_value< int32_t > ( )

Definition at line 485 of file cpu/sampler.cpp.

template<>
uint32_t type_max_value< uint32_t > ( )

Definition at line 491 of file cpu/sampler.cpp.

template<typename T >
static void vec4_add ( T *  vec1,
T *  vec2 
) [static]
template<typename T >
static void vec4_scalar_mul ( T *  vec,
float  val 
) [static]
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines