*
*/
+#include <stdio.h>
#include "main/mtypes.h"
#include "main/fbobject.h"
#include "drivers/common/meta.h"
-static const GLubyte *
-nouveau_get_string(struct gl_context *ctx, GLenum name)
+const char * const nouveau_vendor_string = "Nouveau";
+
+const char *
+nouveau_get_renderer_string(unsigned chipset)
{
- static char buffer[128];
char hardware_name[32];
+ static char buffer[128];
+
+ snprintf(hardware_name, sizeof(hardware_name), "nv%02X", chipset);
+ driGetRendererString(buffer, hardware_name, 0);
+ return buffer;
+}
+
+static const GLubyte *
+nouveau_get_string(struct gl_context *ctx, GLenum name)
+{
switch (name) {
case GL_VENDOR:
- return (GLubyte *)"Nouveau";
+ return (GLubyte *)nouveau_vendor_string;
case GL_RENDERER:
- sprintf(hardware_name, "nv%02X", context_chipset(ctx));
- driGetRendererString(buffer, hardware_name, 0);
-
- return (GLubyte *)buffer;
+ return (GLubyte *)nouveau_get_renderer_string(context_chipset(ctx));
default:
return NULL;
}
else
value = pack_rgba_clamp_f(s->format, color);
- mask = pack_rgba_i(s->format, ctx->Color.ColorMask[0]);
+ const uint8_t colormask[4] = {
+ GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 0) ? 0xff : 0,
+ GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 1) ? 0xff : 0,
+ GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 2) ? 0xff : 0,
+ GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 3) ? 0xff : 0,
+ };
+ mask = pack_rgba_i(s->format, colormask);
if (mask)
context_drv(ctx)->surface_fill(