File: TextureDispatch.ispc

package info (click to toggle)
ospray 3.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,048 kB
  • sloc: cpp: 80,569; ansic: 951; sh: 805; makefile: 170; python: 69
file content (51 lines) | stat: -rw-r--r-- 1,166 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2022 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include "common/DifferentialGeometry.ih"
#include "texture/Texture.ih"
#include "texture/Texture2D.ih"
#include "texture/TextureVolume.ih"

OSPRAY_BEGIN_ISPC_NAMESPACE

SYCL_EXTERNAL vec4f Texture_dispatch_get(
    const uniform Texture *uniform self, const DifferentialGeometry &dg)
{
  switch (self->type) {
  case TEXTURE_TYPE_2D:
    return Texture2D_get(self, dg);
#ifdef OSPRAY_ENABLE_VOLUMES
  case TEXTURE_TYPE_VOLUME:
    return TextureVolume_get(self, dg);
#endif
  default:
#ifndef OSPRAY_TARGET_SYCL
    return self->get(self, dg);
#else
    break;
#endif
  }
  return make_vec4f(0.f);
}

SYCL_EXTERNAL vec3f Texture_dispatch_getNormal(
    const uniform Texture *const uniform self, const DifferentialGeometry &dg)
{
  switch (self->type) {
  case TEXTURE_TYPE_2D:
    return Texture2D_getNormal(self, dg);
#ifdef OSPRAY_ENABLE_VOLUMES
  case TEXTURE_TYPE_VOLUME:
    return TextureVolume_getNormal(self, dg);
#endif
  default:
#ifndef OSPRAY_TARGET_SYCL
    return self->getNormal(self, dg);
#else
    break;
#endif
  }
  return make_vec3f(0.f);
}

OSPRAY_END_ISPC_NAMESPACE