tests: Fix -Wunused-function warnings

Signed-off-by: Joshua Ashton <joshua@froggi.es>
This commit is contained in:
Joshua Ashton 2021-02-12 17:30:38 +00:00 committed by Hans-Kristian Arntzen
parent 9b2841b50f
commit b6444b4728
1 changed files with 25 additions and 25 deletions

View File

@ -25,7 +25,7 @@
static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12CommandQueue *queue); static void wait_queue_idle_(unsigned int line, ID3D12Device *device, ID3D12CommandQueue *queue);
static ID3D12Device *create_device(void); static ID3D12Device *create_device(void);
static void set_rect(RECT *rect, int left, int top, int right, int bottom) static inline void set_rect(RECT *rect, int left, int top, int right, int bottom)
{ {
rect->left = left; rect->left = left;
rect->right = right; rect->right = right;
@ -44,7 +44,7 @@ static inline void set_box(D3D12_BOX *box, unsigned int left, unsigned int top,
box->back = back; box->back = back;
} }
static void set_viewport(D3D12_VIEWPORT *vp, float x, float y, static inline void set_viewport(D3D12_VIEWPORT *vp, float x, float y,
float width, float height, float min_depth, float max_depth) float width, float height, float min_depth, float max_depth)
{ {
vp->TopLeftX = x; vp->TopLeftX = x;
@ -55,7 +55,7 @@ static void set_viewport(D3D12_VIEWPORT *vp, float x, float y,
vp->MaxDepth = max_depth; vp->MaxDepth = max_depth;
} }
static bool compare_color(DWORD c1, DWORD c2, BYTE max_diff) static inline bool compare_color(DWORD c1, DWORD c2, BYTE max_diff)
{ {
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff)
return false; return false;
@ -71,13 +71,13 @@ static bool compare_color(DWORD c1, DWORD c2, BYTE max_diff)
return true; return true;
} }
static D3D12_SHADER_BYTECODE shader_bytecode(const DWORD *code, size_t size) static inline D3D12_SHADER_BYTECODE shader_bytecode(const DWORD *code, size_t size)
{ {
D3D12_SHADER_BYTECODE shader_bytecode = { code, size }; D3D12_SHADER_BYTECODE shader_bytecode = { code, size };
return shader_bytecode; return shader_bytecode;
} }
static void exec_command_list(ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *list) static inline void exec_command_list(ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *list)
{ {
ID3D12CommandList *lists[] = {(ID3D12CommandList *)list}; ID3D12CommandList *lists[] = {(ID3D12CommandList *)list};
ID3D12CommandQueue_ExecuteCommandLists(queue, 1, lists); ID3D12CommandQueue_ExecuteCommandLists(queue, 1, lists);
@ -141,7 +141,7 @@ static inline ID3D12Resource *create_placed_buffer_(unsigned int line, ID3D12Dev
} }
#define create_buffer(a, b, c, d, e) create_buffer_(__LINE__, a, b, c, d, e) #define create_buffer(a, b, c, d, e) create_buffer_(__LINE__, a, b, c, d, e)
static ID3D12Resource *create_buffer_(unsigned int line, ID3D12Device *device, static inline ID3D12Resource *create_buffer_(unsigned int line, ID3D12Device *device,
D3D12_HEAP_TYPE heap_type, size_t size, D3D12_RESOURCE_FLAGS resource_flags, D3D12_HEAP_TYPE heap_type, size_t size, D3D12_RESOURCE_FLAGS resource_flags,
D3D12_RESOURCE_STATES initial_resource_state) D3D12_RESOURCE_STATES initial_resource_state)
{ {
@ -173,7 +173,7 @@ static ID3D12Resource *create_buffer_(unsigned int line, ID3D12Device *device,
} }
#define create_readback_buffer(a, b) create_readback_buffer_(__LINE__, a, b) #define create_readback_buffer(a, b) create_readback_buffer_(__LINE__, a, b)
static ID3D12Resource *create_readback_buffer_(unsigned int line, ID3D12Device *device, static inline ID3D12Resource *create_readback_buffer_(unsigned int line, ID3D12Device *device,
size_t size) size_t size)
{ {
return create_buffer_(line, device, D3D12_HEAP_TYPE_READBACK, size, return create_buffer_(line, device, D3D12_HEAP_TYPE_READBACK, size,
@ -246,7 +246,7 @@ static inline ID3D12DescriptorHeap *create_gpu_descriptor_heap_(unsigned int lin
return descriptor_heap; return descriptor_heap;
} }
static void transition_sub_resource_state(ID3D12GraphicsCommandList *list, ID3D12Resource *resource, static inline void transition_sub_resource_state(ID3D12GraphicsCommandList *list, ID3D12Resource *resource,
unsigned int sub_resource_idx, D3D12_RESOURCE_STATES state_before, D3D12_RESOURCE_STATES state_after) unsigned int sub_resource_idx, D3D12_RESOURCE_STATES state_before, D3D12_RESOURCE_STATES state_after)
{ {
D3D12_RESOURCE_BARRIER barrier; D3D12_RESOURCE_BARRIER barrier;
@ -279,14 +279,14 @@ static inline ID3D12CommandQueue *create_command_queue_(unsigned int line, ID3D1
return queue; return queue;
} }
static void transition_resource_state(ID3D12GraphicsCommandList *list, ID3D12Resource *resource, static inline void transition_resource_state(ID3D12GraphicsCommandList *list, ID3D12Resource *resource,
D3D12_RESOURCE_STATES state_before, D3D12_RESOURCE_STATES state_after) D3D12_RESOURCE_STATES state_before, D3D12_RESOURCE_STATES state_after)
{ {
transition_sub_resource_state(list, resource, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES, transition_sub_resource_state(list, resource, D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES,
state_before, state_after); state_before, state_after);
} }
static unsigned int format_size(DXGI_FORMAT format) static inline unsigned int format_size(DXGI_FORMAT format)
{ {
switch (format) switch (format)
{ {
@ -402,7 +402,7 @@ struct resource_readback
void *data; void *data;
}; };
static void get_texture_readback_with_command_list(ID3D12Resource *texture, unsigned int sub_resource, static inline void get_texture_readback_with_command_list(ID3D12Resource *texture, unsigned int sub_resource,
struct resource_readback *rb, ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *command_list) struct resource_readback *rb, ID3D12CommandQueue *queue, ID3D12GraphicsCommandList *command_list)
{ {
D3D12_TEXTURE_COPY_LOCATION dst_location, src_location; D3D12_TEXTURE_COPY_LOCATION dst_location, src_location;
@ -491,20 +491,20 @@ static void get_texture_readback_with_command_list(ID3D12Resource *texture, unsi
assert_that(hr == S_OK, "Failed to map readback buffer, hr %#x.\n", hr); assert_that(hr == S_OK, "Failed to map readback buffer, hr %#x.\n", hr);
} }
static void *get_readback_data(struct resource_readback *rb, static inline void *get_readback_data(struct resource_readback *rb,
unsigned int x, unsigned int y, unsigned int z, size_t element_size) unsigned int x, unsigned int y, unsigned int z, size_t element_size)
{ {
unsigned int slice_pitch = rb->row_pitch * rb->height; unsigned int slice_pitch = rb->row_pitch * rb->height;
return &((BYTE *)rb->data)[slice_pitch * z + rb->row_pitch * y + x * element_size]; return &((BYTE *)rb->data)[slice_pitch * z + rb->row_pitch * y + x * element_size];
} }
static unsigned int get_readback_uint(struct resource_readback *rb, static inline unsigned int get_readback_uint(struct resource_readback *rb,
unsigned int x, unsigned int y, unsigned int z) unsigned int x, unsigned int y, unsigned int z)
{ {
return *(unsigned int *)get_readback_data(rb, x, y, z, sizeof(unsigned int)); return *(unsigned int *)get_readback_data(rb, x, y, z, sizeof(unsigned int));
} }
static void release_resource_readback(struct resource_readback *rb) static inline void release_resource_readback(struct resource_readback *rb)
{ {
D3D12_RANGE range = {0, 0}; D3D12_RANGE range = {0, 0};
ID3D12Resource_Unmap(rb->resource, 0, &range); ID3D12Resource_Unmap(rb->resource, 0, &range);
@ -512,7 +512,7 @@ static void release_resource_readback(struct resource_readback *rb)
} }
#define check_readback_data_uint(a, b, c, d) check_readback_data_uint_(__LINE__, a, b, c, d) #define check_readback_data_uint(a, b, c, d) check_readback_data_uint_(__LINE__, a, b, c, d)
static void check_readback_data_uint_(unsigned int line, struct resource_readback *rb, static inline void check_readback_data_uint_(unsigned int line, struct resource_readback *rb,
const D3D12_BOX *box, unsigned int expected, unsigned int max_diff) const D3D12_BOX *box, unsigned int expected, unsigned int max_diff)
{ {
D3D12_BOX b = {0, 0, 0, rb->width, rb->height, rb->depth}; D3D12_BOX b = {0, 0, 0, rb->width, rb->height, rb->depth};
@ -565,7 +565,7 @@ static inline ID3D12Resource *create_default_buffer_(unsigned int line, ID3D12De
resource_flags, initial_resource_state); resource_flags, initial_resource_state);
} }
static ID3D12Resource *create_default_texture_(unsigned int line, ID3D12Device *device, static inline ID3D12Resource *create_default_texture_(unsigned int line, ID3D12Device *device,
D3D12_RESOURCE_DIMENSION dimension, unsigned int width, unsigned int height, D3D12_RESOURCE_DIMENSION dimension, unsigned int width, unsigned int height,
unsigned int depth_or_array_size, unsigned int miplevel_count, DXGI_FORMAT format, unsigned int depth_or_array_size, unsigned int miplevel_count, DXGI_FORMAT format,
D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES initial_state) D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES initial_state)
@ -598,7 +598,7 @@ static ID3D12Resource *create_default_texture_(unsigned int line, ID3D12Device *
#define create_default_texture(a, b, c, d, e, f) create_default_texture2d_(__LINE__, a, b, c, 1, 1, d, e, f) #define create_default_texture(a, b, c, d, e, f) create_default_texture2d_(__LINE__, a, b, c, 1, 1, d, e, f)
#define create_default_texture2d(a, b, c, d, e, f, g, h) create_default_texture2d_(__LINE__, a, b, c, d, e, f, g, h) #define create_default_texture2d(a, b, c, d, e, f, g, h) create_default_texture2d_(__LINE__, a, b, c, d, e, f, g, h)
static ID3D12Resource *create_default_texture2d_(unsigned int line, ID3D12Device *device, static inline ID3D12Resource *create_default_texture2d_(unsigned int line, ID3D12Device *device,
unsigned int width, unsigned int height, unsigned int array_size, unsigned int miplevel_count, unsigned int width, unsigned int height, unsigned int array_size, unsigned int miplevel_count,
DXGI_FORMAT format, D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES initial_state) DXGI_FORMAT format, D3D12_RESOURCE_FLAGS flags, D3D12_RESOURCE_STATES initial_state)
{ {
@ -615,7 +615,7 @@ static inline ID3D12Resource *create_default_texture3d_(unsigned int line, ID3D1
width, height, depth, miplevel_count, format, flags, initial_state); width, height, depth, miplevel_count, format, flags, initial_state);
} }
static HRESULT create_root_signature(ID3D12Device *device, const D3D12_ROOT_SIGNATURE_DESC *desc, static inline HRESULT create_root_signature(ID3D12Device *device, const D3D12_ROOT_SIGNATURE_DESC *desc,
ID3D12RootSignature **root_signature) ID3D12RootSignature **root_signature)
{ {
ID3DBlob *blob; ID3DBlob *blob;
@ -631,7 +631,7 @@ static HRESULT create_root_signature(ID3D12Device *device, const D3D12_ROOT_SIGN
} }
#define create_empty_root_signature(device, flags) create_empty_root_signature_(__LINE__, device, flags) #define create_empty_root_signature(device, flags) create_empty_root_signature_(__LINE__, device, flags)
static ID3D12RootSignature *create_empty_root_signature_(unsigned int line, static inline ID3D12RootSignature *create_empty_root_signature_(unsigned int line,
ID3D12Device *device, D3D12_ROOT_SIGNATURE_FLAGS flags) ID3D12Device *device, D3D12_ROOT_SIGNATURE_FLAGS flags)
{ {
D3D12_ROOT_SIGNATURE_DESC root_signature_desc; D3D12_ROOT_SIGNATURE_DESC root_signature_desc;
@ -649,7 +649,7 @@ static ID3D12RootSignature *create_empty_root_signature_(unsigned int line,
return root_signature; return root_signature;
} }
static void init_pipeline_state_desc_shaders(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, static inline void init_pipeline_state_desc_shaders(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc,
ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format, ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format,
const D3D12_INPUT_LAYOUT_DESC *input_layout, const D3D12_INPUT_LAYOUT_DESC *input_layout,
const void *vs_code, size_t vs_size, const void *vs_code, size_t vs_size,
@ -675,7 +675,7 @@ static void init_pipeline_state_desc_shaders(D3D12_GRAPHICS_PIPELINE_STATE_DESC
desc->SampleDesc.Count = 1; desc->SampleDesc.Count = 1;
} }
static void init_pipeline_state_desc(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, static inline void init_pipeline_state_desc(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc,
ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format, ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format,
const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps, const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps,
const D3D12_INPUT_LAYOUT_DESC *input_layout) const D3D12_INPUT_LAYOUT_DESC *input_layout)
@ -725,7 +725,7 @@ static void init_pipeline_state_desc(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc,
ps ? ps->pShaderBytecode : ps_code, ps ? ps->BytecodeLength : sizeof(ps_code)); ps ? ps->pShaderBytecode : ps_code, ps ? ps->BytecodeLength : sizeof(ps_code));
} }
static void init_pipeline_state_desc_dxil(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc, static inline void init_pipeline_state_desc_dxil(D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc,
ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format, ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format,
const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps, const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps,
const D3D12_INPUT_LAYOUT_DESC *input_layout) const D3D12_INPUT_LAYOUT_DESC *input_layout)
@ -850,7 +850,7 @@ static void init_pipeline_state_desc_dxil(D3D12_GRAPHICS_PIPELINE_STATE_DESC *de
} }
#define create_pipeline_state(a, b, c, d, e, f) create_pipeline_state_(__LINE__, a, b, c, d, e, f) #define create_pipeline_state(a, b, c, d, e, f) create_pipeline_state_(__LINE__, a, b, c, d, e, f)
static ID3D12PipelineState *create_pipeline_state_(unsigned int line, ID3D12Device *device, static inline ID3D12PipelineState *create_pipeline_state_(unsigned int line, ID3D12Device *device,
ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format, ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format,
const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps, const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps,
const D3D12_INPUT_LAYOUT_DESC *input_layout) const D3D12_INPUT_LAYOUT_DESC *input_layout)
@ -868,7 +868,7 @@ static ID3D12PipelineState *create_pipeline_state_(unsigned int line, ID3D12Devi
} }
#define create_pipeline_state_dxil(a, b, c, d, e, f) create_pipeline_state_dxil_(__LINE__, a, b, c, d, e, f) #define create_pipeline_state_dxil(a, b, c, d, e, f) create_pipeline_state_dxil_(__LINE__, a, b, c, d, e, f)
static ID3D12PipelineState *create_pipeline_state_dxil_(unsigned int line, ID3D12Device *device, static inline ID3D12PipelineState *create_pipeline_state_dxil_(unsigned int line, ID3D12Device *device,
ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format, ID3D12RootSignature *root_signature, DXGI_FORMAT rt_format,
const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps, const D3D12_SHADER_BYTECODE *vs, const D3D12_SHADER_BYTECODE *ps,
const D3D12_INPUT_LAYOUT_DESC *input_layout) const D3D12_INPUT_LAYOUT_DESC *input_layout)
@ -920,7 +920,7 @@ struct test_context
}; };
#define create_render_target(context, a, b, c) create_render_target_(__LINE__, context, a, b, c) #define create_render_target(context, a, b, c) create_render_target_(__LINE__, context, a, b, c)
static void create_render_target_(unsigned int line, struct test_context *context, static inline void create_render_target_(unsigned int line, struct test_context *context,
const struct test_context_desc *desc, ID3D12Resource **render_target, const struct test_context_desc *desc, ID3D12Resource **render_target,
const D3D12_CPU_DESCRIPTOR_HANDLE *rtv) const D3D12_CPU_DESCRIPTOR_HANDLE *rtv)
{ {