Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include "Headers/glSamplerObject.h"

#include "Core/Headers/Console.h"
#include "Core/Headers/ParamHandler.h"
#include "Utility/Headers/Localization.h"
#include "Platform/Video/OpenGL/Headers/GLWrapper.h"
#include "Platform/Video/Textures/Headers/TextureDescriptor.h"

namespace Divide {

glSamplerObject::glSamplerObject(const SamplerDescriptor& descriptor) {
    glCreateSamplers(1, &_samplerID);
    glSamplerParameterf(_samplerID, GL_TEXTURE_LOD_BIAS, descriptor.biasLOD());
    glSamplerParameterf(_samplerID, GL_TEXTURE_MIN_LOD, descriptor.minLOD());
    glSamplerParameterf(_samplerID, GL_TEXTURE_MAX_LOD, descriptor.maxLOD());
    glSamplerParameteri(
        _samplerID, GL_TEXTURE_MIN_FILTER,
        to_uint(GLUtil::glTextureFilterTable[to_uint(descriptor.minFilter())]));
    glSamplerParameteri(
        _samplerID, GL_TEXTURE_MAG_FILTER,
        to_uint(GLUtil::glTextureFilterTable[to_uint(descriptor.magFilter())]));
    glSamplerParameteri(
        _samplerID, GL_TEXTURE_WRAP_S,
        to_uint(GLUtil::glWrapTable[to_uint(descriptor.wrapU())]));
    glSamplerParameteri(
        _samplerID, GL_TEXTURE_WRAP_T,
        to_uint(GLUtil::glWrapTable[to_uint(descriptor.wrapV())]));
    glSamplerParameteri(
        _samplerID, GL_TEXTURE_WRAP_R,
        to_uint(GLUtil::glWrapTable[to_uint(descriptor.wrapW())]));
    if (descriptor.wrapU() == TextureWrap::CLAMP_TO_BORDER ||
        descriptor.wrapV() == TextureWrap::CLAMP_TO_BORDER ||
        descriptor.wrapW() == TextureWrap::CLAMP_TO_BORDER) {
        glSamplerParameterfv(_samplerID, GL_TEXTURE_BORDER_COLOR,
                             descriptor.borderColour());
    }

    if (descriptor._useRefCompare) {
        glSamplerParameteri(
            _samplerID, GL_TEXTURE_COMPARE_FUNC,
            to_uint(GLUtil::glCompareFuncTable[to_uint(descriptor._cmpFunc)]));

        glSamplerParameteri(_samplerID, GL_TEXTURE_COMPARE_MODE,
                            to_const_uint(GL_COMPARE_REF_TO_TEXTURE));
    }

    if (descriptor.anisotropyLevel() > 1 && descriptor.generateMipMaps()) {
        glSamplerParameterf(_samplerID, gl::GL_TEXTURE_MAX_ANISOTROPY_EXT,
                            std::min<GLfloat>(to_float(descriptor.anisotropyLevel()),
                                              to_float(GL_API::s_anisoLevel)));
    }
    // glSamplerParameterfv(_samplerID, GL_TEXTURE_BORDER_COLOR,
    // &vec4<F32>(0.0f).r));
}

glSamplerObject::~glSamplerObject() {
    if (_samplerID > 0 && _samplerID != GLUtil::_invalidObjectID) {
        glDeleteSamplers(1, &_samplerID);
        _samplerID = 0;
    }
}
};

Commits for Divide-Framework/trunk/Source Code/Platform/Video/OpenGL/Textures/glSamplerOject.cpp

Diff revisions: vs.
Revision Author Commited Message
829 Diff Diff IonutCava picture IonutCava Tue 24 Jan, 2017 17:28:39 +0000

[IonutCava]
- Separate resourceLocation for resources into resourceLocation and resourceName.
- More XML config loading refactoring

721 Diff Diff IonutCava picture IonutCava Wed 08 Jun, 2016 15:47:49 +0000

[IonutCava]
- Spelling: change all references from our code of “color” to the PROPER British version of “colour” because it sounds 100x better

670 Diff Diff IonutCava picture IonutCava Wed 06 Apr, 2016 16:21:35 +0000

[IonutCava]
- getInstance() renamed to instance() for simplicity (should really go away altogether, but that’s a different issue)
- some particle emitter threading updates

628 Diff Diff IonutCava picture IonutCava Wed 20 Jan, 2016 17:17:53 +0000

[IonutCava]
- Reworked GenericVertexData ring-buffering system and changed vertex attributes to the vertex format system
— Might be buggy
- Disabled bump-mapping for low-LoD level entities
- Removed a forgotten test line in BRDF shader that prevented lighting calculations to occur properly (an early return)
- Updated auto-reflection system for high shininess materials
- Converted a lot of ‘to_xyz’ calls to ‘to_const_xyz’ calls where appropriate to reduce runtime cost (‘to_const_xyz’ is evaluated at compile time)

577 Diff Diff IonutCava picture IonutCava Fri 20 Nov, 2015 15:59:10 +0000

[IonutCava]
- Replace all string indexed maps with unsigned long long indexed maps and add both compile time and runtime hashing functions to convert strings to the proper indices
— Balancing the calls between _ID and _ID_RT can reduce map lookup overhead, especially with ParamHandler and Locale::get

477 Diff Diff IonutCava picture IonutCava Tue 07 Jul, 2015 16:03:35 +0000

[Ionut]
- Moving to pure OpenGL 4.5 context (Part 2: everything else)

446 Diff Diff IonutCava picture IonutCava Mon 25 May, 2015 19:37:45 +0000

[Ionut]
- SDL based windowing system:
— Support for Windowed/FullScreen windowed/Fullscreen mode

444 Diff Diff IonutCava picture IonutCava Thu 21 May, 2015 16:06:53 +0000

[Ionut]
- More platform independent code cleanup:
— Moved platform specific defines to their respective header files (e.g. THREAD_LOCAL)
— Moved most preprocessor defines from the VisualC++ projects into source code
— Removed compiler specific code (e.g. warning disables) and fixed most warning resulting from this

401 Diff Diff IonutCava picture IonutCava Thu 16 Apr, 2015 15:55:47 +0000

[Ionut]
- Hacked together a DSA wrapper that enables the switch between OGL4.4 + GL_EXT_direct_state_access and OGL4.5 + GL_ARB_direct_state_access (some texture issues need debugging)
- Fixed a hardware state check on init
- Multithreaded hw resource loading now uses a conditional variable to check for new load commands instead of checking every 20ms reducing the load on a CPU core significantly

398 IonutCava picture IonutCava Mon 13 Apr, 2015 16:11:29 +0000

[Ionut]
- Migrated to a pure OpenGL 4.5 implementation
- Fixed a string bug in glsw’s path suffix and prefix strings
- Some profile-guided optimizations