Browse Source

Temprorarily undo busted partial texture uploads

sdf
A.Olokhtonov 1 week ago
parent
commit
2a94d4625c
  1. 23
      client/webgl_draw.js

23
client/webgl_draw.js

@ -23,7 +23,29 @@ function upload_if_needed(gl, buffer_kind, serializer) { @@ -23,7 +23,29 @@ function upload_if_needed(gl, buffer_kind, serializer) {
serializer.gpu_upload_from = serializer.offset;
}
}
function upload_square_rgba16ui_texture(gl, serializer, texture_size) {
// TODO: only subupload what's needed
const bpp = 2 * 4;
const data_size = serializer.offset;
const data_pixels = data_size / bpp; // data_size % bpp is expected to always be zero here
const rows = Math.ceil(data_pixels / texture_size);
const last_row = data_pixels % texture_size;
const whole_upload = (rows - 1) * texture_size * bpp;
// Upload whole rows
if (rows > 1) {
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, texture_size, rows - 1, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(serializer.buffer, 0, whole_upload / 2));
}
// Upload last row
if (last_row > 0) {
const last_row_upload = last_row * bpp;
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, rows - 1, last_row, 1, gl.RGBA_INTEGER, gl.UNSIGNED_SHORT, new Uint16Array(serializer.buffer, whole_upload, last_row_upload / 2));
}
}
/*
PLS FIX ME
function upload_square_rgba16ui_texture(gl, serializer, texture_size) {
const bpp = 2 * 4;
const data_size = serializer.offset - serializer.gpu_upload_from;
@ -66,6 +88,7 @@ function upload_square_rgba16ui_texture(gl, serializer, texture_size) { @@ -66,6 +88,7 @@ function upload_square_rgba16ui_texture(gl, serializer, texture_size) {
serializer.gpu_upload_from = serializer.offset;
}
*/
function draw_html(state) {
// HUD-like things. Player cursors, screens

Loading…
Cancel
Save