-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fedc52e
commit 6a5fc9c
Showing
15 changed files
with
73 additions
and
303 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package kha.graphics4; | ||
|
||
import haxe.io.Bytes; | ||
import kha.Blob; | ||
|
||
@:headerCode(" | ||
#include <kinc/graphics4/compute.h> | ||
") | ||
@:headerClassCode("kinc_g4_compute_shader shader;") | ||
class ComputeShader { | ||
public function new(sources: Array<Blob>, files: Array<String>) { | ||
init(sources[0], files[0]); | ||
} | ||
|
||
function init(source: Blob, file: String): Void { | ||
untyped __cpp__("kinc_g4_compute_shader_init(&shader, source->bytes->b->Pointer(), source->get_length());"); | ||
} | ||
|
||
public function delete(): Void { | ||
untyped __cpp__("kinc_g4_compute_shader_destroy(&shader);"); | ||
} | ||
|
||
public function getConstantLocation(name: String): ConstantLocation { | ||
var location = new kha.kore.graphics4.ConstantLocation(); | ||
initConstantLocation(location, name); | ||
return location; | ||
} | ||
|
||
@:functionCode("location->location = kinc_g4_compute_shader_get_constant_location(&shader, name.c_str());") | ||
function initConstantLocation(location: kha.kore.graphics4.ConstantLocation, name: String): Void {} | ||
|
||
public function getTextureUnit(name: String): TextureUnit { | ||
var unit = new kha.kore.graphics4.TextureUnit(); | ||
initTextureUnit(unit, name); | ||
return unit; | ||
} | ||
|
||
@:functionCode("unit->unit = kinc_g4_compute_shader_get_texture_unit(&shader, name.c_str());") | ||
function initTextureUnit(unit: kha.kore.graphics4.TextureUnit, name: String): Void {} | ||
|
||
@:keep | ||
function _forceInclude(): Void { | ||
Bytes.alloc(0); | ||
} | ||
} |
6 changes: 2 additions & 4 deletions
6
...-hxcpp/kha/compute/ShaderStorageBuffer.hx → ...xcpp/kha/graphics4/ShaderStorageBuffer.hx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
Sources/kha/compute/Shader.hx → Sources/kha/graphics4/ComputeShader.hx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kha.compute; | ||
package kha.graphics4; | ||
|
||
import kha.Blob; | ||
|
||
|
Oops, something went wrong.