mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
LibGL+LibSoftGPU: Add face culling state to rasterizer options
This commit is contained in:
parent
ad3d5d43bd
commit
2f35135743
2 changed files with 15 additions and 0 deletions
|
@ -685,6 +685,8 @@ void SoftwareGLContext::gl_enable(GLenum capability)
|
||||||
switch (capability) {
|
switch (capability) {
|
||||||
case GL_CULL_FACE:
|
case GL_CULL_FACE:
|
||||||
m_cull_faces = true;
|
m_cull_faces = true;
|
||||||
|
rasterizer_options.enable_culling = true;
|
||||||
|
update_rasterizer_options = true;
|
||||||
break;
|
break;
|
||||||
case GL_DEPTH_TEST:
|
case GL_DEPTH_TEST:
|
||||||
m_depth_test_enabled = true;
|
m_depth_test_enabled = true;
|
||||||
|
@ -750,6 +752,8 @@ void SoftwareGLContext::gl_disable(GLenum capability)
|
||||||
switch (capability) {
|
switch (capability) {
|
||||||
case GL_CULL_FACE:
|
case GL_CULL_FACE:
|
||||||
m_cull_faces = false;
|
m_cull_faces = false;
|
||||||
|
rasterizer_options.enable_culling = false;
|
||||||
|
update_rasterizer_options = true;
|
||||||
break;
|
break;
|
||||||
case GL_DEPTH_TEST:
|
case GL_DEPTH_TEST:
|
||||||
m_depth_test_enabled = false;
|
m_depth_test_enabled = false;
|
||||||
|
@ -1007,6 +1011,10 @@ void SoftwareGLContext::gl_front_face(GLenum face)
|
||||||
RETURN_WITH_ERROR_IF(face < GL_CW || face > GL_CCW, GL_INVALID_ENUM);
|
RETURN_WITH_ERROR_IF(face < GL_CW || face > GL_CCW, GL_INVALID_ENUM);
|
||||||
|
|
||||||
m_front_face = face;
|
m_front_face = face;
|
||||||
|
|
||||||
|
auto rasterizer_options = m_rasterizer.options();
|
||||||
|
rasterizer_options.front_face = face;
|
||||||
|
m_rasterizer.set_options(rasterizer_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoftwareGLContext::gl_cull_face(GLenum cull_mode)
|
void SoftwareGLContext::gl_cull_face(GLenum cull_mode)
|
||||||
|
@ -1016,6 +1024,10 @@ void SoftwareGLContext::gl_cull_face(GLenum cull_mode)
|
||||||
RETURN_WITH_ERROR_IF(cull_mode < GL_FRONT || cull_mode > GL_FRONT_AND_BACK, GL_INVALID_ENUM);
|
RETURN_WITH_ERROR_IF(cull_mode < GL_FRONT || cull_mode > GL_FRONT_AND_BACK, GL_INVALID_ENUM);
|
||||||
|
|
||||||
m_culled_sides = cull_mode;
|
m_culled_sides = cull_mode;
|
||||||
|
|
||||||
|
auto rasterizer_options = m_rasterizer.options();
|
||||||
|
rasterizer_options.culled_sides = cull_mode;
|
||||||
|
m_rasterizer.set_options(rasterizer_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint SoftwareGLContext::gl_gen_lists(GLsizei range)
|
GLuint SoftwareGLContext::gl_gen_lists(GLsizei range)
|
||||||
|
|
|
@ -50,6 +50,9 @@ struct RasterizerOptions {
|
||||||
GLenum draw_buffer { GL_BACK };
|
GLenum draw_buffer { GL_BACK };
|
||||||
GLfloat depth_offset_factor { 0 };
|
GLfloat depth_offset_factor { 0 };
|
||||||
GLfloat depth_offset_constant { 0 };
|
GLfloat depth_offset_constant { 0 };
|
||||||
|
bool enable_culling { false };
|
||||||
|
GLenum front_face { GL_CCW };
|
||||||
|
GLenum culled_sides { GL_BACK };
|
||||||
};
|
};
|
||||||
|
|
||||||
class SoftwareRasterizer final {
|
class SoftwareRasterizer final {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue