File: deferred.h

package info (click to toggle)
ispc 1.28.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 97,620 kB
  • sloc: cpp: 77,067; python: 8,303; yacc: 3,337; lex: 1,126; ansic: 631; sh: 475; makefile: 17
file content (75 lines) | stat: -rw-r--r-- 1,537 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
  Copyright (c) 2011-2023, Intel Corporation

  SPDX-License-Identifier: BSD-3-Clause
*/

#ifndef DEFERRED_H
#define DEFERRED_H

// Currently tile widths must be a multiple of SIMD width (i.e. 8 for ispc sse4x2)!
#define MIN_TILE_WIDTH 16
#define MIN_TILE_HEIGHT 16
#define MAX_LIGHTS 1024

enum InputDataArraysEnum {
    idaZBuffer = 0,
    idaNormalEncoded_x,
    idaNormalEncoded_y,
    idaSpecularAmount,
    idaSpecularPower,
    idaAlbedo_x,
    idaAlbedo_y,
    idaAlbedo_z,
    idaLightPositionView_x,
    idaLightPositionView_y,
    idaLightPositionView_z,
    idaLightAttenuationBegin,
    idaLightColor_x,
    idaLightColor_y,
    idaLightColor_z,
    idaLightAttenuationEnd,

    idaNum
};

#ifndef ISPC

#include "kernels_ispc.h"
#include <stdint.h>

#define ALIGNMENT_BYTES 64

#define MAX_LIGHTS 1024

#define VISUALIZE_LIGHT_COUNT 0

struct InputData {
    ispc::InputHeader header;
    ispc::InputDataArrays arrays;
    uint8_t *chunk;
};

struct Framebuffer {
    Framebuffer(int width, int height);
    ~Framebuffer();

    void clear();

    uint8_t *r, *g, *b;

  private:
    int nPixels;
    Framebuffer(const Framebuffer &);
    Framebuffer &operator=(const Framebuffer *);
};

InputData *CreateInputDataFromFile(const char *path);
void DeleteInputData(InputData *input);
void WriteFrame(const char *filename, const InputData *input, const Framebuffer &framebuffer);
void InitDynamicC(InputData *input);
void DispatchDynamicC(InputData *input, Framebuffer *framebuffer);

#endif // !ISPC

#endif // DEFERRED_H