fix: build issues with NULL on some compilers
	
		
			
	
		
	
	
		
	
		
			Some checks reported errors
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build was killed
				
			
		
		
	
	
				
					
				
			
		
			Some checks reported errors
		
		
	
	continuous-integration/drone/push Build was killed
				
			This commit is contained in:
		
							parent
							
								
									b25ea41096
								
							
						
					
					
						commit
						a88aa739b1
					
				
					 5 changed files with 15 additions and 26 deletions
				
			
		| 
						 | 
					@ -7,7 +7,7 @@ namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//==================== CONSTANT_BUFFER ====================//
 | 
					//==================== CONSTANT_BUFFER ====================//
 | 
				
			||||||
glConstantBuffer::glConstantBuffer(ConstantBufferIndex index, unsigned int size)
 | 
					glConstantBuffer::glConstantBuffer(ConstantBufferIndex index, unsigned int size)
 | 
				
			||||||
    : m_buffer_id(NULL)
 | 
					    : m_buffer_id()
 | 
				
			||||||
    , m_index(static_cast<int>(index))
 | 
					    , m_index(static_cast<int>(index))
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	glCreateBuffers(1, &m_buffer_id);
 | 
						glCreateBuffers(1, &m_buffer_id);
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ void glConstantBuffer::un_map()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//==================== VERTEX_BUFFER ====================//
 | 
					//==================== VERTEX_BUFFER ====================//
 | 
				
			||||||
glVertexBuffer::glVertexBuffer(float *vertices, unsigned int stride, unsigned int count)
 | 
					glVertexBuffer::glVertexBuffer(float *vertices, unsigned int stride, unsigned int count)
 | 
				
			||||||
    : m_buffer_id(NULL)
 | 
					    : m_buffer_id()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	glCreateBuffers(1, &m_buffer_id);
 | 
						glCreateBuffers(1, &m_buffer_id);
 | 
				
			||||||
	glNamedBufferData(
 | 
						glNamedBufferData(
 | 
				
			||||||
| 
						 | 
					@ -63,7 +63,7 @@ void glVertexBuffer::bind()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void glVertexBuffer::un_bind()
 | 
					void glVertexBuffer::un_bind()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	glBindBuffer(GL_ARRAY_BUFFER, NULL);
 | 
						glBindBuffer(GL_ARRAY_BUFFER, {});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto glVertexBuffer::map() -> void *
 | 
					auto glVertexBuffer::map() -> void *
 | 
				
			||||||
| 
						 | 
					@ -78,7 +78,7 @@ void glVertexBuffer::un_map()
 | 
				
			||||||
//==================== VERTEX_BUFFER ====================//
 | 
					//==================== VERTEX_BUFFER ====================//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//==================== INDEX_BUFFER ====================//
 | 
					//==================== INDEX_BUFFER ====================//
 | 
				
			||||||
glIndexBuffer::glIndexBuffer(unsigned int *indices, unsigned int count): m_buffer_id(NULL)
 | 
					glIndexBuffer::glIndexBuffer(unsigned int *indices, unsigned int count): m_buffer_id()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// generate indices if not provided
 | 
						// generate indices if not provided
 | 
				
			||||||
	auto hasIndices = !!indices;
 | 
						auto hasIndices = !!indices;
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ void glIndexBuffer::bind()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void glIndexBuffer::un_bind()
 | 
					void glIndexBuffer::un_bind()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, NULL);
 | 
						glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, {});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
