Merge remote-tracking branch 'origin/master' into gi
This commit is contained in:
@@ -10,18 +10,15 @@
|
||||
class DefaultGPUTasksExecutor : public GPUTasksExecutor
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUTasksContext* _context;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
DefaultGPUTasksExecutor();
|
||||
|
||||
public:
|
||||
|
||||
// [GPUTasksExecutor]
|
||||
String ToString() const override;
|
||||
void FrameBegin() override;
|
||||
|
||||
@@ -17,7 +17,6 @@ class GPUTask : public Task
|
||||
friend GPUTasksContext;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Describes GPU work type
|
||||
/// </summary>
|
||||
@@ -29,7 +28,6 @@ public:
|
||||
DECLARE_ENUM_4(Result, Ok, Failed, MissingResources, MissingData);
|
||||
|
||||
private:
|
||||
|
||||
/// <summary>
|
||||
/// Task type
|
||||
/// </summary>
|
||||
@@ -46,7 +44,6 @@ private:
|
||||
GPUTasksContext* _context;
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUTask"/> class.
|
||||
/// </summary>
|
||||
@@ -59,7 +56,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a task type.
|
||||
/// </summary>
|
||||
@@ -79,7 +75,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Checks if operation is syncing
|
||||
/// </summary>
|
||||
@@ -90,7 +85,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Executes this task.
|
||||
/// </summary>
|
||||
@@ -152,7 +146,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual Result run(GPUTasksContext* context) = 0;
|
||||
|
||||
virtual void OnSync()
|
||||
@@ -160,7 +153,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [Task]
|
||||
String ToString() const override
|
||||
{
|
||||
@@ -168,7 +160,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [Task]
|
||||
void Enqueue() override;
|
||||
|
||||
|
||||
@@ -15,14 +15,12 @@ class GPUTask;
|
||||
class GPUTasksContext
|
||||
{
|
||||
protected:
|
||||
|
||||
CriticalSection _locker;
|
||||
GPUSyncPoint _currentSyncPoint;
|
||||
Array<GPUTask*> _tasksDone;
|
||||
int32 _totalTasksDoneCount;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUTasksContext"/> class.
|
||||
/// </summary>
|
||||
@@ -35,14 +33,12 @@ public:
|
||||
~GPUTasksContext();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The GPU commands context used for tasks execution (can be only copy/upload without graphics capabilities on some platforms).
|
||||
/// </summary>
|
||||
GPUContext* GPU;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets graphics device handle
|
||||
/// </summary>
|
||||
@@ -79,7 +75,6 @@ public:
|
||||
void OnCancelSync(GPUTask* task);
|
||||
|
||||
public:
|
||||
|
||||
void OnFrameBegin();
|
||||
|
||||
void OnFrameEnd();
|
||||
|
||||
@@ -14,18 +14,15 @@ class GPUTask;
|
||||
class GPUTasksExecutor : public Object
|
||||
{
|
||||
protected:
|
||||
|
||||
Array<GPUTasksContext*> _contextList;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
virtual ~GPUTasksExecutor();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Sync point event called on begin of the frame
|
||||
/// </summary>
|
||||
@@ -37,7 +34,6 @@ public:
|
||||
virtual void FrameEnd() = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the context list.
|
||||
/// </summary>
|
||||
@@ -48,6 +44,5 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
GPUTasksContext* createContext();
|
||||
};
|
||||
|
||||
@@ -22,7 +22,6 @@ class GPUTasksManager : public Object, public NonCopyable
|
||||
friend GPUTask;
|
||||
|
||||
private:
|
||||
|
||||
GPUDevice* _device;
|
||||
GPUTasksExecutor* _executor;
|
||||
ConcurrentTaskQueue<GPUTask> _tasks;
|
||||
@@ -30,12 +29,10 @@ private:
|
||||
int32 _bufferIndex;
|
||||
|
||||
private:
|
||||
|
||||
GPUTasksManager(GPUDevice* device);
|
||||
~GPUTasksManager();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent Graphics Device.
|
||||
/// </summary>
|
||||
@@ -70,14 +67,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Clears asynchronous resources loading queue and cancels all tasks.
|
||||
/// </summary>
|
||||
void Dispose();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// On begin rendering frame.
|
||||
/// </summary>
|
||||
@@ -89,7 +84,6 @@ public:
|
||||
void FrameEnd();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Requests work to do. Should be used only by GPUTasksExecutor.
|
||||
/// </summary>
|
||||
@@ -99,7 +93,6 @@ public:
|
||||
int32 RequestWork(GPUTask** buffer, int32 maxCount);
|
||||
|
||||
public:
|
||||
|
||||
// [Object]
|
||||
String ToString() const override
|
||||
{
|
||||
|
||||
@@ -12,12 +12,10 @@
|
||||
class GPUCopyResourceTask : public GPUTask
|
||||
{
|
||||
private:
|
||||
|
||||
GPUResourceReference _srcResource;
|
||||
GPUResourceReference _dstResource;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUCopyResourceTask"/> class.
|
||||
/// </summary>
|
||||
@@ -33,14 +31,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void OnResourceUnload(GPUResourceReference* ref)
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [GPUTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
@@ -48,7 +44,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUTask]
|
||||
Result run(GPUTasksContext* context) override
|
||||
{
|
||||
|
||||
@@ -12,13 +12,11 @@
|
||||
class GPUCopySubresourceTask : public GPUTask
|
||||
{
|
||||
private:
|
||||
|
||||
GPUResourceReference _srcResource;
|
||||
GPUResourceReference _dstResource;
|
||||
uint32 _srcSubresource, _dstSubresource;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -38,14 +36,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void OnResourceUnload(GPUResourceReference* ref)
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [GPUTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
@@ -53,7 +49,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUTask]
|
||||
Result run(GPUTasksContext* context) override
|
||||
{
|
||||
|
||||
@@ -14,13 +14,11 @@
|
||||
class GPUUploadBufferTask : public GPUTask
|
||||
{
|
||||
protected:
|
||||
|
||||
BufferReference _buffer;
|
||||
int32 _offset;
|
||||
BytesContainer _data;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUUploadBufferTask"/> class.
|
||||
/// </summary>
|
||||
@@ -42,14 +40,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void OnResourceUnload(BufferReference* ref)
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [GPUTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
@@ -57,7 +53,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUTask]
|
||||
Result run(GPUTasksContext* context) override
|
||||
{
|
||||
|
||||
@@ -14,13 +14,11 @@
|
||||
class GPUUploadTextureMipTask : public GPUTask
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUTextureReference _texture;
|
||||
int32 _mipIndex, _rowPitch, _slicePitch;
|
||||
BytesContainer _data;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUUploadTextureMipTask"/> class.
|
||||
/// </summary>
|
||||
@@ -46,14 +44,12 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void OnResourceUnload(GPUTextureReference* ref)
|
||||
{
|
||||
Cancel();
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [GPUTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
@@ -61,7 +57,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUTask]
|
||||
Result run(GPUTasksContext* context) override
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
class FLAXENGINE_API DynamicBuffer
|
||||
{
|
||||
protected:
|
||||
|
||||
GPUBuffer* _buffer;
|
||||
String _name;
|
||||
uint32 _stride;
|
||||
@@ -33,7 +32,6 @@ public:
|
||||
virtual ~DynamicBuffer();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The data container (raw bytes storage).
|
||||
/// </summary>
|
||||
@@ -85,7 +83,7 @@ public:
|
||||
Data.AddUninitialized(size);
|
||||
return Data.Get() + start;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Allocates bytes in the buffer by resizing the buffer for new memory and returns the pointer to the start of the allocated space.
|
||||
/// </summary>
|
||||
@@ -113,7 +111,6 @@ public:
|
||||
void Dispose();
|
||||
|
||||
protected:
|
||||
|
||||
virtual void InitDesc(GPUBufferDescription& desc, int32 numElements) = 0;
|
||||
};
|
||||
|
||||
@@ -123,7 +120,6 @@ protected:
|
||||
class FLAXENGINE_API DynamicVertexBuffer : public DynamicBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -136,7 +132,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [DynamicBuffer]
|
||||
void InitDesc(GPUBufferDescription& desc, int32 numElements) override
|
||||
{
|
||||
@@ -150,7 +145,6 @@ protected:
|
||||
class FLAXENGINE_API DynamicIndexBuffer : public DynamicBuffer
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -163,7 +157,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [DynamicBuffer]
|
||||
void InitDesc(GPUBufferDescription& desc, int32 numElements) override
|
||||
{
|
||||
@@ -180,7 +173,6 @@ private:
|
||||
bool _isUnorderedAccess;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -195,7 +187,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [DynamicBuffer]
|
||||
void InitDesc(GPUBufferDescription& desc, int32 numElements) override;
|
||||
};
|
||||
@@ -210,7 +201,6 @@ private:
|
||||
bool _isUnorderedAccess;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -221,7 +211,6 @@ public:
|
||||
DynamicTypedBuffer(uint32 initialCapacity, PixelFormat format, bool isUnorderedAccess = false, const String& name = String::Empty);
|
||||
|
||||
protected:
|
||||
|
||||
// [DynamicBuffer]
|
||||
void InitDesc(GPUBufferDescription& desc, int32 numElements) override;
|
||||
};
|
||||
|
||||
@@ -362,7 +362,7 @@ API_ENUM() enum class CullMode : byte
|
||||
/// </summary>
|
||||
API_STRUCT() struct BlendingMode
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(BlendingMode);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(BlendingMode);
|
||||
|
||||
/// <summary>
|
||||
/// Blending mode.
|
||||
@@ -454,7 +454,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(BlendingMode);
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Render target blending mode descriptor.
|
||||
/// </summary>
|
||||
@@ -501,11 +500,9 @@ public:
|
||||
API_FIELD() ColorWrite RenderTargetWriteMask;
|
||||
|
||||
public:
|
||||
|
||||
bool operator==(const BlendingMode& other) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the opaque rendering (default). No blending is being performed.
|
||||
/// </summary>
|
||||
|
||||
@@ -16,9 +16,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn, Attributes="HideInEditor") class FLAXENGINE_API GPUAdapter : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDevice);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDevice);
|
||||
public:
|
||||
|
||||
GPUAdapter()
|
||||
: ScriptingObject(SpawnParams(Guid::New(), TypeInitializer))
|
||||
{
|
||||
@@ -36,7 +35,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Checks if adapter is valid and returns true if it is.
|
||||
/// </summary>
|
||||
@@ -54,7 +52,6 @@ public:
|
||||
API_PROPERTY() virtual String GetDescription() const = 0;
|
||||
|
||||
public:
|
||||
|
||||
// Returns true if adapter's vendor is AMD.
|
||||
API_PROPERTY() FORCE_INLINE bool IsAMD() const
|
||||
{
|
||||
|
||||
@@ -271,13 +271,11 @@ bool GPUBuffer::DownloadData(BytesContainer& result)
|
||||
class BufferDownloadDataTask : public ThreadPoolTask
|
||||
{
|
||||
private:
|
||||
|
||||
BufferReference _buffer;
|
||||
GPUBuffer* _staging;
|
||||
BytesContainer& _data;
|
||||
|
||||
public:
|
||||
|
||||
BufferDownloadDataTask(GPUBuffer* buffer, GPUBuffer* staging, BytesContainer& data)
|
||||
: _buffer(buffer)
|
||||
, _staging(staging)
|
||||
@@ -291,7 +289,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [ThreadPoolTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
@@ -299,7 +296,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [ThreadPoolTask]
|
||||
bool Run() override
|
||||
{
|
||||
|
||||
@@ -15,9 +15,8 @@ typedef DataContainer<byte> BytesContainer;
|
||||
/// </summary>
|
||||
API_CLASS(Sealed, NoSpawn) class FLAXENGINE_API GPUBufferView : public GPUResourceView
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUBufferView);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUBufferView);
|
||||
protected:
|
||||
|
||||
GPUBufferView();
|
||||
};
|
||||
|
||||
@@ -27,19 +26,17 @@ protected:
|
||||
/// <seealso cref="GPUResource" />
|
||||
API_CLASS(Sealed) class FLAXENGINE_API GPUBuffer : public GPUResource
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUBuffer);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUBuffer);
|
||||
static GPUBuffer* Spawn(const SpawnParams& params);
|
||||
static GPUBuffer* New();
|
||||
|
||||
protected:
|
||||
|
||||
GPUBufferDescription _desc;
|
||||
bool _isLocked = false;
|
||||
|
||||
GPUBuffer();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this buffer has been allocated.
|
||||
/// </summary>
|
||||
@@ -135,7 +132,6 @@ public:
|
||||
API_FUNCTION() virtual GPUBufferView* View() const = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates new buffer.
|
||||
/// </summary>
|
||||
@@ -163,7 +159,6 @@ public:
|
||||
API_FUNCTION() bool Resize(uint32 newSize);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Stops current thread execution to gather buffer data from the GPU. Cannot be called from main thread if the buffer is not a dynamic nor staging readback.
|
||||
/// </summary>
|
||||
@@ -205,18 +200,15 @@ public:
|
||||
API_FUNCTION() virtual void Unmap() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool OnInit() = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
String ToString() const override;
|
||||
ResourceType GetResourceType() const final override;
|
||||
ObjectType GetObjectType() const final override;
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUResource]
|
||||
void OnReleaseGPU() override;
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ DECLARE_ENUM_OPERATORS(GPUBufferFlags);
|
||||
/// </summary>
|
||||
API_STRUCT() struct FLAXENGINE_API GPUBufferDescription
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPUBufferDescription);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPUBufferDescription);
|
||||
|
||||
/// <summary>
|
||||
/// The buffer total size.
|
||||
@@ -111,7 +111,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(GPUBufferDescription);
|
||||
API_FIELD() GPUResourceUsage Usage;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number elements in the buffer.
|
||||
/// </summary>
|
||||
@@ -137,7 +136,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates the buffer description.
|
||||
/// </summary>
|
||||
@@ -334,7 +332,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void Clear();
|
||||
GPUBufferDescription ToStagingUpload() const;
|
||||
GPUBufferDescription ToStagingReadback() const;
|
||||
@@ -342,7 +339,6 @@ public:
|
||||
String ToString() const;
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE bool operator==(const GPUBufferDescription& other) const
|
||||
{
|
||||
return Equals(other);
|
||||
|
||||
@@ -29,7 +29,7 @@ class GPUBufferView;
|
||||
/// </summary>
|
||||
API_STRUCT() struct GPUDispatchIndirectArgs
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDispatchIndirectArgs);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDispatchIndirectArgs);
|
||||
|
||||
/// <summary>
|
||||
/// The X dimension of dispatch size.
|
||||
@@ -52,7 +52,7 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDispatchIndirectArgs);
|
||||
/// </summary>
|
||||
API_STRUCT() struct GPUDrawIndirectArgs
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDrawIndirectArgs);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDrawIndirectArgs);
|
||||
|
||||
/// <summary>
|
||||
/// The number of vertices to draw for each instance.
|
||||
@@ -80,7 +80,7 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDrawIndirectArgs);
|
||||
/// </summary>
|
||||
API_STRUCT() struct GPUDrawIndexedIndirectArgs
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDrawIndexedIndirectArgs);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDrawIndexedIndirectArgs);
|
||||
|
||||
/// <summary>
|
||||
/// The number of indices to draw for each instance.
|
||||
@@ -113,18 +113,15 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDrawIndexedIndirectArgs);
|
||||
/// </summary>
|
||||
API_CLASS(Sealed, NoSpawn) class FLAXENGINE_API GPUContext : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUContext);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUContext);
|
||||
private:
|
||||
|
||||
GPUDevice* _device;
|
||||
|
||||
protected:
|
||||
|
||||
double _lastRenderTime = -1;
|
||||
GPUContext(GPUDevice* device);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the graphics device.
|
||||
/// </summary>
|
||||
@@ -134,7 +131,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Begins new frame and enters commands collecting mode.
|
||||
/// </summary>
|
||||
@@ -146,7 +142,6 @@ public:
|
||||
virtual void FrameEnd();
|
||||
|
||||
public:
|
||||
|
||||
#if GPU_ALLOW_PROFILE_EVENTS
|
||||
|
||||
/// <summary>
|
||||
@@ -167,7 +162,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the native pointer to the underlying graphics device context. It's a low-level platform-specific handle.
|
||||
/// </summary>
|
||||
@@ -180,7 +174,6 @@ public:
|
||||
virtual bool IsDepthBufferBinded() = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Clears texture surface with a color. Supports volumetric textures and texture arrays (including cube textures).
|
||||
/// </summary>
|
||||
@@ -224,7 +217,6 @@ public:
|
||||
virtual void ClearUA(GPUTexture* texture, const Float4& value) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the buffer data.
|
||||
/// </summary>
|
||||
@@ -298,7 +290,6 @@ public:
|
||||
API_FUNCTION() virtual void CopySubresource(GPUResource* dstResource, uint32 dstSubresource, GPUResource* srcResource, uint32 srcSubresource) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Unbinds all the render targets and flushes the change with the driver (used to prevent driver detection of resource hazards, eg. when down-scaling the texture).
|
||||
/// </summary>
|
||||
@@ -325,7 +316,6 @@ public:
|
||||
API_FUNCTION() virtual void SetRenderTarget(GPUTextureView* depthBuffer, const Span<GPUTextureView*>& rts) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Unbinds all shader resource slots and flushes the change with the driver (used to prevent driver detection of resource hazards, eg. when down-scaling the texture).
|
||||
/// </summary>
|
||||
@@ -417,7 +407,6 @@ public:
|
||||
API_FUNCTION() virtual void BindSampler(int32 slot, GPUSampler* sampler) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the constant buffer data.
|
||||
/// </summary>
|
||||
@@ -426,7 +415,6 @@ public:
|
||||
API_FUNCTION() virtual void UpdateCB(GPUConstantBuffer* cb, const void* data) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Executes a command list from a thread group.
|
||||
/// </summary>
|
||||
@@ -534,7 +522,6 @@ public:
|
||||
API_FUNCTION() virtual void DrawIndexedInstancedIndirect(GPUBuffer* bufferForArgs, uint32 offsetForArgs) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Sets the rendering viewport and scissor rectangle.
|
||||
/// </summary>
|
||||
@@ -583,7 +570,6 @@ public:
|
||||
API_FUNCTION() virtual void SetScissor(API_PARAM(Ref) const Rectangle& scissorRect) = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Sets the graphics pipeline state.
|
||||
/// </summary>
|
||||
|
||||
@@ -31,9 +31,8 @@ class MaterialBase;
|
||||
/// </summary>
|
||||
API_CLASS(Sealed, NoSpawn) class FLAXENGINE_API GPUDevice : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDevice);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUDevice);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Graphics Device states that describe its lifetime.
|
||||
/// </summary>
|
||||
@@ -44,7 +43,7 @@ public:
|
||||
/// </summary>
|
||||
API_STRUCT() struct VideoOutputMode
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(VideoOutputMode);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(VideoOutputMode);
|
||||
|
||||
/// <summary>
|
||||
/// The resolution width (in pixel).
|
||||
@@ -68,7 +67,6 @@ public:
|
||||
API_FIELD(ReadOnly) static GPUDevice* Instance;
|
||||
|
||||
protected:
|
||||
|
||||
// State
|
||||
DeviceState _state;
|
||||
bool _isRendering;
|
||||
@@ -83,7 +81,6 @@ protected:
|
||||
PrivateData* _res;
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUDevice"/> class.
|
||||
/// </summary>
|
||||
@@ -92,14 +89,12 @@ protected:
|
||||
GPUDevice(RendererType type, ShaderProfile profile);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="GPUDevice"/> class.
|
||||
/// </summary>
|
||||
virtual ~GPUDevice();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The graphics device locking mutex.
|
||||
/// </summary>
|
||||
@@ -116,7 +111,6 @@ public:
|
||||
GPUTasksManager TasksManager;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The total amount of graphics memory in bytes.
|
||||
/// </summary>
|
||||
@@ -158,7 +152,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets current device state.
|
||||
/// </summary>
|
||||
@@ -268,7 +261,6 @@ public:
|
||||
GPUBuffer* GetFullscreenTriangleVB() const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init device resources
|
||||
/// </summary>
|
||||
@@ -303,7 +295,6 @@ public:
|
||||
virtual void WaitForGPU() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void preDispose();
|
||||
|
||||
/// <summary>
|
||||
@@ -327,7 +318,6 @@ protected:
|
||||
virtual void RenderEnd();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates the texture.
|
||||
/// </summary>
|
||||
|
||||
@@ -184,7 +184,7 @@ DECLARE_ENUM_OPERATORS(FormatSupport);
|
||||
/// </summary>
|
||||
API_STRUCT() struct FormatFeatures
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(FormatFeatures);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(FormatFeatures);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum MSAA sample count for a particular <see cref="PixelFormat"/>.
|
||||
@@ -218,7 +218,7 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(FormatFeatures);
|
||||
/// </summary>
|
||||
API_STRUCT() struct GPULimits
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPULimits);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPULimits);
|
||||
|
||||
/// <summary>
|
||||
/// True if device supports Compute shaders.
|
||||
|
||||
@@ -12,18 +12,17 @@
|
||||
/// </summary>
|
||||
API_CLASS(Sealed) class FLAXENGINE_API GPUPipelineState : public GPUResource
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUPipelineState);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUPipelineState);
|
||||
static GPUPipelineState* Spawn(const SpawnParams& params);
|
||||
static GPUPipelineState* New();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Pipeline state description
|
||||
/// </summary>
|
||||
API_STRUCT() struct Description
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Description);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Description);
|
||||
|
||||
/// <summary>
|
||||
/// Enable/disable depth write
|
||||
@@ -91,7 +90,6 @@ public:
|
||||
API_FIELD() BlendingMode BlendMode;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Default description
|
||||
/// </summary>
|
||||
@@ -109,11 +107,9 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
ShaderBindings _meta;
|
||||
|
||||
public:
|
||||
|
||||
#if BUILD_DEBUG
|
||||
/// <summary>
|
||||
/// The description of the pipeline state cached on creation in debug builds. Can be used to help with rendering crashes or issues and validation.
|
||||
@@ -125,7 +121,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets constant buffers usage mask (each set bit marks usage of the constant buffer at the bit index slot). Combined from all the used shader stages.
|
||||
/// </summary>
|
||||
@@ -151,7 +146,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if pipeline state is valid and ready to use
|
||||
/// </summary>
|
||||
|
||||
@@ -10,11 +10,9 @@ template<int Size>
|
||||
class GPUPipelineStatePermutations
|
||||
{
|
||||
public:
|
||||
|
||||
GPUPipelineState* States[Size];
|
||||
|
||||
public:
|
||||
|
||||
GPUPipelineStatePermutations()
|
||||
{
|
||||
Platform::MemoryClear(States, sizeof(States));
|
||||
@@ -26,7 +24,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
bool IsValid() const
|
||||
{
|
||||
for (int i = 0; i < Size; i++)
|
||||
@@ -51,7 +48,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void CreatePipelineStates()
|
||||
{
|
||||
for (int i = 0; i < Size; i++)
|
||||
@@ -87,11 +83,9 @@ template<int Size>
|
||||
class GPUPipelineStatePermutationsPs : public GPUPipelineStatePermutations<Size>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef GPUPipelineStatePermutations<Size> Base;
|
||||
|
||||
public:
|
||||
|
||||
GPUPipelineStatePermutationsPs()
|
||||
{
|
||||
}
|
||||
@@ -101,7 +95,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
bool Create(GPUPipelineState::Description& desc, GPUShader* shader, const StringAnsiView& psName)
|
||||
{
|
||||
for (int i = 0; i < Size; i++)
|
||||
@@ -121,11 +114,9 @@ template<int Size>
|
||||
class ComputeShaderPermutation
|
||||
{
|
||||
public:
|
||||
|
||||
GPUShaderProgramCS* Shaders[Size];
|
||||
|
||||
public:
|
||||
|
||||
ComputeShaderPermutation()
|
||||
{
|
||||
Platform::MemoryClear(Shaders, sizeof(Shaders));
|
||||
@@ -136,14 +127,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE GPUShaderProgramCS* Get(const int index) const
|
||||
{
|
||||
return Shaders[index];
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void Clear()
|
||||
{
|
||||
Platform::MemoryClear(Shaders, sizeof(Shaders));
|
||||
|
||||
@@ -17,9 +17,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API GPUResource : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUResource);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUResource);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// GPU Resources types.
|
||||
/// </summary>
|
||||
@@ -31,7 +30,6 @@ public:
|
||||
DECLARE_ENUM_3(ObjectType, Texture, Buffer, Other);
|
||||
|
||||
protected:
|
||||
|
||||
uint64 _memoryUsage = 0;
|
||||
|
||||
public:
|
||||
@@ -54,7 +52,6 @@ public:
|
||||
virtual ~GPUResource();
|
||||
|
||||
public:
|
||||
|
||||
// Points to the cache used by the resource for the resource visibility/usage detection. Written during rendering when resource is used.
|
||||
double LastRenderTime = -1;
|
||||
|
||||
@@ -64,7 +61,6 @@ public:
|
||||
Action Releasing;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the resource type.
|
||||
/// </summary>
|
||||
@@ -100,14 +96,12 @@ public:
|
||||
virtual void OnDeviceDispose();
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Releases GPU resource data (implementation).
|
||||
/// </summary>
|
||||
virtual void OnReleaseGPU();
|
||||
|
||||
public:
|
||||
|
||||
// [ScriptingObject]
|
||||
String ToString() const override;
|
||||
void OnDeleteObject() override;
|
||||
@@ -123,17 +117,14 @@ template<class DeviceType, class BaseType>
|
||||
class GPUResourceBase : public BaseType
|
||||
{
|
||||
protected:
|
||||
|
||||
DeviceType* _device;
|
||||
|
||||
private:
|
||||
|
||||
#if GPU_ENABLE_RESOURCE_NAMING
|
||||
String _name;
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUResourceBase"/> class.
|
||||
/// </summary>
|
||||
@@ -158,7 +149,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the graphics device.
|
||||
/// </summary>
|
||||
@@ -168,7 +158,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
#if GPU_ENABLE_RESOURCE_NAMING
|
||||
String GetName() const override
|
||||
@@ -188,7 +177,7 @@ public:
|
||||
/// </summary>
|
||||
API_CLASS(Abstract, NoSpawn, Attributes="HideInEditor") class FLAXENGINE_API GPUResourceView : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUResourceView);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUResourceView);
|
||||
protected:
|
||||
static double DummyLastRenderTime;
|
||||
|
||||
@@ -199,7 +188,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Points to the cache used by the resource for the resource visibility/usage detection. Written during rendering when resource view is used.
|
||||
double* LastRenderTime;
|
||||
|
||||
|
||||
@@ -12,23 +12,19 @@ template<typename T = GPUResource>
|
||||
class GPUResourceProperty
|
||||
{
|
||||
private:
|
||||
|
||||
T* _resource;
|
||||
|
||||
private:
|
||||
|
||||
// Disable copy actions
|
||||
GPUResourceProperty(const GPUResourceProperty& other) = delete;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Action fired when resource gets unloaded (reference gets cleared bu async tasks should stop execution).
|
||||
/// </summary>
|
||||
Delegate<GPUResourceProperty*> OnUnload;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUResourceProperty"/> class.
|
||||
/// </summary>
|
||||
@@ -62,7 +58,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE bool operator==(T* other) const
|
||||
{
|
||||
return Get() == other;
|
||||
@@ -147,7 +142,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Set resource
|
||||
/// </summary>
|
||||
@@ -183,7 +177,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void onResourceUnload()
|
||||
{
|
||||
if (_resource)
|
||||
|
||||
@@ -12,7 +12,6 @@ template<typename StateType, StateType InvalidState>
|
||||
class GPUResourceState
|
||||
{
|
||||
private:
|
||||
|
||||
/// <summary>
|
||||
/// The whole resource state (used only if _allSubresourcesSame is 1).
|
||||
/// </summary>
|
||||
@@ -30,7 +29,6 @@ private:
|
||||
Array<StateType> _subresourceState;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUResourceState"/> class.
|
||||
/// </summary>
|
||||
@@ -41,7 +39,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
void Initialize(uint32 subresourceCount, StateType initialState, bool usePerSubresourceTracking)
|
||||
{
|
||||
ASSERT(_subresourceState.IsEmpty() && subresourceCount > 0);
|
||||
|
||||
@@ -15,12 +15,10 @@ class StringBuilder;
|
||||
class GPUResourcesCollection
|
||||
{
|
||||
private:
|
||||
|
||||
CriticalSection _locker;
|
||||
Array<GPUResource*> _collection;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUResourcesCollection"/> class.
|
||||
/// </summary>
|
||||
@@ -37,7 +35,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total memory usage (in bytes).
|
||||
/// </summary>
|
||||
@@ -60,7 +57,6 @@ public:
|
||||
void DumpToLog(StringBuilder& output) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Adds the specified resource to the collection.
|
||||
/// </summary>
|
||||
|
||||
@@ -10,7 +10,6 @@ class GPUSwapChainDownloadTask : public Task
|
||||
friend GPUSwapChain;
|
||||
|
||||
public:
|
||||
|
||||
GPUSwapChain* SwapChain;
|
||||
GPUTexture* Texture;
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ class Task;
|
||||
class FLAXENGINE_API GPUSwapChain : public GPUResource
|
||||
{
|
||||
protected:
|
||||
|
||||
int32 _width = 0;
|
||||
int32 _height = 0;
|
||||
uint64 _presentCount = 0;
|
||||
@@ -30,7 +29,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the linked window.
|
||||
/// </summary>
|
||||
@@ -123,7 +121,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates GPU async task that will gather render target data from the GPU.
|
||||
/// </summary>
|
||||
@@ -132,7 +129,6 @@ public:
|
||||
virtual Task* DownloadDataAsync(TextureData& result);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Begin task rendering.
|
||||
/// </summary>
|
||||
@@ -162,7 +158,6 @@ public:
|
||||
virtual bool Resize(int32 width, int32 height) = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
ResourceType GetResourceType() const final override
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
class FLAXENGINE_API GPUTimerQuery : public GPUResource
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="GPUTimerQuery"/> class.
|
||||
/// </summary>
|
||||
@@ -21,7 +20,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Starts the counter.
|
||||
/// </summary>
|
||||
@@ -45,7 +43,6 @@ public:
|
||||
virtual float GetResult() = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
String ToString() const override
|
||||
{
|
||||
|
||||
@@ -41,7 +41,6 @@ extern GPUDevice* CreateGPUDevicePS5();
|
||||
class GraphicsService : public EngineService
|
||||
{
|
||||
public:
|
||||
|
||||
GraphicsService()
|
||||
: EngineService(TEXT("Graphics"), -40)
|
||||
{
|
||||
|
||||
@@ -11,9 +11,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API Graphics
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Graphics);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Graphics);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Enables rendering synchronization with the refresh rate of the display device to avoid "tearing" artifacts.
|
||||
/// </summary>
|
||||
@@ -75,7 +74,6 @@ public:
|
||||
API_FIELD() static PostProcessSettings PostProcessSettings;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the device.
|
||||
/// </summary>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class DecalMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
GPUPipelineState* Inside = nullptr;
|
||||
@@ -24,11 +23,9 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cache;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -39,14 +36,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
DrawPass GetDrawModes() const override;
|
||||
void Bind(BindParameters& params) override;
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class DeferredMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
PipelineStateCache Default;
|
||||
@@ -62,19 +61,16 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cache;
|
||||
Cache _cacheInstanced;
|
||||
|
||||
public:
|
||||
|
||||
DeferredMaterialShader(const StringView& name)
|
||||
: MaterialShader(name)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
DrawPass GetDrawModes() const override;
|
||||
bool CanUseLightmap() const override;
|
||||
@@ -83,7 +79,6 @@ public:
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class DeformableMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
PipelineStateCache Default;
|
||||
@@ -48,26 +47,22 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cache;
|
||||
DrawPass _drawModes = DrawPass::None;
|
||||
|
||||
public:
|
||||
|
||||
DeformableMaterialShader(const StringView& name)
|
||||
: MaterialShader(name)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
DrawPass GetDrawModes() const override;
|
||||
void Bind(BindParameters& params) override;
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class ForwardMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
PipelineStateCache Default;
|
||||
@@ -55,13 +54,11 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cache;
|
||||
Cache _cacheInstanced;
|
||||
DrawPass _drawModes = DrawPass::None;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -72,7 +69,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
DrawPass GetDrawModes() const override;
|
||||
bool CanUseInstancing(InstancingHandler& handler) const override;
|
||||
@@ -80,7 +76,6 @@ public:
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -20,6 +20,7 @@ PACK_STRUCT(struct GUIMaterialShaderData {
|
||||
float TimeParam;
|
||||
Float4 ViewInfo;
|
||||
Float4 ScreenSize;
|
||||
Float4 ViewSize;
|
||||
});
|
||||
|
||||
void GUIMaterialShader::Bind(BindParameters& params)
|
||||
@@ -32,6 +33,7 @@ void GUIMaterialShader::Bind(BindParameters& params)
|
||||
cb = Span<byte>(cb.Get() + sizeof(GUIMaterialShaderData), cb.Length() - sizeof(GUIMaterialShaderData));
|
||||
int32 srv = 0;
|
||||
const auto ps = context->IsDepthBufferBinded() ? _cache.Depth : _cache.NoDepth;
|
||||
auto customData = (Render2D::CustomData*)params.CustomData;
|
||||
|
||||
// Setup parameters
|
||||
MaterialParameter::BindMeta bindMeta;
|
||||
@@ -45,8 +47,7 @@ void GUIMaterialShader::Bind(BindParameters& params)
|
||||
|
||||
// Setup material constants
|
||||
{
|
||||
const auto viewProjectionMatrix = (Matrix*)params.CustomData;
|
||||
Matrix::Transpose(*viewProjectionMatrix, materialData->ViewProjectionMatrix);
|
||||
Matrix::Transpose(customData->ViewProjection, materialData->ViewProjectionMatrix);
|
||||
Matrix::Transpose(Matrix::Identity, materialData->WorldMatrix);
|
||||
Matrix::Transpose(Matrix::Identity, materialData->ViewMatrix);
|
||||
materialData->ViewPos = Float3::Zero;
|
||||
@@ -56,6 +57,7 @@ void GUIMaterialShader::Bind(BindParameters& params)
|
||||
materialData->ViewInfo = Float4::Zero;
|
||||
auto& viewport = Render2D::GetViewport();
|
||||
materialData->ScreenSize = Float4(viewport.Width, viewport.Height, 1.0f / viewport.Width, 1.0f / viewport.Height);
|
||||
materialData->ViewSize = Float4(customData->ViewSize.X, customData->ViewSize.Y, 1.0f / customData->ViewSize.X, 1.0f / customData->ViewSize.Y);
|
||||
}
|
||||
|
||||
// Bind constants
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class GUIMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
GPUPipelineState* Depth = nullptr;
|
||||
@@ -24,11 +23,9 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cache;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -39,13 +36,11 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
void Bind(BindParameters& params) override;
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -20,7 +20,6 @@ struct DrawCall;
|
||||
class FLAXENGINE_API IMaterial
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the material info, structure which describes material surface.
|
||||
/// </summary>
|
||||
@@ -134,7 +133,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Settings for the material binding to the graphics pipeline.
|
||||
/// </summary>
|
||||
|
||||
@@ -446,7 +446,7 @@ struct MaterialInfo8
|
||||
/// </summary>
|
||||
API_STRUCT() struct FLAXENGINE_API MaterialInfo
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(MaterialInfo);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(MaterialInfo);
|
||||
|
||||
/// <summary>
|
||||
/// The material shader domain.
|
||||
|
||||
@@ -406,7 +406,9 @@ void MaterialParameter::Bind(BindMeta& meta) const
|
||||
{
|
||||
case MaterialSceneTextures::SceneDepth:
|
||||
view = meta.CanSampleDepth
|
||||
? meta.Buffers->DepthBuffer->GetDescription().Flags & GPUTextureFlags::ReadOnlyDepthView ? meta.Buffers->DepthBuffer->ViewReadOnlyDepth() : meta.Buffers->DepthBuffer->View()
|
||||
? meta.Buffers->DepthBuffer->GetDescription().Flags & GPUTextureFlags::ReadOnlyDepthView
|
||||
? meta.Buffers->DepthBuffer->ViewReadOnlyDepth()
|
||||
: meta.Buffers->DepthBuffer->View()
|
||||
: GPUDevice::Instance->GetDefaultWhiteTexture()->View();
|
||||
break;
|
||||
case MaterialSceneTextures::AmbientOcclusion:
|
||||
|
||||
@@ -174,11 +174,10 @@ struct SerializedMaterialParam
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API MaterialParameter : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(MaterialParameter, ScriptingObject);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(MaterialParameter, ScriptingObject);
|
||||
friend MaterialParams;
|
||||
friend MaterialInstance;
|
||||
private:
|
||||
|
||||
Guid _paramId;
|
||||
MaterialParameterType _type = MaterialParameterType::Invalid;
|
||||
bool _isPublic;
|
||||
@@ -202,7 +201,6 @@ private:
|
||||
String _name;
|
||||
|
||||
public:
|
||||
|
||||
MaterialParameter(const MaterialParameter& other)
|
||||
: MaterialParameter()
|
||||
{
|
||||
@@ -220,7 +218,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parameter ID (not the parameter instance Id but the original parameter ID).
|
||||
/// </summary>
|
||||
@@ -286,7 +283,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the value of the parameter.
|
||||
/// </summary>
|
||||
@@ -300,7 +296,6 @@ public:
|
||||
API_PROPERTY() void SetValue(const Variant& value);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The material parameter binding metadata.
|
||||
/// </summary>
|
||||
@@ -346,11 +341,9 @@ public:
|
||||
bool HasContentLoaded() const;
|
||||
|
||||
private:
|
||||
|
||||
void clone(const MaterialParameter* param);
|
||||
|
||||
public:
|
||||
|
||||
bool operator==(const MaterialParameter& other) const;
|
||||
|
||||
// [Object]
|
||||
@@ -364,25 +357,21 @@ class FLAXENGINE_API MaterialParams : public Array<MaterialParameter>
|
||||
{
|
||||
friend MaterialInstance;
|
||||
private:
|
||||
|
||||
int32 _versionHash = 0;
|
||||
|
||||
public:
|
||||
|
||||
MaterialParameter* Get(const Guid& id);
|
||||
MaterialParameter* Get(const StringView& name);
|
||||
int32 Find(const Guid& id);
|
||||
int32 Find(const StringView& name);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parameters version hash. Every time the parameters are modified (loaded, edited, etc.) the hash changes. Can be used to sync instanced parameters collection.
|
||||
/// </summary>
|
||||
int32 GetVersionHash() const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Binds the parameters to the pipeline.
|
||||
/// </summary>
|
||||
@@ -429,7 +418,6 @@ public:
|
||||
static void Save(BytesContainer& data, const Array<SerializedMaterialParam>* params);
|
||||
|
||||
public:
|
||||
|
||||
#if USE_EDITOR
|
||||
|
||||
/// <summary>
|
||||
@@ -443,6 +431,5 @@ public:
|
||||
bool HasContentLoaded() const;
|
||||
|
||||
private:
|
||||
|
||||
void UpdateHash();
|
||||
};
|
||||
|
||||
@@ -112,21 +112,18 @@ MaterialShader* MaterialShader::Create(const StringView& name, MemoryReadStream&
|
||||
class DummyMaterial : public MaterialShader
|
||||
{
|
||||
public:
|
||||
|
||||
DummyMaterial()
|
||||
: MaterialShader(String::Empty)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [Material]
|
||||
void Bind(BindParameters& params) override
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [Material]
|
||||
bool Load() override
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/// <summary>
|
||||
/// Current materials shader version.
|
||||
/// </summary>
|
||||
#define MATERIAL_GRAPH_VERSION 152
|
||||
#define MATERIAL_GRAPH_VERSION 153
|
||||
|
||||
class Material;
|
||||
class GPUShader;
|
||||
@@ -23,7 +23,6 @@ class MemoryReadStream;
|
||||
class MaterialShader : public IMaterial
|
||||
{
|
||||
protected:
|
||||
|
||||
struct PipelineStateCache
|
||||
{
|
||||
GPUPipelineState* PS[6];
|
||||
@@ -57,7 +56,6 @@ protected:
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
bool _isLoaded;
|
||||
GPUShader* _shader;
|
||||
GPUConstantBuffer* _cb;
|
||||
@@ -65,7 +63,6 @@ protected:
|
||||
MaterialInfo _info;
|
||||
|
||||
protected:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -73,14 +70,12 @@ protected:
|
||||
MaterialShader(const StringView& name);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="MaterialShader"/> class.
|
||||
/// </summary>
|
||||
virtual ~MaterialShader();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates and loads the material from the data.
|
||||
/// </summary>
|
||||
@@ -104,12 +99,10 @@ public:
|
||||
virtual void Unload();
|
||||
|
||||
protected:
|
||||
|
||||
bool Load(MemoryReadStream& shaderCacheStream, const MaterialInfo& info);
|
||||
virtual bool Load() = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [IMaterial]
|
||||
const MaterialInfo& GetInfo() const override;
|
||||
GPUShader* GetShader() const override;
|
||||
|
||||
@@ -136,19 +136,19 @@ void ParticleMaterialShader::Bind(BindParameters& params)
|
||||
PipelineStateCache* psCache = nullptr;
|
||||
switch (drawCall.Particle.Module->TypeID)
|
||||
{
|
||||
// Sprite Rendering
|
||||
// Sprite Rendering
|
||||
case 400:
|
||||
{
|
||||
psCache = _cacheSprite.GetPS(view.Pass);
|
||||
break;
|
||||
}
|
||||
// Model Rendering
|
||||
// Model Rendering
|
||||
case 403:
|
||||
{
|
||||
psCache = _cacheModel.GetPS(view.Pass);
|
||||
break;
|
||||
}
|
||||
// Ribbon Rendering
|
||||
// Ribbon Rendering
|
||||
case 404:
|
||||
{
|
||||
psCache = _cacheRibbon.GetPS(view.Pass);
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class ParticleMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
PipelineStateCache Default;
|
||||
@@ -51,7 +50,6 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cacheSprite;
|
||||
Cache _cacheModel;
|
||||
Cache _cacheRibbon;
|
||||
@@ -59,7 +57,6 @@ private:
|
||||
DrawPass _drawModes = DrawPass::None;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -70,14 +67,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
DrawPass GetDrawModes() const override;
|
||||
void Bind(BindParameters& params) override;
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class PostFxMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
GPUPipelineState* Default = nullptr;
|
||||
@@ -22,11 +21,9 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cache;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -37,13 +34,11 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
void Bind(BindParameters& params) override;
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
class TerrainMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
struct Cache
|
||||
{
|
||||
PipelineStateCache Default;
|
||||
@@ -49,11 +48,9 @@ private:
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Cache _cache;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -64,7 +61,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
DrawPass GetDrawModes() const override;
|
||||
bool CanUseLightmap() const override;
|
||||
@@ -72,7 +68,6 @@ public:
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
class VolumeParticleMaterialShader : public MaterialShader
|
||||
{
|
||||
private:
|
||||
|
||||
GPUPipelineState* _psVolumetricFog = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -25,14 +23,12 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [MaterialShader]
|
||||
DrawPass GetDrawModes() const override;
|
||||
void Bind(BindParameters& params) override;
|
||||
void Unload() override;
|
||||
|
||||
protected:
|
||||
|
||||
// [MaterialShader]
|
||||
bool Load() override;
|
||||
};
|
||||
|
||||
@@ -46,7 +46,6 @@ struct TIsPODType<BlendShapeVertex>
|
||||
class BlendShape
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The name of the blend shape.
|
||||
/// </summary>
|
||||
@@ -84,14 +83,12 @@ public:
|
||||
class BlendShapesInstance
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The runtime data for blend shapes used for on a mesh.
|
||||
/// </summary>
|
||||
class MeshInstance
|
||||
{
|
||||
public:
|
||||
|
||||
bool IsUsed;
|
||||
bool IsDirty;
|
||||
uint32 DirtyMinVertexIndex;
|
||||
@@ -103,7 +100,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The blend shapes weights (pair of blend shape name and the weight).
|
||||
/// </summary>
|
||||
@@ -120,7 +116,6 @@ public:
|
||||
Dictionary<SkinnedMesh*, MeshInstance*> Meshes;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="BlendShapesInstance"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
class FLAXENGINE_API CollisionProxy
|
||||
{
|
||||
public:
|
||||
|
||||
struct CollisionTriangle
|
||||
{
|
||||
Float3 V0, V1, V2;
|
||||
@@ -25,7 +24,6 @@ public:
|
||||
Array<CollisionTriangle> Triangles;
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE bool HasData() const
|
||||
{
|
||||
return Triangles.HasItems();
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API MaterialSlot : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(MaterialSlot, ScriptingObject);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(MaterialSlot, ScriptingObject);
|
||||
|
||||
/// <summary>
|
||||
/// The material to use for rendering.
|
||||
@@ -30,7 +30,6 @@ DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(MaterialSlot, ScriptingObject);
|
||||
API_FIELD() String Name;
|
||||
|
||||
public:
|
||||
|
||||
MaterialSlot(const MaterialSlot& other)
|
||||
: MaterialSlot()
|
||||
{
|
||||
|
||||
@@ -20,9 +20,8 @@ class GPUBuffer;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API Mesh : public MeshBase
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(Mesh, MeshBase);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(Mesh, MeshBase);
|
||||
protected:
|
||||
|
||||
bool _hasLightmapUVs;
|
||||
GPUBuffer* _vertexBuffers[3] = {};
|
||||
GPUBuffer* _indexBuffer = nullptr;
|
||||
@@ -34,7 +33,6 @@ protected:
|
||||
mutable int32 _cachedIndexBufferCount;
|
||||
|
||||
public:
|
||||
|
||||
Mesh(const Mesh& other)
|
||||
: Mesh()
|
||||
{
|
||||
@@ -49,7 +47,6 @@ public:
|
||||
~Mesh();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the model owning this mesh.
|
||||
/// </summary>
|
||||
@@ -110,7 +107,6 @@ public:
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the model mesh (used by the virtual models created with Init rather than Load).
|
||||
/// </summary>
|
||||
@@ -189,7 +185,6 @@ public:
|
||||
bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, Float3* vertices, uint32* triangles, Float3* normals = nullptr, Float3* tangents = nullptr, Float2* uvs = nullptr, Color32* colors = nullptr);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the model mesh index buffer (used by the virtual models created with Init rather than Load).
|
||||
/// </summary>
|
||||
@@ -222,7 +217,6 @@ public:
|
||||
bool UpdateTriangles(uint32 triangleCount, void* ib, bool use16BitIndices);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes instance of the <see cref="Mesh"/> class.
|
||||
/// </summary>
|
||||
@@ -254,7 +248,6 @@ public:
|
||||
void Unload();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the mesh and a ray in given world
|
||||
/// </summary>
|
||||
@@ -275,7 +268,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the draw call geometry for this mesh. Sets the index and vertex buffers.
|
||||
/// </summary>
|
||||
@@ -375,14 +367,12 @@ public:
|
||||
void Draw(const RenderContext& renderContext, const DrawInfo& info, float lodDitherFactor) const;
|
||||
|
||||
public:
|
||||
|
||||
// [MeshBase]
|
||||
bool DownloadDataGPU(MeshBufferType type, BytesContainer& result) const override;
|
||||
Task* DownloadDataGPUAsync(MeshBufferType type, BytesContainer& result) const override;
|
||||
bool DownloadDataCPU(MeshBufferType type, BytesContainer& result, int32& count) const override;
|
||||
|
||||
private:
|
||||
|
||||
// Internal bindings
|
||||
API_FUNCTION(NoProxy) ScriptingObject* GetParentModel();
|
||||
#if !COMPILE_WITHOUT_CSHARP
|
||||
|
||||
@@ -16,9 +16,8 @@ class ModelBase;
|
||||
/// </summary>
|
||||
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API MeshBase : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(MeshBase);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(MeshBase);
|
||||
protected:
|
||||
|
||||
ModelBase* _model;
|
||||
BoundingBox _box;
|
||||
BoundingSphere _sphere;
|
||||
@@ -35,7 +34,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the model owning this mesh.
|
||||
/// </summary>
|
||||
@@ -120,7 +118,6 @@ public:
|
||||
void SetBounds(const BoundingBox& box);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Extract mesh buffer data from GPU. Cannot be called from the main thread.
|
||||
/// </summary>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
class FLAXENGINE_API MeshData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The slot index in the model materials to use during rendering.
|
||||
/// </summary>
|
||||
@@ -92,7 +91,6 @@ public:
|
||||
Array<BlendShape> BlendShapes;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance has any mesh data.
|
||||
/// </summary>
|
||||
@@ -102,7 +100,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Clear arrays
|
||||
/// </summary>
|
||||
@@ -130,7 +127,6 @@ public:
|
||||
void Release();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init from model vertices array
|
||||
/// </summary>
|
||||
@@ -185,7 +181,6 @@ public:
|
||||
void SetIndexBuffer(void* data, uint32 indicesCount);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Pack mesh data to the stream
|
||||
/// </summary>
|
||||
@@ -213,7 +208,6 @@ public:
|
||||
void CalculateSphere(BoundingSphere& result) const;
|
||||
|
||||
public:
|
||||
|
||||
#if COMPILE_WITH_MODEL_TOOL
|
||||
|
||||
/// <summary>
|
||||
@@ -363,7 +357,6 @@ struct FLAXENGINE_API MaterialSlotEntry
|
||||
class FLAXENGINE_API ModelLodData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The screen size to switch LODs. Bottom limit of the model screen size to render this LOD.
|
||||
/// </summary>
|
||||
@@ -375,7 +368,6 @@ public:
|
||||
Array<MeshData*> Meshes;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModelLodData"/> class.
|
||||
/// </summary>
|
||||
@@ -403,7 +395,6 @@ public:
|
||||
class FLAXENGINE_API ModelData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The minimum screen size to draw model (the bottom limit).
|
||||
/// </summary>
|
||||
@@ -435,7 +426,6 @@ public:
|
||||
AnimationData Animation;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModelData"/> class.
|
||||
/// </summary>
|
||||
@@ -444,7 +434,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the valid level of details count.
|
||||
/// </summary>
|
||||
@@ -464,7 +453,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Automatically calculates the screen size for every model LOD for a proper transitions.
|
||||
/// </summary>
|
||||
@@ -477,7 +465,6 @@ public:
|
||||
void TransformBuffer(const Matrix& matrix);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Pack mesh data to the header stream
|
||||
/// </summary>
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
/// </summary>
|
||||
API_STRUCT() struct FLAXENGINE_API ModelInstanceEntry : ISerializable
|
||||
{
|
||||
API_AUTO_SERIALIZATION();
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(ModelInstanceEntry);
|
||||
API_AUTO_SERIALIZATION();
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(ModelInstanceEntry);
|
||||
|
||||
/// <summary>
|
||||
/// The mesh surface material used for the rendering. If not assigned the default value will be used from the model asset.
|
||||
@@ -36,7 +36,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(ModelInstanceEntry);
|
||||
API_FIELD() bool ReceiveDecals = true;
|
||||
|
||||
public:
|
||||
|
||||
bool operator==(const ModelInstanceEntry& other) const;
|
||||
FORCE_INLINE bool operator!=(const ModelInstanceEntry& other) const
|
||||
{
|
||||
@@ -50,7 +49,6 @@ public:
|
||||
class FLAXENGINE_API ModelInstanceEntries : public Array<ModelInstanceEntry>, public ISerializable
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether buffer is valid for the given model.
|
||||
/// </summary>
|
||||
@@ -66,7 +64,6 @@ public:
|
||||
bool IsValidFor(const SkinnedModel* model) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Setup buffer for given model
|
||||
/// </summary>
|
||||
@@ -117,7 +114,6 @@ public:
|
||||
bool HasContentLoaded() const;
|
||||
|
||||
public:
|
||||
|
||||
// [ISerializable]
|
||||
void Serialize(SerializeStream& stream, const void* otherObj) override;
|
||||
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
|
||||
|
||||
@@ -12,16 +12,14 @@ class MemoryReadStream;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API ModelLOD : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(ModelLOD, ScriptingObject);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(ModelLOD, ScriptingObject);
|
||||
friend Model;
|
||||
friend Mesh;
|
||||
private:
|
||||
|
||||
Model* _model = nullptr;
|
||||
uint32 _verticesCount;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The screen size to switch LODs. Bottom limit of the model screen size to render this LOD.
|
||||
/// </summary>
|
||||
@@ -51,7 +49,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the LOD from the data stream.
|
||||
/// </summary>
|
||||
@@ -70,7 +67,6 @@ public:
|
||||
void Dispose();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the Model and a Ray in given world using given instance
|
||||
/// </summary>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
/// </summary>
|
||||
API_STRUCT() struct SkeletonNode
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(SkeletonNode);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(SkeletonNode);
|
||||
|
||||
/// <summary>
|
||||
/// The parent node index. The root node uses value -1.
|
||||
@@ -36,7 +36,7 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(SkeletonNode);
|
||||
/// </summary>
|
||||
API_STRUCT() struct SkeletonBone
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(SkeletonBone);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(SkeletonBone);
|
||||
|
||||
/// <summary>
|
||||
/// The parent bone index. The root bone uses value -1.
|
||||
@@ -74,7 +74,6 @@ struct TIsPODType<SkeletonBone>
|
||||
class SkeletonData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The nodes in this hierarchy. The root node is always at the index 0.
|
||||
/// </summary>
|
||||
@@ -86,7 +85,6 @@ public:
|
||||
Array<SkeletonBone> Bones;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the root node reference.
|
||||
/// </summary>
|
||||
|
||||
@@ -12,11 +12,9 @@ template<typename T>
|
||||
class SkeletonMapping
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Array<T> Items;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The amount of the nodes (from the source skeleton).
|
||||
/// </summary>
|
||||
@@ -33,7 +31,6 @@ public:
|
||||
Array<int32> SourceToSource;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SkeletonMapping"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -12,7 +12,6 @@ template<typename T>
|
||||
class SkeletonUpdater
|
||||
{
|
||||
public:
|
||||
|
||||
typedef Array<T> Items;
|
||||
|
||||
/// <summary>
|
||||
@@ -43,14 +42,12 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The cached node transformations.
|
||||
/// </summary>
|
||||
Array<Node> NodeTransformations;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SkeletonUpdater" /> class.
|
||||
/// </summary>
|
||||
@@ -133,7 +130,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default root node.
|
||||
/// </summary>
|
||||
@@ -149,7 +145,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void UpdateNode(Node& node)
|
||||
{
|
||||
// Compute local matrix
|
||||
|
||||
@@ -16,9 +16,8 @@ class SkinnedMeshDrawData;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API SkinnedMesh : public MeshBase
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(SkinnedMesh, MeshBase);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(SkinnedMesh, MeshBase);
|
||||
protected:
|
||||
|
||||
GPUBuffer* _vertexBuffer = nullptr;
|
||||
GPUBuffer* _indexBuffer = nullptr;
|
||||
mutable Array<byte> _cachedIndexBuffer;
|
||||
@@ -26,7 +25,6 @@ protected:
|
||||
mutable int32 _cachedIndexBufferCount;
|
||||
|
||||
public:
|
||||
|
||||
SkinnedMesh(const SkinnedMesh& other)
|
||||
: SkinnedMesh()
|
||||
{
|
||||
@@ -41,7 +39,6 @@ public:
|
||||
~SkinnedMesh();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the skinned model owning this mesh.
|
||||
/// </summary>
|
||||
@@ -64,7 +61,6 @@ public:
|
||||
Array<BlendShape> BlendShapes;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SkinnedMesh"/> class.
|
||||
/// </summary>
|
||||
@@ -93,7 +89,6 @@ public:
|
||||
void Unload();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Updates the model mesh (used by the virtual models created with Init rather than Load).
|
||||
/// </summary>
|
||||
@@ -145,7 +140,6 @@ public:
|
||||
bool UpdateMesh(uint32 vertexCount, uint32 triangleCount, VB0SkinnedElementType* vb, void* ib, bool use16BitIndices);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the mesh and a ray in given world
|
||||
/// </summary>
|
||||
@@ -166,7 +160,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Model instance drawing packed data.
|
||||
/// </summary>
|
||||
@@ -238,14 +231,12 @@ public:
|
||||
void Draw(const RenderContext& renderContext, const DrawInfo& info, float lodDitherFactor) const;
|
||||
|
||||
public:
|
||||
|
||||
// [MeshBase]
|
||||
bool DownloadDataGPU(MeshBufferType type, BytesContainer& result) const override;
|
||||
Task* DownloadDataGPUAsync(MeshBufferType type, BytesContainer& result) const override;
|
||||
bool DownloadDataCPU(MeshBufferType type, BytesContainer& result, int32& count) const override;
|
||||
|
||||
private:
|
||||
|
||||
// Internal bindings
|
||||
API_FUNCTION(NoProxy) ScriptingObject* GetParentModel();
|
||||
#if !COMPILE_WITHOUT_CSHARP
|
||||
|
||||
@@ -11,12 +11,10 @@
|
||||
class FLAXENGINE_API SkinnedMeshDrawData
|
||||
{
|
||||
private:
|
||||
|
||||
bool _hasValidData = false;
|
||||
bool _isDirty = false;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The bones count.
|
||||
/// </summary>
|
||||
@@ -38,7 +36,6 @@ public:
|
||||
Array<byte> Data;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SkinnedMeshDrawData"/> class.
|
||||
/// </summary>
|
||||
@@ -50,7 +47,6 @@ public:
|
||||
~SkinnedMeshDrawData();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this instance is ready for rendering.
|
||||
/// </summary>
|
||||
|
||||
@@ -12,14 +12,12 @@ class MemoryReadStream;
|
||||
/// </summary>
|
||||
API_CLASS(NoSpawn) class FLAXENGINE_API SkinnedModelLOD : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(SkinnedModelLOD, ScriptingObject);
|
||||
DECLARE_SCRIPTING_TYPE_WITH_CONSTRUCTOR_IMPL(SkinnedModelLOD, ScriptingObject);
|
||||
friend SkinnedModel;
|
||||
private:
|
||||
|
||||
SkinnedModel* _model = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The screen size to switch LODs. Bottom limit of the model screen size to render this LOD.
|
||||
/// </summary>
|
||||
@@ -36,7 +34,6 @@ public:
|
||||
bool HasAnyMeshInitialized() const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the LOD from the data stream.
|
||||
/// </summary>
|
||||
@@ -55,7 +52,6 @@ public:
|
||||
void Dispose();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines if there is an intersection between the Model and a Ray in given world using given instance
|
||||
/// </summary>
|
||||
|
||||
@@ -54,29 +54,29 @@ enum class MeshBufferType
|
||||
// Vertex structure for all models (versioned)
|
||||
PACK_STRUCT(struct ModelVertex15
|
||||
{
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
});
|
||||
|
||||
PACK_STRUCT(struct ModelVertex18
|
||||
{
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Half2 LightmapUVs;
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Half2 LightmapUVs;
|
||||
});
|
||||
|
||||
PACK_STRUCT(struct ModelVertex19
|
||||
{
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Half2 LightmapUVs;
|
||||
Color32 Color;
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Half2 LightmapUVs;
|
||||
Color32 Color;
|
||||
});
|
||||
|
||||
typedef ModelVertex19 ModelVertex;
|
||||
@@ -96,32 +96,32 @@ struct RawModelVertex
|
||||
// For vertex data we use three buffers: one with positions, one with other attributes, and one with colors
|
||||
PACK_STRUCT(struct VB0ElementType15
|
||||
{
|
||||
Float3 Position;
|
||||
Float3 Position;
|
||||
});
|
||||
|
||||
PACK_STRUCT(struct VB1ElementType15
|
||||
{
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
});
|
||||
|
||||
PACK_STRUCT(struct VB0ElementType18
|
||||
{
|
||||
Float3 Position;
|
||||
Float3 Position;
|
||||
});
|
||||
|
||||
PACK_STRUCT(struct VB1ElementType18
|
||||
{
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Half2 LightmapUVs;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Half2 LightmapUVs;
|
||||
});
|
||||
|
||||
PACK_STRUCT(struct VB2ElementType18
|
||||
{
|
||||
Color32 Color;
|
||||
Color32 Color;
|
||||
});
|
||||
|
||||
typedef VB0ElementType18 VB0ElementType;
|
||||
@@ -132,12 +132,12 @@ typedef VB2ElementType18 VB2ElementType;
|
||||
// Vertex structure for all skinned models (versioned)
|
||||
PACK_STRUCT(struct SkinnedModelVertex1
|
||||
{
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Color32 BlendIndices;
|
||||
Color32 BlendWeights;
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Color32 BlendIndices;
|
||||
Color32 BlendWeights;
|
||||
});
|
||||
|
||||
typedef SkinnedModelVertex1 SkinnedModelVertex;
|
||||
@@ -156,22 +156,22 @@ struct RawSkinnedModelVertex
|
||||
|
||||
PACK_STRUCT(struct VB0SkinnedElementType1
|
||||
{
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Color32 BlendIndices;
|
||||
Color32 BlendWeights;
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Color32 BlendIndices;
|
||||
Color32 BlendWeights;
|
||||
});
|
||||
|
||||
PACK_STRUCT(struct VB0SkinnedElementType2
|
||||
{
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Color32 BlendIndices;
|
||||
Half4 BlendWeights;
|
||||
Float3 Position;
|
||||
Half2 TexCoord;
|
||||
Float1010102 Normal;
|
||||
Float1010102 Tangent;
|
||||
Color32 BlendIndices;
|
||||
Half4 BlendWeights;
|
||||
});
|
||||
|
||||
typedef VB0SkinnedElementType2 VB0SkinnedElementType;
|
||||
|
||||
@@ -10,16 +10,14 @@
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API PixelFormatExtensions
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(PixelFormatExtensions);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(PixelFormatExtensions);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes cache.
|
||||
/// </summary>
|
||||
static void Init();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the size of a <see cref="PixelFormat"/> in bytes.
|
||||
/// </summary>
|
||||
@@ -211,7 +209,6 @@ public:
|
||||
API_FUNCTION() static PixelFormat MakeTypelessUNorm(PixelFormat format);
|
||||
|
||||
public:
|
||||
|
||||
static PixelFormat FindShaderResourceFormat(PixelFormat format, bool bSRGB);
|
||||
static PixelFormat FindUnorderedAccessFormat(PixelFormat format);
|
||||
static PixelFormat FindDepthStencilFormat(PixelFormat format);
|
||||
|
||||
@@ -15,7 +15,6 @@ struct RenderContext;
|
||||
class PostProcessBase
|
||||
{
|
||||
protected:
|
||||
|
||||
bool _isEnabled;
|
||||
bool _useSingleTarget;
|
||||
PostProcessEffectLocation _location;
|
||||
@@ -28,7 +27,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Destructor
|
||||
/// </summary>
|
||||
@@ -37,7 +35,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if effect is enabled
|
||||
/// </summary>
|
||||
@@ -101,7 +98,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Perform rendering
|
||||
/// </summary>
|
||||
@@ -111,7 +107,6 @@ public:
|
||||
virtual void Render(RenderContext& renderContext, GPUTexture* input, GPUTexture* output) = 0;
|
||||
|
||||
protected:
|
||||
|
||||
virtual void onEnable()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ void PostProcessSettings::Serialize(SerializeStream& stream, const void* otherOb
|
||||
|
||||
stream.JKEY("AO");
|
||||
stream.Object(&AmbientOcclusion, other ? &other->AmbientOcclusion : nullptr);
|
||||
|
||||
|
||||
stream.JKEY("GI");
|
||||
stream.Object(&GlobalIllumination, other ? &other->GlobalIllumination : nullptr);
|
||||
|
||||
|
||||
@@ -322,13 +322,13 @@ API_STRUCT() struct FLAXENGINE_API GlobalIlluminationSettings : ISerializable
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(0), PostProcessSetting((int)GlobalIlluminationSettingsOverride.Mode)")
|
||||
GlobalIlluminationMode Mode = GlobalIlluminationMode::None;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Global Illumination indirect lighting intensity scale. Can be used to boost or reduce GI effect.
|
||||
/// </summary>
|
||||
API_FIELD(Attributes="EditorOrder(10), Limit(0, 10, 0.01f), PostProcessSetting((int)GlobalIlluminationSettingsOverride.Intensity)")
|
||||
float Intensity = 1.0f;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defines how quickly GI blends between the the current frame and the history buffer. Lower values update GI faster, but with more jittering and noise. If the camera in your game doesn't move much, we recommend values closer to 1.
|
||||
/// </summary>
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API RenderTargetPool
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(RenderTargetPool);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(RenderTargetPool);
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Flushes the temporary render targets.
|
||||
/// </summary>
|
||||
|
||||
@@ -26,7 +26,7 @@ class Actor;
|
||||
/// </summary>
|
||||
API_CLASS() class FLAXENGINE_API RenderTask : public ScriptingObject
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE(RenderTask);
|
||||
DECLARE_SCRIPTING_TYPE(RenderTask);
|
||||
|
||||
/// <summary>
|
||||
/// List with all registered tasks
|
||||
@@ -49,18 +49,15 @@ DECLARE_SCRIPTING_TYPE(RenderTask);
|
||||
static void DrawAll();
|
||||
|
||||
private:
|
||||
|
||||
RenderTask* _prevTask = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="RenderTask"/> class.
|
||||
/// </summary>
|
||||
virtual ~RenderTask();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether task is enabled.
|
||||
/// </summary>
|
||||
@@ -150,7 +147,6 @@ public:
|
||||
API_FUNCTION() virtual bool Resize(int32 width, int32 height);
|
||||
|
||||
public:
|
||||
|
||||
bool operator<(const RenderTask& other) const
|
||||
{
|
||||
return Order < other.Order;
|
||||
@@ -193,21 +189,18 @@ DECLARE_ENUM_OPERATORS(ActorsSources);
|
||||
class ManagedPostProcessEffect : public PostProcessBase
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The script to use. Inherits from C# class 'PostProcessEffect'.
|
||||
/// </summary>
|
||||
Script* Target = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Fetches the information about the PostFx location from the managed object.
|
||||
/// </summary>
|
||||
void FetchInfo();
|
||||
|
||||
public:
|
||||
|
||||
// [PostProcessBase]
|
||||
bool IsLoaded() const override;
|
||||
void Render(RenderContext& renderContext, GPUTexture* input, GPUTexture* output) override;
|
||||
@@ -219,19 +212,17 @@ public:
|
||||
/// <seealso cref="FlaxEngine.RenderTask" />
|
||||
API_CLASS() class FLAXENGINE_API SceneRenderTask : public RenderTask
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE(SceneRenderTask);
|
||||
DECLARE_SCRIPTING_TYPE(SceneRenderTask);
|
||||
protected:
|
||||
class SceneRendering* _customActorsScene = nullptr;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="SceneRenderTask"/> class.
|
||||
/// </summary>
|
||||
~SceneRenderTask();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// True if the current frame is after the camera cut. Used to clear the temporal effects history and prevent visual artifacts blended from the previous frames.
|
||||
/// </summary>
|
||||
@@ -300,7 +291,6 @@ public:
|
||||
Array<ManagedPostProcessEffect> CustomPostFx;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The action called on view rendering to collect draw calls. It allows to extend rendering pipeline and draw custom geometry non-existing in the scene or custom actors set.
|
||||
/// </summary>
|
||||
@@ -343,7 +333,6 @@ public:
|
||||
virtual void OnPostRender(GPUContext* context, RenderContext& renderContext);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the rendering render task viewport (before upsampling).
|
||||
/// </summary>
|
||||
@@ -360,7 +349,6 @@ public:
|
||||
API_PROPERTY() GPUTextureView* GetOutputView() const;
|
||||
|
||||
public:
|
||||
|
||||
// [RenderTask]
|
||||
bool Resize(int32 width, int32 height) override;
|
||||
bool CanDraw() const override;
|
||||
@@ -380,7 +368,7 @@ public:
|
||||
/// <seealso cref="FlaxEngine.SceneRenderTask" />
|
||||
API_CLASS() class FLAXENGINE_API MainRenderTask : public SceneRenderTask
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE(MainRenderTask);
|
||||
DECLARE_SCRIPTING_TYPE(MainRenderTask);
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="MainRenderTask"/> class.
|
||||
@@ -388,14 +376,12 @@ DECLARE_SCRIPTING_TYPE(MainRenderTask);
|
||||
~MainRenderTask();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the main game rendering task. Use it to plug custom rendering logic for your game.
|
||||
/// </summary>
|
||||
API_FIELD(ReadOnly) static MainRenderTask* Instance;
|
||||
|
||||
public:
|
||||
|
||||
// [SceneRenderTask]
|
||||
void OnBegin(GPUContext* context) override;
|
||||
};
|
||||
@@ -405,7 +391,7 @@ public:
|
||||
/// </summary>
|
||||
API_STRUCT() struct RenderContext
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(RenderContext);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(RenderContext);
|
||||
|
||||
/// <summary>
|
||||
/// The render buffers.
|
||||
|
||||
@@ -20,9 +20,8 @@ PACK_STRUCT(struct QuadShaderData
|
||||
/// </summary>
|
||||
API_CLASS(Static) class FLAXENGINE_API RenderTools
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(RenderTools);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(RenderTools);
|
||||
public:
|
||||
|
||||
// Calculate a subresource index for a texture
|
||||
FORCE_INLINE static int32 CalcSubresourceIndex(uint32 mipSlice, int32 arraySlice, int32 mipLevels)
|
||||
{
|
||||
@@ -54,7 +53,6 @@ public:
|
||||
static void ComputePitch(PixelFormat format, int32 width, int32 height, uint32& rowPitch, uint32& slicePitch);
|
||||
|
||||
public:
|
||||
|
||||
static void UpdateModelLODTransition(byte& lodTransition);
|
||||
static uint64 CalculateTextureMemoryUsage(PixelFormat format, int32 width, int32 height, int32 mipLevels);
|
||||
static uint64 CalculateTextureMemoryUsage(PixelFormat format, int32 width, int32 height, int32 depth, int32 mipLevels);
|
||||
|
||||
@@ -21,7 +21,7 @@ class SceneRenderTask;
|
||||
/// </summary>
|
||||
API_STRUCT() struct FLAXENGINE_API RenderView
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(RenderView);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(RenderView);
|
||||
|
||||
/// <summary>
|
||||
/// The position of the view.
|
||||
@@ -86,7 +86,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(RenderView);
|
||||
API_FIELD() BoundingFrustum CullingFrustum;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The draw passes mask for the current view rendering.
|
||||
/// </summary>
|
||||
@@ -158,7 +157,6 @@ public:
|
||||
API_FIELD() LayersMask RenderLayersMask;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// The view information vector with packed components to reconstruct linear depth and view position from the hardware depth buffer. Cached before rendering.
|
||||
/// </summary>
|
||||
@@ -226,7 +224,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// Set up view with custom params
|
||||
// @param viewProjection View * Projection matrix
|
||||
void SetUp(const Matrix& viewProjection)
|
||||
@@ -277,11 +274,9 @@ public:
|
||||
void CopyFrom(Camera* camera, Viewport* viewport);
|
||||
|
||||
public:
|
||||
|
||||
DrawPass GetShadowsDrawPassMask(ShadowsCastingMode shadowsMode) const;
|
||||
|
||||
public:
|
||||
|
||||
// Camera's View * Projection matrix
|
||||
FORCE_INLINE const Matrix& ViewProjection() const
|
||||
{
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
class FLAXENGINE_API ShaderAssetBase
|
||||
{
|
||||
protected:
|
||||
|
||||
ShaderStorage::Header _shaderHeader;
|
||||
|
||||
public:
|
||||
|
||||
static bool IsNullRenderer();
|
||||
|
||||
/// <summary>
|
||||
@@ -44,7 +42,6 @@ public:
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
bool initBase(AssetInitData& initData);
|
||||
|
||||
/// <summary>
|
||||
@@ -114,23 +111,21 @@ template<typename BaseType>
|
||||
class ShaderAssetTypeBase : public BaseType, public ShaderAssetBase
|
||||
{
|
||||
public:
|
||||
|
||||
static const uint32 ShadersSerializedVersion = ShaderStorage::Header::Version;
|
||||
|
||||
protected:
|
||||
|
||||
explicit ShaderAssetTypeBase(const ScriptingObjectSpawnParams& params, const AssetInfo* info)
|
||||
: BaseType(params, info)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [BaseType]
|
||||
bool init(AssetInitData& initData) override
|
||||
{
|
||||
return initBase(initData);
|
||||
}
|
||||
|
||||
AssetChunksFlag getChunksToPreload() const override
|
||||
{
|
||||
AssetChunksFlag result = 0;
|
||||
|
||||
@@ -31,12 +31,10 @@ static_assert(ARRAY_COUNT(ShaderProfileCacheDirNames) == (int32)ShaderProfile::M
|
||||
class ShaderProfileDatabase
|
||||
{
|
||||
public:
|
||||
|
||||
ShaderProfile Profile;
|
||||
String Folder;
|
||||
|
||||
public:
|
||||
|
||||
void Init(ShaderProfile profile, const String& cacheRoot)
|
||||
{
|
||||
Profile = profile;
|
||||
@@ -84,7 +82,6 @@ public:
|
||||
class ShaderCacheManagerService : public EngineService
|
||||
{
|
||||
public:
|
||||
|
||||
ShaderCacheManagerService()
|
||||
: EngineService(TEXT("Shader Cache Manager"), -200)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
class ShaderCacheManager
|
||||
{
|
||||
public:
|
||||
|
||||
struct CachedEntryHandle
|
||||
{
|
||||
Guid ID = Guid::Empty;
|
||||
@@ -30,7 +29,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get cached shader entry for a given shader
|
||||
/// </summary>
|
||||
|
||||
@@ -28,7 +28,6 @@ class MemoryReadStream;
|
||||
class ShaderStorage
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Different shader cache storage modes (disabled, inside asset and in project cache)
|
||||
/// </summary>
|
||||
@@ -46,14 +45,12 @@ public:
|
||||
static CachingMode GetCachingMode();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Packed version of the Magic Code for shader files
|
||||
/// </summary>
|
||||
static const int32 MagicCode;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// File header, version 18
|
||||
/// [Deprecated on 24.07.2019, expires on 10.05.2021]
|
||||
|
||||
@@ -10,11 +10,9 @@
|
||||
class FLAXENGINE_API GPUConstantBuffer : public GPUResource
|
||||
{
|
||||
protected:
|
||||
|
||||
uint32 _size = 0;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the buffer size (in bytes).
|
||||
/// </summary>
|
||||
@@ -25,7 +23,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
ResourceType GetResourceType() const override
|
||||
{
|
||||
|
||||
@@ -20,11 +20,9 @@ class GPUShaderProgram;
|
||||
class GPUShaderProgramsContainer
|
||||
{
|
||||
private:
|
||||
|
||||
Dictionary<int32, GPUShaderProgram*> _shaders;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GPUShaderProgramsContainer"/> class.
|
||||
/// </summary>
|
||||
@@ -36,7 +34,6 @@ public:
|
||||
~GPUShaderProgramsContainer();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new shader program to the collection.
|
||||
/// </summary>
|
||||
@@ -58,7 +55,6 @@ public:
|
||||
void Clear();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Calculates unique hash for given shader program name and its permutation index.
|
||||
/// </summary>
|
||||
@@ -73,9 +69,8 @@ public:
|
||||
/// </summary>
|
||||
API_CLASS(Sealed, NoSpawn) class FLAXENGINE_API GPUShader : public GPUResource
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUShader);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUShader);
|
||||
protected:
|
||||
|
||||
GPUShaderProgramsContainer _shaders;
|
||||
GPUConstantBuffer* _constantBuffers[MAX_CONSTANT_BUFFER_SLOTS];
|
||||
|
||||
@@ -85,7 +80,6 @@ protected:
|
||||
GPUShader();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates the shader resource and loads its data from the bytes.
|
||||
/// <param name="stream">The stream with compiled shader data.</param>
|
||||
@@ -93,7 +87,6 @@ public:
|
||||
virtual bool Create(class MemoryReadStream& stream);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the vertex shader.
|
||||
/// </summary>
|
||||
@@ -172,7 +165,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the specified shader program is in the shader.
|
||||
/// </summary>
|
||||
@@ -185,18 +177,15 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
GPUShaderProgram* GetShader(ShaderStage stage, const StringAnsiView& name, int32 permutationIndex) const;
|
||||
virtual GPUShaderProgram* CreateGPUShaderProgram(ShaderStage type, const GPUShaderProgramInitializer& initializer, byte* cacheBytes, uint32 cacheSize, MemoryReadStream& stream) = 0;
|
||||
virtual GPUConstantBuffer* CreateCB(const String& name, uint32 size, MemoryReadStream& stream) = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
ResourceType GetResourceType() const final override;
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUResource]
|
||||
void OnReleaseGPU() override;
|
||||
};
|
||||
|
||||
@@ -50,7 +50,6 @@ struct GPUShaderProgramInitializer
|
||||
class FLAXENGINE_API GPUShaderProgram
|
||||
{
|
||||
protected:
|
||||
|
||||
StringAnsi _name;
|
||||
ShaderBindings _bindings;
|
||||
ShaderFlags _flags;
|
||||
@@ -69,7 +68,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes an instance of the <see cref="GPUShaderProgram"/> class.
|
||||
/// </summary>
|
||||
@@ -78,7 +76,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets name of the shader program.
|
||||
/// </summary>
|
||||
@@ -104,7 +101,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets shader program stage type.
|
||||
/// </summary>
|
||||
@@ -127,7 +123,6 @@ public:
|
||||
class GPUShaderProgramVS : public GPUShaderProgram
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets input layout description handle (platform dependent).
|
||||
/// </summary>
|
||||
@@ -139,7 +134,6 @@ public:
|
||||
virtual byte GetInputLayoutSize() const = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [GPUShaderProgram]
|
||||
ShaderStage GetStage() const override
|
||||
{
|
||||
@@ -153,7 +147,6 @@ public:
|
||||
class GPUShaderProgramGS : public GPUShaderProgram
|
||||
{
|
||||
public:
|
||||
|
||||
// [GPUShaderProgram]
|
||||
ShaderStage GetStage() const override
|
||||
{
|
||||
@@ -167,11 +160,9 @@ public:
|
||||
class GPUShaderProgramHS : public GPUShaderProgram
|
||||
{
|
||||
protected:
|
||||
|
||||
int32 _controlPointsCount;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the input control points count (valid range: 1-32).
|
||||
/// </summary>
|
||||
@@ -181,7 +172,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [GPUShaderProgram]
|
||||
ShaderStage GetStage() const override
|
||||
{
|
||||
@@ -195,7 +185,6 @@ public:
|
||||
class GPUShaderProgramDS : public GPUShaderProgram
|
||||
{
|
||||
public:
|
||||
|
||||
// [GPUShaderProgram]
|
||||
ShaderStage GetStage() const override
|
||||
{
|
||||
@@ -209,7 +198,6 @@ public:
|
||||
class GPUShaderProgramPS : public GPUShaderProgram
|
||||
{
|
||||
public:
|
||||
|
||||
// [GPUShaderProgram]
|
||||
ShaderStage GetStage() const override
|
||||
{
|
||||
@@ -223,7 +211,6 @@ public:
|
||||
class GPUShaderProgramCS : public GPUShaderProgram
|
||||
{
|
||||
public:
|
||||
|
||||
// [GPUShaderProgram]
|
||||
ShaderStage GetStage() const override
|
||||
{
|
||||
|
||||
@@ -11,18 +11,16 @@
|
||||
/// <seealso cref="GPUResource" />
|
||||
API_CLASS(Sealed) class FLAXENGINE_API GPUSampler : public GPUResource
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUSampler);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUSampler);
|
||||
static GPUSampler* Spawn(const SpawnParams& params);
|
||||
static GPUSampler* New();
|
||||
|
||||
protected:
|
||||
|
||||
GPUSamplerDescription _desc;
|
||||
|
||||
GPUSampler();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets sampler description structure.
|
||||
/// </summary>
|
||||
@@ -32,7 +30,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates new sampler.
|
||||
/// </summary>
|
||||
@@ -41,18 +38,15 @@ public:
|
||||
API_FUNCTION() bool Init(API_PARAM(Ref) const GPUSamplerDescription& desc);
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool OnInit() = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
String ToString() const override;
|
||||
ResourceType GetResourceType() const final override;
|
||||
ObjectType GetObjectType() const final override;
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUResource]
|
||||
void OnReleaseGPU() override;
|
||||
};
|
||||
|
||||
@@ -79,7 +79,7 @@ API_ENUM() enum class GPUSamplerBorderColor
|
||||
/// </summary>
|
||||
API_STRUCT() struct FLAXENGINE_API GPUSamplerDescription
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPUSamplerDescription);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPUSamplerDescription);
|
||||
|
||||
/// <summary>
|
||||
/// The filtering method to use when sampling a texture.
|
||||
@@ -132,7 +132,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(GPUSamplerDescription);
|
||||
API_FIELD() GPUSamplerCompareFunction ComparisonFunction;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GPUSamplerDescription" /> with default settings.
|
||||
/// </summary>
|
||||
@@ -142,13 +141,11 @@ public:
|
||||
static GPUSamplerDescription New(GPUSamplerFilter filter = GPUSamplerFilter::Point, GPUSamplerAddressMode addressMode = GPUSamplerAddressMode::Wrap);
|
||||
|
||||
public:
|
||||
|
||||
void Clear();
|
||||
bool Equals(const GPUSamplerDescription& other) const;
|
||||
String ToString() const;
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE bool operator==(const GPUSamplerDescription& other) const
|
||||
{
|
||||
return Equals(other);
|
||||
|
||||
@@ -629,14 +629,12 @@ GPUTask* GPUTexture::UploadMipMapAsync(const BytesContainer& data, int32 mipInde
|
||||
class TextureDownloadDataTask : public ThreadPoolTask
|
||||
{
|
||||
private:
|
||||
|
||||
GPUTextureReference _texture;
|
||||
GPUTexture* _staging;
|
||||
TextureData* _data;
|
||||
bool _deleteStaging;
|
||||
|
||||
public:
|
||||
|
||||
TextureDownloadDataTask(GPUTexture* texture, GPUTexture* staging, TextureData& data)
|
||||
: _texture(texture)
|
||||
, _staging(staging)
|
||||
@@ -652,7 +650,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [ThreadPoolTask]
|
||||
bool HasReference(Object* resource) const override
|
||||
{
|
||||
@@ -660,7 +657,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [ThreadPoolTask]
|
||||
bool Run() override
|
||||
{
|
||||
|
||||
@@ -19,9 +19,8 @@ class Task;
|
||||
/// </summary>
|
||||
API_CLASS(Sealed, NoSpawn) class FLAXENGINE_API GPUTextureView : public GPUResourceView
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUTextureView);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUTextureView);
|
||||
protected:
|
||||
|
||||
GPUResource* _parent = nullptr;
|
||||
PixelFormat _format = PixelFormat::Unknown;
|
||||
MSAALevel _msaa = MSAALevel::None;
|
||||
@@ -41,7 +40,6 @@ protected:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets parent GPU resource owning that view.
|
||||
/// </summary>
|
||||
@@ -72,12 +70,11 @@ public:
|
||||
/// </summary>
|
||||
API_CLASS(Sealed) class FLAXENGINE_API GPUTexture : public GPUResource
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUTexture);
|
||||
DECLARE_SCRIPTING_TYPE_NO_SPAWN(GPUTexture);
|
||||
static GPUTexture* Spawn(const SpawnParams& params);
|
||||
static GPUTexture* New();
|
||||
|
||||
protected:
|
||||
|
||||
int32 _residentMipLevels;
|
||||
bool _sRGB, _isBlockCompressed;
|
||||
GPUTextureDescription _desc;
|
||||
@@ -88,7 +85,6 @@ protected:
|
||||
GPUTexture();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this texture has any resided mip (data already uploaded to the GPU).
|
||||
/// </summary>
|
||||
@@ -202,7 +198,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this texture is a render target.
|
||||
/// </summary>
|
||||
@@ -316,7 +311,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the texture total size in pixels.
|
||||
/// </summary>
|
||||
@@ -366,7 +360,6 @@ public:
|
||||
void GetResidentSize(int32& width, int32& height, int32& depth) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Calculates mip map row pitch (in bytes).
|
||||
/// </summary>
|
||||
@@ -398,7 +391,6 @@ public:
|
||||
int32 CalculateMipSize(int32 size, int32 mipLevel) const;
|
||||
|
||||
public:
|
||||
|
||||
int32 ComputeSubresourceSize(int32 subresource, int32 rowAlign, int32 sliceAlign) const;
|
||||
int32 ComputeBufferOffset(int32 subresource, int32 rowAlign, int32 sliceAlign) const;
|
||||
int32 ComputeBufferTotalSize(int32 rowAlign, int32 sliceAlign) const;
|
||||
@@ -406,7 +398,6 @@ public:
|
||||
int32 ComputeRowPitch(int32 mipLevel, int32 rowAlign) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the view to the first surface (only for 2D textures).
|
||||
/// </summary>
|
||||
@@ -471,7 +462,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a texture resource (allocates the GPU memory and performs the resource setup).
|
||||
/// </summary>
|
||||
@@ -513,7 +503,6 @@ public:
|
||||
API_FUNCTION() bool Resize(int32 width, int32 height, int32 depth);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the native pointer to the underlying resource. It's a low-level platform-specific handle.
|
||||
/// </summary>
|
||||
@@ -568,27 +557,24 @@ public:
|
||||
/// Sets the number of resident mipmap levels in the texture (already uploaded to the GPU).
|
||||
/// </summary>
|
||||
API_PROPERTY() void SetResidentMipLevels(int32 count);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Event called when texture residency gets changed. Texture Mip gets loaded into GPU memory and is ready to use.
|
||||
/// </summary>
|
||||
Delegate<GPUTexture*> ResidentMipsChanged;
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool OnInit() = 0;
|
||||
uint64 calculateMemoryUsage() const;
|
||||
virtual void OnResidentMipsChanged() = 0;
|
||||
|
||||
public:
|
||||
|
||||
// [GPUResource]
|
||||
String ToString() const override;
|
||||
ResourceType GetResourceType() const final override;
|
||||
ObjectType GetObjectType() const final override;
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUResource]
|
||||
void OnReleaseGPU() override;
|
||||
};
|
||||
|
||||
@@ -85,7 +85,7 @@ API_ENUM() enum class TextureDimensions
|
||||
/// </summary>
|
||||
API_STRUCT() struct FLAXENGINE_API GPUTextureDescription
|
||||
{
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPUTextureDescription);
|
||||
DECLARE_SCRIPTING_TYPE_MINIMAL(GPUTextureDescription);
|
||||
|
||||
/// <summary>
|
||||
/// The dimensions of the texture.
|
||||
@@ -143,7 +143,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(GPUTextureDescription);
|
||||
API_FIELD() Color DefaultClearColor;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is a render target.
|
||||
/// </summary>
|
||||
@@ -225,7 +224,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new 1D <see cref="GPUTextureDescription" /> with a single mipmap.
|
||||
/// </summary>
|
||||
@@ -265,7 +263,6 @@ public:
|
||||
static GPUTextureDescription New1D(int32 width, PixelFormat format, GPUTextureFlags textureFlags, int32 mipCount, int32 arraySize);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GPUTextureDescription" /> with a single mipmap.
|
||||
/// </summary>
|
||||
@@ -310,7 +307,6 @@ public:
|
||||
static GPUTextureDescription New2D(int32 width, int32 height, PixelFormat format, GPUTextureFlags textureFlags, int32 mipCount, int32 arraySize, MSAALevel msaaLevel = MSAALevel::None);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="GPUTextureDescription" /> with a single mipmap.
|
||||
/// </summary>
|
||||
@@ -362,7 +358,6 @@ public:
|
||||
static GPUTextureDescription New3D(int32 width, int32 height, int32 depth, PixelFormat format, GPUTextureFlags textureFlags, int32 mipCount);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new Cube <see cref="GPUTextureDescription" />.
|
||||
/// </summary>
|
||||
@@ -399,7 +394,6 @@ public:
|
||||
static GPUTextureDescription NewCube(int32 size, PixelFormat format, GPUTextureFlags textureFlags, int32 mipCount);
|
||||
|
||||
public:
|
||||
|
||||
void Clear();
|
||||
GPUTextureDescription ToStagingUpload() const;
|
||||
GPUTextureDescription ToStagingReadback() const;
|
||||
@@ -407,7 +401,6 @@ public:
|
||||
String ToString() const;
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE bool operator==(const GPUTextureDescription& other) const
|
||||
{
|
||||
return Equals(other);
|
||||
|
||||
@@ -14,7 +14,6 @@ class Task;
|
||||
class FLAXENGINE_API ITextureOwner
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the texture owner mutex used to synchronize texture logic.
|
||||
/// </summary>
|
||||
|
||||
@@ -179,13 +179,11 @@ bool StreamingTexture::CanBeUpdated() const
|
||||
class StreamTextureResizeTask : public GPUTask
|
||||
{
|
||||
private:
|
||||
|
||||
StreamingTexture* _streamingTexture;
|
||||
GPUTexture* _newTexture;
|
||||
int32 _uploadedMipCount;
|
||||
|
||||
public:
|
||||
|
||||
StreamTextureResizeTask(StreamingTexture* texture, GPUTexture* newTexture)
|
||||
: GPUTask(Type::CopyResource)
|
||||
, _streamingTexture(texture)
|
||||
@@ -200,7 +198,6 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUTask]
|
||||
Result run(GPUTasksContext* context) override
|
||||
{
|
||||
@@ -222,6 +219,7 @@ protected:
|
||||
|
||||
return Result::Ok;
|
||||
}
|
||||
|
||||
void OnEnd() override
|
||||
{
|
||||
Platform::InterlockedDecrement(&_streamingTexture->_streamingTasksCount);
|
||||
@@ -229,6 +227,7 @@ protected:
|
||||
// Base
|
||||
GPUTask::OnEnd();
|
||||
}
|
||||
|
||||
void OnSync() override
|
||||
{
|
||||
Swap(_streamingTexture->_texture, _newTexture);
|
||||
@@ -310,12 +309,10 @@ Task* StreamingTexture::UpdateAllocation(int32 residency)
|
||||
class StreamTextureMipTask : public GPUUploadTextureMipTask
|
||||
{
|
||||
private:
|
||||
|
||||
StreamingTexture* _streamingTexture;
|
||||
FlaxStorage::LockData _dataLock;
|
||||
|
||||
public:
|
||||
|
||||
StreamTextureMipTask(StreamingTexture* texture, int32 mipIndex)
|
||||
: GPUUploadTextureMipTask(texture->GetTexture(), mipIndex, Span<byte>(nullptr, 0), 0, 0, false)
|
||||
, _streamingTexture(texture)
|
||||
@@ -326,7 +323,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void onResourceUnload2(GPUTextureReference* ref)
|
||||
{
|
||||
// Unlink texture
|
||||
@@ -338,7 +334,6 @@ private:
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
// [GPUTask]
|
||||
Result run(GPUTasksContext* context) override
|
||||
{
|
||||
@@ -378,6 +373,7 @@ protected:
|
||||
|
||||
return Result::Ok;
|
||||
}
|
||||
|
||||
void OnEnd() override
|
||||
{
|
||||
_dataLock.Release();
|
||||
@@ -390,6 +386,7 @@ protected:
|
||||
// Base
|
||||
GPUUploadTextureMipTask::OnEnd();
|
||||
}
|
||||
|
||||
void OnFail() override
|
||||
{
|
||||
if (_streamingTexture)
|
||||
|
||||
@@ -16,7 +16,6 @@ class FLAXENGINE_API StreamingTexture : public Object, public StreamableResource
|
||||
friend class StreamTextureMipTask;
|
||||
friend class StreamTextureResizeTask;
|
||||
protected:
|
||||
|
||||
ITextureOwner* _owner;
|
||||
GPUTexture* _texture;
|
||||
TextureHeader _header;
|
||||
@@ -25,12 +24,10 @@ protected:
|
||||
bool _isBlockCompressed;
|
||||
|
||||
public:
|
||||
|
||||
StreamingTexture(ITextureOwner* owner, const String& name);
|
||||
~StreamingTexture();
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the owner.
|
||||
/// </summary>
|
||||
@@ -125,7 +122,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Converts allocated texture mip index to the absolute mip map index.
|
||||
/// </summary>
|
||||
@@ -141,7 +137,6 @@ public:
|
||||
int32 TotalIndexToTextureMipIndex(int32 mipIndex) const;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Creates new texture
|
||||
/// </summary>
|
||||
@@ -162,14 +157,12 @@ public:
|
||||
uint64 GetTotalMemoryUsage() const;
|
||||
|
||||
public:
|
||||
|
||||
FORCE_INLINE GPUTexture* operator->() const
|
||||
{
|
||||
return _texture;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// [Object]
|
||||
String ToString() const override;
|
||||
|
||||
|
||||
@@ -784,7 +784,7 @@ bool TextureBase::InitData::GenerateMip(int32 mipIndex, bool linear)
|
||||
{
|
||||
switch (Format)
|
||||
{
|
||||
// 4 component, 32 bit with 8 bits per component - use Color32 type
|
||||
// 4 component, 32 bit with 8 bits per component - use Color32 type
|
||||
case PixelFormat::R8G8B8A8_SInt:
|
||||
case PixelFormat::R8G8B8A8_Typeless:
|
||||
case PixelFormat::R8G8B8A8_SNorm:
|
||||
|
||||
@@ -14,7 +14,7 @@ class TextureMipData;
|
||||
/// <seealso cref="FlaxEngine.BinaryAsset" />
|
||||
API_CLASS(Abstract, NoSpawn) class FLAXENGINE_API TextureBase : public BinaryAsset, public ITextureOwner
|
||||
{
|
||||
DECLARE_ASSET_HEADER(TextureBase);
|
||||
DECLARE_ASSET_HEADER(TextureBase);
|
||||
static const uint32 TexturesSerializedVersion = 4;
|
||||
|
||||
/// <summary>
|
||||
@@ -48,13 +48,11 @@ DECLARE_ASSET_HEADER(TextureBase);
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
StreamingTexture _texture;
|
||||
InitData* _customData;
|
||||
BinaryAsset* _parent;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the streaming texture object handle.
|
||||
/// </summary>
|
||||
@@ -124,7 +122,7 @@ public:
|
||||
/// Gets the total memory usage that texture may have in use (if loaded to the maximum quality). Exact value may differ due to memory alignment and resource allocation policy.
|
||||
/// </summary>
|
||||
API_PROPERTY() uint64 GetTotalMemoryUsage() const;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the index of the texture group used by this texture.
|
||||
/// </summary>
|
||||
@@ -136,7 +134,6 @@ public:
|
||||
API_PROPERTY() void SetTextureGroup(int32 textureGroup);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gets the mip data.
|
||||
/// </summary>
|
||||
@@ -214,16 +211,13 @@ public:
|
||||
bool Init(InitData* initData);
|
||||
|
||||
protected:
|
||||
|
||||
virtual int32 CalculateChunkIndex(int32 mipIndex) const;
|
||||
|
||||
private:
|
||||
|
||||
// Internal bindings
|
||||
API_FUNCTION(NoProxy) bool Init(void* ptr);
|
||||
|
||||
public:
|
||||
|
||||
// [ITextureOwner]
|
||||
CriticalSection& GetOwnerLocker() const override;
|
||||
Task* RequestMipDataAsync(int32 mipIndex) override;
|
||||
@@ -233,7 +227,6 @@ public:
|
||||
bool GetMipDataCustomPitch(int32 mipIndex, uint32& rowPitch, uint32& slicePitch) const override;
|
||||
|
||||
protected:
|
||||
|
||||
// [BinaryAsset]
|
||||
bool init(AssetInitData& initData) override;
|
||||
LoadResult load() override;
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
class FLAXENGINE_API TextureMipData
|
||||
{
|
||||
public:
|
||||
|
||||
uint32 RowPitch;
|
||||
uint32 DepthPitch;
|
||||
uint32 Lines;
|
||||
@@ -47,7 +46,6 @@ public:
|
||||
class FLAXENGINE_API TextureData
|
||||
{
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Single entry of the texture array. Contains collection of mip maps.
|
||||
/// </summary>
|
||||
@@ -60,7 +58,6 @@ public:
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Init
|
||||
/// </summary>
|
||||
@@ -76,7 +73,6 @@ public:
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Top level texture width (in pixels).
|
||||
/// </summary>
|
||||
@@ -103,7 +99,6 @@ public:
|
||||
Array<ArrayEntry, InlinedAllocation<6>> Items;
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
/// Gather texture data
|
||||
/// </summary>
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
class TextureUtils
|
||||
{
|
||||
public:
|
||||
|
||||
static PixelFormat ToPixelFormat(const TextureFormatType format, int32 width, int32 height, bool canCompress)
|
||||
{
|
||||
const bool canUseBlockCompression = width % 4 == 0 && height % 4 == 0;
|
||||
|
||||
Reference in New Issue
Block a user