/**************************************************************************
*
- * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 VMware, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <emmintrin.h>
#endif
-static INLINE int
+static inline int
subpixel_snap(float a)
{
return util_iround(FIXED_ONE * a);
}
-static INLINE float
+static inline float
fixed_to_float(int a)
{
return a * (1.0f / FIXED_ONE);
plane_sz);
tri = lp_scene_alloc_aligned( scene, *tri_size, 16 );
- if (tri == NULL)
+ if (!tri)
return NULL;
tri->inputs.stride = input_array_sz;
int nr_planes = 3;
unsigned viewport_index = 0;
unsigned layer = 0;
+ const float (*pv)[4];
/* Area should always be positive here */
assert(position->area > 0);
if (0)
lp_setup_print_triangle(setup, v0, v1, v2);
- if (setup->scissor_test) {
- nr_planes = 7;
- if (setup->viewport_index_slot > 0) {
- unsigned *udata = (unsigned*)v0[setup->viewport_index_slot];
- viewport_index = lp_clamp_viewport_idx(*udata);
- }
+ if (setup->flatshade_first) {
+ pv = v0;
}
else {
- nr_planes = 3;
+ pv = v2;
+ }
+ if (setup->viewport_index_slot > 0) {
+ unsigned *udata = (unsigned*)pv[setup->viewport_index_slot];
+ viewport_index = lp_clamp_viewport_idx(*udata);
}
if (setup->layer_slot > 0) {
- layer = *(unsigned*)v1[setup->layer_slot];
+ layer = *(unsigned*)pv[setup->layer_slot];
layer = MIN2(layer, scene->fb_max_layer);
}
+ if (setup->scissor_test) {
+ nr_planes = 7;
+ }
+ else {
+ nr_planes = 3;
+ }
+
/* Bounding rectangle (in pixels) */
{
/* Yes this is necessary to accurately calculate bounding boxes
* up needing a bottom-left fill convention, which requires
* slightly different rounding.
*/
- int adj = (setup->pixel_offset != 0) ? 1 : 0;
+ int adj = (setup->bottom_edge_rule != 0) ? 1 : 0;
/* Inclusive x0, exclusive x1 */
bbox.x0 = MIN3(position->x[0], position->x[1], position->x[2]) >> FIXED_ORDER;
*
* Undefined if no bit set exists, so code should check against 0 first.
*/
-static INLINE uint32_t
+static inline uint32_t
floor_pot(uint32_t n)
{
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
for (i = 0; i < nr_planes; i++) {
int64_t planeout = cx[i] + eo[i];
int64_t planepartial = cx[i] + ei[i] - 1;
- out |= (planeout >> 63);
- partial |= (planepartial >> 63) & (1<<i);
+ out |= (int) (planeout >> 63);
+ partial |= ((int) (planepartial >> 63)) & (1<<i);
}
if (out) {
/**
* Calculate fixed position data for a triangle
*/
-static INLINE void
+static inline void
calc_fixed_position( struct lp_setup_context *setup,
struct fixed_position* position,
const float (*v0)[4],
* Rotate a triangle, flipping its clockwise direction,
* Swaps values for xy[0] and xy[1]
*/
-static INLINE void
+static inline void
rotate_fixed_position_01( struct fixed_position* position )
{
int x, y;
* Rotate a triangle, flipping its clockwise direction,
* Swaps values for xy[1] and xy[2]
*/
-static INLINE void
+static inline void
rotate_fixed_position_12( struct fixed_position* position )
{
int x, y;