2 * Copyright 2012 Henri Verbeet for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wine/port.h"
23 #include "wined3d_private.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(d3d
);
27 ULONG CDECL
wined3d_sampler_incref(struct wined3d_sampler
*sampler
)
29 ULONG refcount
= InterlockedIncrement(&sampler
->refcount
);
31 TRACE("%p increasing refcount to %u.\n", sampler
, refcount
);
36 ULONG CDECL
wined3d_sampler_decref(struct wined3d_sampler
*sampler
)
38 ULONG refcount
= InterlockedDecrement(&sampler
->refcount
);
40 TRACE("%p decreasing refcount to %u.\n", sampler
, refcount
);
43 HeapFree(GetProcessHeap(), 0, sampler
);
48 void * CDECL
wined3d_sampler_get_parent(const struct wined3d_sampler
*sampler
)
50 TRACE("sampler %p.\n", sampler
);
52 return sampler
->parent
;
55 static void wined3d_sampler_init(struct wined3d_sampler
*sampler
, void *parent
)
57 sampler
->refcount
= 1;
58 sampler
->parent
= parent
;
61 HRESULT CDECL
wined3d_sampler_create(void *parent
, struct wined3d_sampler
**sampler
)
63 struct wined3d_sampler
*object
;
65 TRACE("parent %p, sampler %p.\n", parent
, sampler
);
67 if (!(object
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(*object
))))
70 wined3d_sampler_init(object
, parent
);
72 TRACE("Created sampler %p.\n", object
);