aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/compute/sk/SkContext_Compute.cpp
blob: 331fad6df4f7de171facc2accd11386981c76977 (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
 * Copyright 2016 Google Inc.
 *
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 *
 */

#include "SkContext_Compute.h"

//
//
//

//
//
//

#ifdef __cplusplus
extern "C" {
#endif

#ifdef __cplusplus
}
#endif

#define TARGET_PLATFORM_SUBSTRING   "TO BE SET"
#define TARGET_DEVICE_SUBSTRING     "TO BE SET"

//
//
//

//
//
//

SkContext_Compute::SkContext_Compute(GrGLInterface const * fInterface)
  : fInterface(fInterface)
{
  //
  // Make sure fInterface destruction occurs after compute
  //
  SkSafeRef(fInterface);

  skc_err err;

  //
  // CREATE A NEW SPINEL CONTEXT AND ATTACH TO WINDOW
  //
  err = skc_context_create(&context, TARGET_PLATFORM_SUBSTRING, TARGET_DEVICE_SUBSTRING);
  SKC_ERR_CHECK(err);

  //
  // CREATE A NEW REUSABLE INTEROP OBJECT
  //
  // interop = skc_interop_create(fInterface,1); TODO have this in skc.h

  //
  // CREATE A NEW REUSABLE SURFACE OBJECT
  //
  err = skc_surface_create(context,
			   interop,
			   &surface);
  SKC_ERR_CHECK(err);
}

//
//
//

SkContext_Compute::~SkContext_Compute()
{
  skc_err err;

  // dispose of surface
  err = skc_surface_dispose(surface);
  SKC_ERR_CHECK(err);

  // dispose of interop
  // skc_interop_dispose(interop); TODO have this in skc.h

  // dispose of context
  err = skc_context_release(context);
  SKC_ERR_CHECK(err);

  // unref GL interface
  SkSafeUnref(fInterface);
}

//
//
//