forked from LeenkxTeam/LNXSDK
VOX_PATCH_2 + VOX_5
This commit is contained in:
@ -142,6 +142,8 @@ class Image implements Canvas implements Resource {
|
||||
return 5;
|
||||
case A16:
|
||||
return 7;
|
||||
case R32UI:
|
||||
return 8;
|
||||
default:
|
||||
return 1; // Grey8
|
||||
}
|
||||
|
||||
@ -234,6 +234,8 @@ class Image implements Canvas implements Resource {
|
||||
return 5;
|
||||
case A16:
|
||||
return 7;
|
||||
case R32UI:
|
||||
return 8;
|
||||
default:
|
||||
return 1; // Grey8
|
||||
}
|
||||
|
||||
@ -23,6 +23,7 @@ extern class Krom {
|
||||
static function setRenderTarget(stage: kha.graphics4.TextureUnit, renderTarget: Dynamic): Void;
|
||||
static function setTextureDepth(unit: kha.graphics4.TextureUnit, texture: Dynamic): Void;
|
||||
static function setImageTexture(stage: kha.graphics4.TextureUnit, texture: Dynamic): Void;
|
||||
static function setImageRenderTarget(stage: kha.graphics4.TextureUnit, renderTarget: Dynamic): Void;
|
||||
static function setTextureParameters(texunit: kha.graphics4.TextureUnit, uAddressing: Int, vAddressing: Int, minificationFilter: Int,
|
||||
magnificationFilter: Int, mipmapFilter: Int): Void;
|
||||
static function setTexture3DParameters(texunit: kha.graphics4.TextureUnit, uAddressing: Int, vAddressing: Int, wAddressing: Int, minificationFilter: Int,
|
||||
|
||||
@ -75,6 +75,8 @@ class Image implements Canvas implements Resource {
|
||||
return 5;
|
||||
case A16:
|
||||
return 7;
|
||||
case R32UI:
|
||||
return 8;
|
||||
default:
|
||||
return 1; // Grey8
|
||||
}
|
||||
@ -200,6 +202,7 @@ class Image implements Canvas implements Resource {
|
||||
case RGBA64: 8;
|
||||
case A32: 4;
|
||||
case A16: 2;
|
||||
case R32UI: 4;
|
||||
default: 4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ class Compute {
|
||||
public static function setSampledDepthTexture(unit: TextureUnit, texture: Image) {
|
||||
if (texture == null)
|
||||
return;
|
||||
Krom.setSampledDepthTextureCompute(unit, texture);
|
||||
Krom.setSampledDepthTextureCompute(unit, texture.renderTarget_);
|
||||
}
|
||||
|
||||
public static function setSampledCubeMap(unit: TextureUnit, cubeMap: CubeMap) {
|
||||
@ -118,7 +118,7 @@ class Compute {
|
||||
public static function setSampledDepthCubeMap(unit: TextureUnit, cubeMap: CubeMap) {
|
||||
if (cubeMap == null)
|
||||
return;
|
||||
Krom.setSampledDepthTextureCompute(unit, cubeMap);
|
||||
Krom.setSampledDepthTextureCompute(unit, cubeMap.renderTarget_);
|
||||
}
|
||||
|
||||
public static function setTextureParameters(unit: TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
|
||||
@ -9,14 +9,7 @@ class ShaderStorageBuffer {
|
||||
public function new(indexCount: Int, type: VertexData) {
|
||||
myCount = indexCount;
|
||||
data = new Array<Int>();
|
||||
data[myCount - 1] = 0;
|
||||
init(indexCount, type);
|
||||
}
|
||||
|
||||
function init(indexCount: Int, type: VertexData) {
|
||||
myCount = indexCount;
|
||||
data = new Array<Int>();
|
||||
data[myCount - 1] = 0;
|
||||
if (myCount > 0) data[myCount - 1] = 0;
|
||||
}
|
||||
|
||||
public function delete(): Void {}
|
||||
|
||||
@ -122,7 +122,12 @@ class Graphics implements kha.graphics4.Graphics {
|
||||
public function setImageTexture(unit: kha.graphics4.TextureUnit, texture: kha.Image): Void {
|
||||
if (texture == null)
|
||||
return;
|
||||
Krom.setImageTexture(unit, texture.texture_);
|
||||
if (texture.texture_ != null) {
|
||||
Krom.setImageTexture(unit, texture.texture_);
|
||||
}
|
||||
else if (texture.renderTarget_ != null) {
|
||||
Krom.setImageRenderTarget(unit, texture.renderTarget_);
|
||||
}
|
||||
}
|
||||
|
||||
public function setTextureParameters(texunit: kha.graphics4.TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
|
||||
@ -821,8 +821,19 @@ int kinc_g4_max_bound_textures(void) {
|
||||
return units;
|
||||
}
|
||||
|
||||
static int getUnitStage(kinc_g4_texture_unit_t unit) {
|
||||
for (int i = 0; i < KINC_G4_SHADER_TYPE_COUNT; ++i) {
|
||||
if (unit.stages[i] >= 0) {
|
||||
return unit.stages[i];
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void setTextureAddressingInternal(GLenum target, kinc_g4_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing) {
|
||||
glActiveTexture(GL_TEXTURE0 + unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
int stage = getUnitStage(unit);
|
||||
if (stage < 0) return;
|
||||
glActiveTexture(GL_TEXTURE0 + stage);
|
||||
GLenum texDir;
|
||||
switch (dir) {
|
||||
case KINC_G4_TEXTURE_DIRECTION_U:
|
||||
@ -841,39 +852,39 @@ static void setTextureAddressingInternal(GLenum target, kinc_g4_texture_unit_t u
|
||||
case KINC_G4_TEXTURE_ADDRESSING_CLAMP:
|
||||
glTexParameteri(target, texDir, GL_CLAMP_TO_EDGE);
|
||||
if (dir == KINC_G4_TEXTURE_DIRECTION_U) {
|
||||
texModesU[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_CLAMP_TO_EDGE;
|
||||
texModesU[stage] = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
else {
|
||||
texModesV[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_CLAMP_TO_EDGE;
|
||||
texModesV[stage] = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
break;
|
||||
case KINC_G4_TEXTURE_ADDRESSING_REPEAT:
|
||||
glTexParameteri(target, texDir, GL_REPEAT);
|
||||
if (dir == KINC_G4_TEXTURE_DIRECTION_U) {
|
||||
texModesU[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_REPEAT;
|
||||
texModesU[stage] = GL_REPEAT;
|
||||
}
|
||||
else {
|
||||
texModesV[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_REPEAT;
|
||||
texModesV[stage] = GL_REPEAT;
|
||||
}
|
||||
break;
|
||||
case KINC_G4_TEXTURE_ADDRESSING_BORDER:
|
||||
// unsupported
|
||||
glTexParameteri(target, texDir, GL_CLAMP_TO_EDGE);
|
||||
if (dir == KINC_G4_TEXTURE_DIRECTION_U) {
|
||||
texModesU[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_CLAMP_TO_EDGE;
|
||||
texModesU[stage] = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
else {
|
||||
texModesV[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_CLAMP_TO_EDGE;
|
||||
texModesV[stage] = GL_CLAMP_TO_EDGE;
|
||||
}
|
||||
break;
|
||||
case KINC_G4_TEXTURE_ADDRESSING_MIRROR:
|
||||
// unsupported
|
||||
glTexParameteri(target, texDir, GL_REPEAT);
|
||||
if (dir == KINC_G4_TEXTURE_DIRECTION_U) {
|
||||
texModesU[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_REPEAT;
|
||||
texModesU[stage] = GL_REPEAT;
|
||||
}
|
||||
else {
|
||||
texModesV[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = GL_REPEAT;
|
||||
texModesV[stage] = GL_REPEAT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -881,11 +892,15 @@ static void setTextureAddressingInternal(GLenum target, kinc_g4_texture_unit_t u
|
||||
}
|
||||
|
||||
int Kinc_G4_Internal_TextureAddressingU(kinc_g4_texture_unit_t unit) {
|
||||
return texModesU[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]];
|
||||
int stage = getUnitStage(unit);
|
||||
if (stage < 0) return GL_CLAMP_TO_EDGE;
|
||||
return texModesU[stage];
|
||||
}
|
||||
|
||||
int Kinc_G4_Internal_TextureAddressingV(kinc_g4_texture_unit_t unit) {
|
||||
return texModesV[unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]];
|
||||
int stage = getUnitStage(unit);
|
||||
if (stage < 0) return GL_CLAMP_TO_EDGE;
|
||||
return texModesV[stage];
|
||||
}
|
||||
|
||||
void kinc_g4_set_texture_addressing(kinc_g4_texture_unit_t unit, kinc_g4_texture_direction_t dir, kinc_g4_texture_addressing_t addressing) {
|
||||
@ -899,7 +914,9 @@ void kinc_g4_set_texture3d_addressing(kinc_g4_texture_unit_t unit, kinc_g4_textu
|
||||
}
|
||||
|
||||
static void setTextureMagnificationFilterInternal(GLenum target, kinc_g4_texture_unit_t texunit, kinc_g4_texture_filter_t filter) {
|
||||
glActiveTexture(GL_TEXTURE0 + texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
int stage = getUnitStage(texunit);
|
||||
if (stage < 0) return;
|
||||
glActiveTexture(GL_TEXTURE0 + stage);
|
||||
glCheckErrors();
|
||||
switch (filter) {
|
||||
case KINC_G4_TEXTURE_FILTER_POINT:
|
||||
@ -964,26 +981,34 @@ static void setMinMipFilters(GLenum target, int unit) {
|
||||
}
|
||||
|
||||
void kinc_g4_set_texture_minification_filter(kinc_g4_texture_unit_t texunit, kinc_g4_texture_filter_t filter) {
|
||||
minFilters[texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = filter;
|
||||
setMinMipFilters(GL_TEXTURE_2D, texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
int stage = getUnitStage(texunit);
|
||||
if (stage < 0) return;
|
||||
minFilters[stage] = filter;
|
||||
setMinMipFilters(GL_TEXTURE_2D, stage);
|
||||
}
|
||||
|
||||
void kinc_g4_set_texture3d_minification_filter(kinc_g4_texture_unit_t texunit, kinc_g4_texture_filter_t filter) {
|
||||
minFilters[texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = filter;
|
||||
int stage = getUnitStage(texunit);
|
||||
if (stage < 0) return;
|
||||
minFilters[stage] = filter;
|
||||
#ifndef KINC_OPENGL_ES
|
||||
setMinMipFilters(GL_TEXTURE_3D, texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
setMinMipFilters(GL_TEXTURE_3D, stage);
|
||||
#endif
|
||||
}
|
||||
|
||||
void kinc_g4_set_texture_mipmap_filter(kinc_g4_texture_unit_t texunit, kinc_g4_mipmap_filter_t filter) {
|
||||
mipFilters[texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = filter;
|
||||
setMinMipFilters(GL_TEXTURE_2D, texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
int stage = getUnitStage(texunit);
|
||||
if (stage < 0) return;
|
||||
mipFilters[stage] = filter;
|
||||
setMinMipFilters(GL_TEXTURE_2D, stage);
|
||||
}
|
||||
|
||||
void kinc_g4_set_texture3d_mipmap_filter(kinc_g4_texture_unit_t texunit, kinc_g4_mipmap_filter_t filter) {
|
||||
mipFilters[texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]] = filter;
|
||||
int stage = getUnitStage(texunit);
|
||||
if (stage < 0) return;
|
||||
mipFilters[stage] = filter;
|
||||
#ifndef KINC_OPENGL_ES
|
||||
setMinMipFilters(GL_TEXTURE_3D, texunit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
setMinMipFilters(GL_TEXTURE_3D, stage);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -190,6 +190,17 @@ void kinc_g4_set_compute_shader(kinc_g4_compute_shader *shader) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void kinc_g4_set_image_render_target(kinc_g4_texture_unit_t unit, kinc_g4_render_target_t *render_target) {
|
||||
#if defined(KINC_WINDOWS) || (defined(KINC_LINUX) && defined(GL_VERSION_4_4))
|
||||
for (int i = 0; i < KINC_G4_SHADER_TYPE_COUNT; ++i) {
|
||||
if (unit.stages[i] >= 0) {
|
||||
glBindImageTexture(unit.stages[i], render_target->impl._texture, 0, GL_FALSE, 0, GL_READ_WRITE, convertInternalRTFormat((kinc_g4_render_target_format_t)render_target->impl.format));
|
||||
}
|
||||
}
|
||||
glCheckErrors();
|
||||
#endif
|
||||
}
|
||||
|
||||
void kinc_g4_compute(int x, int y, int z) {
|
||||
#ifdef HAS_COMPUTE
|
||||
glDispatchCompute(x, y, z);
|
||||
|
||||
@ -360,17 +360,23 @@ void kinc_g4_render_target_destroy(kinc_g4_render_target_t *renderTarget) {
|
||||
}
|
||||
|
||||
void kinc_g4_render_target_use_color_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit) {
|
||||
glActiveTexture(GL_TEXTURE0 + unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
glCheckErrors();
|
||||
glBindTexture(renderTarget->isCubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, renderTarget->impl._texture);
|
||||
glCheckErrors();
|
||||
for (int i = 0; i < KINC_G4_SHADER_TYPE_COUNT; ++i) {
|
||||
if (unit.stages[i] >= 0) {
|
||||
glActiveTexture(GL_TEXTURE0 + unit.stages[i]);
|
||||
glBindTexture(renderTarget->isCubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, renderTarget->impl._texture);
|
||||
glCheckErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kinc_g4_render_target_use_depth_as_texture(kinc_g4_render_target_t *renderTarget, kinc_g4_texture_unit_t unit) {
|
||||
glActiveTexture(GL_TEXTURE0 + unit.stages[KINC_G4_SHADER_TYPE_FRAGMENT]);
|
||||
glCheckErrors();
|
||||
glBindTexture(renderTarget->isCubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, renderTarget->impl._depthTexture);
|
||||
glCheckErrors();
|
||||
for (int i = 0; i < KINC_G4_SHADER_TYPE_COUNT; ++i) {
|
||||
if (unit.stages[i] >= 0) {
|
||||
glActiveTexture(GL_TEXTURE0 + unit.stages[i]);
|
||||
glBindTexture(renderTarget->isCubeMap ? GL_TEXTURE_CUBE_MAP : GL_TEXTURE_2D, renderTarget->impl._depthTexture);
|
||||
glCheckErrors();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void kinc_g4_render_target_set_depth_stencil_from(kinc_g4_render_target_t *renderTarget, kinc_g4_render_target_t *source) {
|
||||
|
||||
@ -99,6 +99,8 @@ static int convertFormat(kinc_image_format_t format) {
|
||||
case KINC_IMAGE_FORMAT_A16:
|
||||
case KINC_IMAGE_FORMAT_GREY8:
|
||||
return GL_RED;
|
||||
case KINC_IMAGE_FORMAT_R32UI:
|
||||
return GL_RED_INTEGER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,6 +134,8 @@ static int convertInternalFormat(kinc_image_format_t format) {
|
||||
#else
|
||||
return GL_R8;
|
||||
#endif
|
||||
case KINC_IMAGE_FORMAT_R32UI:
|
||||
return GL_R32UI;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,6 +149,8 @@ static int convertType(kinc_image_format_t format) {
|
||||
case KINC_IMAGE_FORMAT_RGBA32:
|
||||
default:
|
||||
return GL_UNSIGNED_BYTE;
|
||||
case KINC_IMAGE_FORMAT_R32UI:
|
||||
return GL_UNSIGNED_INT;
|
||||
}
|
||||
}
|
||||
|
||||
@ -483,7 +489,7 @@ void kinc_g4_texture_init3d(kinc_g4_texture_t *texture, int width, int height, i
|
||||
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glCheckErrors();
|
||||
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, convertInternalFormat(format), width, height, depth, 0, convertFormat(format), GL_UNSIGNED_BYTE, NULL);
|
||||
glTexImage3D(GL_TEXTURE_3D, 0, convertInternalFormat(format), width, height, depth, 0, convertFormat(format), convertType(format), NULL);
|
||||
glCheckErrors();
|
||||
#endif
|
||||
}
|
||||
@ -523,8 +529,8 @@ void Kinc_G4_Internal_TextureSet(kinc_g4_texture_t *texture, kinc_g4_texture_uni
|
||||
#else
|
||||
glBindTexture(target, texture->impl.texture);
|
||||
glCheckErrors();
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, Kinc_G4_Internal_TextureAddressingU(unit));
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, Kinc_G4_Internal_TextureAddressingV(unit));
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_S, Kinc_G4_Internal_TextureAddressingU(unit));
|
||||
glTexParameteri(target, GL_TEXTURE_WRAP_T, Kinc_G4_Internal_TextureAddressingV(unit));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -532,7 +538,7 @@ void Kinc_G4_Internal_TextureImageSet(kinc_g4_texture_t *texture, kinc_g4_textur
|
||||
#if defined(KINC_WINDOWS) || (defined(KINC_LINUX) && defined(GL_VERSION_4_4))
|
||||
for (int i = 0; i < KINC_G4_SHADER_TYPE_COUNT; ++i) {
|
||||
if (unit.stages[i] >= 0) {
|
||||
glBindImageTexture(unit.stages[i], texture->impl.texture, 0, GL_FALSE, 0, GL_WRITE_ONLY, convertInternalFormat(texture->format));
|
||||
glBindImageTexture(unit.stages[i], texture->impl.texture, 0, GL_FALSE, 0, GL_READ_WRITE, convertInternalFormat(texture->format));
|
||||
}
|
||||
}
|
||||
glCheckErrors();
|
||||
|
||||
@ -392,6 +392,11 @@ void kinc_window_hide(int window_index) {
|
||||
UpdateWindow(windows[window_index].handle);
|
||||
}
|
||||
|
||||
void kinc_window_set_foreground(int window_index) {
|
||||
SetForegroundWindow(windows[window_index].handle);
|
||||
SetFocus(windows[window_index].handle);
|
||||
}
|
||||
|
||||
void kinc_window_set_title(int window_index, const char *title) {
|
||||
wchar_t buffer[1024];
|
||||
MultiByteToWideChar(CP_UTF8, 0, title, -1, buffer, 1024);
|
||||
|
||||
@ -376,6 +376,8 @@ KINC_FUNC void kinc_g4_set_texture(kinc_g4_texture_unit_t unit, struct kinc_g4_t
|
||||
/// <param name="texture">The texture to assign to the unit</param>
|
||||
KINC_FUNC void kinc_g4_set_image_texture(kinc_g4_texture_unit_t unit, struct kinc_g4_texture *texture);
|
||||
|
||||
KINC_FUNC void kinc_g4_set_image_render_target(kinc_g4_texture_unit_t unit, struct kinc_g4_render_target *render_target);
|
||||
|
||||
KINC_FUNC bool kinc_g4_init_occlusion_query(unsigned *occlusionQuery);
|
||||
|
||||
KINC_FUNC void kinc_g4_delete_occlusion_query(unsigned occlusionQuery);
|
||||
|
||||
@ -30,7 +30,8 @@ typedef enum kinc_image_format {
|
||||
KINC_IMAGE_FORMAT_RGBA64,
|
||||
KINC_IMAGE_FORMAT_A32,
|
||||
KINC_IMAGE_FORMAT_BGRA32,
|
||||
KINC_IMAGE_FORMAT_A16
|
||||
KINC_IMAGE_FORMAT_A16,
|
||||
KINC_IMAGE_FORMAT_R32UI
|
||||
} kinc_image_format_t;
|
||||
|
||||
typedef struct kinc_image {
|
||||
@ -608,6 +609,8 @@ int kinc_image_format_sizeof(kinc_image_format_t format) {
|
||||
return 1;
|
||||
case KINC_IMAGE_FORMAT_RGB24:
|
||||
return 3;
|
||||
case KINC_IMAGE_FORMAT_R32UI:
|
||||
return 4;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -139,6 +139,11 @@ KINC_FUNC void kinc_window_show(int window);
|
||||
/// </summary>
|
||||
KINC_FUNC void kinc_window_hide(int window);
|
||||
|
||||
/// <summary>
|
||||
/// Brings a window to the foreground and sets focus to it.
|
||||
/// </summary>
|
||||
KINC_FUNC void kinc_window_set_foreground(int window);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the title of a window.
|
||||
/// </summary>
|
||||
|
||||
7
Kha/Sources/kha/compute/Access.hx
Normal file
7
Kha/Sources/kha/compute/Access.hx
Normal file
@ -0,0 +1,7 @@
|
||||
package kha.compute;
|
||||
|
||||
enum abstract Access(Int) to Int {
|
||||
var Read = 0;
|
||||
var Write = 1;
|
||||
var ReadWrite = 2;
|
||||
}
|
||||
41
Kha/Sources/kha/compute/Compute.hx
Normal file
41
Kha/Sources/kha/compute/Compute.hx
Normal file
@ -0,0 +1,41 @@
|
||||
package kha.compute;
|
||||
|
||||
import kha.arrays.Float32Array;
|
||||
import kha.Image;
|
||||
import kha.FastFloat;
|
||||
import kha.math.FastMatrix3;
|
||||
import kha.math.FastMatrix4;
|
||||
import kha.math.FastVector2;
|
||||
import kha.math.FastVector3;
|
||||
import kha.math.FastVector4;
|
||||
import kha.graphics4.CubeMap;
|
||||
import kha.graphics4.TextureAddressing;
|
||||
import kha.graphics4.TextureFilter;
|
||||
import kha.graphics4.MipMapFilter;
|
||||
|
||||
extern class Compute {
|
||||
public static function setBool(location: ConstantLocation, value: Bool): Void;
|
||||
public static function setInt(location: ConstantLocation, value: Int): Void;
|
||||
public static function setFloat(location: ConstantLocation, value: FastFloat): Void;
|
||||
public static function setFloat2(location: ConstantLocation, value1: FastFloat, value2: FastFloat): Void;
|
||||
public static function setFloat3(location: ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat): Void;
|
||||
public static function setFloat4(location: ConstantLocation, value1: FastFloat, value2: FastFloat, value3: FastFloat, value4: FastFloat): Void;
|
||||
public static function setFloats(location: ConstantLocation, values: Float32Array): Void;
|
||||
public static function setVector2(location: ConstantLocation, value: FastVector2): Void;
|
||||
public static function setVector3(location: ConstantLocation, value: FastVector3): Void;
|
||||
public static function setVector4(location: ConstantLocation, value: FastVector4): Void;
|
||||
public static function setMatrix(location: ConstantLocation, value: FastMatrix4): Void;
|
||||
public static function setMatrix3(location: ConstantLocation, value: FastMatrix3): Void;
|
||||
public static function setBuffer(buffer: ShaderStorageBuffer, index: Int): Void;
|
||||
public static function setTexture(unit: TextureUnit, texture: Image, access: Access): Void;
|
||||
public static function setSampledTexture(unit: TextureUnit, texture: Image): Void;
|
||||
public static function setSampledDepthTexture(unit: TextureUnit, texture: Image): Void;
|
||||
public static function setSampledCubeMap(unit: TextureUnit, cubeMap: CubeMap): Void;
|
||||
public static function setSampledDepthCubeMap(unit: TextureUnit, cubeMap: CubeMap): Void;
|
||||
public static function setTextureParameters(unit: TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void;
|
||||
public static function setTexture3DParameters(unit: TextureUnit, uAddressing: TextureAddressing, vAddressing: TextureAddressing,
|
||||
wAddressing: TextureAddressing, minificationFilter: TextureFilter, magnificationFilter: TextureFilter, mipmapFilter: MipMapFilter): Void;
|
||||
public static function setShader(shader: Shader): Void;
|
||||
public static function compute(x: Int, y: Int, z: Int): Void;
|
||||
}
|
||||
3
Kha/Sources/kha/compute/ConstantLocation.hx
Normal file
3
Kha/Sources/kha/compute/ConstantLocation.hx
Normal file
@ -0,0 +1,3 @@
|
||||
package kha.compute;
|
||||
|
||||
interface ConstantLocation {}
|
||||
10
Kha/Sources/kha/compute/Shader.hx
Normal file
10
Kha/Sources/kha/compute/Shader.hx
Normal file
@ -0,0 +1,10 @@
|
||||
package kha.compute;
|
||||
|
||||
import kha.Blob;
|
||||
|
||||
extern class Shader {
|
||||
public function new(sources: Array<Blob>, files: Array<String>);
|
||||
public function delete(): Void;
|
||||
public function getConstantLocation(name: String): ConstantLocation;
|
||||
public function getTextureUnit(name: String): TextureUnit;
|
||||
}
|
||||
12
Kha/Sources/kha/compute/ShaderStorageBuffer.hx
Normal file
12
Kha/Sources/kha/compute/ShaderStorageBuffer.hx
Normal file
@ -0,0 +1,12 @@
|
||||
package kha.compute;
|
||||
|
||||
import kha.graphics4.VertexData;
|
||||
|
||||
extern class ShaderStorageBuffer {
|
||||
public function new(indexCount: Int, type: VertexData);
|
||||
public function delete(): Void;
|
||||
public function lock(): Array<Int>;
|
||||
public function unlock(): Void;
|
||||
public function set(): Void;
|
||||
public function count(): Int;
|
||||
}
|
||||
3
Kha/Sources/kha/compute/TextureUnit.hx
Normal file
3
Kha/Sources/kha/compute/TextureUnit.hx
Normal file
@ -0,0 +1,3 @@
|
||||
package kha.compute;
|
||||
|
||||
interface TextureUnit {}
|
||||
@ -8,4 +8,5 @@ enum abstract TextureFormat(Int) to Int {
|
||||
var RGBA64 = 4; // Half floats
|
||||
var A32 = 5; // Float
|
||||
var A16 = 6; // Half float
|
||||
var R32UI = 7; // Unsigned 32-bit integer
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user