-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review texture storage implementations and add fallback mode
- Loading branch information
Showing
23 changed files
with
472 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
source/globjects/source/implementations/AbstractTextureStorageImplementation.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
#include "AbstractTextureStorageImplementation.h" | ||
|
||
#include <glbinding/gl/enum.h> | ||
#include <glbinding/gl/extension.h> | ||
|
||
#include <globjects/globjects.h> | ||
|
||
#include "TextureStorageImplementation_DirectStateAccessARB.h" | ||
#include "TextureStorageImplementation_DirectStateAccessEXT.h" | ||
#include "TextureStorageImplementation_Legacy.h" | ||
#include "TextureStorageImplementation_Fallback.h" | ||
|
||
|
||
using namespace gl; | ||
|
||
namespace globjects | ||
{ | ||
|
||
AbstractTextureStorageImplementation::AbstractTextureStorageImplementation() | ||
{ | ||
} | ||
|
||
AbstractTextureStorageImplementation::~AbstractTextureStorageImplementation() | ||
{ | ||
} | ||
|
||
AbstractTextureStorageImplementation * AbstractTextureStorageImplementation::get(const Texture::StorageImplementation impl) | ||
{ | ||
if (!hasExtension(GLextension::GL_ARB_texture_storage)) | ||
{ | ||
return TextureStorageImplementation_Fallback::instance(); | ||
} | ||
|
||
if (impl == Texture::StorageImplementation::DirectStateAccessARB | ||
&& hasExtension(GLextension::GL_ARB_direct_state_access)) | ||
{ | ||
return TextureStorageImplementation_DirectStateAccessARB::instance(); | ||
} | ||
else if (impl >= Texture::StorageImplementation::DirectStateAccessEXT | ||
&& hasExtension(GLextension::GL_EXT_direct_state_access)) | ||
{ | ||
return TextureStorageImplementation_DirectStateAccessEXT::instance(); | ||
} | ||
else | ||
{ | ||
return TextureStorageImplementation_Legacy::instance(); | ||
} | ||
} | ||
|
||
} // namespace globjects |
26 changes: 26 additions & 0 deletions
26
source/globjects/source/implementations/AbstractTextureStorageImplementation.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include <glbinding/gl/types.h> | ||
|
||
#include <globjects/Texture.h> | ||
|
||
namespace globjects | ||
{ | ||
|
||
class AbstractTextureStorageImplementation | ||
{ | ||
public: | ||
AbstractTextureStorageImplementation(); | ||
virtual ~AbstractTextureStorageImplementation(); | ||
|
||
static AbstractTextureStorageImplementation * get(Texture::StorageImplementation impl = | ||
Texture::StorageImplementation::DirectStateAccessARB); | ||
|
||
virtual void storage1D(const Texture * texture, gl::GLsizei levels, gl::GLenum internalFormat, gl::GLsizei width) const = 0; | ||
virtual void storage2D(const Texture * texture, gl::GLsizei levels, gl::GLenum internalFormat, gl::GLsizei width, gl::GLsizei height) const = 0; | ||
virtual void storage3D(const Texture * texture, gl::GLsizei levels, gl::GLenum internalFormat, gl::GLsizei width, gl::GLsizei height, gl::GLsizei depth) const = 0; | ||
|
||
virtual void cubeMapStorage(const Texture * texture, gl::GLint levels, gl::GLenum internalFormat, gl::GLsizei width, gl::GLsizei height) const = 0; | ||
}; | ||
|
||
} // namespace globjects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.