|
@@ -2424,7 +2424,7 @@ void RasterizerCanvasGLES3::reset_canvas() {
|
|
void RasterizerCanvasGLES3::draw_lens_distortion_rect(const Rect2 &p_rect, float p_k1, float p_k2, const Vector2 &p_eye_center, float p_oversample) {
|
|
void RasterizerCanvasGLES3::draw_lens_distortion_rect(const Rect2 &p_rect, float p_k1, float p_k2, const Vector2 &p_eye_center, float p_oversample) {
|
|
}
|
|
}
|
|
|
|
|
|
-RendererCanvasRender::PolygonID RasterizerCanvasGLES3::request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights) {
|
|
|
|
|
|
+RendererCanvasRender::PolygonID RasterizerCanvasGLES3::request_polygon(const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, int p_count) {
|
|
// We interleave the vertex data into one big VBO to improve cache coherence
|
|
// We interleave the vertex data into one big VBO to improve cache coherence
|
|
uint32_t vertex_count = p_points.size();
|
|
uint32_t vertex_count = p_points.size();
|
|
uint32_t stride = 2;
|
|
uint32_t stride = 2;
|
|
@@ -2552,15 +2552,15 @@ RendererCanvasRender::PolygonID RasterizerCanvasGLES3::request_polygon(const Vec
|
|
if (p_indices.size()) {
|
|
if (p_indices.size()) {
|
|
//create indices, as indices were requested
|
|
//create indices, as indices were requested
|
|
Vector<uint8_t> index_buffer;
|
|
Vector<uint8_t> index_buffer;
|
|
- index_buffer.resize(p_indices.size() * sizeof(int32_t));
|
|
|
|
|
|
+ index_buffer.resize(p_count * sizeof(int32_t));
|
|
{
|
|
{
|
|
uint8_t *w = index_buffer.ptrw();
|
|
uint8_t *w = index_buffer.ptrw();
|
|
- memcpy(w, p_indices.ptr(), sizeof(int32_t) * p_indices.size());
|
|
|
|
|
|
+ memcpy(w, p_indices.ptr(), sizeof(int32_t) * p_count);
|
|
}
|
|
}
|
|
glGenBuffers(1, &pb.index_buffer);
|
|
glGenBuffers(1, &pb.index_buffer);
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, pb.index_buffer);
|
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, pb.index_buffer);
|
|
- GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ELEMENT_ARRAY_BUFFER, pb.index_buffer, p_indices.size() * 4, index_buffer.ptr(), GL_STATIC_DRAW, "Polygon 2D index buffer");
|
|
|
|
- pb.count = p_indices.size();
|
|
|
|
|
|
+ GLES3::Utilities::get_singleton()->buffer_allocate_data(GL_ELEMENT_ARRAY_BUFFER, pb.index_buffer, p_count * 4, index_buffer.ptr(), GL_STATIC_DRAW, "Polygon 2D index buffer");
|
|
|
|
+ pb.count = p_count;
|
|
}
|
|
}
|
|
|
|
|
|
glBindVertexArray(0);
|
|
glBindVertexArray(0);
|