Skip to content

Commit

Permalink
Extracted method from the large method LoadCommonCapabilities in GLCa…
Browse files Browse the repository at this point in the history
…pabilities
  • Loading branch information
JoopAue committed Apr 5, 2016
1 parent d093aa8 commit 8280e2b
Showing 1 changed file with 36 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,38 +145,7 @@ protected void loadCapabilitiesCommon() {
if (hasExtension("GL_EXT_framebuffer_object")
|| caps.contains(Caps.OpenGL30)
|| caps.contains(Caps.OpenGLES20)) {
caps.add(Caps.FrameBuffer);

limits.put(Limits.RenderBufferSize, getInteger(GLFbo.GL_MAX_RENDERBUFFER_SIZE_EXT));
limits.put(Limits.FrameBufferAttachments, getInteger(GLFbo.GL_MAX_COLOR_ATTACHMENTS_EXT));

if (hasExtension("GL_EXT_framebuffer_blit") || caps.contains(Caps.OpenGL30)) {
caps.add(Caps.FrameBufferBlit);
}

if (hasExtension("GL_EXT_framebuffer_multisample")) {
caps.add(Caps.FrameBufferMultisample);
limits.put(Limits.FrameBufferSamples, getInteger(GLExt.GL_MAX_SAMPLES_EXT));
}

if (hasExtension("GL_ARB_texture_multisample")) {
caps.add(Caps.TextureMultisample);
limits.put(Limits.ColorTextureSamples, getInteger(GLExt.GL_MAX_COLOR_TEXTURE_SAMPLES));
limits.put(Limits.DepthTextureSamples, getInteger(GLExt.GL_MAX_DEPTH_TEXTURE_SAMPLES));
if (!limits.containsKey(Limits.FrameBufferSamples)) {
// In case they want to query samples on main FB ...
limits.put(Limits.FrameBufferSamples, limits.get(Limits.ColorTextureSamples));
}
}

if (hasExtension("GL_ARB_draw_buffers") || caps.contains(Caps.OpenGL30)) {
limits.put(Limits.FrameBufferMrtAttachments, getInteger(GLExt.GL_MAX_DRAW_BUFFERS_ARB));
if (limits.get(Limits.FrameBufferMrtAttachments) > 1) {
caps.add(Caps.FrameBufferMRT);
}
} else {
limits.put(Limits.FrameBufferMrtAttachments, 1);
}
loadGLExtFrameBufferObjectCapabilities();
}

if (hasExtension("GL_ARB_multisample")) {
Expand Down Expand Up @@ -241,6 +210,41 @@ protected void loadCapabilitiesCommon() {
}
}

private void loadGLExtFrameBufferObjectCapabilities() {
caps.add(Caps.FrameBuffer);

limits.put(Limits.RenderBufferSize, getInteger(GLFbo.GL_MAX_RENDERBUFFER_SIZE_EXT));
limits.put(Limits.FrameBufferAttachments, getInteger(GLFbo.GL_MAX_COLOR_ATTACHMENTS_EXT));

if (hasExtension("GL_EXT_framebuffer_blit") || caps.contains(Caps.OpenGL30)) {
caps.add(Caps.FrameBufferBlit);
}

if (hasExtension("GL_EXT_framebuffer_multisample")) {
caps.add(Caps.FrameBufferMultisample);
limits.put(Limits.FrameBufferSamples, getInteger(GLExt.GL_MAX_SAMPLES_EXT));
}

if (hasExtension("GL_ARB_texture_multisample")) {
caps.add(Caps.TextureMultisample);
limits.put(Limits.ColorTextureSamples, getInteger(GLExt.GL_MAX_COLOR_TEXTURE_SAMPLES));
limits.put(Limits.DepthTextureSamples, getInteger(GLExt.GL_MAX_DEPTH_TEXTURE_SAMPLES));
if (!limits.containsKey(Limits.FrameBufferSamples)) {
// In case they want to query samples on main FB ...
limits.put(Limits.FrameBufferSamples, limits.get(Limits.ColorTextureSamples));
}
}

if (hasExtension("GL_ARB_draw_buffers") || caps.contains(Caps.OpenGL30)) {
limits.put(Limits.FrameBufferMrtAttachments, getInteger(GLExt.GL_MAX_DRAW_BUFFERS_ARB));
if (limits.get(Limits.FrameBufferMrtAttachments) > 1) {
caps.add(Caps.FrameBufferMRT);
}
} else {
limits.put(Limits.FrameBufferMrtAttachments, 1);
}
}

private void loadTextureFormatExtensions() {
boolean hasFloatTexture;

Expand Down

0 comments on commit 8280e2b

Please sign in to comment.