diff options
-rw-r--r-- | drivers/gles3/rasterizer_storage_gles3.cpp | 38 | ||||
-rw-r--r-- | platform/windows/context_gl_win.cpp | 3 | ||||
-rw-r--r-- | servers/visual/rasterizer.h | 8 |
3 files changed, 45 insertions, 4 deletions
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index ffcd462808..698788316c 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -2460,6 +2460,8 @@ RID RasterizerStorageGLES3::mesh_create(){ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::PrimitiveType p_primitive,const DVector<uint8_t>& p_array,int p_vertex_count,const DVector<uint8_t>& p_index_array,int p_index_count,const AABB& p_aabb,const Vector<DVector<uint8_t> >& p_blend_shapes,const Vector<AABB>& p_bone_aabbs){ + DVector<uint8_t> array = p_array; + Mesh *mesh = mesh_owner.getornull(p_mesh); ERR_FAIL_COND(!mesh); @@ -2657,7 +2659,35 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P int array_size = stride * p_vertex_count; int index_array_size=0; - ERR_FAIL_COND(p_array.size()!=array_size); + print_line("desired size: "+itos(array_size)+" vcount "+itos(p_vertex_count)+" should be: "+itos(array.size()+p_vertex_count*2)+" but is "+itos(array.size())); + if (array.size()!=array_size && array.size()+p_vertex_count*2 == array_size) { + //old format, convert + array = DVector<uint8_t>(); + + array.resize( p_array.size()+p_vertex_count*2 ); + + DVector<uint8_t>::Write w = array.write(); + DVector<uint8_t>::Read r = p_array.read(); + + uint16_t *w16 = (uint16_t*)w.ptr(); + const uint16_t *r16 = (uint16_t*)r.ptr(); + + uint16_t one = Math::make_half_float(1); + + for(int i=0;i<p_vertex_count;i++) { + + *w16++ = *r16++; + *w16++ = *r16++; + *w16++ = *r16++; + *w16++ = one; + for(int j=0;j<(stride/2)-4;j++) { + *w16++ = *r16++; + } + } + + } + + ERR_FAIL_COND(array.size()!=array_size); if (p_format&VS::ARRAY_FORMAT_INDEX) { @@ -2680,7 +2710,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P surface->active=true; surface->array_len=p_vertex_count; surface->index_array_len=p_index_count; - surface->array_byte_size=p_array.size(); + surface->array_byte_size=array.size(); surface->index_array_byte_size=p_index_array.size(); surface->primitive=p_primitive; surface->mesh=mesh; @@ -2704,7 +2734,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh,uint32_t p_format,VS::P { - DVector<uint8_t>::Read vr = p_array.read(); + DVector<uint8_t>::Read vr = array.read(); glGenBuffers(1,&surface->vertex_id); glBindBuffer(GL_ARRAY_BUFFER,surface->vertex_id); @@ -5907,7 +5937,9 @@ void RasterizerStorageGLES3::initialize() { { int max_extensions=0; + print_line("getting extensions"); glGetIntegerv(GL_NUM_EXTENSIONS,&max_extensions); + print_line("total "+itos(max_extensions)); for(int i=0;i<max_extensions;i++) { const GLubyte *s = glGetStringi( GL_EXTENSIONS,i ); if (!s) diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index fc6e33f408..0ca4a67d19 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -110,6 +110,7 @@ bool ContextGL_Win::is_using_vsync() const { return use_vsync; } +#define _WGL_CONTEXT_DEBUG_BIT_ARB 0x0001 Error ContextGL_Win::initialize() { @@ -165,7 +166,7 @@ Error ContextGL_Win::initialize() { WGL_CONTEXT_MAJOR_VERSION_ARB, 3,//we want a 3.3 context WGL_CONTEXT_MINOR_VERSION_ARB, 3, //and it shall be forward compatible so that we can only use up to date functionality - WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB/*|WGL_CONTEXT_DEBUG_BIT_ARB*/, + WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB|_WGL_CONTEXT_DEBUG_BIT_ARB, 0}; //zero indicates the end of the array PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = NULL; //pointer to the method diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 725a325909..844504372e 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -432,9 +432,17 @@ public: virtual uint32_t gi_probe_get_version(RID p_probe)=0; + enum GIProbeCompress { + GI_PROBE_UNCOMPRESSED, + GI_PROBE_S3TC, + GI_PROBE_ETC2 + }; + virtual RID gi_probe_dynamic_data_create(int p_width,int p_height,int p_depth)=0; virtual void gi_probe_dynamic_data_update_rgba8(RID p_gi_probe_data,int p_depth_slice,int p_slice_count,int p_mipmap,const void* p_data)=0; + + /* RENDER TARGET */ enum RenderTargetFlags { |