aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/dri/swrast/swrast.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/drivers/dri/swrast/swrast.c')
-rwxr-xr-x[-rw-r--r--]mesalib/src/mesa/drivers/dri/swrast/swrast.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/mesalib/src/mesa/drivers/dri/swrast/swrast.c b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
index fb29078b6..e84059073 100644..100755
--- a/mesalib/src/mesa/drivers/dri/swrast/swrast.c
+++ b/mesalib/src/mesa/drivers/dri/swrast/swrast.c
@@ -33,6 +33,11 @@
*/
#include <stdio.h>
+#ifdef _MSC_VER
+#define WIN32_LEAN_AND_MEAN 1
+#include <windows.h>
+#endif
+
#include "main/api_exec.h"
#include "main/context.h"
#include "main/extensions.h"
@@ -61,7 +66,7 @@
#include "swrast_priv.h"
#include "swrast/s_context.h"
-const __DRIextension **__driDriverGetExtensions_swrast(void);
+PUBLIC const __DRIextension **__driDriverGetExtensions_swrast(void);
const char * const swrast_vendor_string = "Mesa Project";
const char * const swrast_renderer_string = "Software Rasterizer";
@@ -82,7 +87,7 @@ static void swrastSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
uint32_t internalFormat;
mesa_format texFormat;
- dri_ctx = pDRICtx->driverPrivate;
+ dri_ctx = (struct dri_context *)pDRICtx->driverPrivate;
internalFormat = (texture_format == __DRI_TEXTURE_FORMAT_RGB ? 3 : 4);
@@ -138,6 +143,7 @@ swrast_query_renderer_integer(__DRIscreen *psp, int param,
return 0;
case __DRI2_RENDERER_VIDEO_MEMORY: {
/* XXX: Do we want to return the full amount of system memory ? */
+#ifndef _MSC_VER
const long system_memory_pages = sysconf(_SC_PHYS_PAGES);
const long system_page_size = sysconf(_SC_PAGE_SIZE);
@@ -152,6 +158,9 @@ swrast_query_renderer_integer(__DRIscreen *psp, int param,
value[0] = system_memory_megabytes;
return 0;
+#else
+ return -1;
+#endif
}
case __DRI2_RENDERER_UNIFIED_MEMORY_ARCHITECTURE:
/**
@@ -246,7 +255,7 @@ swrastFillInModes(__DRIscreen *psp,
format = MESA_FORMAT_B8G8R8A8_UNORM;
break;
default:
- fprintf(stderr, "[%s:%u] bad depth %d\n", __func__, __LINE__,
+ fprintf(stderr, "[%s:%u] bad depth %d\n", __FUNCTION__, __LINE__,
pixel_bits);
return NULL;
}
@@ -257,7 +266,7 @@ swrastFillInModes(__DRIscreen *psp,
back_buffer_factor, msaa_samples_array, 1,
GL_TRUE);
if (configs == NULL) {
- fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __func__,
+ fprintf(stderr, "[%s:%u] Error creating FBConfig!\n", __FUNCTION__,
__LINE__);
return NULL;
}
@@ -381,7 +390,7 @@ swrast_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
- xrb->Base.Buffer = malloc(height * xrb->pitch);
+ xrb->Base.Buffer = (GLubyte*)malloc(height * xrb->pitch);
return GL_TRUE;
}
@@ -390,7 +399,7 @@ static struct dri_swrast_renderbuffer *
swrast_new_renderbuffer(const struct gl_config *visual, __DRIdrawable *dPriv,
GLboolean front)
{
- struct dri_swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
+ struct dri_swrast_renderbuffer *xrb = (struct dri_swrast_renderbuffer *)calloc(1, sizeof *xrb);
struct gl_renderbuffer *rb;
GLuint pixel_format;
@@ -471,7 +480,7 @@ swrast_map_renderbuffer(struct gl_context *ctx,
xrb->map_h = h;
stride = w * cpp;
- xrb->Base.Buffer = malloc(h * stride);
+ xrb->Base.Buffer = (GLubyte*)malloc(h * stride);
sPriv->swrast_loader->getImage(dPriv, x, rb->Height - y - h, w, h,
(char *) xrb->Base.Buffer,
@@ -540,7 +549,7 @@ dri_create_buffer(__DRIscreen * sPriv,
dPriv->driverPrivate = drawable;
drawable->dPriv = dPriv;
- drawable->row = malloc(SWRAST_MAX_WIDTH * 4);
+ drawable->row = (char*)malloc(SWRAST_MAX_WIDTH * 4);
if (drawable->row == NULL)
goto drawable_fail;
@@ -921,21 +930,23 @@ dri_copy_sub_buffer(__DRIdrawable *dPriv, int x, int y,
static const struct __DriverAPIRec swrast_driver_api = {
- .InitScreen = dri_init_screen,
- .DestroyScreen = dri_destroy_screen,
- .CreateContext = dri_create_context,
- .DestroyContext = dri_destroy_context,
- .CreateBuffer = dri_create_buffer,
- .DestroyBuffer = dri_destroy_buffer,
- .SwapBuffers = dri_swap_buffers,
- .MakeCurrent = dri_make_current,
- .UnbindContext = dri_unbind_context,
- .CopySubBuffer = dri_copy_sub_buffer,
+ /*.InitScreen = */dri_init_screen,
+ /*.DestroyScreen = */dri_destroy_screen,
+ /*.CreateContext = */dri_create_context,
+ /*.DestroyContext = */dri_destroy_context,
+ /*.CreateBuffer = */dri_create_buffer,
+ /*.DestroyBuffer = */dri_destroy_buffer,
+ /*.SwapBuffers = */dri_swap_buffers,
+ /*.MakeCurrent = */dri_make_current,
+ /*.UnbindContext = */dri_unbind_context,
+ /*.CopySubBuffer = */dri_copy_sub_buffer,
+ /*.AllocateBuffer = */NULL,
+ /*.ReleaseBuffer = */NULL
};
static const struct __DRIDriverVtableExtensionRec swrast_vtable = {
- .base = { __DRI_DRIVER_VTABLE, 1 },
- .vtable = &swrast_driver_api,
+ /*.base = */{ __DRI_DRIVER_VTABLE, 1 },
+ /*.vtable = */&swrast_driver_api,
};
static const __DRIextension *swrast_driver_extensions[] = {