Fixes for GPU resources C# object types
This commit is contained in:
@@ -137,6 +137,7 @@ GPUBuffer* GPUBuffer::New()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GPUBuffer::GPUBuffer()
|
GPUBuffer::GPUBuffer()
|
||||||
|
: GPUResource(SpawnParams(Guid::New(), TypeInitializer))
|
||||||
{
|
{
|
||||||
// Buffer with size 0 is considered to be invalid
|
// Buffer with size 0 is considered to be invalid
|
||||||
_desc.Size = 0;
|
_desc.Size = 0;
|
||||||
|
|||||||
@@ -35,6 +35,11 @@ GPUPipelineState* GPUPipelineState::New()
|
|||||||
return GPUDevice::Instance->CreatePipelineState();
|
return GPUDevice::Instance->CreatePipelineState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GPUPipelineState::GPUPipelineState()
|
||||||
|
: GPUResource(SpawnParams(Guid::New(), TypeInitializer))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
bool GPUPipelineState::Init(const Description& desc)
|
bool GPUPipelineState::Init(const Description& desc)
|
||||||
{
|
{
|
||||||
// Cache description in debug builds
|
// Cache description in debug builds
|
||||||
@@ -177,7 +182,7 @@ GPUPipelineState::Description GPUPipelineState::Description::DefaultFullscreenTr
|
|||||||
};
|
};
|
||||||
|
|
||||||
GPUResource::GPUResource()
|
GPUResource::GPUResource()
|
||||||
: ScriptingObject(SpawnParams(Guid::New(), GPUResource::TypeInitializer))
|
: ScriptingObject(SpawnParams(Guid::New(), TypeInitializer))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
ShaderBindings _meta;
|
ShaderBindings _meta;
|
||||||
|
|
||||||
|
GPUPipelineState();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#if BUILD_DEBUG
|
#if BUILD_DEBUG
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -144,7 +144,8 @@ public:
|
|||||||
/// <param name="device">The graphics device.</param>
|
/// <param name="device">The graphics device.</param>
|
||||||
/// <param name="name">The resource name.</param>
|
/// <param name="name">The resource name.</param>
|
||||||
GPUResourceBase(DeviceType* device, const StringView& name) noexcept
|
GPUResourceBase(DeviceType* device, const StringView& name) noexcept
|
||||||
: _device(device)
|
: BaseType()
|
||||||
|
, _device(device)
|
||||||
{
|
{
|
||||||
#if GPU_ENABLE_RESOURCE_NAMING
|
#if GPU_ENABLE_RESOURCE_NAMING
|
||||||
if (name.HasChars())
|
if (name.HasChars())
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ uint32 GPUShaderProgramsContainer::CalculateHash(const StringAnsiView& name, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
GPUShader::GPUShader()
|
GPUShader::GPUShader()
|
||||||
|
: GPUResource(SpawnParams(Guid::New(), TypeInitializer))
|
||||||
{
|
{
|
||||||
Platform::MemoryClear(_constantBuffers, sizeof(_constantBuffers));
|
Platform::MemoryClear(_constantBuffers, sizeof(_constantBuffers));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ protected:
|
|||||||
GPUShaderProgramsContainer _shaders;
|
GPUShaderProgramsContainer _shaders;
|
||||||
GPUConstantBuffer* _constantBuffers[MAX_CONSTANT_BUFFER_SLOTS];
|
GPUConstantBuffer* _constantBuffers[MAX_CONSTANT_BUFFER_SLOTS];
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="GPUShader"/> class.
|
|
||||||
/// </summary>
|
|
||||||
GPUShader();
|
GPUShader();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ GPUSampler* GPUSampler::New()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GPUSampler::GPUSampler()
|
GPUSampler::GPUSampler()
|
||||||
|
: GPUResource(SpawnParams(Guid::New(), TypeInitializer))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ GPUTexture* GPUTexture::New()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GPUTexture::GPUTexture()
|
GPUTexture::GPUTexture()
|
||||||
: GPUResource(SpawnParams(Guid::New(), GPUTexture::TypeInitializer))
|
: GPUResource(SpawnParams(Guid::New(), TypeInitializer))
|
||||||
, _residentMipLevels(0)
|
, _residentMipLevels(0)
|
||||||
, _sRGB(false)
|
, _sRGB(false)
|
||||||
, _isBlockCompressed(false)
|
, _isBlockCompressed(false)
|
||||||
@@ -423,7 +423,6 @@ bool GPUTexture::Init(const GPUTextureDescription& desc)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TextureDimensions::VolumeTexture:
|
case TextureDimensions::VolumeTexture:
|
||||||
{
|
{
|
||||||
if (desc.IsDepthStencil())
|
if (desc.IsDepthStencil())
|
||||||
@@ -461,7 +460,6 @@ bool GPUTexture::Init(const GPUTextureDescription& desc)
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TextureDimensions::CubeTexture:
|
case TextureDimensions::CubeTexture:
|
||||||
{
|
{
|
||||||
if (desc.HasPerSliceViews())
|
if (desc.HasPerSliceViews())
|
||||||
|
|||||||
@@ -79,9 +79,6 @@ protected:
|
|||||||
bool _sRGB, _isBlockCompressed;
|
bool _sRGB, _isBlockCompressed;
|
||||||
GPUTextureDescription _desc;
|
GPUTextureDescription _desc;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="GPUTexture"/> class.
|
|
||||||
/// </summary>
|
|
||||||
GPUTexture();
|
GPUTexture();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public:
|
|||||||
/// <param name="device">The graphics device.</param>
|
/// <param name="device">The graphics device.</param>
|
||||||
/// <param name="name">The resource name.</param>
|
/// <param name="name">The resource name.</param>
|
||||||
GPUResourceDX11(GPUDeviceDX11* device, const StringView& name) noexcept
|
GPUResourceDX11(GPUDeviceDX11* device, const StringView& name) noexcept
|
||||||
: GPUResourceBase(device, name)
|
: GPUResourceBase<GPUDeviceDX11, BaseType>(device, name)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user