diff --git a/Backends/HTML5/kha/graphics4/FragmentShader.hx b/Backends/HTML5/kha/graphics4/FragmentShader.hx
index 2cb89dead..9bbf2312f 100644
--- a/Backends/HTML5/kha/graphics4/FragmentShader.hx
+++ b/Backends/HTML5/kha/graphics4/FragmentShader.hx
@@ -12,4 +12,10 @@ class FragmentShader {
this.type = GL.FRAGMENT_SHADER;
this.shader = null;
}
+
+ public function delete(): Void {
+ SystemImpl.gl.deleteShader(shader);
+ shader = null;
+ source = null;
+ }
}
diff --git a/Backends/HTML5/kha/graphics4/IndexBuffer.hx b/Backends/HTML5/kha/graphics4/IndexBuffer.hx
index 064a82e66..8f1c8c8ee 100644
--- a/Backends/HTML5/kha/graphics4/IndexBuffer.hx
+++ b/Backends/HTML5/kha/graphics4/IndexBuffer.hx
@@ -17,6 +17,11 @@ class IndexBuffer {
data[indexCount - 1] = 0;
}
+ public function delete(): Void {
+ data = null;
+ SystemImpl.gl.deleteBuffer(buffer);
+ }
+
public function lock(): Array {
return data;
}
diff --git a/Backends/HTML5/kha/graphics4/PipelineState.hx b/Backends/HTML5/kha/graphics4/PipelineState.hx
index 99b92b1b2..ef89df7e4 100644
--- a/Backends/HTML5/kha/graphics4/PipelineState.hx
+++ b/Backends/HTML5/kha/graphics4/PipelineState.hx
@@ -17,6 +17,10 @@ class PipelineState extends PipelineStateBase {
textures = new Array();
textureValues = new Array();
}
+
+ public function delete(): Void {
+ SystemImpl.gl.deleteProgram(program);
+ }
public function compile(): Void {
compileShader(vertexShader);
diff --git a/Backends/HTML5/kha/graphics4/VertexShader.hx b/Backends/HTML5/kha/graphics4/VertexShader.hx
index db509d291..d9453744c 100644
--- a/Backends/HTML5/kha/graphics4/VertexShader.hx
+++ b/Backends/HTML5/kha/graphics4/VertexShader.hx
@@ -12,4 +12,10 @@ class VertexShader {
this.type = GL.VERTEX_SHADER;
this.shader = null;
}
+
+ public function delete(): Void {
+ SystemImpl.gl.deleteShader(shader);
+ shader = null;
+ source = null;
+ }
}
diff --git a/Backends/Kore/kha/capture/Audio.hx b/Backends/Kore/kha/capture/Audio.hx
new file mode 100644
index 000000000..6baa5d637
--- /dev/null
+++ b/Backends/Kore/kha/capture/Audio.hx
@@ -0,0 +1,11 @@
+package kha.capture;
+
+import kha.audio2.Buffer;
+
+class Audio {
+ public static var audioCallback: Int->Buffer->Void;
+
+ public static function init(initialized: Void->Void, error: Void->Void): Void {
+ error();
+ }
+}
diff --git a/Backends/Kore/kha/graphics4/FragmentShader.hx b/Backends/Kore/kha/graphics4/FragmentShader.hx
index 8cb3e12e4..e115b0945 100644
--- a/Backends/Kore/kha/graphics4/FragmentShader.hx
+++ b/Backends/Kore/kha/graphics4/FragmentShader.hx
@@ -17,18 +17,10 @@ import kha.Blob;
@:headerClassCode("Kore::Shader* shader;")
class FragmentShader {
public function new(source: Blob, file: String) {
- initFragmentShader(source);
- //cpp.vm.Gc.setFinalizer(this, cpp.Function.fromStaticFunction(destroy)); // TODO
+ untyped __cpp__('shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::FragmentShader);');
}
- @:void private static function destroy(shader: FragmentShader): Void {
- untyped __cpp__('delete shader->shader;');
- }
-
- @:functionCode("
- shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::FragmentShader);
- ")
- private function initFragmentShader(source: Blob): Void {
-
+ public function delete(): Void {
+ untyped __cpp__('delete shader->shader; shader->shader = nullptr;');
}
}
diff --git a/Backends/Kore/kha/graphics4/GeometryShader.hx b/Backends/Kore/kha/graphics4/GeometryShader.hx
index 2bba80315..fccc8b6bf 100644
--- a/Backends/Kore/kha/graphics4/GeometryShader.hx
+++ b/Backends/Kore/kha/graphics4/GeometryShader.hx
@@ -17,18 +17,10 @@ import kha.Blob;
@:headerClassCode("Kore::Shader* shader;")
class GeometryShader {
public function new(source: Blob) {
- initGeometryShader(source);
- //cpp.vm.Gc.setFinalizer(this, cpp.Function.fromStaticFunction(destroy)); // TODO
+ untyped __cpp__('shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::GeometryShader);');
}
- @:void private static function destroy(shader: GeometryShader): Void {
- untyped __cpp__('delete shader->shader;');
- }
-
- @:functionCode("
- shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::GeometryShader);
- ")
- private function initGeometryShader(source: Blob): Void {
-
+ public function delete(): Void {
+ untyped __cpp__('delete shader->shader; shader->shader = nullptr;');
}
}
diff --git a/Backends/Kore/kha/graphics4/IndexBuffer.hx b/Backends/Kore/kha/graphics4/IndexBuffer.hx
index 9d6ae1595..4ed01a280 100644
--- a/Backends/Kore/kha/graphics4/IndexBuffer.hx
+++ b/Backends/Kore/kha/graphics4/IndexBuffer.hx
@@ -14,14 +14,11 @@ class IndexBuffer {
myCount = indexCount;
data = new Array();
data[myCount - 1] = 0;
- init(indexCount);
+ untyped __cpp__('buffer = new Kore::IndexBuffer(indexCount);');
}
- @:functionCode('
- buffer = new Kore::IndexBuffer(count);
- ')
- private function init(count: Int) {
-
+ public function delete(): Void {
+ untyped __cpp__('delete buffer; buffer = nullptr;');
}
public function lock(): Array {
diff --git a/Backends/Kore/kha/graphics4/PipelineState.hx b/Backends/Kore/kha/graphics4/PipelineState.hx
index 8dea608f3..f067b249c 100644
--- a/Backends/Kore/kha/graphics4/PipelineState.hx
+++ b/Backends/Kore/kha/graphics4/PipelineState.hx
@@ -15,14 +15,11 @@ import kha.graphics4.VertexStructure;
class PipelineState extends PipelineStateBase {
public function new() {
super();
- init();
+ untyped __cpp__('program = new Kore::Program;');
}
- @:functionCode('
- program = new Kore::Program();
- ')
- private function init(): Void {
-
+ public function delete(): Void {
+ untyped __cpp__('delete program; program = nullptr;');
}
@:functionCode('
diff --git a/Backends/Kore/kha/graphics4/TesselationControlShader.hx b/Backends/Kore/kha/graphics4/TesselationControlShader.hx
index 39054a01a..77ed43ab6 100644
--- a/Backends/Kore/kha/graphics4/TesselationControlShader.hx
+++ b/Backends/Kore/kha/graphics4/TesselationControlShader.hx
@@ -17,18 +17,10 @@ import kha.Blob;
@:headerClassCode("Kore::Shader* shader;")
class TesselationControlShader {
public function new(source: Blob) {
- initTesselationControlShader(source);
- //cpp.vm.Gc.setFinalizer(this, cpp.Function.fromStaticFunction(destroy)); // TODO
+ untyped __cpp__('shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::TesselationControlShader);');
}
- @:void private static function destroy(shader: TesselationControlShader): Void {
- untyped __cpp__('delete shader->shader;');
- }
-
- @:functionCode("
- shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::TesselationControlShader);
- ")
- private function initTesselationControlShader(source: Blob): Void {
-
+ public function delete(): Void {
+ untyped __cpp__('delete shader->shader; shader->shader = nullptr;');
}
}
diff --git a/Backends/Kore/kha/graphics4/TesselationEvaluationShader.hx b/Backends/Kore/kha/graphics4/TesselationEvaluationShader.hx
index 0260b01ba..447e26bc6 100644
--- a/Backends/Kore/kha/graphics4/TesselationEvaluationShader.hx
+++ b/Backends/Kore/kha/graphics4/TesselationEvaluationShader.hx
@@ -17,18 +17,10 @@ import kha.Blob;
@:headerClassCode("Kore::Shader* shader;")
class TesselationEvaluationShader {
public function new(source: Blob) {
- initTesselationEvaluationShader(source);
- //cpp.vm.Gc.setFinalizer(this, cpp.Function.fromStaticFunction(destroy)); // TODO
+ untyped __cpp__('shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::TesselationEvaluationShader);');
}
- @:void private static function destroy(shader: TesselationEvaluationShader): Void {
- untyped __cpp__('delete shader->shader;');
- }
-
- @:functionCode("
- shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::TesselationEvaluationShader);
- ")
- private function initTesselationEvaluationShader(source: Blob): Void {
-
+ public function delete(): Void {
+ untyped __cpp__('delete shader->shader; shader->shader = nullptr;');
}
}
diff --git a/Backends/Kore/kha/graphics4/VertexBuffer.hx b/Backends/Kore/kha/graphics4/VertexBuffer.hx
index b1df3b6ad..89b675ad8 100644
--- a/Backends/Kore/kha/graphics4/VertexBuffer.hx
+++ b/Backends/Kore/kha/graphics4/VertexBuffer.hx
@@ -20,6 +20,10 @@ class VertexBuffer {
var a: VertexElement = new VertexElement("a", VertexData.Float2); //to generate include
}
+ public function delete(): Void {
+ untyped __cpp__('delete buffer; buffer = nullptr;');
+ }
+
@:functionCode("
Kore::VertexStructure structure2;
for (int i = 0; i < structure->size(); ++i) {
diff --git a/Backends/Kore/kha/graphics4/VertexShader.hx b/Backends/Kore/kha/graphics4/VertexShader.hx
index 34e000b42..57c1553de 100644
--- a/Backends/Kore/kha/graphics4/VertexShader.hx
+++ b/Backends/Kore/kha/graphics4/VertexShader.hx
@@ -17,18 +17,10 @@ import kha.Blob;
@:headerClassCode("Kore::Shader* shader;")
class VertexShader {
public function new(source: Blob, file: String) {
- initVertexShader(source);
- //cpp.vm.Gc.setFinalizer(this, cpp.Function.fromStaticFunction(destroy)); // TODO
+ untyped __cpp__('shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::VertexShader);');
}
- @:void private static function destroy(shader: VertexShader): Void {
- untyped __cpp__('delete shader->shader;');
- }
-
- @:functionCode("
- shader = new Kore::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::VertexShader);
- ")
- private function initVertexShader(source: Blob): Void {
-
+ public function delete(): Void {
+ untyped __cpp__('delete shader->shader; shader->shader = nullptr;');
}
}
diff --git a/Kore b/Kore
index 4fa673608..214be321f 160000
--- a/Kore
+++ b/Kore
@@ -1 +1 @@
-Subproject commit 4fa673608e06ac3a84b5410682cb97f3e2319c17
+Subproject commit 214be321f29776939fd258567234a5aa6342323a
diff --git a/Sources/kha/graphics4/FragmentShader.hx b/Sources/kha/graphics4/FragmentShader.hx
index d3317cc8b..36cc6cab4 100644
--- a/Sources/kha/graphics4/FragmentShader.hx
+++ b/Sources/kha/graphics4/FragmentShader.hx
@@ -4,4 +4,5 @@ import kha.Blob;
extern class FragmentShader {
public function new(source: Blob);
+ public function delete(): Void;
}
diff --git a/Sources/kha/graphics4/GeometryShader.hx b/Sources/kha/graphics4/GeometryShader.hx
index af5884e80..ccb6dede6 100644
--- a/Sources/kha/graphics4/GeometryShader.hx
+++ b/Sources/kha/graphics4/GeometryShader.hx
@@ -5,11 +5,16 @@ import kha.Blob;
#if cpp
extern class GeometryShader {
public function new(source: Blob);
+ public function delete(): Void;
}
#else
class GeometryShader {
public function new(source: Blob) {
}
+
+ public function delete(): Void {
+
+ }
}
#end
diff --git a/Sources/kha/graphics4/IndexBuffer.hx b/Sources/kha/graphics4/IndexBuffer.hx
index 54c58a70a..80cbe6321 100644
--- a/Sources/kha/graphics4/IndexBuffer.hx
+++ b/Sources/kha/graphics4/IndexBuffer.hx
@@ -2,6 +2,7 @@ package kha.graphics4;
extern class IndexBuffer {
public function new(indexCount: Int, usage: Usage, canRead: Bool = false);
+ public function delete(): Void;
public function lock(): Array;
public function unlock(): Void;
public function set(): Void;
diff --git a/Sources/kha/graphics4/PipelineState.hx b/Sources/kha/graphics4/PipelineState.hx
index c1ae2db09..f455fdef0 100644
--- a/Sources/kha/graphics4/PipelineState.hx
+++ b/Sources/kha/graphics4/PipelineState.hx
@@ -2,6 +2,7 @@ package kha.graphics4;
extern class PipelineState extends PipelineStateBase {
public function new();
+ public function delete(): Void;
public function compile(): Void;
public function getConstantLocation(name: String): ConstantLocation;
public function getTextureUnit(name: String): TextureUnit;
diff --git a/Sources/kha/graphics4/TesselationControlShader.hx b/Sources/kha/graphics4/TesselationControlShader.hx
index 000dc328b..87a7f6f73 100644
--- a/Sources/kha/graphics4/TesselationControlShader.hx
+++ b/Sources/kha/graphics4/TesselationControlShader.hx
@@ -5,11 +5,16 @@ import kha.Blob;
#if cpp
extern class TesselationControlShader {
public function new(source: Blob);
+ public function delete();
}
#else
class TesselationControlShader {
public function new(source: Blob) {
}
+
+ public function delete(): Void {
+
+ }
}
#end
diff --git a/Sources/kha/graphics4/TesselationEvaluationShader.hx b/Sources/kha/graphics4/TesselationEvaluationShader.hx
index d26d44913..d9ccb9490 100644
--- a/Sources/kha/graphics4/TesselationEvaluationShader.hx
+++ b/Sources/kha/graphics4/TesselationEvaluationShader.hx
@@ -5,11 +5,16 @@ import kha.Blob;
#if cpp
extern class TesselationEvaluationShader {
public function new(source: Blob);
+ public function delete();
}
#else
class TesselationEvaluationShader {
public function new(source: Blob) {
}
+
+ public function delete(): Void {
+
+ }
}
#end
diff --git a/Sources/kha/graphics4/VertexBuffer.hx b/Sources/kha/graphics4/VertexBuffer.hx
index 7e3e7ce90..420e0af5d 100644
--- a/Sources/kha/graphics4/VertexBuffer.hx
+++ b/Sources/kha/graphics4/VertexBuffer.hx
@@ -4,6 +4,7 @@ import kha.arrays.Float32Array;
extern class VertexBuffer {
public function new(vertexCount: Int, structure: VertexStructure, usage: Usage, instanceDataStepRate: Int = 0, canRead: Bool = false);
+ public function delete(): Void;
public function lock(?start: Int, ?count: Int): Float32Array;
public function unlock(): Void;
public function count(): Int;
diff --git a/Sources/kha/graphics4/VertexShader.hx b/Sources/kha/graphics4/VertexShader.hx
index 598d1e25f..8a7d753a0 100644
--- a/Sources/kha/graphics4/VertexShader.hx
+++ b/Sources/kha/graphics4/VertexShader.hx
@@ -4,4 +4,5 @@ import kha.Blob;
extern class VertexShader {
public function new(source: Blob);
+ public function delete(): Void;
}