mirror of
https://github.com/red-prig/fpPS4.git
synced 2024-11-27 00:20:36 +00:00
51 lines
790 B
ObjectPascal
51 lines
790 B
ObjectPascal
unit vSampler;
|
|
|
|
{$mode objfpc}{$H+}
|
|
|
|
interface
|
|
|
|
uses
|
|
Vulkan,
|
|
vDevice;
|
|
|
|
type
|
|
TvSampler=class
|
|
FHandle:TVkSampler;
|
|
function Compile(pInfo:PVkSamplerCreateInfo):Boolean;
|
|
Destructor Destroy; override;
|
|
end;
|
|
|
|
implementation
|
|
|
|
function TvSampler.Compile(pInfo:PVkSamplerCreateInfo):Boolean;
|
|
var
|
|
r:TVkResult;
|
|
begin
|
|
Result:=False;
|
|
if (pInfo=nil) then Exit;
|
|
|
|
if (FHandle<>VK_NULL_HANDLE) then
|
|
begin
|
|
vkDestroySampler(Device.FHandle,FHandle,nil);
|
|
FHandle:=VK_NULL_HANDLE;
|
|
end;
|
|
|
|
r:=vkCreateSampler(Device.FHandle,pInfo,nil,@FHandle);
|
|
if (r<>VK_SUCCESS) then
|
|
begin
|
|
Writeln(StdErr,'vkCreateImage:',r);
|
|
Exit;
|
|
end;
|
|
Result:=True;
|
|
end;
|
|
|
|
Destructor TvSampler.Destroy;
|
|
begin
|
|
if (FHandle<>VK_NULL_HANDLE) then
|
|
vkDestroySampler(Device.FHandle,FHandle,nil);
|
|
inherited;
|
|
end;
|
|
|
|
end.
|
|
|