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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
   Copyright (c) 2018 DIVIDE-Studio
   Copyright (c) 2009 Ionut Cava

   This file is part of DIVIDE Framework.

   Permission is hereby granted, free of charge, to any person obtaining a copy
   of this software
   and associated documentation files (the "Software"), to deal in the Software
   without restriction,
   including without limitation the rights to use, copy, modify, merge, publish,
   distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so,
   subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED,
   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
   PARTICULAR PURPOSE AND NONINFRINGEMENT.
   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
   DAMAGES OR OTHER LIABILITY,
   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
   IN CONNECTION WITH THE SOFTWARE
   OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 */

#ifndef _GL_TEXTURE_H_
#define _GL_TEXTURE_H_

#include "Platform/Video/OpenGL/Headers/glResources.h"
#include "Platform/Video/Textures/Headers/Texture.h"

namespace Divide {
class glLockManager;
class glTexture final : public Texture,
                        public glObject {
   public:
    explicit glTexture(GFXDevice& context,
                       size_t descriptorHash,
                       const stringImpl& name,
                       const stringImpl& resourceName,
                       const stringImpl& resourceLocation,
                       bool isFlipped,
                       bool asyncLoad,
                       const TextureDescriptor& texDescriptor);
    ~glTexture();

    bool resourceLoadComplete() override;

    bool unload() override;

    void bindLayer(U8 slot, U8 level, U8 layer, bool layered, bool read, bool write) override;

    void setMipMapRange(U16 base = 0, U16 max = 1000) override;

    void resize(const bufferPtr ptr,
                const vec2<U16>& dimensions) override;

    void loadData(const TextureLoadInfo& info,
                  const vectorImpl<ImageTools::ImageLayer>& imageLayers) override;

    void loadData(const TextureLoadInfo& info,
                  const bufferPtr data,
                  const vec2<U16>& dimensions) override;

    void copy(const Texture_ptr& other) override;

    void setCurrentSampler(const SamplerDescriptor& descriptor) override;


    void refreshMipMaps(bool immediate) override;

   protected:
    void threadedLoad(DELEGATE_CBK<void, CachedResource_wptr> onLoadCallback) override;
    void reserveStorage();

    void loadDataCompressed(const TextureLoadInfo& info,
                            const vectorImpl<ImageTools::ImageLayer>& imageLayers);

    void loadDataUncompressed(const TextureLoadInfo& info,
                              bufferPtr data);

    void setMipRangeInternal(U16 base, U16 max);

   private:
    GLenum _type;
    std::atomic_bool _allocatedStorage;
    glLockManager* _lockManager;
};

TYPEDEF_SMART_POINTERS_FOR_CLASS(glTexture);

};  // namespace Divide

#endif

Commits for Divide-Framework/trunk/Source Code/Platform/Video/OpenGL/Textures/Headers/glTexture.h

Diff revisions: vs.
Revision Author Commited Message
1029 Diff Diff IonutCava picture IonutCava Tue 30 Jan, 2018 17:28:39 +0000

[Ionut]
- Update copyright notices

976 Diff Diff IonutCava picture IonutCava Sun 19 Nov, 2017 23:10:18 +0000

[Ionut]
- Texture mipmaps are now compute before bind if they need a refresh (to avoid recalculation if they’re not used)
- More work on the editor: cleanup, load/save functionality, etc
- Input scaling: Mouse position is now relative to the scene preview position in editor mode. (the scene preview rect is used to re-map X/Y absolute and relative mouse positions)

938 Diff Diff IonutCava picture IonutCava Wed 16 Aug, 2017 21:35:55 +0000

[Ionut]
- Separate texture binding slot from TextureData
- Binding slot is now a property of the descriptor set
- Remove bind() calls from texture’s public interface
ToDo
- Add image layer binding options (addTextureLayer(data, binding, layer, ...)

920 Diff Diff IonutCava picture IonutCava Thu 27 Jul, 2017 22:16:17 +0000

[Ionut]
- Attempt to fix HiZConstructions. Didn’t work, but fixed some bugs in the process.

909 Diff Diff IonutCava picture IonutCava Thu 29 Jun, 2017 23:57:18 +0000

[Ionut]
- Rework RenderTarget class
— RTAttachment now deal with textures directly
— RT size needs to be specified upfront
- Application class is no longer a Singleton but passed around in the PlatformContext

907 Diff Diff IonutCava picture IonutCava Wed 28 Jun, 2017 23:16:40 +0000

[Ionut]
- Rework texture loading, mip map generation, sampler usage, etc
- ResourceDescriptor for textures now ONLY takes a TextureDescriptor as a property descriptor. Sampler must be assigned to the tex descriptor:
— ToDo: Separate samplers completely from textures and assign them from a pool to textures at bind time

897 Diff Diff IonutCava picture IonutCava Thu 22 Jun, 2017 18:26:20 +0000

[IonutCava]
- Fix multi-context GL object creation
- Add missing file

885 Diff Diff IonutCava picture IonutCava Mon 27 Mar, 2017 21:16:49 +0000

[Ionut]
- Match terrain collision mesh with rendered mesh

863 Diff Diff IonutCava picture IonutCava Wed 15 Feb, 2017 16:27:26 +0000

[IonutCava]
- Split Resource class into Resource and CachedResource
— CachedResource is the only resource held in a ResourceCache and loaded from a ResourceDescriptor
— CachedResource is mapped by its creation descriptor’s hash value, instead of the resource name
-— Multiple cached resources can now exist with the same name if the have different properties, for example.

860 IonutCava picture IonutCava Mon 13 Feb, 2017 21:07:59 +0000

[IonutCava]
- Fix shared_ptr leak in resource loading callbacks