[Mesa-dev] [PATCH 05/18] i965: Refactor the renderer string creation out of intelGetString
Ian Romanick
idr at freedesktop.org
Sat Oct 12 00:10:12 CEST 2013
From: Ian Romanick <ian.d.romanick at intel.com>
This will soon be used in intel_screen.c from a function that doesn't
have a gl_context.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/mesa/drivers/dri/i965/intel_context.c | 37 +++++++++++++++++++------------
src/mesa/drivers/dri/i965/intel_context.h | 2 ++
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/intel_context.c b/src/mesa/drivers/dri/i965/intel_context.c
index cd69f00..c18cde7 100644
--- a/src/mesa/drivers/dri/i965/intel_context.c
+++ b/src/mesa/drivers/dri/i965/intel_context.c
@@ -61,30 +61,39 @@ int INTEL_DEBUG = (0);
const char *const brw_vendor_string = "Intel Open Source Technology Center";
-static const GLubyte *
-intelGetString(struct gl_context * ctx, GLenum name)
+const char *
+brw_get_renderer_string(unsigned deviceID)
{
- const struct brw_context *const brw = brw_context(ctx);
const char *chipset;
static char buffer[128];
+ switch (deviceID) {
+#undef CHIPSET
+#define CHIPSET(id, symbol, str) case id: chipset = str; break;
+#include "pci_ids/i965_pci_ids.h"
+ default:
+ chipset = "Unknown Intel Chipset";
+ break;
+ }
+
+ (void) driGetRendererString(buffer, chipset, 0);
+ return buffer;
+}
+
+static const GLubyte *
+intelGetString(struct gl_context * ctx, GLenum name)
+{
switch (name) {
case GL_VENDOR:
return (GLubyte *) brw_vendor_string;
break;
- case GL_RENDERER:
- switch (brw->intelScreen->deviceID) {
-#undef CHIPSET
-#define CHIPSET(id, symbol, str) case id: chipset = str; break;
-#include "pci_ids/i965_pci_ids.h"
- default:
- chipset = "Unknown Intel Chipset";
- break;
- }
+ case GL_RENDERER: {
+ const struct brw_context *const brw = brw_context(ctx);
- (void) driGetRendererString(buffer, chipset, 0);
- return (GLubyte *) buffer;
+ return
+ (GLubyte *) brw_get_renderer_string(brw->intelScreen->deviceID);
+ }
default:
return NULL;
diff --git a/src/mesa/drivers/dri/i965/intel_context.h b/src/mesa/drivers/dri/i965/intel_context.h
index a66483a..91d2589 100644
--- a/src/mesa/drivers/dri/i965/intel_context.h
+++ b/src/mesa/drivers/dri/i965/intel_context.h
@@ -241,6 +241,8 @@ extern int INTEL_DEBUG;
extern const char *const brw_vendor_string;
+extern const char *brw_get_renderer_string(unsigned deviceID);
+
extern bool intelInitContext(struct brw_context *brw,
int api,
unsigned major_version,
--
1.8.1.4
More information about the mesa-dev
mailing list