Skip to content

Commit

Permalink
gsdx ogl: reduce requirement for SW renderer
Browse files Browse the repository at this point in the history
Clip Control is only used for the HW renderer.

It will help Nvidia DX10 GPU on Windows. Potentially old AMD GPU too.
Unfortunately Ivy bridge still misses texture copy

Note on Linux, you can use the free Mesa driver.

Otherwise, it is time to save money for a future upgrade :)
  • Loading branch information
gregory38 committed Apr 4, 2017
1 parent df32564 commit 5b91dc4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion plugins/GSdx/GLLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ namespace GLLoader {
}

bool status = true;
bool required_for_hw = (theApp.GetCurrentRendererType() == GSRendererType::OGL_HW);

// Bonus
status &= status_and_override(found_GL_EXT_texture_filter_anisotropic, "GL_EXT_texture_filter_anisotropic");
Expand All @@ -429,7 +430,7 @@ namespace GLLoader {
status &= status_and_override(found_GL_ARB_buffer_storage,"GL_ARB_buffer_storage", true);
status &= status_and_override(found_GL_ARB_clear_texture,"GL_ARB_clear_texture");
// GL4.5
status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control", true);
status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control", required_for_hw);
status &= status_and_override(found_GL_ARB_direct_state_access, "GL_ARB_direct_state_access");
// Mandatory for the advance HW renderer effect. Unfortunately Mesa LLVMPIPE/SWR renderers doesn't support this extension.
// Rendering might be corrupted but it could be good enough for test/virtual machine.
Expand Down
1 change: 1 addition & 0 deletions plugins/GSdx/GLLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ namespace GLLoader {

// GL
extern bool found_geometry_shader;
extern bool found_GL_ARB_clip_control;
extern bool found_GL_ARB_gpu_shader5;
extern bool found_GL_ARB_shader_image_load_store;
extern bool found_GL_ARB_clear_texture;
Expand Down
3 changes: 2 additions & 1 deletion plugins/GSdx/GSDeviceOGL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,8 @@ bool GSDeviceOGL::Create(const std::shared_ptr<GSWnd> &wnd)
// This extension allow FS depth to range from -1 to 1. So
// gl_position.z could range from [0, 1]
// Change depth convention
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);
if (GLLoader::found_GL_ARB_clip_control && glClipControl)
glClipControl(GL_LOWER_LEFT, GL_ZERO_TO_ONE);

// ****************************************************************
// HW renderer shader
Expand Down
2 changes: 1 addition & 1 deletion plugins/GSdx/GSWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void GSWndGL::PopulateGlFunction()
GL_EXT_LOAD_OPT(glCreateSamplers);
GL_EXT_LOAD_OPT(glCreateProgramPipelines);

GL_EXT_LOAD(glClipControl);
GL_EXT_LOAD_OPT(glClipControl);
GL_EXT_LOAD_OPT(glTextureBarrier);
GL_EXT_LOAD_OPT(glGetTextureSubImage);

Expand Down
1 change: 1 addition & 0 deletions plugins/GSdx/GSdx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ void GSdxApp::Init()
m_default_configuration["osd_max_log_messages"] = "3";
m_default_configuration["override_geometry_shader"] = "-1";
m_default_configuration["override_GL_ARB_clear_texture"] = "-1";
m_default_configuration["override_GL_ARB_clip_control"] = "-1";
m_default_configuration["override_GL_ARB_direct_state_access"] = "-1";
m_default_configuration["override_GL_ARB_draw_buffers_blend"] = "-1";
m_default_configuration["override_GL_ARB_get_texture_sub_image"] = "-1";
Expand Down

14 comments on commit 5b91dc4

@lightningterror
Copy link
Contributor

@lightningterror lightningterror commented on 5b91dc4 Apr 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would've been nice to make Ivy Bridge working since now it only needs 1 extension to be moved to optional (sw render at least) :)

Edit: Is texture copy needed on sw opengl ?

@gregory38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lightningterror
I don't think we need texture copy for SW but maybe you can try it.

@gregory38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And actually Nvidia driver misses others extension. It got copy texture but not the buffer storage :(

@lightningterror
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I got Software OpenGL working on Ivy Bridge using the same method you did with clip control :)

@gregory38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do a pr ;)

@lightningterror
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do after I do some tests , wanna test if OpenGL works on my old nvidia 9300 gs xD

@gregory38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my old nvidia 9300 gs

Not with the Nvidia driver (fine on Linux with Mesa). It misses the mandatory arb_buffer_storage extension.

@lightningterror
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm what about sw? Is it needed on sw render ?

@gregory38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is used to send the vertices and the texture.

@lightningterror
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh well at least Ivy Bridge works now which is enough I think since it's still recently newer , dunno If Sandy will work but I think not since I think it doesn't support gl 4 at all.

@gregory38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 dunno If Sandy will work but I think not since I think it doesn't support gl 4 at all.

Please let's the turtle rest in peace ;) Seriously it is a big no for SB. At least the SB is small enough now.

@lightningterror
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submitted the PR , can you check if it's all good?

@lightningterror
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw is it ok to have "required_for_hw" named like that ? required_for_hw_ogl" or something similar would have been better imo.

@gregory38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're overthinking ;) Hint GLLoader.cpp file

Please sign in to comment.