* Translate Mesa format to Gallium format.
*/
enum pipe_format
-st_mesa_format_to_pipe_format(const struct st_context *st, mesa_format mesaFormat)
+st_mesa_format_to_pipe_format(const struct st_context *st,
+ mesa_format mesaFormat)
{
switch (mesaFormat) {
case MESA_FORMAT_A8B8G8R8_UNORM:
return PIPE_FORMAT_XRGB8888_UNORM;
case MESA_FORMAT_B5G5R5A1_UNORM:
return PIPE_FORMAT_B5G5R5A1_UNORM;
+ case MESA_FORMAT_A1B5G5R5_UNORM:
+ return PIPE_FORMAT_A1B5G5R5_UNORM;
case MESA_FORMAT_B4G4R4A4_UNORM:
return PIPE_FORMAT_B4G4R4A4_UNORM;
case MESA_FORMAT_B5G6R5_UNORM:
return PIPE_FORMAT_B4G4R4X4_UNORM;
case MESA_FORMAT_B5G5R5X1_UNORM:
return PIPE_FORMAT_B5G5R5X1_UNORM;
+ case MESA_FORMAT_X1B5G5R5_UNORM:
+ return PIPE_FORMAT_X1B5G5R5_UNORM;
case MESA_FORMAT_R8G8B8X8_SNORM:
return PIPE_FORMAT_RGBX8888_SNORM;
case MESA_FORMAT_X8B8G8R8_SNORM:
return MESA_FORMAT_X8R8G8B8_UNORM;
case PIPE_FORMAT_B5G5R5A1_UNORM:
return MESA_FORMAT_B5G5R5A1_UNORM;
+ case PIPE_FORMAT_A1B5G5R5_UNORM:
+ return MESA_FORMAT_A1B5G5R5_UNORM;
case PIPE_FORMAT_B4G4R4A4_UNORM:
return MESA_FORMAT_B4G4R4A4_UNORM;
case PIPE_FORMAT_B5G6R5_UNORM:
return MESA_FORMAT_B4G4R4X4_UNORM;
case PIPE_FORMAT_B5G5R5X1_UNORM:
return MESA_FORMAT_B5G5R5X1_UNORM;
+ case PIPE_FORMAT_X1B5G5R5_UNORM:
+ return MESA_FORMAT_X1B5G5R5_UNORM;
case PIPE_FORMAT_RGBX8888_SNORM:
return MESA_FORMAT_R8G8B8X8_SNORM;
case PIPE_FORMAT_XBGR8888_SNORM:
},
{
{ GL_RGB5_A1, 0 },
- { PIPE_FORMAT_B5G5R5A1_UNORM, DEFAULT_RGBA_FORMATS }
+ { PIPE_FORMAT_B5G5R5A1_UNORM, PIPE_FORMAT_A1B5G5R5_UNORM,
+ DEFAULT_RGBA_FORMATS }
},
{
{ GL_R3_G3_B2, 0 },
},
{
{ GL_RGB5 },
- { PIPE_FORMAT_B5G5R5X1_UNORM, PIPE_FORMAT_B5G5R5A1_UNORM,
+ { PIPE_FORMAT_B5G5R5X1_UNORM, PIPE_FORMAT_X1B5G5R5_UNORM,
+ PIPE_FORMAT_B5G5R5A1_UNORM, PIPE_FORMAT_A1B5G5R5_UNORM,
DEFAULT_RGB_FORMATS }
},
{
{ PIPE_FORMAT_R8G8B8A8_SINT, 0 }
},
{
- { GL_RGB_INTEGER_EXT,
+ { GL_RGB_INTEGER_EXT,
GL_BGR_INTEGER_EXT,
GL_RGB8I_EXT,
GL_BLUE_INTEGER_EXT, 0 },
const enum pipe_format formats[],
enum pipe_texture_target target,
unsigned sample_count,
- unsigned tex_usage,
+ unsigned bindings,
boolean allow_dxt)
{
uint i;
for (i = 0; formats[i]; i++) {
if (screen->is_format_supported(screen, formats[i], target,
- sample_count, tex_usage)) {
+ sample_count, bindings)) {
if (!allow_dxt && util_format_is_s3tc(formats[i])) {
/* we can't return a dxt format, continue searching */
continue;
return PIPE_FORMAT_NONE;
}
+
struct exact_format_mapping
{
GLenum format;
{ 0, 0, 0 }
};
+
/**
* For unsized/base internal formats, we may choose a convenient effective
* internal format for {format, type}. If one exists, return that, otherwise
return PIPE_FORMAT_NONE;
}
+
/**
* Given an OpenGL internalFormat value for a texture or surface, return
* the best matching PIPE_FORMAT_x, or PIPE_FORMAT_NONE if there's no match.
st_choose_renderbuffer_format(struct st_context *st,
GLenum internalFormat, unsigned sample_count)
{
- uint usage;
+ unsigned bindings;
if (_mesa_is_depth_or_stencil_format(internalFormat))
- usage = PIPE_BIND_DEPTH_STENCIL;
+ bindings = PIPE_BIND_DEPTH_STENCIL;
else
- usage = PIPE_BIND_RENDER_TARGET;
+ bindings = PIPE_BIND_RENDER_TARGET;
return st_choose_format(st, internalFormat, GL_NONE, GL_NONE,
- PIPE_TEXTURE_2D, sample_count, usage, FALSE);
+ PIPE_TEXTURE_2D, sample_count, bindings, FALSE);
}
*/
enum pipe_format
st_choose_matching_format(struct st_context *st, unsigned bind,
- GLenum format, GLenum type, GLboolean swapBytes)
+ GLenum format, GLenum type, GLboolean swapBytes)
{
struct pipe_screen *screen = st->pipe->screen;
mesa_format mesa_format;
internalFormat == GL_RGBA16F ||
internalFormat == GL_RGB32F ||
internalFormat == GL_RGBA32F)
- bindings |= PIPE_BIND_RENDER_TARGET;
+ bindings |= PIPE_BIND_RENDER_TARGET;
/* GLES allows the driver to choose any format which matches
* the format+type combo, because GLES only supports unsized internal
return st_pipe_format_to_mesa_format(pFormat);
if (!is_renderbuffer) {
- /* try choosing format again, this time without render target bindings */
+ /* try choosing format again, this time without render
+ * target bindings.
+ */
pFormat = st_choose_matching_format(st, PIPE_BIND_SAMPLER_VIEW,
format, type,
ctx->Unpack.SwapBytes);
return num_sample_counts;
}
+
/**
* ARB_internalformat_query2 driver hook.
*/
break;
case GL_NUM_SAMPLE_COUNTS: {
+ int samples[16];
size_t num_samples;
num_samples = st_QuerySamplesForFormat(ctx, target, internalFormat,
- params);
+ samples);
params[0] = (GLint) num_samples;
break;
}
* the driver, and if so return the same internal format, otherwise
* return GL_NONE.
*/
- uint usage;
+ unsigned bindings;
if (_mesa_is_depth_or_stencil_format(internalFormat))
- usage = PIPE_BIND_DEPTH_STENCIL;
+ bindings = PIPE_BIND_DEPTH_STENCIL;
else
- usage = PIPE_BIND_RENDER_TARGET;
+ bindings = PIPE_BIND_RENDER_TARGET;
enum pipe_format pformat = st_choose_format(st,
internalFormat,
GL_NONE,
GL_NONE,
PIPE_TEXTURE_2D, 1,
- usage, FALSE);
+ bindings, FALSE);
if (pformat)
params[0] = internalFormat;
break;
}
}
+
/**
* This is used for translating texture border color and the clear
* color. For example, the clear color is interpreted according to