//==================== INDEX_BUFFER ====================//
 | 
					//==================== INDEX_BUFFER ====================//
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,9 +6,9 @@ namespace lt {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
glFramebuffer::glFramebuffer(const FramebufferSpecification &specification)
 | 
					glFramebuffer::glFramebuffer(const FramebufferSpecification &specification)
 | 
				
			||||||
    : m_specification(specification)
 | 
					    : m_specification(specification)
 | 
				
			||||||
    , m_buffer_id(NULL)
 | 
					    , m_buffer_id()
 | 
				
			||||||
    , m_color_attachment_id(NULL)
 | 
					    , m_color_attachment_id()
 | 
				
			||||||
    , m_depth_stencil_attachment_id(NULL)
 | 
					    , m_depth_stencil_attachment_id()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	resize({ specification.width, specification.height });
 | 
						resize({ specification.width, specification.height });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ void glFramebuffer::resize(const glm::uvec2 &size)
 | 
				
			||||||
	    GL_RGBA8,
 | 
						    GL_RGBA8,
 | 
				
			||||||
	    m_specification.width,
 | 
						    m_specification.width,
 | 
				
			||||||
	    m_specification.height,
 | 
						    m_specification.height,
 | 
				
			||||||
	    NULL,
 | 
						    {},
 | 
				
			||||||
	    GL_RGBA,
 | 
						    GL_RGBA,
 | 
				
			||||||
	    GL_UNSIGNED_BYTE,
 | 
						    GL_UNSIGNED_BYTE,
 | 
				
			||||||
	    nullptr
 | 
						    nullptr
 | 
				
			||||||
| 
						 | 
					@ -74,17 +74,6 @@ void glFramebuffer::resize(const glm::uvec2 &size)
 | 
				
			||||||
	    0
 | 
						    0
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// glTextureStorage2D(m_color_attachment_id, 0, GL_RGBA8, m_specification.width,
 | 
					 | 
				
			||||||
	// m_specification.height);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	//	glCreateTextures(GL_TEXTURE_2D, 1, &m_depth_stencil_attachment_id);
 | 
					 | 
				
			||||||
	//	glBindTexture(GL_TEXTURE_2D, m_depth_stencil_attachment_id);
 | 
					 | 
				
			||||||
	//	glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, m_specification.width,
 | 
					 | 
				
			||||||
	// m_specification.height, NULL, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, nullptr);
 | 
					 | 
				
			||||||
	//	// glTextureStorage2D(m_depth_stencil_attachment_id, 0, GL_DEPTH24_STENCIL8,
 | 
					 | 
				
			||||||
	// m_specification.width, m_specification.height); 	glFramebufferTexture2D(GL_FRAMEBUFFER,
 | 
					 | 
				
			||||||
	// GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_depth_stencil_attachment_id, 0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ensure(
 | 
						ensure(
 | 
				
			||||||
	    (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE),
 | 
						    (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE),
 | 
				
			||||||
	    "Framebuffer is incomplete"
 | 
						    "Framebuffer is incomplete"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ void glRenderCommand::draw_indexed(unsigned int count)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void glRenderCommand::default_target_framebuffer()
 | 
					void glRenderCommand::default_target_framebuffer()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	glBindFramebuffer(GL_FRAMEBUFFER, NULL);
 | 
						glBindFramebuffer(GL_FRAMEBUFFER, {});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void glRenderCommand::set_viewport(
 | 
					void glRenderCommand::set_viewport(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -56,7 +56,7 @@ void glShader::bind()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void glShader::un_bind()
 | 
					void glShader::un_bind()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	glUseProgram(NULL);
 | 
						glUseProgram({});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto glShader::compile_shader(const std::string &source, Shader::Stage stage) -> unsigned int
 | 
					auto glShader::compile_shader(const std::string &source, Shader::Stage stage) -> unsigned int
 | 
				
			||||||
| 
						 | 
					@ -67,7 +67,7 @@ auto glShader::compile_shader(const std::string &source, Shader::Stage stage) ->
 | 
				
			||||||
	    stage == Shader::Stage::vertex   ? GL_VERTEX_SHADER :
 | 
						    stage == Shader::Stage::vertex   ? GL_VERTEX_SHADER :
 | 
				
			||||||
	    stage == Shader::Stage::pixel    ? GL_FRAGMENT_SHADER :
 | 
						    stage == Shader::Stage::pixel    ? GL_FRAGMENT_SHADER :
 | 
				
			||||||
	    stage == Shader::Stage::geometry ? GL_GEOMETRY_SHADER :
 | 
						    stage == Shader::Stage::geometry ? GL_GEOMETRY_SHADER :
 | 
				
			||||||
	                                       NULL
 | 
						                                       0
 | 
				
			||||||
	);
 | 
						);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// compile
 | 
						// compile
 | 
				
			||||||
| 
						 | 
					@ -91,7 +91,7 @@ auto glShader::compile_shader(const std::string &source, Shader::Stage stage) ->
 | 
				
			||||||
		    errorLog
 | 
							    errorLog
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return NULL;
 | 
							return {};
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
#define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
 | 
					#define LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
 | 
				
			||||||
#ifdef LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
 | 
					#ifdef LIGHT_OPENGL_ENABLE_SHADER_INFO_LOG
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ glVertexLayout::glVertexLayout(
 | 
				
			||||||
    const Ref<VertexBuffer> &buffer,
 | 
					    const Ref<VertexBuffer> &buffer,
 | 
				
			||||||
    const std::vector<std::pair<std::string, VertexElementType>> &elements
 | 
					    const std::vector<std::pair<std::string, VertexElementType>> &elements
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
    : m_array_id(NULL)
 | 
					    : m_array_id()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	// check
 | 
						// check
 | 
				
			||||||
	ensure(
 | 
						ensure(
 | 
				
			||||||
| 
						 | 
					@ -65,7 +65,7 @@ void glVertexLayout::bind()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void glVertexLayout::un_bind()
 | 
					void glVertexLayout::un_bind()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	glBindVertexArray(NULL);
 | 
						glBindVertexArray({});
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
auto glVertexLayout::get_element_desc(VertexElementType type, unsigned int offset)
 | 
					auto glVertexLayout::get_element_desc(VertexElementType type, unsigned int offset)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue