Do not batch for now
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
P: float4x4;
|
||||
pos: float4; // xywh
|
||||
tex: float4; // xywh
|
||||
col: float4;
|
||||
};
|
||||
|
||||
#[set(everything)]
|
||||
@@ -11,9 +14,7 @@ const tex: tex2d;
|
||||
const sampler_linear: sampler;
|
||||
|
||||
struct vert_in {
|
||||
pos: float3;
|
||||
tex: float2;
|
||||
col: float4;
|
||||
pos: float2;
|
||||
}
|
||||
|
||||
struct vert_out {
|
||||
@@ -24,9 +25,12 @@ struct vert_out {
|
||||
|
||||
fun draw_image_vert(input: vert_in): vert_out {
|
||||
var output: vert_out;
|
||||
output.pos = constants.P * float4(input.pos, 1.0);
|
||||
output.tex = input.tex;
|
||||
output.col = input.col;
|
||||
output.pos = float4(input.pos, 0.0, 1.0);
|
||||
output.pos.xy = output.pos.xy * constants.pos.zw + constants.pos.xy;
|
||||
output.pos.xy = output.pos.xy * 2.0 - 1.0;
|
||||
output.pos.y = -output.pos.y;
|
||||
output.tex = input.pos * constants.tex.zw + constants.tex.xy;
|
||||
output.col = constants.col;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
P: float4x4;
|
||||
pos: float4; // xywh
|
||||
col: float4;
|
||||
};
|
||||
|
||||
struct vert_in {
|
||||
pos: float3;
|
||||
col: float4;
|
||||
pos: float2;
|
||||
}
|
||||
|
||||
struct vert_out {
|
||||
@@ -16,8 +17,11 @@ struct vert_out {
|
||||
|
||||
fun draw_colored_vert(input: vert_in): vert_out {
|
||||
var output: vert_out;
|
||||
output.pos = constants.P * float4(input.pos, 1.0);
|
||||
output.col = input.col;
|
||||
output.pos = float4(input.pos, 0.0, 1.0);
|
||||
output.pos.xy = output.pos.xy * constants.pos.zw + constants.pos.xy;
|
||||
output.pos.xy = output.pos.xy * 2.0 - 1.0;
|
||||
output.pos.y = -output.pos.y;
|
||||
output.col = constants.col;
|
||||
return output;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
P: float4x4;
|
||||
pos: float4; // xywh
|
||||
tex: float4; // xywh
|
||||
col: float4;
|
||||
};
|
||||
|
||||
#[set(everything)]
|
||||
@@ -11,9 +14,7 @@ const tex: tex2d;
|
||||
const sampler_linear: sampler;
|
||||
|
||||
struct vert_in {
|
||||
pos: float3;
|
||||
tex: float2;
|
||||
col: float4;
|
||||
pos: float2;
|
||||
}
|
||||
|
||||
struct vert_out {
|
||||
@@ -24,9 +25,12 @@ struct vert_out {
|
||||
|
||||
fun draw_text_vert(input: vert_in): vert_out {
|
||||
var output: vert_out;
|
||||
output.pos = constants.P * float4(input.pos, 1.0);
|
||||
output.tex = input.tex;
|
||||
output.col = input.col;
|
||||
output.pos = float4(input.pos, 0.0, 1.0);
|
||||
output.pos.xy = output.pos.xy * constants.pos.zw + constants.pos.xy;
|
||||
output.pos.xy = output.pos.xy * 2.0 - 1.0;
|
||||
output.pos.y = -output.pos.y;
|
||||
output.tex = input.pos * constants.tex.zw + constants.tex.xy;
|
||||
output.col = constants.col;
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
#[set(everything)]
|
||||
const constants: {
|
||||
P: float4x4;
|
||||
pos0: float2;
|
||||
pos1: float2;
|
||||
pos2: float2;
|
||||
col: float4;
|
||||
};
|
||||
|
||||
struct vert_in {
|
||||
pos: float2;
|
||||
}
|
||||
|
||||
struct vert_out {
|
||||
pos: float4;
|
||||
col: float4;
|
||||
}
|
||||
|
||||
fun draw_tris_vert(input: vert_in): vert_out {
|
||||
var output: vert_out;
|
||||
if (vertex_id() == 0) {
|
||||
output.pos = float4(constants.pos0, 0.0, 1.0);
|
||||
}
|
||||
else if (vertex_id() == 1) {
|
||||
output.pos = float4(constants.pos1, 0.0, 1.0);
|
||||
}
|
||||
else if (vertex_id() == 2) {
|
||||
output.pos = float4(constants.pos2, 0.0, 1.0);
|
||||
}
|
||||
output.pos.xy = output.pos.xy * 2.0 - 1.0;
|
||||
output.pos.y = -output.pos.y;
|
||||
output.col = constants.col;
|
||||
return output;
|
||||
}
|
||||
|
||||
fun draw_tris_frag(input: vert_out): float4 {
|
||||
return input.col;
|
||||
}
|
||||
|
||||
#[pipe]
|
||||
struct pipe {
|
||||
vertex = draw_tris_vert;
|
||||
fragment = draw_tris_frag;
|
||||
}
|
||||
@@ -1498,6 +1498,7 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *render_target, ir
|
||||
}
|
||||
|
||||
void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, bool gpuMemory) {
|
||||
buffer->myCount = count;
|
||||
buffer->impl.myCount = count;
|
||||
|
||||
buffer->impl.myStride = 0;
|
||||
|
||||
@@ -3272,6 +3272,7 @@ void iron_gpu_render_target_set_depth_from(iron_gpu_texture_t *target, iron_gpu_
|
||||
}
|
||||
|
||||
void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int vertexCount, iron_gpu_vertex_structure_t *structure, bool gpuMemory) {
|
||||
buffer->myCount = count;
|
||||
buffer->impl.myCount = vertexCount;
|
||||
buffer->impl.myStride = 0;
|
||||
for (int i = 0; i < structure->size; ++i) {
|
||||
|
||||
@@ -68,6 +68,7 @@ extern WGPUDevice device;
|
||||
iron_gpu_buffer_t *iron_gpu_internal_current_vertex_buffer = NULL;
|
||||
|
||||
void iron_gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, bool gpuMemory) {
|
||||
buffer->myCount = count;
|
||||
buffer->impl.count = count;
|
||||
buffer->impl.stride = 0;
|
||||
for (int i = 0; i < structure->size; ++i) {
|
||||
|
||||
+2
-7
@@ -957,13 +957,8 @@ buffer_t *gpu_lock_vertex_buffer(iron_gpu_buffer_t *buffer) {
|
||||
return b;
|
||||
}
|
||||
|
||||
void gpu_draw_indexed_vertices(i32 start, i32 count) {
|
||||
if (count < 0) {
|
||||
iron_gpu_draw_indexed_vertices();
|
||||
}
|
||||
else {
|
||||
iron_gpu_draw_indexed_vertices_from_to(start, count);
|
||||
}
|
||||
void gpu_draw_indexed_vertices() {
|
||||
iron_gpu_draw_indexed_vertices();
|
||||
}
|
||||
|
||||
iron_gpu_shader_t *gpu_create_shader(buffer_t *data, i32 shader_type) {
|
||||
|
||||
+198
-601
File diff suppressed because it is too large
Load Diff
@@ -26,16 +26,12 @@ typedef struct draw_font {
|
||||
int index;
|
||||
} draw_font_t;
|
||||
|
||||
void draw_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *colored_vert, buffer_t *colored_frag, buffer_t *text_vert, buffer_t *text_frag);
|
||||
void draw_init(buffer_t *image_vert, buffer_t *image_frag, buffer_t *rect_vert, buffer_t *rect_frag, buffer_t *tris_vert, buffer_t *tris_frag, buffer_t *text_vert, buffer_t *text_frag);
|
||||
void draw_begin(iron_gpu_texture_t *target);
|
||||
void draw_scaled_sub_image(iron_gpu_texture_t *img, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
|
||||
void draw_scaled_sub_texture(iron_gpu_texture_t *tex, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh);
|
||||
void draw_scaled_image(iron_gpu_texture_t *tex, float dx, float dy, float dw, float dh);
|
||||
void draw_sub_image(iron_gpu_texture_t *tex, float sx, float sy, float sw, float sh, float x, float y);
|
||||
void draw_image(iron_gpu_texture_t *tex, float x, float y);
|
||||
void draw_scaled_texture(iron_gpu_texture_t *tex, float dx, float dy, float dw, float dh);
|
||||
void draw_sub_texture(iron_gpu_texture_t *tex, float sx, float sy, float sw, float sh, float x, float y);
|
||||
void draw_texture(iron_gpu_texture_t *tex, float x, float y);
|
||||
void draw_filled_triangle(float x0, float y0, float x1, float y1, float x2, float y2);
|
||||
void draw_filled_rect(float x, float y, float width, float height);
|
||||
void draw_rect(float x, float y, float width, float height, float strength);
|
||||
|
||||
+14
-48
@@ -7,7 +7,7 @@
|
||||
#include "iron_file.h"
|
||||
|
||||
#define CONSTANT_BUFFER_SIZE 256
|
||||
#define CONSTANT_BUFFER_MULTIPLE 1024
|
||||
#define CONSTANT_BUFFER_MULTIPLE 10240
|
||||
#define FRAMEBUFFER_COUNT 2
|
||||
#define MAX_TEXTURES 16
|
||||
|
||||
@@ -17,7 +17,6 @@ static int constantBufferIndex = 0;
|
||||
static int window_currentBuffer;
|
||||
static iron_gpu_texture_t window_framebuffers[FRAMEBUFFER_COUNT];
|
||||
static iron_gpu_texture_t *window_current_render_targets[8];
|
||||
static int window_current_render_target_count;
|
||||
static bool window_resized = false;
|
||||
|
||||
void iron_gpu_internal_resize(int width, int height) {
|
||||
@@ -34,46 +33,30 @@ void gpu_internal_init_window(int depthBufferBits, bool vsync) {
|
||||
iron_gpu_constant_buffer_init(&vertexConstantBuffer, CONSTANT_BUFFER_SIZE * CONSTANT_BUFFER_MULTIPLE);
|
||||
}
|
||||
|
||||
static void iron_internal_start_draw() {
|
||||
void iron_gpu_draw_indexed_vertices(void) {
|
||||
iron_gpu_constant_buffer_unlock(&vertexConstantBuffer);
|
||||
iron_gpu_command_list_set_constant_buffer(&commandList, &vertexConstantBuffer, constantBufferIndex * CONSTANT_BUFFER_SIZE, CONSTANT_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
static void iron_internal_end_draw() {
|
||||
iron_gpu_command_list_set_constant_buffer(&commandList, &vertexConstantBuffer, constantBufferIndex * CONSTANT_BUFFER_SIZE, CONSTANT_BUFFER_SIZE);\
|
||||
iron_gpu_command_list_draw_indexed_vertices(&commandList);
|
||||
++constantBufferIndex;
|
||||
iron_gpu_constant_buffer_lock(&vertexConstantBuffer, constantBufferIndex * CONSTANT_BUFFER_SIZE, CONSTANT_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
void iron_gpu_draw_indexed_vertices(void) {
|
||||
iron_internal_start_draw();
|
||||
iron_gpu_command_list_draw_indexed_vertices(&commandList);
|
||||
iron_internal_end_draw();
|
||||
}
|
||||
|
||||
void iron_gpu_draw_indexed_vertices_from_to(int start, int count) {
|
||||
iron_internal_start_draw();
|
||||
iron_gpu_command_list_draw_indexed_vertices_from_to(&commandList, start, count);
|
||||
iron_internal_end_draw();
|
||||
}
|
||||
|
||||
void iron_gpu_clear(unsigned color, float depth, unsigned flags) {
|
||||
if (window_current_render_target_count > 0) {
|
||||
if (window_current_render_targets[0] == NULL) {
|
||||
iron_gpu_command_list_clear(&commandList, &window_framebuffers[window_currentBuffer], flags, color, depth);
|
||||
}
|
||||
else {
|
||||
if (window_current_render_targets[0]->state != IRON_INTERNAL_RENDER_TARGET_STATE_RENDER_TARGET) {
|
||||
iron_gpu_command_list_texture_to_render_target_barrier(&commandList, window_current_render_targets[0]);
|
||||
window_current_render_targets[0]->state = IRON_INTERNAL_RENDER_TARGET_STATE_RENDER_TARGET;
|
||||
}
|
||||
iron_gpu_command_list_clear(&commandList, window_current_render_targets[0], flags, color, depth);
|
||||
if (window_current_render_targets[0] == NULL) {
|
||||
iron_gpu_command_list_clear(&commandList, &window_framebuffers[window_currentBuffer], flags, color, depth);
|
||||
}
|
||||
else {
|
||||
if (window_current_render_targets[0]->state != IRON_INTERNAL_RENDER_TARGET_STATE_RENDER_TARGET) {
|
||||
iron_gpu_command_list_texture_to_render_target_barrier(&commandList, window_current_render_targets[0]);
|
||||
window_current_render_targets[0]->state = IRON_INTERNAL_RENDER_TARGET_STATE_RENDER_TARGET;
|
||||
}
|
||||
iron_gpu_command_list_clear(&commandList, window_current_render_targets[0], flags, color, depth);
|
||||
}
|
||||
}
|
||||
|
||||
void gpu_begin() {
|
||||
constantBufferIndex = 0;
|
||||
iron_gpu_constant_buffer_lock(&vertexConstantBuffer, 0, CONSTANT_BUFFER_SIZE);
|
||||
iron_gpu_constant_buffer_lock(&vertexConstantBuffer, constantBufferIndex, CONSTANT_BUFFER_SIZE);
|
||||
|
||||
window_currentBuffer = (window_currentBuffer + 1) % FRAMEBUFFER_COUNT;
|
||||
|
||||
@@ -94,7 +77,6 @@ void gpu_begin() {
|
||||
// }
|
||||
|
||||
window_current_render_targets[0] = NULL;
|
||||
window_current_render_target_count = 1;
|
||||
iron_gpu_command_list_begin(&commandList);
|
||||
iron_gpu_command_list_framebuffer_to_render_target_barrier(&commandList, &window_framebuffers[window_currentBuffer]);
|
||||
gpu_restore_render_target();
|
||||
@@ -236,7 +218,6 @@ void gpu_restore_render_target(void) {
|
||||
window_current_render_targets[0] = NULL;
|
||||
iron_gpu_texture_t *render_target = &window_framebuffers[window_currentBuffer];
|
||||
iron_gpu_command_list_set_render_targets(&commandList, &render_target, 1);
|
||||
window_current_render_target_count = 1;
|
||||
}
|
||||
|
||||
void gpu_set_render_targets(iron_gpu_texture_t **targets, int count) {
|
||||
@@ -247,12 +228,7 @@ void gpu_set_render_targets(iron_gpu_texture_t **targets, int count) {
|
||||
window_current_render_targets[i]->state = IRON_INTERNAL_RENDER_TARGET_STATE_RENDER_TARGET;
|
||||
}
|
||||
}
|
||||
window_current_render_target_count = count;
|
||||
iron_gpu_texture_t *render_targets[16];
|
||||
for (int i = 0; i < count; ++i) {
|
||||
render_targets[i] = targets[i];
|
||||
}
|
||||
iron_gpu_command_list_set_render_targets(&commandList, render_targets, count);
|
||||
iron_gpu_command_list_set_render_targets(&commandList, window_current_render_targets, count);
|
||||
}
|
||||
|
||||
void gpu_set_vertex_buffer(iron_gpu_buffer_t *buffer) {
|
||||
@@ -296,11 +272,6 @@ void gpu_index_buffer_unlock_all(iron_gpu_buffer_t *buffer) {
|
||||
iron_gpu_command_list_upload_index_buffer(&commandList, buffer);
|
||||
}
|
||||
|
||||
void gpu_index_buffer_unlock(iron_gpu_buffer_t *buffer, int count) {
|
||||
iron_gpu_index_buffer_unlock(buffer, count);
|
||||
iron_gpu_command_list_upload_index_buffer(&commandList, buffer);
|
||||
}
|
||||
|
||||
void iron_gpu_vertex_structure_init(iron_gpu_vertex_structure_t *structure) {
|
||||
structure->size = 0;
|
||||
}
|
||||
@@ -312,7 +283,6 @@ void iron_gpu_vertex_structure_add(iron_gpu_vertex_structure_t *structure, const
|
||||
}
|
||||
|
||||
void gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, gpu_usage_t usage) {
|
||||
buffer->myCount = count;
|
||||
iron_gpu_vertex_buffer_init(buffer, count, structure, usage == GPU_USAGE_STATIC);
|
||||
}
|
||||
|
||||
@@ -320,10 +290,6 @@ float *gpu_vertex_buffer_lock_all(iron_gpu_buffer_t *buffer) {
|
||||
return iron_gpu_vertex_buffer_lock_all(buffer);
|
||||
}
|
||||
|
||||
float *gpu_vertex_buffer_lock(iron_gpu_buffer_t *buffer, int start, int count) {
|
||||
return iron_gpu_vertex_buffer_lock(buffer, start, count);
|
||||
}
|
||||
|
||||
void iron_gpu_internal_pipeline_init(iron_gpu_pipeline_t *pipe) {
|
||||
pipe->input_layout = NULL;
|
||||
pipe->vertex_shader = NULL;
|
||||
|
||||
@@ -186,7 +186,6 @@ void gpu_viewport(int x, int y, int width, int height);
|
||||
void gpu_scissor(int x, int y, int width, int height);
|
||||
void gpu_disable_scissor(void);
|
||||
void iron_gpu_draw_indexed_vertices(void);
|
||||
void iron_gpu_draw_indexed_vertices_from_to(int start, int count);
|
||||
void iron_gpu_set_pipeline(struct iron_gpu_pipeline *pipeline);
|
||||
void gpu_set_int(struct iron_gpu_constant_location *location, int value);
|
||||
void gpu_set_int2(struct iron_gpu_constant_location *location, int value1, int value2);
|
||||
@@ -208,7 +207,6 @@ void gpu_set_index_buffer(iron_gpu_buffer_t *buffer);
|
||||
void gpu_internal_init_window(int depth_buffer_bits, bool vsync);
|
||||
void gpu_set_texture_depth(struct iron_gpu_texture_unit *unit, struct iron_gpu_texture *renderTarget);
|
||||
void gpu_index_buffer_unlock_all(iron_gpu_buffer_t *buffer);
|
||||
void gpu_index_buffer_unlock(iron_gpu_buffer_t *buffer, int count);
|
||||
|
||||
void iron_gpu_vertex_structure_init(iron_gpu_vertex_structure_t *structure);
|
||||
void iron_gpu_vertex_structure_add(iron_gpu_vertex_structure_t *structure, const char *name, iron_gpu_vertex_data_t data);
|
||||
@@ -232,7 +230,6 @@ int iron_gpu_vertex_buffer_stride(iron_gpu_buffer_t *buffer);
|
||||
int iron_gpu_internal_vertex_buffer_set(iron_gpu_buffer_t *buffer);
|
||||
void gpu_vertex_buffer_init(iron_gpu_buffer_t *buffer, int count, iron_gpu_vertex_structure_t *structure, gpu_usage_t usage);
|
||||
float *gpu_vertex_buffer_lock_all(iron_gpu_buffer_t *buffer);
|
||||
float *gpu_vertex_buffer_lock(iron_gpu_buffer_t *buffer, int start, int count);
|
||||
void gpu_set_vertex_buffer(iron_gpu_buffer_t *buffer);
|
||||
void iron_gpu_constant_buffer_init(iron_gpu_buffer_t *buffer, int size);
|
||||
void iron_gpu_constant_buffer_destroy(iron_gpu_buffer_t *buffer);
|
||||
|
||||
@@ -43,6 +43,19 @@ mat3_t mat3_rotation(float alpha) {
|
||||
);
|
||||
}
|
||||
|
||||
mat3_t mat3_scale(mat3_t m, vec4_t v) {
|
||||
m.m[0] *= v.x;
|
||||
m.m[1] *= v.x;
|
||||
m.m[2] *= v.x;
|
||||
m.m[3] *= v.y;
|
||||
m.m[4] *= v.y;
|
||||
m.m[5] *= v.y;
|
||||
m.m[6] *= v.z;
|
||||
m.m[7] *= v.z;
|
||||
m.m[8] *= v.z;
|
||||
return m;
|
||||
}
|
||||
|
||||
mat3_t mat3_set_from4(mat4_t m4) {
|
||||
mat3_t m;
|
||||
m.m[0] = m4.m[0];
|
||||
|
||||
@@ -9,6 +9,7 @@ mat3_t mat3_create(float _00, float _10, float _20,
|
||||
mat3_t mat3_identity();
|
||||
mat3_t mat3_translation(float x, float y);
|
||||
mat3_t mat3_rotation(float alpha);
|
||||
mat3_t mat3_scale(mat3_t m, vec4_t v);
|
||||
mat3_t mat3_set_from4(mat4_t m4);
|
||||
mat3_t mat3_multmat(mat3_t a, mat3_t b);
|
||||
mat3_t mat3_nan();
|
||||
|
||||
+20
-20
@@ -203,10 +203,10 @@ void ui_draw_rect(bool fill, float x, float y, float w, float h) {
|
||||
if (theme->ROUND_CORNERS && current->enabled && r > 0 && w >= r * 2.0) {
|
||||
y -= 1; // Make it pixel perfect with non-round draw
|
||||
h += 1;
|
||||
draw_scaled_texture(¤t->filled_round_corner_image, x, y, r, r);
|
||||
draw_scaled_texture(¤t->filled_round_corner_image, x, y + h, r, -r);
|
||||
draw_scaled_texture(¤t->filled_round_corner_image, x + w, y, -r, r);
|
||||
draw_scaled_texture(¤t->filled_round_corner_image, x + w, y + h, -r, -r);
|
||||
draw_scaled_image(¤t->filled_round_corner_image, x, y, r, r);
|
||||
draw_scaled_image(¤t->filled_round_corner_image, x, y + h, r, -r);
|
||||
draw_scaled_image(¤t->filled_round_corner_image, x + w, y, -r, r);
|
||||
draw_scaled_image(¤t->filled_round_corner_image, x + w, y + h, -r, -r);
|
||||
draw_filled_rect(x + r, y, w - r * 2.0, h);
|
||||
draw_filled_rect(x, y + r, w, h - r * 2.0);
|
||||
}
|
||||
@@ -221,10 +221,10 @@ void ui_draw_rect(bool fill, float x, float y, float w, float h) {
|
||||
w += 1;
|
||||
y -= 1;
|
||||
h += 1;
|
||||
draw_scaled_texture(¤t->round_corner_image, x, y, r, r);
|
||||
draw_scaled_texture(¤t->round_corner_image, x, y + h, r, -r);
|
||||
draw_scaled_texture(¤t->round_corner_image, x + w, y, -r, r);
|
||||
draw_scaled_texture(¤t->round_corner_image, x + w, y + h, -r, -r);
|
||||
draw_scaled_image(¤t->round_corner_image, x, y, r, r);
|
||||
draw_scaled_image(¤t->round_corner_image, x, y + h, r, -r);
|
||||
draw_scaled_image(¤t->round_corner_image, x + w, y, -r, r);
|
||||
draw_scaled_image(¤t->round_corner_image, x + w, y + h, -r, -r);
|
||||
draw_filled_rect(x + r, y, w - r * 2.0, strength);
|
||||
draw_filled_rect(x + r, y + h - 1, w - r * 2.0, strength);
|
||||
draw_filled_rect(x, y + r, strength, h - r * 2.0);
|
||||
@@ -243,8 +243,8 @@ void ui_draw_round_bottom(float x, float y, float w) {
|
||||
y -= 1; // Make it pixel perfect with non-round draw
|
||||
h += 1;
|
||||
draw_set_color(theme->SEPARATOR_COL);
|
||||
draw_scaled_texture(¤t->filled_round_corner_image, x, y + h, r, -r);
|
||||
draw_scaled_texture(¤t->filled_round_corner_image, x + w, y + h, -r, -r);
|
||||
draw_scaled_image(¤t->filled_round_corner_image, x, y + h, r, -r);
|
||||
draw_scaled_image(¤t->filled_round_corner_image, x + w, y + h, -r, -r);
|
||||
draw_filled_rect(x + r, y, w - r * 2.0, h);
|
||||
}
|
||||
}
|
||||
@@ -654,8 +654,8 @@ void ui_draw_tooltip_image(bool bind_global_g) {
|
||||
draw_filled_rect(current->tooltip_x, current->tooltip_y, w, h);
|
||||
draw_set_color(0xffffffff);
|
||||
current->tooltip_invert_y ?
|
||||
draw_scaled_texture(current->tooltip_img, current->tooltip_x, current->tooltip_y + h, w, -h) :
|
||||
draw_scaled_texture(current->tooltip_img, current->tooltip_x, current->tooltip_y, w, h);
|
||||
draw_scaled_image(current->tooltip_img, current->tooltip_x, current->tooltip_y + h, w, -h) :
|
||||
draw_scaled_image(current->tooltip_img, current->tooltip_x, current->tooltip_y, w, h);
|
||||
}
|
||||
|
||||
void ui_draw_tooltip(bool bind_global_g) {
|
||||
@@ -1423,7 +1423,7 @@ void ui_draw_check(bool selected, bool hover) {
|
||||
ui_fade_color(0.25);
|
||||
}
|
||||
int size = UI_CHECK_SELECT_SIZE();
|
||||
draw_scaled_texture(¤t->check_select_image, x + current->check_select_offset_x, y + current->check_select_offset_y, size, size);
|
||||
draw_scaled_image(¤t->check_select_image, x + current->check_select_offset_x, y + current->check_select_offset_y, size, size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1431,14 +1431,14 @@ void ui_draw_radio(bool selected, bool hover) {
|
||||
float x = current->_x + current->radio_offset_x;
|
||||
float y = current->_y + current->radio_offset_y;
|
||||
draw_set_color(selected ? theme->HIGHLIGHT_COL : hover ? theme->HOVER_COL : theme->BUTTON_COL);
|
||||
draw_texture(¤t->radio_image, x, y); // Circle bg
|
||||
draw_image(¤t->radio_image, x, y); // Circle bg
|
||||
|
||||
if (selected) { // Check
|
||||
draw_set_color(theme->LABEL_COL);
|
||||
if (!current->enabled) {
|
||||
ui_fade_color(0.25);
|
||||
}
|
||||
draw_texture(¤t->radio_select_image, x + current->radio_select_offset_x, y + current->radio_select_offset_y); // Circle
|
||||
draw_image(¤t->radio_select_image, x + current->radio_select_offset_x, y + current->radio_select_offset_y); // Circle
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1654,7 +1654,7 @@ void ui_end_window(bool bind_global_g) {
|
||||
draw_restore_render_target();
|
||||
}
|
||||
draw_set_color(0xffffffff);
|
||||
draw_texture(&handle->texture, current->_window_x, current->_window_y);
|
||||
draw_image(&handle->texture, current->_window_x, current->_window_y);
|
||||
if (handle->redraws <= 0) {
|
||||
handle->redraws--;
|
||||
}
|
||||
@@ -1787,10 +1787,10 @@ bool ui_button(char *text, int align, char *label/*, iron_gpu_texture_t *icon, i
|
||||
if (icon != NULL) {
|
||||
draw_set_color(0xffffffff);
|
||||
if (current->image_invert_y) {
|
||||
draw_scaled_sub_texture(icon, sx, sy, sw, sh, _x + current->button_offset_y, _y - 1 + sh, sw, -sh);
|
||||
draw_scaled_sub_image(icon, sx, sy, sw, sh, _x + current->button_offset_y, _y - 1 + sh, sw, -sh);
|
||||
}
|
||||
else {
|
||||
draw_scaled_sub_texture(icon, sx, sy, sw, sh, _x + current->button_offset_y, _y - 1, sw, sh);
|
||||
draw_scaled_sub_image(icon, sx, sy, sw, sh, _x + current->button_offset_y, _y - 1, sw, sh);
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1896,11 +1896,11 @@ static int image_height(void *image) {
|
||||
}
|
||||
|
||||
static void _draw_scaled_image(void *image, float dx, float dy, float dw, float dh) {
|
||||
draw_scaled_texture((iron_gpu_texture_t *)image, dx, dy, dw, dh);
|
||||
draw_scaled_image((iron_gpu_texture_t *)image, dx, dy, dw, dh);
|
||||
}
|
||||
|
||||
static void _draw_scaled_sub_image(void *image, float sx, float sy, float sw, float sh, float dx, float dy, float dw, float dh) {
|
||||
draw_scaled_sub_texture((iron_gpu_texture_t *)image, sx, sy, sw, sh, dx, dy, dw, dh);
|
||||
draw_scaled_sub_image((iron_gpu_texture_t *)image, sx, sy, sw, sh, dx, dy, dw, dh);
|
||||
}
|
||||
|
||||
int ui_sub_image(iron_gpu_texture_t *image, uint32_t tint, int h, int sx, int sy, int sw, int sh) {
|
||||
|
||||
@@ -452,7 +452,7 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) {
|
||||
ui_node_socket_t *out = node->outputs->buffer[i];
|
||||
ny += lineh;
|
||||
draw_set_color(out->color);
|
||||
draw_scaled_texture(&ui_socket_image, nx + w - ui_p(6), ny - ui_p(3), ui_p(12), ui_p(12));
|
||||
draw_scaled_image(&ui_socket_image, nx + w - ui_p(6), ny - ui_p(3), ui_p(12), ui_p(12));
|
||||
}
|
||||
ny -= lineh * node->outputs->length;
|
||||
draw_set_color(current->ops->theme->LABEL_COL);
|
||||
@@ -636,7 +636,7 @@ void ui_draw_node(ui_node_t *node, ui_node_canvas_t *canvas) {
|
||||
ui_node_socket_t *inp = node->inputs->buffer[i];
|
||||
ny += lineh;
|
||||
draw_set_color(inp->color);
|
||||
draw_scaled_texture(&ui_socket_image, nx - ui_p(6), ny - ui_p(3), ui_p(12), ui_p(12));
|
||||
draw_scaled_image(&ui_socket_image, nx - ui_p(6), ny - ui_p(3), ui_p(12), ui_p(12));
|
||||
bool is_linked = ui_input_linked(canvas, node->id, i);
|
||||
if (!is_linked && strcmp(inp->type, "VALUE") == 0) {
|
||||
current->_x = nx + ui_p(6);
|
||||
|
||||
@@ -221,7 +221,7 @@ declare function gpu_delete_vertex_buffer(buffer: any): void;
|
||||
declare function gpu_lock_vertex_buffer(buffer: any): buffer_t;
|
||||
declare function iron_gpu_vertex_buffer_unlock_all(buffer: any): void;
|
||||
declare function gpu_set_vertex_buffer(buffer: any): void;
|
||||
declare function gpu_draw_indexed_vertices(start: i32 = 0, count: i32 = -1): void;
|
||||
declare function gpu_draw_indexed_vertices(): void;
|
||||
declare function gpu_create_shader(data: buffer_t, type: i32): iron_gpu_shader_t;
|
||||
declare function gpu_create_shader_from_source(source: string, shader_type: shader_type_t): iron_gpu_shader_t;
|
||||
declare function iron_gpu_shader_destroy(shader: iron_gpu_shader_t): void;
|
||||
@@ -294,7 +294,7 @@ declare function iron_get_arg(index: i32): string;
|
||||
declare function iron_get_files_location(): string;
|
||||
declare function _iron_http_request(url: string, size: i32, callback: (url: string, _: buffer_t)=>void): void;
|
||||
|
||||
declare function draw_init(image_vert: buffer_t, image_frag: buffer_t, colored_vert: buffer_t, colored_frag: buffer_t, text_vert: buffer_t, text_frag: buffer_t): void;
|
||||
declare function draw_init(image_vert: buffer_t, image_frag: buffer_t, rect_vert: buffer_t, rect_frag: buffer_t, tris_vert: buffer_t, tris_frag: buffer_t, text_vert: buffer_t, text_frag: buffer_t): void;
|
||||
declare function draw_begin(render_target: iron_gpu_texture_t = null): void;
|
||||
declare function draw_end(): void;
|
||||
declare function draw_scaled_sub_image(image: iron_gpu_texture_t, sx: f32, sy: f32, sw: f32, sh: f32, dx: f32, dy: f32, dw: f32, dh: f32): void;
|
||||
|
||||
@@ -50,8 +50,10 @@ function sys_start(ops: iron_window_options_t) {
|
||||
draw_init(
|
||||
iron_load_blob(data_path() + "draw_image.vert" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_image.frag" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_colored.vert" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_colored.frag" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_rect.vert" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_rect.frag" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_tris.vert" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_tris.frag" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_text.vert" + sys_shader_ext()),
|
||||
iron_load_blob(data_path() + "draw_text.frag" + sys_shader_ext())
|
||||
);
|
||||
|
||||
@@ -243,7 +243,9 @@ function line_draw_end(overlay: bool = false) {
|
||||
color_get_gb(line_draw_color) / 255,
|
||||
color_get_bb(line_draw_color) / 255
|
||||
);
|
||||
gpu_draw_indexed_vertices(0, line_draw_lines * 6);
|
||||
////
|
||||
// gpu_draw_indexed_vertices(0, line_draw_lines * 6);
|
||||
////
|
||||
}
|
||||
|
||||
let _shape_draw_sphere_vb: iron_gpu_buffer_t = null;
|
||||
|
||||
@@ -12,7 +12,7 @@ function render() {
|
||||
iron_gpu_set_pipeline(pipeline);
|
||||
gpu_set_vertex_buffer(vb);
|
||||
gpu_set_index_buffer(ib);
|
||||
gpu_draw_indexed_vertices(0, -1);
|
||||
gpu_draw_indexed_vertices();
|
||||
_gpu_end();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user