2018-01-11 22:18:54 -08:00
|
|
|
/*
|
|
|
|
|
* Copyright © 2017 Intel Corporation
|
|
|
|
|
*
|
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
|
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
|
|
|
|
* license, and/or sell copies of the Software, and to permit persons to whom
|
|
|
|
|
* the Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
*
|
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
|
* Software.
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
* THE AUTHOR(S) AND/OR THEIR 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.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef IRIS_PIPE_H
|
|
|
|
|
#define IRIS_PIPE_H
|
|
|
|
|
|
|
|
|
|
#include "pipe/p_defines.h"
|
2019-04-16 23:54:37 -07:00
|
|
|
|
2018-10-06 22:50:34 -07:00
|
|
|
/**
|
|
|
|
|
* Convert an swizzle enumeration (i.e. PIPE_SWIZZLE_X) to one of the HW's
|
|
|
|
|
* "Shader Channel Select" enumerations (i.e. SCS_RED). The mappings are
|
|
|
|
|
*
|
|
|
|
|
* SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W, SWIZZLE_ZERO, SWIZZLE_ONE
|
|
|
|
|
* 0 1 2 3 4 5
|
|
|
|
|
* 4 5 6 7 0 1
|
|
|
|
|
* SCS_RED, SCS_GREEN, SCS_BLUE, SCS_ALPHA, SCS_ZERO, SCS_ONE
|
|
|
|
|
*
|
|
|
|
|
* which is simply adding 4 then modding by 8 (or anding with 7).
|
|
|
|
|
*/
|
|
|
|
|
static inline enum isl_channel_select
|
|
|
|
|
pipe_swizzle_to_isl_channel(enum pipe_swizzle swizzle)
|
|
|
|
|
{
|
|
|
|
|
return (swizzle + 4) & 7;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-11 22:18:54 -08:00
|
|
|
#endif
|