mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:42:43 +00:00 
			
		
		
		
	LibGL+LibGPU: Implement glPointSize
				
					
				
			This commit is contained in:
		
							parent
							
								
									ac3e46b97d
								
							
						
					
					
						commit
						0dcb23ee96
					
				
					 6 changed files with 25 additions and 4 deletions
				
			
		|  | @ -78,6 +78,8 @@ Optional<ContextParameter> GLContext::get_context_parameter(GLenum name) | ||||||
|         return ContextParameter { .type = GL_INT, .value = { .integer_value = 0 } }; |         return ContextParameter { .type = GL_INT, .value = { .integer_value = 0 } }; | ||||||
|     case GL_PACK_SWAP_BYTES: |     case GL_PACK_SWAP_BYTES: | ||||||
|         return ContextParameter { .type = GL_BOOL, .value = { .boolean_value = false } }; |         return ContextParameter { .type = GL_BOOL, .value = { .boolean_value = false } }; | ||||||
|  |     case GL_POINT_SIZE: | ||||||
|  |         return ContextParameter { .type = GL_DOUBLE, .value = { .double_value = static_cast<GLdouble>(m_point_size) } }; | ||||||
|     case GL_POLYGON_OFFSET_FILL: |     case GL_POLYGON_OFFSET_FILL: | ||||||
|         return ContextParameter { .type = GL_BOOL, .is_capability = true, .value = { .boolean_value = m_depth_offset_enabled } }; |         return ContextParameter { .type = GL_BOOL, .is_capability = true, .value = { .boolean_value = m_depth_offset_enabled } }; | ||||||
|     case GL_RED_BITS: |     case GL_RED_BITS: | ||||||
|  |  | ||||||
|  | @ -301,6 +301,7 @@ extern "C" { | ||||||
| 
 | 
 | ||||||
| // Points
 | // Points
 | ||||||
| #define GL_POINT_SMOOTH 0x0B10 | #define GL_POINT_SMOOTH 0x0B10 | ||||||
|  | #define GL_POINT_SIZE 0x0B11 | ||||||
| #define GL_POINT_SIZE_MIN_EXT 0x8126 | #define GL_POINT_SIZE_MIN_EXT 0x8126 | ||||||
| #define GL_POINT_SIZE_MAX_EXT 0x8127 | #define GL_POINT_SIZE_MAX_EXT 0x8127 | ||||||
| #define GL_DISTANCE_ATTENUATION_EXT 0x8129 | #define GL_DISTANCE_ATTENUATION_EXT 0x8129 | ||||||
|  |  | ||||||
|  | @ -673,8 +673,7 @@ void glPixelStorei(GLenum pname, GLint param) | ||||||
| 
 | 
 | ||||||
| void glPointSize(GLfloat size) | void glPointSize(GLfloat size) | ||||||
| { | { | ||||||
|     // FIXME: implement
 |     g_gl_context->gl_point_size(size); | ||||||
|     dbgln_if(GL_DEBUG, "glPointSize({}): unimplemented", size); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void glPolygonMode(GLenum face, GLenum mode) | void glPolygonMode(GLenum face, GLenum mode) | ||||||
|  |  | ||||||
|  | @ -1192,6 +1192,18 @@ void GLContext::gl_rect(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2) | ||||||
|     gl_end(); |     gl_end(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void GLContext::gl_point_size(GLfloat size) | ||||||
|  | { | ||||||
|  |     APPEND_TO_CALL_LIST_AND_RETURN_IF_NEEDED(gl_point_size, size); | ||||||
|  |     RETURN_WITH_ERROR_IF(size <= 0.f, GL_INVALID_VALUE); | ||||||
|  | 
 | ||||||
|  |     m_point_size = size; | ||||||
|  | 
 | ||||||
|  |     auto rasterizer_options = m_rasterizer->options(); | ||||||
|  |     rasterizer_options.point_size = size; | ||||||
|  |     m_rasterizer->set_options(rasterizer_options); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void GLContext::present() | void GLContext::present() | ||||||
| { | { | ||||||
|     m_rasterizer->blit_color_buffer_to(*m_frontbuffer); |     m_rasterizer->blit_color_buffer_to(*m_frontbuffer); | ||||||
|  |  | ||||||
|  | @ -199,6 +199,7 @@ public: | ||||||
|     void gl_clip_plane(GLenum plane, GLdouble const* equation); |     void gl_clip_plane(GLenum plane, GLdouble const* equation); | ||||||
|     void gl_array_element(GLint i); |     void gl_array_element(GLint i); | ||||||
|     void gl_copy_tex_sub_image_2d(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); |     void gl_copy_tex_sub_image_2d(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); | ||||||
|  |     void gl_point_size(GLfloat size); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     void sync_device_config(); |     void sync_device_config(); | ||||||
|  | @ -442,7 +443,8 @@ private: | ||||||
|             decltype(&GLContext::gl_get_light), |             decltype(&GLContext::gl_get_light), | ||||||
|             decltype(&GLContext::gl_clip_plane), |             decltype(&GLContext::gl_clip_plane), | ||||||
|             decltype(&GLContext::gl_array_element), |             decltype(&GLContext::gl_array_element), | ||||||
|             decltype(&GLContext::gl_copy_tex_sub_image_2d)>; |             decltype(&GLContext::gl_copy_tex_sub_image_2d), | ||||||
|  |             decltype(&GLContext::gl_point_size)>; | ||||||
| 
 | 
 | ||||||
|         using ExtraSavedArguments = Variant< |         using ExtraSavedArguments = Variant< | ||||||
|             FloatMatrix4x4>; |             FloatMatrix4x4>; | ||||||
|  | @ -481,7 +483,11 @@ private: | ||||||
|     GLsizei m_unpack_row_length { 0 }; |     GLsizei m_unpack_row_length { 0 }; | ||||||
|     u8 m_unpack_alignment { 4 }; |     u8 m_unpack_alignment { 4 }; | ||||||
| 
 | 
 | ||||||
|     float m_line_width { 1.0f }; |     // Point drawing configuration
 | ||||||
|  |     float m_point_size { 1.f }; | ||||||
|  | 
 | ||||||
|  |     // Line drawing configuration
 | ||||||
|  |     float m_line_width { 1.f }; | ||||||
| 
 | 
 | ||||||
|     // Lighting configuration
 |     // Lighting configuration
 | ||||||
|     bool m_lighting_enabled { false }; |     bool m_lighting_enabled { false }; | ||||||
|  |  | ||||||
|  | @ -38,6 +38,7 @@ struct RasterizerOptions { | ||||||
|     bool fog_enabled { false }; |     bool fog_enabled { false }; | ||||||
|     float fog_start { 0.0f }; |     float fog_start { 0.0f }; | ||||||
|     float fog_end { 1.0f }; |     float fog_end { 1.0f }; | ||||||
|  |     float point_size { 1.f }; | ||||||
|     bool scissor_enabled { false }; |     bool scissor_enabled { false }; | ||||||
|     bool normalization_enabled { false }; |     bool normalization_enabled { false }; | ||||||
|     Gfx::IntRect scissor_box; |     Gfx::IntRect scissor_box; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Jelle Raaijmakers
						Jelle Raaijmakers