}
}
-static inline uint32_t
-translate_blend(unsigned blend)
-{
- switch (blend) {
- case PIPE_BLEND_ADD:
- return BLEND_EQ_ADD;
- case PIPE_BLEND_SUBTRACT:
- return BLEND_EQ_SUBTRACT;
- case PIPE_BLEND_REVERSE_SUBTRACT:
- return BLEND_EQ_REVERSE_SUBTRACT;
- case PIPE_BLEND_MIN:
- return BLEND_EQ_MIN;
- case PIPE_BLEND_MAX:
- return BLEND_EQ_MAX;
- default:
- DBG("Unhandled blend: %i", blend);
- return ETNA_NO_MATCH;
- }
-}
-
static inline uint32_t
translate_blend_factor(unsigned blend_factor)
{
return TEXTURE_FILTER_NEAREST;
case PIPE_TEX_FILTER_LINEAR:
return TEXTURE_FILTER_LINEAR;
- /* What about anisotropic? */
default:
DBG("Unhandled texture filter: %i", filter);
return ETNA_NO_MATCH;
/* assumes that normalization of channel 0 holds for all channels;
* this holds for all vertex formats that we support */
return desc->channel[0].normalized
- ? VIVS_FE_VERTEX_ELEMENT_CONFIG_NORMALIZE_ON
+ ? VIVS_FE_VERTEX_ELEMENT_CONFIG_NORMALIZE_SIGN_EXTEND
: VIVS_FE_VERTEX_ELEMENT_CONFIG_NORMALIZE_OFF;
}
+static inline uint32_t
+translate_output_mode(enum pipe_format fmt, bool halti5)
+{
+ const unsigned bits =
+ util_format_get_component_bits(fmt, UTIL_FORMAT_COLORSPACE_RGB, 0);
+
+ if (bits == 32)
+ return COLOR_OUTPUT_MODE_UIF32;
+
+ if (!util_format_is_pure_integer(fmt))
+ return COLOR_OUTPUT_MODE_NORMAL;
+
+ /* generic integer output mode pre-halti5 (?) */
+ if (bits == 10 || !halti5)
+ return COLOR_OUTPUT_MODE_A2B10G10R10UI;
+
+ if (util_format_is_pure_sint(fmt))
+ return bits == 8 ? COLOR_OUTPUT_MODE_I8 : COLOR_OUTPUT_MODE_I16;
+
+ return bits == 8 ? COLOR_OUTPUT_MODE_U8 : COLOR_OUTPUT_MODE_U16;
+}
+
static inline uint32_t
translate_index_size(unsigned index_size)
{
return clear_value;
}
-/* Convert MSAA number of samples to x and y scaling factor and
- * VIVS_GL_MULTI_SAMPLE_CONFIG value.
+/* Convert MSAA number of samples to x and y scaling factor.
* Return true if supported and false otherwise. */
static inline bool
-translate_samples_to_xyscale(int num_samples, int *xscale_out, int *yscale_out,
- uint32_t *config_out)
+translate_samples_to_xyscale(int num_samples, int *xscale_out, int *yscale_out)
{
int xscale, yscale;
- uint32_t config;
switch (num_samples) {
case 0:
case 1:
xscale = 1;
yscale = 1;
- config = VIVS_GL_MULTI_SAMPLE_CONFIG_MSAA_SAMPLES_NONE;
break;
case 2:
xscale = 2;
yscale = 1;
- config = VIVS_GL_MULTI_SAMPLE_CONFIG_MSAA_SAMPLES_2X;
break;
case 4:
xscale = 2;
yscale = 2;
- config = VIVS_GL_MULTI_SAMPLE_CONFIG_MSAA_SAMPLES_4X;
break;
default:
return false;
*xscale_out = xscale;
if (yscale_out)
*yscale_out = yscale;
- if (config_out)
- *config_out = config;
return true;
}