@@ -47,6 +47,7 @@ static void dealloc(Object *self) {
4747 if (this -> device ) {
4848 SDL_ReleaseGPUSampler (this -> device , this -> _samplerNearest );
4949 SDL_ReleaseGPUSampler (this -> device , this -> _samplerLinear );
50+ SDL_ReleaseGPUSampler (this -> device , this -> _samplerLinearClamp );
5051 SDL_ReleaseGPUSampler (this -> device , this -> _samplerAnisotropic );
5152 }
5253
@@ -237,6 +238,27 @@ static SDL_GPUSampler *samplerLinear(const RenderDevice *self) {
237238 return this -> _samplerLinear ;
238239}
239240
241+ /**
242+ * @fn SDL_GPUSampler *RenderDevice::samplerLinearClamp(const RenderDevice *self)
243+ * @memberof RenderDevice
244+ */
245+ static SDL_GPUSampler * samplerLinearClamp (const RenderDevice * self ) {
246+ assert (self );
247+
248+ RenderDevice * this = (RenderDevice * ) self ;
249+ if (!this -> _samplerLinearClamp ) {
250+ this -> _samplerLinearClamp = $ (self , createSampler , & (SDL_GPUSamplerCreateInfo ) {
251+ .min_filter = SDL_GPU_FILTER_LINEAR ,
252+ .mag_filter = SDL_GPU_FILTER_LINEAR ,
253+ .mipmap_mode = SDL_GPU_SAMPLERMIPMAPMODE_NEAREST ,
254+ .address_mode_u = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE ,
255+ .address_mode_v = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE ,
256+ .address_mode_w = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE ,
257+ });
258+ }
259+ return this -> _samplerLinearClamp ;
260+ }
261+
240262/**
241263 * @fn SDL_GPUSampler *RenderDevice::samplerNearest(const RenderDevice *self)
242264 * @memberof RenderDevice
@@ -794,6 +816,7 @@ static void initialize(Class *clazz) {
794816 ((RenderDeviceInterface * ) clazz -> interface )-> releaseTransferBuffer = releaseTransferBuffer ;
795817 ((RenderDeviceInterface * ) clazz -> interface )-> samplerAnisotropic = samplerAnisotropic ;
796818 ((RenderDeviceInterface * ) clazz -> interface )-> samplerLinear = samplerLinear ;
819+ ((RenderDeviceInterface * ) clazz -> interface )-> samplerLinearClamp = samplerLinearClamp ;
797820 ((RenderDeviceInterface * ) clazz -> interface )-> samplerNearest = samplerNearest ;
798821 ((RenderDeviceInterface * ) clazz -> interface )-> setAllowedFramesInFlight = setAllowedFramesInFlight ;
799822 ((RenderDeviceInterface * ) clazz -> interface )-> setBufferName = setBufferName ;
0 commit comments