2020-11-18 19:11:30 +01:00
|
|
|
/*************************************************************************/
|
2021-10-26 17:18:39 +02:00
|
|
|
/* rasterizer_storage_gles3.cpp */
|
2020-11-18 19:11:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/*************************************************************************/
|
2022-01-03 21:27:34 +01:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2020-11-18 19:11:30 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
#include "rasterizer_storage_gles3.h"
|
2022-02-16 13:56:32 +01:00
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
#ifdef GLES3_ENABLED
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
#include "core/config/project_settings.h"
|
|
|
|
#include "core/math/transform_3d.h"
|
2022-03-21 12:25:25 +01:00
|
|
|
// #include "rasterizer_canvas_gles3.h"
|
2021-10-26 17:18:39 +02:00
|
|
|
#include "rasterizer_scene_gles3.h"
|
2020-11-18 19:11:30 +01:00
|
|
|
#include "servers/rendering/shader_language.h"
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::base_update_dependency(RID p_base, DependencyTracker *p_instance) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* VOXEL GI API */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::voxel_gi_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_initialize(RID p_rid) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_allocate_data(RID p_voxel_gi, const Transform3D &p_to_cell_xform, const AABB &p_aabb, const Vector3i &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::voxel_gi_get_bounds(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector3i RasterizerStorageGLES3::voxel_gi_get_octree_size(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector3i();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<uint8_t> RasterizerStorageGLES3::voxel_gi_get_octree_cells(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<uint8_t>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<uint8_t> RasterizerStorageGLES3::voxel_gi_get_data_cells(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<uint8_t>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<uint8_t> RasterizerStorageGLES3::voxel_gi_get_distance_field(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<uint8_t>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Vector<int> RasterizerStorageGLES3::voxel_gi_get_level_counts(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Vector<int>();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
Transform3D RasterizerStorageGLES3::voxel_gi_get_to_cell_xform(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return Transform3D();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_dynamic_range(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_dynamic_range(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_propagation(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_propagation(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_energy(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_energy(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_bias(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_bias(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_normal_bias(RID p_voxel_gi, float p_range) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_normal_bias(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_interior(RID p_voxel_gi, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::voxel_gi_is_interior(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_use_two_bounces(RID p_voxel_gi, bool p_enable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::voxel_gi_is_using_two_bounces(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::voxel_gi_set_anisotropy_strength(RID p_voxel_gi, float p_strength) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
float RasterizerStorageGLES3::voxel_gi_get_anisotropy_strength(RID p_voxel_gi) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
uint32_t RasterizerStorageGLES3::voxel_gi_get_version(RID p_voxel_gi) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OCCLUDER */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::occluder_set_mesh(RID p_occluder, const PackedVector3Array &p_vertices, const PackedInt32Array &p_indices) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2022-04-12 13:41:50 +02:00
|
|
|
/* FOG */
|
2021-10-26 17:18:39 +02:00
|
|
|
|
|
|
|
RID RasterizerStorageGLES3::fog_volume_allocate() {
|
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_initialize(RID p_rid) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_set_shape(RID p_fog_volume, RS::FogVolumeShape p_shape) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_set_extents(RID p_fog_volume, const Vector3 &p_extents) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void RasterizerStorageGLES3::fog_volume_set_material(RID p_fog_volume, RID p_material) {
|
|
|
|
}
|
|
|
|
|
|
|
|
AABB RasterizerStorageGLES3::fog_volume_get_aabb(RID p_fog_volume) const {
|
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
|
|
|
RS::FogVolumeShape RasterizerStorageGLES3::fog_volume_get_shape(RID p_fog_volume) const {
|
|
|
|
return RS::FOG_VOLUME_SHAPE_BOX;
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* VISIBILITY NOTIFIER */
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::visibility_notifier_allocate() {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RID();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_initialize(RID p_notifier) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_set_aabb(RID p_notifier, const AABB &p_aabb) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_set_callbacks(RID p_notifier, const Callable &p_enter_callbable, const Callable &p_exit_callable) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
AABB RasterizerStorageGLES3::visibility_notifier_get_aabb(RID p_notifier) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return AABB();
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::visibility_notifier_call(RID p_notifier, bool p_enter, bool p_deferred) {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2020-11-18 19:11:30 +01:00
|
|
|
/* CANVAS SHADOW */
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::canvas_light_shadow_buffer_create(int p_width) {
|
2020-11-18 19:11:30 +01:00
|
|
|
CanvasLightShadow *cls = memnew(CanvasLightShadow);
|
|
|
|
|
2022-03-12 12:19:59 +01:00
|
|
|
if (p_width > config->max_texture_size) {
|
|
|
|
p_width = config->max_texture_size;
|
2022-01-27 17:34:33 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
cls->size = p_width;
|
|
|
|
cls->height = 16;
|
|
|
|
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
|
|
|
|
glGenFramebuffers(1, &cls->fbo);
|
2022-04-07 16:00:51 +02:00
|
|
|
glBindFramebuffer(GL_FRAMEBUFFER, cls->fbo);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
glGenRenderbuffers(1, &cls->depth);
|
|
|
|
glBindRenderbuffer(GL_RENDERBUFFER, cls->depth);
|
2022-03-12 12:19:59 +01:00
|
|
|
glRenderbufferStorage(GL_RENDERBUFFER, config->depth_buffer_internalformat, cls->size, cls->height);
|
2020-11-18 19:11:30 +01:00
|
|
|
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, cls->depth);
|
|
|
|
|
|
|
|
glGenTextures(1, &cls->distance);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, cls->distance);
|
2022-03-12 12:19:59 +01:00
|
|
|
if (config->use_rgba_2d_shadows) {
|
2022-02-20 01:08:53 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, cls->size, cls->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
} else {
|
2022-02-20 01:08:53 +01:00
|
|
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, cls->size, cls->height, 0, GL_RED, GL_FLOAT, nullptr);
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, cls->distance, 0);
|
|
|
|
|
|
|
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
|
|
|
//printf("errnum: %x\n",status);
|
2022-04-07 16:00:51 +02:00
|
|
|
glBindFramebuffer(GL_FRAMEBUFFER, GLES3::TextureStorage::system_fbo);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
|
|
|
memdelete(cls);
|
|
|
|
ERR_FAIL_COND_V(status != GL_FRAMEBUFFER_COMPLETE, RID());
|
|
|
|
}
|
|
|
|
|
|
|
|
return canvas_light_shadow_owner.make_rid(cls);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* LIGHT SHADOW MAPPING */
|
|
|
|
/*
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RID RasterizerStorageGLES3::canvas_light_occluder_create() {
|
2020-11-18 19:11:30 +01:00
|
|
|
CanvasOccluder *co = memnew(CanvasOccluder);
|
|
|
|
co->index_id = 0;
|
|
|
|
co->vertex_id = 0;
|
|
|
|
co->len = 0;
|
|
|
|
|
|
|
|
return canvas_occluder_owner.make_rid(co);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::canvas_light_occluder_set_polylines(RID p_occluder, const PoolVector<Vector2> &p_lines) {
|
2020-11-18 19:11:30 +01:00
|
|
|
CanvasOccluder *co = canvas_occluder_owner.get(p_occluder);
|
|
|
|
ERR_FAIL_COND(!co);
|
|
|
|
|
|
|
|
co->lines = p_lines;
|
|
|
|
|
|
|
|
if (p_lines.size() != co->len) {
|
2022-02-16 13:56:32 +01:00
|
|
|
if (co->index_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->index_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
} if (co->vertex_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->vertex_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
co->index_id = 0;
|
|
|
|
co->vertex_id = 0;
|
|
|
|
co->len = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_lines.size()) {
|
|
|
|
PoolVector<float> geometry;
|
|
|
|
PoolVector<uint16_t> indices;
|
|
|
|
int lc = p_lines.size();
|
|
|
|
|
|
|
|
geometry.resize(lc * 6);
|
|
|
|
indices.resize(lc * 3);
|
|
|
|
|
|
|
|
PoolVector<float>::Write vw = geometry.write();
|
|
|
|
PoolVector<uint16_t>::Write iw = indices.write();
|
|
|
|
|
|
|
|
PoolVector<Vector2>::Read lr = p_lines.read();
|
|
|
|
|
|
|
|
const int POLY_HEIGHT = 16384;
|
|
|
|
|
|
|
|
for (int i = 0; i < lc / 2; i++) {
|
|
|
|
vw[i * 12 + 0] = lr[i * 2 + 0].x;
|
|
|
|
vw[i * 12 + 1] = lr[i * 2 + 0].y;
|
|
|
|
vw[i * 12 + 2] = POLY_HEIGHT;
|
|
|
|
|
|
|
|
vw[i * 12 + 3] = lr[i * 2 + 1].x;
|
|
|
|
vw[i * 12 + 4] = lr[i * 2 + 1].y;
|
|
|
|
vw[i * 12 + 5] = POLY_HEIGHT;
|
|
|
|
|
|
|
|
vw[i * 12 + 6] = lr[i * 2 + 1].x;
|
|
|
|
vw[i * 12 + 7] = lr[i * 2 + 1].y;
|
|
|
|
vw[i * 12 + 8] = -POLY_HEIGHT;
|
|
|
|
|
|
|
|
vw[i * 12 + 9] = lr[i * 2 + 0].x;
|
|
|
|
vw[i * 12 + 10] = lr[i * 2 + 0].y;
|
|
|
|
vw[i * 12 + 11] = -POLY_HEIGHT;
|
|
|
|
|
|
|
|
iw[i * 6 + 0] = i * 4 + 0;
|
|
|
|
iw[i * 6 + 1] = i * 4 + 1;
|
|
|
|
iw[i * 6 + 2] = i * 4 + 2;
|
|
|
|
|
|
|
|
iw[i * 6 + 3] = i * 4 + 2;
|
|
|
|
iw[i * 6 + 4] = i * 4 + 3;
|
|
|
|
iw[i * 6 + 5] = i * 4 + 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//if same buffer len is being set, just use BufferSubData to avoid a pipeline flush
|
|
|
|
|
|
|
|
if (!co->vertex_id) {
|
|
|
|
glGenBuffers(1, &co->vertex_id);
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
|
|
|
|
glBufferData(GL_ARRAY_BUFFER, lc * 6 * sizeof(real_t), vw.ptr(), GL_STATIC_DRAW);
|
|
|
|
} else {
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, co->vertex_id);
|
|
|
|
glBufferSubData(GL_ARRAY_BUFFER, 0, lc * 6 * sizeof(real_t), vw.ptr());
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
|
|
|
|
|
|
|
|
if (!co->index_id) {
|
|
|
|
glGenBuffers(1, &co->index_id);
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, co->index_id);
|
|
|
|
glBufferData(GL_ELEMENT_ARRAY_BUFFER, lc * 3 * sizeof(uint16_t), iw.ptr(), GL_DYNAMIC_DRAW);
|
|
|
|
} else {
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, co->index_id);
|
|
|
|
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, lc * 3 * sizeof(uint16_t), iw.ptr());
|
|
|
|
}
|
|
|
|
|
|
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); //unbind
|
|
|
|
|
|
|
|
co->len = lc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RS::InstanceType RasterizerStorageGLES3::get_base_type(RID p_rid) const {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_NONE;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
if (mesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_MESH;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (light_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_LIGHT;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (multimesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_MULTIMESH;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (immediate_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_IMMEDIATE;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (reflection_probe_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_REFLECTION_PROBE;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else if (lightmap_capture_data_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_LIGHTMAP_CAPTURE;
|
2020-11-18 19:11:30 +01:00
|
|
|
} else {
|
2021-09-27 01:07:10 +02:00
|
|
|
return RS::INSTANCE_NONE;
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::free(RID p_rid) {
|
2022-04-07 16:00:51 +02:00
|
|
|
if (GLES3::TextureStorage::get_singleton()->owns_render_target(p_rid)) {
|
|
|
|
GLES3::TextureStorage::get_singleton()->render_target_free(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
return true;
|
2022-03-12 12:19:59 +01:00
|
|
|
} else if (GLES3::TextureStorage::get_singleton()->owns_texture(p_rid)) {
|
|
|
|
GLES3::TextureStorage::get_singleton()->texture_free(p_rid);
|
2021-11-16 16:25:42 +01:00
|
|
|
return true;
|
2022-04-07 16:00:51 +02:00
|
|
|
} else if (GLES3::TextureStorage::get_singleton()->owns_canvas_texture(p_rid)) {
|
|
|
|
GLES3::TextureStorage::get_singleton()->canvas_texture_free(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
return true;
|
2022-03-21 12:25:25 +01:00
|
|
|
} else if (GLES3::MaterialStorage::get_singleton()->owns_shader(p_rid)) {
|
|
|
|
GLES3::MaterialStorage::get_singleton()->shader_free(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
return true;
|
2022-03-21 12:25:25 +01:00
|
|
|
} else if (GLES3::MaterialStorage::get_singleton()->owns_material(p_rid)) {
|
|
|
|
GLES3::MaterialStorage::get_singleton()->material_free(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
} else if (skeleton_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Skeleton *s = skeleton_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
if (s->update_list.in_list()) {
|
|
|
|
skeleton_update_list.remove(&s->update_list);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (Set<InstanceBaseDependency *>::Element *E = s->instances.front(); E; E = E->next()) {
|
|
|
|
E->get()->skeleton = RID();
|
|
|
|
}
|
|
|
|
|
|
|
|
skeleton_allocate(p_rid, 0, false);
|
|
|
|
|
|
|
|
if (s->tex_id) {
|
|
|
|
glDeleteTextures(1, &s->tex_id);
|
|
|
|
}
|
|
|
|
|
|
|
|
skeleton_owner.free(p_rid);
|
|
|
|
memdelete(s);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (mesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Mesh *mesh = mesh_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
mesh->instance_remove_deps();
|
|
|
|
mesh_clear(p_rid);
|
|
|
|
|
|
|
|
while (mesh->multimeshes.first()) {
|
|
|
|
MultiMesh *multimesh = mesh->multimeshes.first()->self();
|
|
|
|
multimesh->mesh = RID();
|
|
|
|
multimesh->dirty_aabb = true;
|
|
|
|
|
|
|
|
mesh->multimeshes.remove(mesh->multimeshes.first());
|
|
|
|
|
|
|
|
if (!multimesh->update_list.in_list()) {
|
|
|
|
multimesh_update_list.add(&multimesh->update_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mesh_owner.free(p_rid);
|
|
|
|
memdelete(mesh);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (multimesh_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
MultiMesh *multimesh = multimesh_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
multimesh->instance_remove_deps();
|
|
|
|
|
|
|
|
if (multimesh->mesh.is_valid()) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Mesh *mesh = mesh_owner.get_or_null(multimesh->mesh);
|
2020-11-18 19:11:30 +01:00
|
|
|
if (mesh) {
|
|
|
|
mesh->multimeshes.remove(&multimesh->mesh_list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-27 01:07:10 +02:00
|
|
|
multimesh_allocate(p_rid, 0, RS::MULTIMESH_TRANSFORM_3D, RS::MULTIMESH_COLOR_NONE);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2022-04-28 05:20:36 +02:00
|
|
|
_update_dirty_multimeshes();
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
multimesh_owner.free(p_rid);
|
|
|
|
memdelete(multimesh);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (immediate_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Immediate *im = immediate_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
im->instance_remove_deps();
|
|
|
|
|
|
|
|
immediate_owner.free(p_rid);
|
|
|
|
memdelete(im);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (light_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
Light *light = light_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
light->instance_remove_deps();
|
|
|
|
|
|
|
|
light_owner.free(p_rid);
|
|
|
|
memdelete(light);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (reflection_probe_owner.owns(p_rid)) {
|
|
|
|
// delete the texture
|
2021-09-27 01:07:10 +02:00
|
|
|
ReflectionProbe *reflection_probe = reflection_probe_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
reflection_probe->instance_remove_deps();
|
|
|
|
|
|
|
|
reflection_probe_owner.free(p_rid);
|
|
|
|
memdelete(reflection_probe);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (lightmap_capture_data_owner.owns(p_rid)) {
|
|
|
|
// delete the texture
|
2021-09-27 01:07:10 +02:00
|
|
|
LightmapCapture *lightmap_capture = lightmap_capture_data_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
lightmap_capture->instance_remove_deps();
|
|
|
|
|
|
|
|
lightmap_capture_data_owner.free(p_rid);
|
|
|
|
memdelete(lightmap_capture);
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else if (canvas_occluder_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
CanvasOccluder *co = canvas_occluder_owner.get_or_null(p_rid);
|
2022-02-16 13:56:32 +01:00
|
|
|
if (co->index_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->index_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
}
|
|
|
|
if (co->vertex_id) {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteBuffers(1, &co->vertex_id);
|
2022-02-16 13:56:32 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
canvas_occluder_owner.free(p_rid);
|
|
|
|
memdelete(co);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
} else if (canvas_light_shadow_owner.owns(p_rid)) {
|
2021-09-27 01:07:10 +02:00
|
|
|
CanvasLightShadow *cls = canvas_light_shadow_owner.get_or_null(p_rid);
|
2020-11-18 19:11:30 +01:00
|
|
|
glDeleteFramebuffers(1, &cls->fbo);
|
|
|
|
glDeleteRenderbuffers(1, &cls->depth);
|
|
|
|
glDeleteTextures(1, &cls->distance);
|
|
|
|
canvas_light_shadow_owner.free(p_rid);
|
|
|
|
memdelete(cls);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
bool RasterizerStorageGLES3::has_os_feature(const String &p_feature) const {
|
2022-02-20 01:08:53 +01:00
|
|
|
if (p_feature == "rgtc") {
|
|
|
|
return config->rgtc_supported;
|
|
|
|
}
|
|
|
|
|
2021-12-29 02:06:12 +01:00
|
|
|
if (p_feature == "s3tc") {
|
2022-03-12 12:19:59 +01:00
|
|
|
return config->s3tc_supported;
|
2021-12-29 02:06:12 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2022-02-20 01:08:53 +01:00
|
|
|
if (p_feature == "bptc") {
|
|
|
|
return config->bptc_supported;
|
|
|
|
}
|
2021-12-29 02:06:12 +01:00
|
|
|
if (p_feature == "etc") {
|
2022-03-12 12:19:59 +01:00
|
|
|
return config->etc_supported;
|
2021-12-29 02:06:12 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2022-02-20 01:08:53 +01:00
|
|
|
if (p_feature == "etc2") {
|
|
|
|
return config->etc2_supported;
|
2021-12-29 02:06:12 +01:00
|
|
|
}
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::set_debug_generate_wireframes(bool p_generate) {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//void RasterizerStorageGLES3::render_info_begin_capture() {
|
2020-11-18 19:11:30 +01:00
|
|
|
// info.snap = info.render;
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//void RasterizerStorageGLES3::render_info_end_capture() {
|
2020-11-18 19:11:30 +01:00
|
|
|
// info.snap.object_count = info.render.object_count - info.snap.object_count;
|
|
|
|
// info.snap.draw_call_count = info.render.draw_call_count - info.snap.draw_call_count;
|
|
|
|
// info.snap.material_switch_count = info.render.material_switch_count - info.snap.material_switch_count;
|
|
|
|
// info.snap.surface_switch_count = info.render.surface_switch_count - info.snap.surface_switch_count;
|
|
|
|
// info.snap.shader_rebind_count = info.render.shader_rebind_count - info.snap.shader_rebind_count;
|
|
|
|
// info.snap.vertices_count = info.render.vertices_count - info.snap.vertices_count;
|
|
|
|
// info.snap._2d_item_count = info.render._2d_item_count - info.snap._2d_item_count;
|
|
|
|
// info.snap._2d_draw_call_count = info.render._2d_draw_call_count - info.snap._2d_draw_call_count;
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//int RasterizerStorageGLES3::get_captured_render_info(RS::RenderInfo p_info) {
|
2020-11-18 19:11:30 +01:00
|
|
|
// switch (p_info) {
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_OBJECTS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.object_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VERTICES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.vertices_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_MATERIAL_CHANGES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.material_switch_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SHADER_CHANGES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.shader_rebind_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SURFACE_CHANGES_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.surface_switch_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_DRAW_CALLS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap.draw_call_count;
|
|
|
|
// } break;
|
|
|
|
// /*
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_ITEMS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap._2d_item_count;
|
|
|
|
// } break;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_DRAW_CALLS_IN_FRAME: {
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.snap._2d_draw_call_count;
|
|
|
|
// } break;
|
|
|
|
// */
|
|
|
|
// default: {
|
|
|
|
// return get_render_info(p_info);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
//int RasterizerStorageGLES3::get_render_info(RS::RenderInfo p_info) {
|
2020-11-18 19:11:30 +01:00
|
|
|
// switch (p_info) {
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_OBJECTS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.object_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VERTICES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.vertices_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_MATERIAL_CHANGES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.material_switch_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SHADER_CHANGES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.shader_rebind_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_SURFACE_CHANGES_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.surface_switch_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_DRAW_CALLS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final.draw_call_count;
|
|
|
|
// /*
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_ITEMS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final._2d_item_count;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_2D_DRAW_CALLS_IN_FRAME:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.render_final._2d_draw_call_count;
|
|
|
|
//*/
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_USAGE_VIDEO_MEM_TOTAL:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return 0; //no idea
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VIDEO_MEM_USED:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.vertex_mem + info.texture_mem;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_TEXTURE_MEM_USED:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.texture_mem;
|
2021-09-27 01:07:10 +02:00
|
|
|
// case RS::INFO_VERTEX_MEM_USED:
|
2020-11-18 19:11:30 +01:00
|
|
|
// return info.vertex_mem;
|
|
|
|
// default:
|
|
|
|
// return 0; //no idea either
|
|
|
|
// }
|
|
|
|
//}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
String RasterizerStorageGLES3::get_video_adapter_name() const {
|
2020-11-18 19:11:30 +01:00
|
|
|
return (const char *)glGetString(GL_RENDERER);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
String RasterizerStorageGLES3::get_video_adapter_vendor() const {
|
2020-11-18 19:11:30 +01:00
|
|
|
return (const char *)glGetString(GL_VENDOR);
|
|
|
|
}
|
|
|
|
|
2021-12-10 17:01:51 +01:00
|
|
|
RenderingDevice::DeviceType RasterizerStorageGLES3::get_video_adapter_type() const {
|
|
|
|
return RenderingDevice::DeviceType::DEVICE_TYPE_OTHER;
|
|
|
|
}
|
|
|
|
|
2021-07-31 15:39:46 +02:00
|
|
|
String RasterizerStorageGLES3::get_video_adapter_api_version() const {
|
|
|
|
return (const char *)glGetString(GL_VERSION);
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::initialize() {
|
2022-03-12 12:19:59 +01:00
|
|
|
config = GLES3::Config::get_singleton();
|
2020-11-18 19:11:30 +01:00
|
|
|
|
|
|
|
// skeleton buffer
|
|
|
|
{
|
|
|
|
resources.skeleton_transform_buffer_size = 0;
|
|
|
|
glGenBuffers(1, &resources.skeleton_transform_buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
// radical inverse vdc cache texture
|
|
|
|
// used for cubemap filtering
|
2022-02-20 01:08:53 +01:00
|
|
|
glGenTextures(1, &resources.radical_inverse_vdc_cache_tex);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2022-02-20 01:08:53 +01:00
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, resources.radical_inverse_vdc_cache_tex);
|
|
|
|
/*
|
|
|
|
uint8_t radical_inverse[512];
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2022-02-20 01:08:53 +01:00
|
|
|
for (uint32_t i = 0; i < 512; i++) {
|
|
|
|
uint32_t bits = i;
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2022-02-20 01:08:53 +01:00
|
|
|
bits = (bits << 16) | (bits >> 16);
|
|
|
|
bits = ((bits & 0x55555555) << 1) | ((bits & 0xAAAAAAAA) >> 1);
|
|
|
|
bits = ((bits & 0x33333333) << 2) | ((bits & 0xCCCCCCCC) >> 2);
|
|
|
|
bits = ((bits & 0x0F0F0F0F) << 4) | ((bits & 0xF0F0F0F0) >> 4);
|
|
|
|
bits = ((bits & 0x00FF00FF) << 8) | ((bits & 0xFF00FF00) >> 8);
|
2020-11-18 19:11:30 +01:00
|
|
|
|
2022-02-20 01:08:53 +01:00
|
|
|
float value = float(bits) * 2.3283064365386963e-10;
|
|
|
|
radical_inverse[i] = uint8_t(CLAMP(value * 255.0, 0, 255));
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2022-02-20 01:08:53 +01:00
|
|
|
//glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 512, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, radical_inverse);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); //need this for proper sampling
|
|
|
|
*/
|
|
|
|
glBindTexture(GL_TEXTURE_2D, 0);
|
|
|
|
|
2020-11-18 19:11:30 +01:00
|
|
|
{
|
|
|
|
glGenFramebuffers(1, &resources.mipmap_blur_fbo);
|
|
|
|
glGenTextures(1, &resources.mipmap_blur_color);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GLES_OVER_GL
|
2022-02-20 01:08:53 +01:00
|
|
|
glEnable(GL_PROGRAM_POINT_SIZE);
|
2020-11-18 19:11:30 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::finalize() {
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::_copy_screen() {
|
2020-11-18 19:11:30 +01:00
|
|
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
|
|
|
}
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_memory_info() {
|
2021-09-27 01:07:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
uint64_t RasterizerStorageGLES3::get_rendering_info(RS::RenderingInfo p_info) {
|
2021-09-27 01:07:10 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
void RasterizerStorageGLES3::update_dirty_resources() {
|
2022-02-20 01:08:53 +01:00
|
|
|
GLES3::MaterialStorage::get_singleton()->_update_global_variables();
|
|
|
|
GLES3::MaterialStorage::get_singleton()->_update_queued_materials();
|
2022-04-28 05:20:36 +02:00
|
|
|
//GLES3::MeshStorage::get_singleton()->_update_dirty_skeletons();
|
|
|
|
GLES3::MeshStorage::get_singleton()->_update_dirty_multimeshes();
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-10-26 17:18:39 +02:00
|
|
|
RasterizerStorageGLES3::RasterizerStorageGLES3() {
|
2022-04-19 18:54:30 +02:00
|
|
|
initialize();
|
2020-11-18 19:11:30 +01:00
|
|
|
}
|
|
|
|
|
2021-11-16 16:25:42 +01:00
|
|
|
RasterizerStorageGLES3::~RasterizerStorageGLES3() {
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // GLES3_ENABLED
|