Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
IceT
IceT
Commits
5e99ff9f
Commit
5e99ff9f
authored
Dec 14, 2010
by
Kenneth Moreland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test that catches odd image sizes.
parent
30a3d07d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
177 additions
and
0 deletions
+177
-0
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-0
tests/OddImageSizes.c
tests/OddImageSizes.c
+176
-0
No files found.
tests/CMakeLists.txt
View file @
5e99ff9f
...
...
@@ -10,6 +10,7 @@ SET(MyTests
BoundsBehindViewer.c
CompressionSize.c
DisplayNoDraw.c
OddImageSizes.c
RandomTransform.c
SimpleExample.c
)
...
...
tests/OddImageSizes.c
0 → 100644
View file @
5e99ff9f
/* -*- c -*- *****************************************************************
** Copyright (C) 2005 Sandia Corporation
** Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
** the U.S. Government retains certain rights in this software.
**
** This source code is released under the New BSD License.
**
** This tests how compositing behaves when given various image sizes that
** have been known to cause problems in the past.
*****************************************************************************/
#include <IceT.h>
#include "test_codes.h"
#include "test-util.h"
#include <stdlib.h>
#include <stdio.h>
#define NUM_IMAGE_SIZES 2
static
int
c_image_sizes
[
NUM_IMAGE_SIZES
][
2
]
=
{
{
1
,
1
},
{
0
,
0
}
};
static
void
draw
(
const
IceTDouble
*
projection_matrix
,
const
IceTDouble
*
modelview_matrix
,
const
IceTFloat
*
background_color
,
const
IceTInt
*
readback_viewport
,
IceTImage
result
)
{
IceTUByte
*
color_buffer
;
IceTFloat
*
depth_buffer
;
IceTSizeType
num_pixels
;
IceTSizeType
i
;
/* Suppress compiler warnings. */
(
void
)
projection_matrix
;
(
void
)
modelview_matrix
;
(
void
)
background_color
;
(
void
)
readback_viewport
;
num_pixels
=
icetImageGetNumPixels
(
result
);
color_buffer
=
icetImageGetColorub
(
result
);
for
(
i
=
0
;
i
<
num_pixels
*
4
;
i
++
)
{
color_buffer
[
i
]
=
255
;
}
depth_buffer
=
icetImageGetDepthf
(
result
);
for
(
i
=
0
;
i
<
num_pixels
;
i
++
)
{
depth_buffer
[
i
]
=
0
.
5
;
}
}
static
void
setup_tiles
(
int
tile_dimensions
,
IceTSizeType
width
,
IceTSizeType
height
)
{
int
display_node
;
int
tile_y
;
icetResetTiles
();
display_node
=
0
;
for
(
tile_y
=
0
;
tile_y
<
tile_dimensions
;
tile_y
++
)
{
int
tile_x
;
for
(
tile_x
=
0
;
tile_x
<
tile_dimensions
;
tile_x
++
)
{
icetAddTile
(
tile_x
*
width
,
tile_y
*
height
,
width
,
height
,
display_node
);
display_node
++
;
}
}
}
static
int
OddImageSizesRun
(
void
)
{
IceTDouble
identity
[
16
];
IceTFloat
black
[
4
];
int
image_size_index
;
IceTInt
num_proc
;
icetGetIntegerv
(
ICET_NUM_PROCESSES
,
&
num_proc
);
icetDrawCallback
(
draw
);
identity
[
0
]
=
1
.
0
;
identity
[
1
]
=
0
.
0
;
identity
[
2
]
=
0
.
0
;
identity
[
3
]
=
0
.
0
;
identity
[
4
]
=
0
.
0
;
identity
[
5
]
=
1
.
0
;
identity
[
6
]
=
0
.
0
;
identity
[
7
]
=
0
.
0
;
identity
[
8
]
=
0
.
0
;
identity
[
9
]
=
0
.
0
;
identity
[
10
]
=
1
.
0
;
identity
[
11
]
=
0
.
0
;
identity
[
12
]
=
0
.
0
;
identity
[
13
]
=
0
.
0
;
identity
[
14
]
=
0
.
0
;
identity
[
15
]
=
1
.
0
;
black
[
0
]
=
black
[
1
]
=
black
[
2
]
=
0
.
0
;
black
[
3
]
=
1
.
0
;
for
(
image_size_index
=
0
;
image_size_index
<
NUM_IMAGE_SIZES
;
image_size_index
++
)
{
IceTSizeType
width
,
height
;
int
tile_dimensions
;
width
=
c_image_sizes
[
image_size_index
][
0
];
height
=
c_image_sizes
[
image_size_index
][
1
];
printf
(
"
\n\n
Using image size %dx%d
\n
"
,
(
int
)
width
,
(
int
)
height
);
for
(
tile_dimensions
=
1
;
tile_dimensions
*
tile_dimensions
<=
num_proc
;
tile_dimensions
++
)
{
int
strategy_index
;
printf
(
"Using tile dimensions %d
\n
"
,
tile_dimensions
);
setup_tiles
(
tile_dimensions
,
width
,
height
);
for
(
strategy_index
=
0
;
strategy_index
<
STRATEGY_LIST_SIZE
;
strategy_index
++
)
{
IceTEnum
strategy
=
strategy_list
[
strategy_index
];
int
single_image_strategy_index
;
int
num_single_image_strategy
;
icetStrategy
(
strategy
);
printf
(
"Using %s strategy
\n
"
,
icetGetStrategyName
());
if
(
strategy_uses_single_image_strategy
(
strategy
))
{
num_single_image_strategy
=
SINGLE_IMAGE_STRATEGY_LIST_SIZE
;
}
else
{
/* Set to 1 since single image strategy does not matter. */
num_single_image_strategy
=
1
;
}
for
(
single_image_strategy_index
=
0
;
single_image_strategy_index
<
num_single_image_strategy
;
single_image_strategy_index
++
)
{
IceTEnum
single_image_strategy
=
single_image_strategy_list
[
single_image_strategy_index
];
icetSingleImageStrategy
(
single_image_strategy
);
printf
(
"Using %s single image sub-strategy.
\n
"
,
icetGetSingleImageStrategyName
());
/* Just invoke a frame. I'm more worried about crashing
than other incorrect behavior. */
icetDrawFrame
(
identity
,
identity
,
black
);
}
}
}
}
return
TEST_PASSED
;
}
int
OddImageSizes
(
int
argc
,
char
*
argv
[])
{
/* To remove warning. */
(
void
)
argc
;
(
void
)
argv
;
return
run_test
(
OddImageSizesRun
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment